Luyenkim.Net!

...where your idea grows!

 
  • Decrease font size
  • Default font size
  • Increase font size
Trang chủ arrow DIỄN ĐÀN
Luyện kim
Banner
Làm thế nào để thêm nhiều user trong file configuration.php (1 viewing) (1) Guest
Go to bottom Post Reply Favoured: 0
TOPIC: Làm thế nào để thêm nhiều user trong file configuration.php
#2589
nak
(User)
Fresh Boarder
Posts: 7
graphgraph
User Offline Click here to see the profile of this user
Làm thế nào để thêm nhiều user trong file configuration.php 4 Months ago Karma: 0  
Hi all,

Tôi đang dùng sharing host nên bị hạn chế về lượng query. Max query cho 1 user là 50.000 questions. Nhưng Joomla thường lại tạo nhiều hơn do đó site hay bị treo. Trước tôi dùng Joomla 1.0.x nên có thể thêm nhiều user trong file configuration.php bằng cách sửa code như sau:

$mosConfig_users = array("user1", "user2", "user3", "user4", "user5", "user6", "user7", "user8", "user9", "user10";
$mosConfig_user = $mosConfig_users[array_rand($mosConfig_users)];

Nhưng khi xem trong file configuration.php của Joomla 1.5 thì nó ko dùng câu lệnh $mosConfig_user nữa mà chuyển thành Var $user, nên chẳng biết add nhiều user thế nào.

Xin các bạn chỉ hộ cách thêm với

Cảm ơn

NAK
 
Report to moderator   Logged Logged  
  The administrator has disabled public write access.

Liên kết website

http://www.clevermind.com.vn/Thư viện cộng đồngLuyenkim.netthietbidien.vnvnfolk.com
#2621
support
(Moderator)
Nhóm hỗ trợ
Moderator
Posts: 697
graph
User Offline Click here to see the profile of this user
Gender: Male Luyenkim.NET luyenkimnet Location: Hà Nội Birthdate: 1977-04-07
Trả lời: Làm thế nào để thêm nhiều user trong file configuration.php 3 Months, 3 Weeks ago Karma: 4  
Bạn sử dụng câu lệnh sau:

var $user = array("user1", "user2", "user3", "user4", "user5", "user6", "user7", "user8", "user9", "user10" ) ;
$this->user = $this->$user[array_rand($this->$user)];
 
Report to moderator   Logged Logged  
 
  The administrator has disabled public write access.
#2622
nak
(User)
Fresh Boarder
Posts: 7
graphgraph
User Offline Click here to see the profile of this user
Trả lời: Làm thế nào để thêm nhiều user trong file configuration.php 3 Months, 3 Weeks ago Karma: 0  
Cảm ơn bạn.

Nhưng khi tôi thay đoạn code của bạn vào file configuration.php và up lại lên thì site hathanh.info lại trắng xóa ko có gì cả. Không hiểu có bị lỗi gì trong đoạn code không. Rất mong bạn chỉ giúp

Cảm ơn

NAK
 
Report to moderator   Logged Logged  
  The administrator has disabled public write access.
#2628
support
(Moderator)
Nhóm hỗ trợ
Moderator
Posts: 697
graph
User Offline Click here to see the profile of this user
Gender: Male Luyenkim.NET luyenkimnet Location: Hà Nội Birthdate: 1977-04-07
Trả lời: Làm thế nào để thêm nhiều user trong file configuration.php 3 Months, 3 Weeks ago Karma: 4  
Thử cách này xem sao:

Code:

<?php
class JConfig {
....
var $user = random_users();
....
}
//New function added
function random_users(){
$theusers = array("user1", "user2", "user3",..., "user7", "user8", "user9", "user10" ) ;
return $theusers[array_rand($theusers)];
}
?>
 
Report to moderator   Logged Logged  
 
  The administrator has disabled public write access.
#2629
nak
(User)
Fresh Boarder
Posts: 7
graphgraph
User Offline Click here to see the profile of this user
Re: Trả lời: Làm thế nào để thêm nhiều user trong file configuration.php 3 Months, 3 Weeks ago Karma: 0  
Vẫn không được ạ . Tôi add đúng như thế nhưng khi tải lên thay file config cũ thì trang hathanh.info vẫn thành trắng toát. Không hiểu còn cần lệnh gì nữa ko hay cái var user này nó cứng như thế ko thể chỉnh sửa được nữa . Nếu cứ để thế thì site liên tục bị tạm dừng vì bị tràn query truy cập vào database . Cái joomla 1.5 này đúng là khó chỉnh sửa hơn joomla 1.0 quá. Mong bạn chỉ giúp thêm

Cảm ơn nhiều

NAK
 
Report to moderator   Logged Logged  
  The administrator has disabled public write access.
#2631
support
(Moderator)
Nhóm hỗ trợ
Moderator
Posts: 697
graph
User Offline Click here to see the profile of this user
Gender: Male Luyenkim.NET luyenkimnet Location: Hà Nội Birthdate: 1977-04-07
Trả lời: Làm thế nào để thêm nhiều user trong file configuration.php 3 Months, 3 Weeks ago Karma: 4  
nak wrote:
Vẫn không được ạ . Tôi add đúng như thế nhưng khi tải lên thay file config cũ thì trang hathanh.info vẫn thành trắng toát. Không hiểu còn cần lệnh gì nữa ko hay cái var user này nó cứng như thế ko thể chỉnh sửa được nữa . Nếu cứ để thế thì site liên tục bị tạm dừng vì bị tràn query truy cập vào database . Cái joomla 1.5 này đúng là khó chỉnh sửa hơn joomla 1.0 quá. Mong bạn chỉ giúp thêm

Cảm ơn nhiều

NAK

Ok, vậy có 1 cách khác là sử dụng phương thức khởi tạo khi Class bị triệu gọi:

Code:

class JConfig {
...
var $user = 'userxyz'; //gán biến là hằng bất kì
....

function jconfig(){
$this->user = random_users();
}
}

//New function added
function random_users(){
$theusers = array("user1", "user2", "user3","user7", "user8", "user9", "user10" ) ;
return $theusers[array_rand($theusers)];
}


Cách này sẽ giải quyết vấn đề của bạn.
 
Report to moderator   Logged Logged  
 
  The administrator has disabled public write access.
#2632
nak
(User)
Fresh Boarder
Posts: 7
graphgraph
User Offline Click here to see the profile of this user
Re: Trả lời: Làm thế nào để thêm nhiều user trong file configuration.php 3 Months, 3 Weeks ago Karma: 0  
cảm ơn bạn, tôi đã add thêm code và không còn bị ra trang trắng nữa. Sẽ chạy test xem còn bị lỗi không thể connect với database nữa ko. Có gì sẽ xin hỏi thêm bạn để hoàn chỉnh.

Cảm ơn nhiều

NAK
 
Report to moderator   Logged Logged  
  The administrator has disabled public write access.
Go to top Post Reply
Powered by FireBoardget the latest posts directly to your desktop