Congratulations to AcaCandy on her 100,000th post!
There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
 
Tag Cloud
acer black screen blue screen boot bsod computer connection crash css dell driver drivers email error ethernet excel firefox firefox 3 game hard drive internet internet explorer itunes laptop linux malware monitor network networking nvidia outlook outlook 2003 outlook 2007 outlook express partition printer problem router slow software sound trojan usb video virus vista windows windows vista windows xp wireless
Web Design & Development
Search
Search in:
 
Advanced Search
Tech Support Guy Forums > Internet & Networking > Web Design & Development >
Solved: PHP Error


HELLO AND WELCOME! Before you can post your question, you'll have to register -- it's completely free! Click here to join today! We highly recommend that you print a copy of our Guide for New Members. Enjoy!

Closed Thread
 
Thread Tools
bob121's Avatar
Senior Member with 188 posts.
 
Join Date: Sep 2006
03-Oct-2007, 12:06 PM #1
Cool Solved: PHP Error
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'");
} ?>
MMJ's Avatar
MMJ MMJ is offline
Distinguished Member with 3,247 posts.
 
Join Date: Oct 2006
03-Oct-2007, 01:38 PM #2
Its very easy to find out the problem with PHP errors.

So take a closer look at the error and the files that it points to.
bob121's Avatar
Senior Member with 188 posts.
 
Join Date: Sep 2006
03-Oct-2007, 01:40 PM #3
Already have done so would you like to upload the set of files ?

www.northeast-gangs.info/functions.zip
MMJ's Avatar
MMJ MMJ is offline
Distinguished Member with 3,247 posts.
 
Join Date: Oct 2006
03-Oct-2007, 01:48 PM #4
Grrr...

On line 42 in /fpgs2/users/northeast-gangs/includes/functions.php you created a function called logincheck(). On line 49 in /fpgs2/users/northeast-gangs/game/functions.php you try to make the same function so PHP throws an error.

Does that make any sens?
bob121's Avatar
Senior Member with 188 posts.
 
Join Date: Sep 2006
03-Oct-2007, 01:50 PM #5
Yeah i know what it means but if you take a look at the script it does not make sense.

The lines will have changed a little bit due to me deleteing My name and stuff of the top of the Script
MMJ's Avatar
MMJ MMJ is offline
Distinguished Member with 3,247 posts.
 
Join Date: Oct 2006
03-Oct-2007, 01:58 PM #6
Post /fpgs2/users/northeast-gangs/includes/functions.php
And /fpgs2/users/northeast-gangs/game/functions.php
bob121's Avatar
Senior Member with 188 posts.
 
Join Date: Sep 2006
03-Oct-2007, 02:00 PM #7
There is not a Game/functions.php it loads it from ../includes/functions.php and i just checked that and i know it works because some of the script still works
bob121's Avatar
Senior Member with 188 posts.
 
Join Date: Sep 2006
03-Oct-2007, 02:02 PM #8
I changed failed.php and have fixed it now thank you
Closed Thread

THIS THREAD HAS EXPIRED.
Are you having the same problem? We have volunteers ready to answer your question, but first you'll have to join for free. Need help getting started? Check out our Welcome Guide.


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
WELCOME TO TECH SUPPORT GUY! Are you looking for the solution to your computer problem? Join our site today to ask your question -- for free! Our site is run completely by volunteers who help people like you solve computer problems. See our Welcome Guide to get started.



Thread Tools


You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -4. The time now is 11:07 PM.
Copyright © 1996 - 2008 TechGuy, Inc. All rights reserved.
Powered by vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Powered by Cermak Technologies, Inc.