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'); ?>