corkg Posted June 8, 2007 Share Posted June 8, 2007 Help i am having trouble converting this code from 3 to 4 I am new to php and brought the script and juts realised i need php 4. Any help will be gratefull if you could convert a bit to get me started that would be great i have looked through the php website bit about migration and i have no Idea what to do. <?php session_start(); include_once "db_connect.php"; $username=$_SESSION['username']; echo "<link rel=stylesheet href=includes/in.css type=text/css>"; $query=mysql_query("SELECT * FROM users WHERE username='$username' LIMIT 1"); $info = mysql_fetch_object($query); $don=mysql_num_rows(mysql_query("SELECT * FROM donaters WHERE username='$username'")); $date = gmdate('Y-m-d h:i:s'); if ($info->health <= "0"){ mysql_query("UPDATE users SET status='Dead' WHERE username='$username'"); session_destroy(); } if ($info->status == "Dead" || $info->status == "Banned"){ session_destroy(); echo "Your DEAD!!!!!"; exit(); } $crew_check =mysql_query("SELECT * FROM crews"); while($k = mysql_fetch_object($crew_check)){ $user=mysql_fetch_object(mysql_query("SELECT * FROM users WHERE username='$k->owner'")); $rhm=mysql_fetch_object(mysql_query("SELECT * FROM users WHERE username='$k->rhm'")); if ($user->status == "Dead" || $user->status == "Banned"){ if ($k->rhm != "0" && $rhm->status == "Alive"){ mysql_query("UPDATE crews SET owner='$k->rhm', rhm='0' WHERE name='$k->name'"); } elseif ($k->rhm == "0" || $rhm->status == "Dead" || $rhm->status == "Banned"){ mysql_query("UPDATE `users` SET `crew`='0' WHERE `crew`='$k->name'"); mysql_query("DELETE FROM crews WHERE name='$k->name'"); } } } $bba=mysql_query("SELECT * FROM bank"); while($nana =mysql_fetch_object($bba)){ $ppl=mysql_fetch_object(mysql_query("SELECT * FROM users WHERE username='$nana->owner'")); if ($ppl->status == "Dead" || $ppl->status == "Banned"){ mysql_query("UPDATE bank SET owner='0' WHERE id='$nana->id'"); } } $oc_query=mysql_query("SELECT * FROM oc"); while($ttfn = mysql_fetch_object($oc_query)){ $user_oc=mysql_fetch_object(mysql_query("SELECT * FROM users WHERE username='$ttfn->leader'")); if ($user_oc->status == "Dead" || $user_oc->status == "Banned"){ mysql_query("UPDATE users SET oc='0' WHERE username='$ttfn->we'"); mysql_query("UPDATE users SET oc='0' WHERE username='$ttfn->ee'"); mysql_query("UPDATE users SET oc='0' WHERE username='$ttfn->driver'"); mysql_query("UPDATE users SET oc='0' WHERE username='$ttfn->leader'"); mysql_query("DELETE FROM oc WHERE id='$ttfn->id'"); }} function logincheck(){ if (empty($_SESSION['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 == "Tramp") && ($info->rankpoints >= "100")){ $newrank="Paper Kid"; $done="1"; } elseif (($info->rank == "Paper Kid") && ($info->rankpoints >= "200")){ $newrank="Thief"; $done="1"; } elseif (($info->rank == "Thief") && ($info->rankpoints >= "400")){ $newrank="Hooligan"; $done="1"; } elseif (($info->rank == "Hooligan") && ($info->rankpoints >= "800")){ $newrank="SecurityGuard"; $done="1"; } elseif (($info->rank == "SecurityGuard") && ($info->rankpoints >= "1600")){ $newrank="BodyGuard"; $done="1"; } elseif (($info->rank == "BodyGuard") && ($info->rankpoints >= "2000")){ $newrank="Criminal"; $done="1"; } elseif (($info->rank == "Criminal") && ($info->rankpoints >= "4000")){ $newrank="Sniper"; $done="1"; } elseif (($info->rank == "Sniper") && ($info->rankpoints >= "8000")){ $newrank="Soldier"; $done="1"; } elseif (($info->rank == "Soldier") && ($info->rankpoints >= "12800")){ $newrank="MarksMan"; $done="1"; } elseif (($info->rank == "MarksMan") && ($info->rankpoints >= "16700")){ $newrank="WiseGuy"; $done="1"; } elseif (($info->rank == "WiseGuy") && ($info->rankpoints >= "19200")){ $newrank="Druglord"; $done="1"; } elseif (($info->rank == "Druglord") && ($info->rankpoints >= "24800")){ $newrank="Advisor"; $done="1"; } elseif (($info->rank == "Advisor") && ($info->rankpoints >= "30000")){ $newrank="MadeMan"; $done="1"; } elseif (($info->rank == "MadeMan") && ($info->rankpoints >= "34800")){ $newrank="General"; $done="1"; } elseif (($info->rank == "General") && ($info->rankpoints >= "40000")){ $newrank="Capo"; $done="1"; } elseif (($info->rank == "Capo") && ($info->rankpoints >= "46400")){ $newrank="WarMaster"; $done="1"; } elseif (($info->rank == "WarMaster") && ($info->rankpoints >= "52300")){ $newrank="Boss"; $done="1"; } elseif (($info->rank == "Boss") && ($info->rankpoints >= "67200")){ $newrank="Don"; $done="1"; } elseif (($info->rank == "Don") && ($info->rankpoints >= "73000")){ $newrank="Boss Of Bosses"; $done="1"; } elseif (($info->rank == "Boss Of Bosses") && ($info->rankpoints >= "81000")){ $newrank="Mob Boss"; $done="1"; } elseif (($info->rank == "Mob Boss") && ($info->rankpoints >= "87000")){ $newrank="WarGod"; $done="1"; } elseif (($info->rank == "WarGod") && ($info->rankpoints >= "92000")){ $newrank="Slayer"; $done="1"; } elseif (($info->rank == "Slayer") && ($info->rankpoints >= "104600")){ $newrank="Messiah"; $done="1"; } elseif (($info->rank == "Messiah") && ($info->rankpoints >= "115000")){ $newrank="SupremeBeing"; $done="1"; } elseif (($info->rank == "SupremeBeing") && ($info->rankpoints >= "120300")){ $newrank="God"; $done="1"; } elseif (($info->rank == "God") && ($info->rankpoints >= "17048000")){ $newrank="God"; $done="1"; } if (!$done){ $done="0"; } if ($done == "1"){ mysql_query("UPDATE users SET rank='$newrank' WHERE username='$username'"); mysql_query("INSERT INTO `inbox` ( `id` , `to` , `from` , `message` , `date` , `read` , `saved` , `event_id` ) VALUES ( '', '$username', '$username', 'You have been promoted to $newrank your doing well!', '$date', '0', '0', '0' )"); }} rankcheck(); ///////HOUSTON WE HAVE JAIL CHECK! $jail_check=mysql_query("SELECT * 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"; }} $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'"); } $drop =mysql_query("SELECT * FROM casinos"); while($tard=mysql_fetch_object($drop)){ $per = mysql_fetch_object(mysql_query("SELECT * FROM users WHERE username='$tard->owner'")); if ($per->status == "Dead" || $per->status == "Banned"){ mysql_query("UPDATE casinos SET owner='0' WHERE casino='$tard->casino' AND owner='$tard->owner'"); } } $drop_bar =mysql_query("SELECT * FROM bar"); while($tard_bar=mysql_fetch_object($drop_bar)){ $per_bar = mysql_fetch_object(mysql_query("SELECT * FROM users WHERE username='$tard_bar->owner'")); if ($per_bar->status == "Dead" || $per_bar->status == "Banned"){ mysql_query("UPDATE bar SET owner='0' WHERE owner='$tard_bar->owner'"); } } $drop_bf =mysql_query("SELECT * FROM bf"); while($tard_bf=mysql_fetch_object($drop_bf)){ $per_bf = mysql_fetch_object(mysql_query("SELECT * FROM users WHERE username='$tard_bf->owner'")); if ($per_bf->status == "Dead" || $per_bf->status == "Banned"){ mysql_query("UPDATE bf SET owner='0' WHERE owner='$tard_bf->owner'"); } } 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'"); } $drop_shop =mysql_query("SELECT * FROM shop"); while($tard_und=mysql_fetch_object($drop_shop)){ $per_shop = mysql_fetch_object(mysql_query("SELECT * FROM users WHERE username='$tard_shop->owner'")); if ($per_und->status == "Dead" || $per_und->status == "Banned"){ mysql_query("UPDATE shop SET owner='0' WHERE owner='$tard_shop->owner'"); } } $drop_bank =mysql_query("SELECT * FROM bank"); while($tard_und=mysql_fetch_object($drop_bank)){ $per_bank = mysql_fetch_object(mysql_query("SELECT * FROM users WHERE username='$tard_bank->owner'")); if ($per_und->status == "Dead" || $per_und->status == "Banned"){ mysql_query("UPDATE shop SET owner='0' WHERE owner='$tard_bank->owner'"); } } $drop_airport =mysql_query("SELECT * FROM airport"); while($tard_und=mysql_fetch_object($drop_airport)){ $per_airport = mysql_fetch_object(mysql_query("SELECT * FROM users WHERE username='$tard_airport->owner'")); if ($per_und->status == "Dead" || $per_und->status == "Banned"){ mysql_query("UPDATE shop SET owner='0' WHERE owner='$tard_airport->owner'"); } } $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_shit=mysql_fetch_object(mysql_query("SELECT * FROM user_info WHERE username='$username'")); if ($user_shit->last_respect < time() && $fetch->rank != "Tramp"){ if ($info->rank == "Paper Kid"){ $new_res="1"; }elseif($info->rank == "Thief"){ $new_res="2"; }elseif($info->rank == "Hooligan"){ $new_res="3"; }elseif($info->rank == "SecurityGuard"){ $new_res="4"; }elseif($info->rank == "BodyGuard"){ $new_res="5"; }elseif($info->rank == "Criminal"){ $new_res="6"; }elseif($info->rank == "Sniper"){ $new_res="7"; }elseif($info->rank == "Soldier"){ $new_res="8"; }elseif($info->rank == "MarksMan"){ $new_res="9"; }elseif($info->rank == "WiseGuy"){ $new_res="10"; }elseif($info->rank == "Druglord"){ $new_res="11"; }elseif($info->rank == "Advisor"){ $new_res="12"; }elseif($info->rank == "MadeMan"){ $new_res="13"; }elseif($info->rank == "General"){ $new_res="14"; }elseif($info->rank == "Capo"){ $new_res="15"; }elseif($info->rank == "WarMaster"){ $new_res="16"; }elseif($info->rank == "Boss"){ $new_res="17"; }elseif($info->rank == "Godfather"){ $new_res="18"; }elseif($info->rank == "Don"){ $new_res="19"; }elseif($info->rank == "Boss of Bosses"){ $new_res="20"; }elseif($info->rank == "Mob Boss"){ $new_res="21"; }elseif($info->rank == "WarGod"){ $new_res="22"; }elseif($info->rank == "Slayer"){ $new_res="23"; }elseif($info->rank == "Messiah"){ $new_res="24"; }elseif($info->rank == "SupremeBeing"){ $new_res="25"; }elseif($info->rank == "God"){ $now=time() + (3600 * 24 * 7); mysql_query("UPDATE user_info SET respect='$new_res', last_respect='$now' WHERE username='$username'"); } } ?> Quote Link to comment https://forums.phpfreaks.com/topic/54768-converting-from-php3-to-4/ Share on other sites More sharing options...
wildteen88 Posted June 8, 2007 Share Posted June 8, 2007 Does the code not work on your PHP setup? Even it has been coded for PHP3 it should still run on PHP4. There was no syntax change from 3 to 4. Just the PHP core (Zend Engine) has been improved to speed up processing and capabilities. Quote Link to comment https://forums.phpfreaks.com/topic/54768-converting-from-php3-to-4/#findComment-270939 Share on other sites More sharing options...
corkg Posted June 8, 2007 Author Share Posted June 8, 2007 No It does not work all I get is errors; Notice: Undefined index: username in e:\domains\m\mafia-revolutions.co.uk\user\htdocs\game\includes\functions.php on line 4 Notice: Undefined index: username in e:\domains\m\mafia-revolutions.co.uk\user\htdocs\game\includes\functions.php on line 102 Notice: Undefined variable: done in e:\domains\m\mafia-revolutions.co.uk\user\htdocs\game\includes\functions.php on line 163 Notice: Undefined variable: tard_shop in e:\domains\m\mafia-revolutions.co.uk\user\htdocs\game\includes\functions.php on line 270 Notice: Undefined variable: per_und in e:\domains\m\mafia-revolutions.co.uk\user\htdocs\game\includes\functions.php on line 271 Notice: Undefined variable: per_und in e:\domains\m\mafia-revolutions.co.uk\user\htdocs\game\includes\functions.php on line 271 Notice: Undefined variable: tard_shop in e:\domains\m\mafia-revolutions.co.uk\user\htdocs\game\includes\functions.php on line 270 Notice: Undefined variable: per_und in e:\domains\m\mafia-revolutions.co.uk\user\htdocs\game\includes\functions.php on line 271 Notice: Undefined variable: per_und in e:\domains\m\mafia-revolutions.co.uk\user\htdocs\game\includes\functions.php on line 271 Notice: Undefined variable: tard_shop in e:\domains\m\mafia-revolutions.co.uk\user\htdocs\game\includes\functions.php on line 270 Notice: Undefined variable: per_und in e:\domains\m\mafia-revolutions.co.uk\user\htdocs\game\includes\functions.php on line 271 Notice: Undefined variable: per_und in e:\domains\m\mafia-revolutions.co.uk\user\htdocs\game\includes\functions.php on line 271 Notice: Undefined variable: tard_shop in e:\domains\m\mafia-revolutions.co.uk\user\htdocs\game\includes\functions.php on line 270 Notice: Undefined variable: per_und in e:\domains\m\mafia-revolutions.co.uk\user\htdocs\game\includes\functions.php on line 271 Notice: Undefined variable: per_und in e:\domains\m\mafia-revolutions.co.uk\user\htdocs\game\includes\functions.php on line 271 Notice: Undefined variable: tard_shop in e:\domains\m\mafia-revolutions.co.uk\user\htdocs\game\includes\functions.php on line 270 Notice: Undefined variable: per_und in e:\domains\m\mafia-revolutions.co.uk\user\htdocs\game\includes\functions.php on line 271 Notice: Undefined variable: per_und in e:\domains\m\mafia-revolutions.co.uk\user\htdocs\game\includes\functions.php on line 271 Notice: Undefined variable: tard_shop in e:\domains\m\mafia-revolutions.co.uk\user\htdocs\game\includes\functions.php on line 270 Notice: Undefined variable: per_und in e:\domains\m\mafia-revolutions.co.uk\user\htdocs\game\includes\functions.php on line 271 Notice: Undefined variable: per_und in e:\domains\m\mafia-revolutions.co.uk\user\htdocs\game\includes\functions.php on line 271 Notice: Undefined variable: tard_bank in e:\domains\m\mafia-revolutions.co.uk\user\htdocs\game\includes\functions.php on line 279 Notice: Undefined variable: per_und in e:\domains\m\mafia-revolutions.co.uk\user\htdocs\game\includes\functions.php on line 280 Notice: Undefined variable: per_und in e:\domains\m\mafia-revolutions.co.uk\user\htdocs\game\includes\functions.php on line 280 Notice: Undefined variable: tard_bank in e:\domains\m\mafia-revolutions.co.uk\user\htdocs\game\includes\functions.php on line 279 Notice: Undefined variable: per_und in e:\domains\m\mafia-revolutions.co.uk\user\htdocs\game\includes\functions.php on line 280 Notice: Undefined variable: per_und in e:\domains\m\mafia-revolutions.co.uk\user\htdocs\game\includes\functions.php on line 280 Notice: Undefined variable: tard_bank in e:\domains\m\mafia-revolutions.co.uk\user\htdocs\game\includes\functions.php on line 279 Notice: Undefined variable: per_und in e:\domains\m\mafia-revolutions.co.uk\user\htdocs\game\includes\functions.php on line 280 Notice: Undefined variable: per_und in e:\domains\m\mafia-revolutions.co.uk\user\htdocs\game\includes\functions.php on line 280 Notice: Undefined variable: tard_bank in e:\domains\m\mafia-revolutions.co.uk\user\htdocs\game\includes\functions.php on line 279 Notice: Undefined variable: per_und in e:\domains\m\mafia-revolutions.co.uk\user\htdocs\game\includes\functions.php on line 280 Notice: Undefined variable: per_und in e:\domains\m\mafia-revolutions.co.uk\user\htdocs\game\includes\functions.php on line 280 Notice: Undefined variable: tard_bank in e:\domains\m\mafia-revolutions.co.uk\user\htdocs\game\includes\functions.php on line 279 Notice: Undefined variable: per_und in e:\domains\m\mafia-revolutions.co.uk\user\htdocs\game\includes\functions.php on line 280 Notice: Undefined variable: per_und in e:\domains\m\mafia-revolutions.co.uk\user\htdocs\game\includes\functions.php on line 280 Notice: Undefined variable: tard_bank in e:\domains\m\mafia-revolutions.co.uk\user\htdocs\game\includes\functions.php on line 279 Notice: Undefined variable: per_und in e:\domains\m\mafia-revolutions.co.uk\user\htdocs\game\includes\functions.php on line 280 Notice: Undefined variable: per_und in e:\domains\m\mafia-revolutions.co.uk\user\htdocs\game\includes\functions.php on line 280 Notice: Undefined variable: tard_airport in e:\domains\m\mafia-revolutions.co.uk\user\htdocs\game\includes\functions.php on line 288 Notice: Undefined variable: per_und in e:\domains\m\mafia-revolutions.co.uk\user\htdocs\game\includes\functions.php on line 289 Notice: Undefined variable: per_und in e:\domains\m\mafia-revolutions.co.uk\user\htdocs\game\includes\functions.php on line 289 Notice: Undefined variable: tard_airport in e:\domains\m\mafia-revolutions.co.uk\user\htdocs\game\includes\functions.php on line 288 Notice: Undefined variable: per_und in e:\domains\m\mafia-revolutions.co.uk\user\htdocs\game\includes\functions.php on line 289 Notice: Undefined variable: per_und in e:\domains\m\mafia-revolutions.co.uk\user\htdocs\game\includes\functions.php on line 289 Notice: Undefined variable: tard_airport in e:\domains\m\mafia-revolutions.co.uk\user\htdocs\game\includes\functions.php on line 288 Notice: Undefined variable: per_und in e:\domains\m\mafia-revolutions.co.uk\user\htdocs\game\includes\functions.php on line 289 Notice: Undefined variable: per_und in e:\domains\m\mafia-revolutions.co.uk\user\htdocs\game\includes\functions.php on line 289 Notice: Undefined variable: tard_airport in e:\domains\m\mafia-revolutions.co.uk\user\htdocs\game\includes\functions.php on line 288 Notice: Undefined variable: per_und in e:\domains\m\mafia-revolutions.co.uk\user\htdocs\game\includes\functions.php on line 289 Notice: Undefined variable: per_und in e:\domains\m\mafia-revolutions.co.uk\user\htdocs\game\includes\functions.php on line 289 Notice: Undefined variable: tard_airport in e:\domains\m\mafia-revolutions.co.uk\user\htdocs\game\includes\functions.php on line 288 Notice: Undefined variable: per_und in e:\domains\m\mafia-revolutions.co.uk\user\htdocs\game\includes\functions.php on line 289 Notice: Undefined variable: per_und in e:\domains\m\mafia-revolutions.co.uk\user\htdocs\game\includes\functions.php on line 289 Notice: Undefined variable: tard_airport in e:\domains\m\mafia-revolutions.co.uk\user\htdocs\game\includes\functions.php on line 288 Notice: Undefined variable: per_und in e:\domains\m\mafia-revolutions.co.uk\user\htdocs\game\includes\functions.php on line 289 Notice: Undefined variable: per_und in e:\domains\m\mafia-revolutions.co.uk\user\htdocs\game\includes\functions.php on line 289 Notice: Undefined variable: fetch in e:\domains\m\mafia-revolutions.co.uk\user\htdocs\game\includes\functions.php on line 303 Quote Link to comment https://forums.phpfreaks.com/topic/54768-converting-from-php3-to-4/#findComment-270979 Share on other sites More sharing options...
wildteen88 Posted June 8, 2007 Share Posted June 8, 2007 Could you post the exact version of PHP you are using. I cannot see why it wont work. Quote Link to comment https://forums.phpfreaks.com/topic/54768-converting-from-php3-to-4/#findComment-271105 Share on other sites More sharing options...
per1os Posted June 8, 2007 Share Posted June 8, 2007 If those errors are the problem, you can make it to where the notice errors are not shown via the php.ini or the www.php.net/error_reporting Quote Link to comment https://forums.phpfreaks.com/topic/54768-converting-from-php3-to-4/#findComment-271106 Share on other sites More sharing options...
corkg Posted June 9, 2007 Author Share Posted June 9, 2007 I am using streamline and their power package and it says PHP 4. They told me this; In order to hide notices displayed on your PHP page, you will need to include the following line of code in your page. error_reporting(E_ALL ^ E_NOTICE); yet i can put this on my Fasthosts server and it works fine. Quote Link to comment https://forums.phpfreaks.com/topic/54768-converting-from-php3-to-4/#findComment-271321 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.