Posted on Thursday 5th June 2008 at 09:09 PM
Adam981
Adam981
Fatal error: Cannot redeclare change_levels() (previously declared in /home/crystal/public_html/config.php:25) in /home/crystal/public_html/config.php on line 31


Little help?
Posted on Friday 26th October 2007 at 04:13 PM
Enros
Enros
Hey guys another way of doing this which I found more useful was making an elseif script.

{
$Job = "<br><b>$user[username]'s JOBS :</b>";
$Rank = " $user[userlevel] ";
if ($Rank == 7)
echo " $Job Administrator";
elseif ($Rank == 6)
echo " $Job MODERATOR";
elseif ($Rank == 5)
echo " $Job Newsie/Radio junky";
elseif ($Rank == 4)
echo " $Job Dj";
elseif ($Rank == 3)
echo " $Job Journalist ";
elseif ($Rank == 2)
echo " $Job User";
}

And again just change the levels for what you need there name to be displayed... I found this more useful because in the user level script I rly didnt see what use it could be off...
Posted on Thursday 25th October 2007 at 11:51 AM
Belloc
Belloc
Thanks man, very cool and useful.
Posted on Monday 25th June 2007 at 11:51 AM
ShadowMage
ShadowMage
no prob
Posted on Monday 25th June 2007 at 07:54 AM
dtnet
dtnet
Thank you so much :D
Posted on Sunday 24th June 2007 at 10:45 PM
ShadowMage
ShadowMage
where:
Code

$user_rank = change_levels($user[userlevel]);

get rid of it

Where:
Code

$user = mysql_fetch_array($getuser);


Add After:
Code

$user_rank = change_levels($user[userlevel]);
Posted on Sunday 24th June 2007 at 09:04 PM
dtnet
dtnet
Config.php
PHP Code
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<?php  
session_start
(); //allows session 

$conn mysql_connect("","","");  
mysql_select_db() or die(mysql_error());  

$logged MYSQL_QUERY("SELECT * FROM `members` WHERE `id` = '$_SESSION[id]' AND `password` = '$_SESSION[password]'");  
$logged mysql_fetch_array($logged);  


//change this to your site name 
$sitename "My Site"
function 
change_levels($level){
$listed = array('2','4','6');
$changed = array('Member','Moderator','Admin'); 
return 
str_replace($listed$changed$level); 
function 
secure($var){
$p $var;
$md5 md5(md5(md5(md5(md5($p)))));
$sha1 sha1(sha1(sha1(sha1(sha1($p)))));
$compile "xX-$md5-$sha1-Xx";
$secure_full md5(sha1($compile));
return 
$secure_full;
}
function 
change_levels($level){ //define the function 
$listed = array('2','4','6'); // define your levels 
// if you wish to add to this list just add '', between the quotes add the rank number. 
$changed = array('Member','Moderator','Admin'); //this is the changed rank name 
//Again if you wish to add to the like just add '', 
return str_replace($listed$changed$level); //replace the listed rank with the rank name 
//End the function
$host $_SERVER['HTTP_HOST']; 
$self $_SERVER['PHP_SELF'];
$sets mysql_query("SELECT * FROM site_stats WHERE `sid` = '1';");
$setting mysql_fetch_array($sets);
}
?>


members.php
PHP Code
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
<?php 
session_start
(); //allows session 
require_once "config.php";
include(
'header.php') ; ?>
<div class="left">
<div class="divheader">Medlemmer
</div>
<?php 
if(isset($_GET['user'])){ //if there trying to view a profile 
//gets the user name and makes it safe 
$username addslashes($_GET[user]); 
//querys the db to find the username 
$getuser mysql_query("SELECT * FROM `members` WHERE `username` = '$username'"); 
//checks see if the username exists in the db  
$user_rank change_levels($user[userlevel]);
$usernum mysql_num_rows($getuser); 
//if it don't exist  
if ($usernum == 0)  

{  
//don't exist 

echo ("User Not Found");  

}  
//if it does exist then show there profile 
else 

$user mysql_fetch_array($getuser);  
echo 
"<fieldset style='width: 350'> 
<b>
$user[username]'s Profile</b><br><br>
User Rank: 
$user_rank 
Email: 
$user[email]<br> 
Location: 
$user[location]<br> 
Sex: 
$user[sex]<br> 
Age: 
$user[age] 
</fieldset>"




else 

//gets all the members from the database 
$getusers mysql_query("SELECT * FROM `members` ORDER BY `id` ASC") or die(mysql_error());  
//loops their names out 
while ($user mysql_fetch_array($getusers))  

if (
$user[userlevel] == 6

echo (
"<font face='Verdana' color='#FF0000'>$user[username]</font><br>"); 

elseif (
$user[userlevel] == 4

echo (
"<font face='Verdana' color='#0000FF'>$user[username]</font><br>"); 

else 

echo (
"<font face='Verdana'' color='#000000'>$user[username]</font><br>"); 


{  
echo 
"<a href='members.php?user=$user[username]'>$user[username]</a><br>";  

}
?></div>
<?php include('footer.php'); ?>
Posted on Sunday 24th June 2007 at 08:12 PM
ShadowMage
ShadowMage
show your code. this works for me no problems.
Posted on Sunday 24th June 2007 at 07:55 PM
dtnet
dtnet
Why is this not showing on the profiles?
Posted on Saturday 9th June 2007 at 02:18 PM
ShadowMage
ShadowMage
admin level is 6 1 is validation i believe 2 is member and 4 is moderator.