Hello,, i now get a error for some reason on a game of mine and i have tryed putting the orginal functions.php back in and still does it
Error Message
HTML Code:
Fatal error: Cannot redeclare logincheck() (previously declared in /fpgs2/users/northeast-gangs/includes/functions.php:42) in /fpgs2/users/northeast-gangs/game/functions.php on line 49
Functions.php
HTML Code:
<?php
session_start();
include_once "db_connect.php";
$username=$_SESSION['username'];
$info=mysql_fetch_object(mysql_query("SELECT health,status,userlevel,password,javamsg,location FROM users WHERE username='$username'"));
//// set date variable
$date = gmdate('Y-m-d h:i:s');
mysql_query("UPDATE users SET crew='0' WHERE status='Dead'");
//// kill them if there health is 0
if ($info->health <= "0"){
mysql_query("UPDATE users SET status='Dead' WHERE username='$username'");
session_destroy();
}
//// tell them if they are dead
if ($info->status == "Dead"){
session_destroy();
echo "You have been killed !";
exit();
}
//// tell them if they are banned
if ($info->status == "Banned"){
session_destroy();
echo "You have been banned !";
exit();
}
if($info->location == ""){
$wwwwdt="You attempted to travel to an invalid country. This is classed as cheating. If you do it again you will be banned!";
mysql_query("UPDATE users SET location='England' WHERE username='$username'");
mysql_query("UPDATE users SET javamsg='$wwwwdt' WHERE username='$username'");
}
?>
<?
////// login check functions
function logincheck(){
if (!$username){
echo "
<SCRIPT LANGUAGE='JavaScript'>
window.location='../index.php';
</script>
";
exit();
}
?> <?
////UPDATE ONLINE
$time = time() + (60 * 10);
mysql_query("UPDATE users SET online='$time' WHERE username='$username'");
///FINSH UPDATING ONLINE
function makecomma($input)
{
if(strlen($input)<=3)
{ return $input; }
$length=substr($input,0,strlen($input)-3);
$formatted_input = makecomma($length).",".substr($input,-3);
return $formatted_input;
}
/////////NOW TO THE BB CODES ETC....
function rankcheck(){
$username=$_SESSION['username'];
$query=mysql_query("SELECT * FROM users WHERE username='$username' LIMIT 1");
$info = mysql_fetch_object($query);
$date = gmdate('Y-m-d h:i:s');
if (($info->rank == "Civilian") && ($info->rankpoints >= "100")){ $newrank="Pick Pocketer"; $done="1"; }
elseif (($info->rank == "Pick Pocketer") && ($info->rankpoints >= "200")){ $newrank="Shoplifter"; $done="1"; }
elseif (($info->rank == "Shoplifter") && ($info->rankpoints >= "400")){ $newrank="Worker"; $done="1"; }
elseif (($info->rank == "Worker") && ($info->rankpoints >= "800")){ $newrank="Body Guard"; $done="1"; }
elseif (($info->rank == "Body Guard") && ($info->rankpoints >= "1000")){ $newrank="Associate"; $done="1"; }
elseif (($info->rank == "Associate") && ($info->rankpoints >= "2000")){ $newrank="Assassin"; $done="1"; }
elseif (($info->rank == "Assassin") && ($info->rankpoints >= "3000")){ $newrank="Bank Robber"; $done="1"; }
elseif (($info->rank == "Bank Robber") && ($info->rankpoints >= "4000")){ $newrank="Playa"; $done="1"; }
elseif (($info->rank == "Playa") && ($info->rankpoints >= "5000")){ $newrank="Street Thug"; $done="1"; }
elseif (($info->rank == "Street Thug") && ($info->rankpoints >= "7000")){ $newrank="Thug"; $done="1"; }
elseif (($info->rank == "Thug") && ($info->rankpoints >= "9000")){ $newrank="Gangster"; $done="1"; }
elseif (($info->rank == "Gangster") && ($info->rankpoints >= "10000")){ $newrank="Highjacker"; $done="1"; }
elseif (($info->rank == "Highjacker") && ($info->rankpoints >= "13000")){ $newrank="Street Boss"; $done="1"; }
elseif (($info->rank == "Street Boss") && ($info->rankpoints >= "15000")){ $newrank="Soldier"; $done="1"; }
elseif (($info->rank == "Soldier") && ($info->rankpoints >= "20000")){ $newrank="Made Man"; $done="1"; }
elseif (($info->rank == "Made Man") && ($info->rankpoints >= "25000")){ $newrank="Wiseguy"; $done="1"; }
elseif (($info->rank == "Wiseguy") && ($info->rankpoints >= "30000")){ $newrank="Lieutenant"; $done="1"; }
elseif (($info->rank == "Lieutenant") && ($info->rankpoints >= "40000")){ $newrank="Feared Thug"; $done="1"; }
elseif (($info->rank == "Feared Thug") && ($info->rankpoints >= "50000")){ $newrank="Man of Honour"; $done="1"; }
elseif (($info->rank == "Man of Honour") && ($info->rankpoints >= "60000")){ $newrank="Under Boss"; $done="1"; }
elseif (($info->rank == "Under Boss") && ($info->rankpoints >= "70000")){ $newrank="Boss"; $done="1"; }
elseif (($info->rank == "Boss") && ($info->rankpoints >= "80000")){ $newrank="Head Boss"; $done="1"; }
elseif (($info->rank == "Head Boss") && ($info->rankpoints >= "90000")){ $newrank="Don"; $done="1"; }
elseif (($info->rank == "Don") && ($info->rankpoints >= "100000")){ $newrank="Respected Don"; $done="1"; }
elseif (($info->rank == "Respected Don") && ($info->rankpoints >= "120000")){ $newrank="Godfather"; $done="1"; }
if (!$done){
$done="0";
}
if ($done == "1"){
mysql_query("INSERT INTO `inbox` ( `id` , `to` , `from` , `message` , `date` , `read`)
VALUES (
'', '$username', 'Ranking System', 'You have been promoted to $newrank your doing well!', '$date', '0')");
mysql_query("UPDATE users SET rank='$newrank' WHERE username='$info->username'") or die("Failed");
}}
rankcheck();
$stats12=mysql_fetch_object(mysql_query("SELECT logou FROM site_stats where id='1'"));
if ($stats12->logou == "1" && $info->userlevel == "0"){
session_destroy();
echo "<script language=\"javascript\">
top.window.location.replace(\"../index.php\");
</script>"; exit(); }
///////HOUSTON WE HAVE JAIL CHECK!
$jail_check=mysql_query("SELECT time_left FROM jail");
while($monster=mysql_fetch_object($jail_check)){
if (time() > $monster->time_left){
mysql_query("DELETE FROM jail WHERE username='$monster->username'");
}}
function maketime($last){
$timenow = time();
if($last>$timenow){
$order = $last-$timenow;
while($order >= 60){
$order = $order-60;
$ordermleft++;
}
while($ordermleft >= 60){
$ordermleft = $ordermleft-60;
$orderhleft++;
}
if($ordermleft == 0){
$ordermleft = "";
} else {
$ordermleft = "$ordermleft Minutes";
}
if($orderhleft == 0){
$orderhleft = "";
} else {
$orderhleft = "$orderhleft Hours";
}
return "$orderhleft $ordermleft $order Seconds";
}}
//// UPDATE MOST EVER ONLINE
$most_online=mysql_fetch_object(mysql_query("SELECT * FROM site_stats WHERE id='1'"));
$timenow=time();
$now_online =mysql_num_rows(mysql_query("SELECT * FROM users WHERE online > '$timenow'"));
if ($now_online > $most_online->online){
mysql_query("UPDATE site_stats SET online='$now_online' WHERE id='1'");
}
if ($info->banktime <= time() && $info->bank > "0"){
$nmoney = 10 * $info->bank / 100;
$money_in = $info->bank + $nmoney;
$money_in= round($money_in);
$recieve = $info->money + $money_in;
mysql_query("UPDATE users SET money='$recieve', bank='0', banktime='0' WHERE username='$username'");
}
$user_info=mysql_fetch_object(mysql_query("SELECT * FROM user_info WHERE username='$username'"));
if ($user_info->jail_able == "1" && $user_info->jail_untill <= time()){
mysql_query("UPDATE user_info SET jail_able='0' WHERE username='$username'");
}
$user_****=mysql_fetch_object(mysql_query("SELECT * FROM user_info WHERE username='$username'"));
if ($user_****->last_respect < time() && $fetch->rank != "Civilian"){
if ($info->rank == "Pick Pocketer"){ $new_res="1"; }elseif($info->rank == "Shoplifter"){ $new_res="2"; }elseif($info->rank == "Worker"){ $new_res="3"; }elseif($info->rank == "Body Guard"){ $new_res="4"; }elseif($info->rank == "Associate"){ $new_res="5"; }elseif($info->rank == "Assassin"){ $new_res="6"; }elseif($info->rank == "Bank Robber"){ $new_res="7";
}elseif($info->rank == "Playa"){ $new_res="8"; }elseif($info->rank == "Street Thug"){ $new_res="9"; }elseif($info->rank == "Thug"){ $new_res="10"; }elseif($info->rank == "Gangster"){ $new_res="11"; }elseif($info->rank == "Highjacker"){ $new_res="12"; }
$now=time() + (3600 * 24 * 7);
mysql_query("UPDATE user_info SET respect='$new_res', last_respect='$now' WHERE username='$username'");
}
if($info->javamsg != "0"){
?>
<script language="Javascript">
alert ("<? print"$info->javamsg"; ?>")
</script> <?
mysql_query("UPDATE users SET javamsg='0' WHERE username='$username'");
} ?>