Alienware Posted December 8, 2008 Share Posted December 8, 2008 I really dont know whats wrong with my site. 30 minutes ago i tested the "register" page. I have just had a look at the require.php page but havnt changed anything. Now i am getting this error when i try to access the register page- Fatal error: Cannot redeclare upd() (previously declared in /home2/nymobste/public_html/register.php:15) in /home2/nymobste/public_html/connections/require.php on line 42 Quote Link to comment https://forums.phpfreaks.com/topic/136115-totally-confused/ Share on other sites More sharing options...
Brian W Posted December 8, 2008 Share Posted December 8, 2008 do you have a file that is include() or require()? Quote Link to comment https://forums.phpfreaks.com/topic/136115-totally-confused/#findComment-709765 Share on other sites More sharing options...
Alienware Posted December 8, 2008 Author Share Posted December 8, 2008 yes, but i havnt changed it within the last 30 minutes, and it isnt working now. NObody eltse has my host password, so nobody eltse could either. Quote Link to comment https://forums.phpfreaks.com/topic/136115-totally-confused/#findComment-709769 Share on other sites More sharing options...
premiso Posted December 8, 2008 Share Posted December 8, 2008 It looks like you have 2 definitions of the function "upd". It has already been defined on line 42 of require.php and you are re-defining it on register.php at line 15... Quote Link to comment https://forums.phpfreaks.com/topic/136115-totally-confused/#findComment-709774 Share on other sites More sharing options...
Brian W Posted December 8, 2008 Share Posted December 8, 2008 use include_once()instead of just plain include(). Or, simply make sure that you don't include the the function twice. Quote Link to comment https://forums.phpfreaks.com/topic/136115-totally-confused/#findComment-709789 Share on other sites More sharing options...
Alienware Posted December 8, 2008 Author Share Posted December 8, 2008 how can i change this without destroying the page? here is the code- <?php session_start(); require("connections/db.php"); $date = gmdate('Y-m-d h:i:s'); function error($input){ print ("<br /> <table width=\"30%\" align=\"center\" class=\"tbl\"> <tr><td align=\"center\" class=\"hdr\">Error</td></tr> <tr><td align=\"center\" class=\"tbl\">".$input."</td></tr> </table>"); } function upd($input){ print ("<br /> <table width=\"30%\" align=\"center\" class=\"tbl\"> <tr><td align=\"center\" class=\"hdr\">Update</td></tr> <tr><td align=\"center\" class=\"tbl\">".$input."</td></tr> </table>"); } function createRandomPassword() { $chars = "abcdefghijkmnopqrstuvwxyz023456789"; srand((double)microtime()*1000000); $i = 0; $pass = '' ; while ($i <= 7){ $num = rand() % 33; $tmp = substr($chars, $num, 1); $pass = $pass . $tmp; $i++; } return $pass; } $ip = $_SERVER['REMOTE_ADDR']; $name = strip_tags($_POST['name']); $email = $_POST['email']; $email2 = $_POST['email2']; $location = $_POST['location']; $gender = $_POST['gender']; $submit = $_POST['submit']; $refferer = $_POST['refferer']; $script = intval($_POST['script']); $promoid = strip_tags(addslashes(mysql_real_escape_string(intval($_POST['promo'])))); if ($submit){ if (md5($script) != $_SESSION['image_random_value']){ $error = "Script number incorrect."; }elseif (md5($script) == $_SESSION['image_random_value']){ if (!$name || !$email || !$email2){ $error = "Please fill in all fill all fields."; }else{ if (strlen($name) < 3 || strlen($name) > 20){ $error = "Player name can only contain between 3 and 20 characters."; }else{ if (ereg("[^A-Za-z0-9]", $name)){ $error = "Player name can only contain alphanumeric characters."; }else{ if (!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $email)){ $error = "Invalid email format."; }else{ if ($email != $email2){ $error = "Email addresses do not match."; }else{ if ($location != "New Zealand" && $location != "Australia" && $location != "USA" && $location != "England" && $location != "South Africa" && $location != "Cuba"){ $error = "Invalid location."; }else{ if ($gender != "Un-known" && $gender != "Male" && $gender != "Female"){ $error = "Invalid gender."; }else{ $que = mysql_query("SELECT * FROM `players` WHERE `playername` = '$name' ORDER BY `id` DESC")or die(mysql_error()); $num = mysql_numrows($que); if ($num != 0){ $error = "That player name is already in use."; }else{ $qry = mysql_query("SELECT * FROM `players` WHERE `email` = '$email' AND `status` != 'Alive' ORDER BY `id` DESC")or die(mysql_error()); $rows = mysql_numrows($qry); if ($rows > 0){ $error = "Your email is already in use."; }else{ $password = createRandomPassword(); $random = rand(10000, 50000); $safety = time() + 604800; if ($promoid == 2010){ $points = 50; }else{ $points = 0; } mysql_query("INSERT INTO `players` ( `id` , `playername` , `password` , `email` , `ip` , `status` , `registered` , `active` , `money` , `rank` , `rankpos` , `rankpoints` , `bank` , `banktime` , `crimechance` , `crimetime` , `crimessucc` , `crimesfail` , `gtachance` , `gtatime` , `gtassucc` , `gtasfail` , `btachance` , `btatime` , `btassucc` , `btasfail` , `location` , `gender` , `forumposts` , `image` , `quote` , `safety` , `points` , `refferer` ) VALUES ( '' , '$name' , '$password' , '$email' , '$ip' , 'Alive' , '$date' , '' , '$random' , 'Tramp' , '1' , '0' , '0' , '' , '0-0-0-0-0' , '' , '0' , '0' , '0-0-0-0-0' , '' , '0' , '0' , '0-0-0-0-0' , '' , '0' , '0' , '$location' , '$gender' , '0' , 'images/default.jpg' , 'No quote.' , '$safety' , '$points' , '$refferer' )")or die(mysql_error()); $upd = "Your account has now been registered!<br><br>Playername: ".$name." <br /> Password: ".$password.""; $to = "".$name." <".$email.">"; $subject = "Ny-Mobster Login Details"; $message = "Thankyou for registering at Ny-Mobster, your login details are as follows: <br /> <br /> Playername: ".$name." <br /> Password: ".$password." <br /> <br /> You can now login at: <a href=\"http://www.ny-mobster.net\">http://ny-mobster.net</a> <br /> <br /> admin@ny-mobster.net <br />"; $headers = "From: admin@ny-mobster.net\r\n" . 'X-Mailer: PHP/' . phpversion() . "\r\n" . "MIME-Version: 1.0\r\n" . "Content-Type: text/html; charset=utf-8\r\n" . "Content-Transfer-Encoding: ­ 8bit\r\n\r\n"; mail ($to, $subject, $message, $headers); }}}}}}}}}}} require("banner.php"); if ($error){ error($error); } if ($upd){ upd($upd); } ?> <html> <head> <meta name="description" content="Sign up to the latest up and coming MORPG mafia game, start life as a humble Tramp in the world of Ny-Mobster, do crimes, earn money and kill players on your way up to becoming a feared mafioso." /> <meta name="keywords" content="Ny-mobster,Ny-Mobster,ny-mobster, ny-Mobster, NyMobster, Nymobster, nyMobster, nymobster, mafia, game, mafia game, MORPG, morpg, MMORPG, mmorpg, MMOrpg, mmoRPG, Gangster, gangster, Ny, ny, NY, NewYork, newyork, New York, new york, Crime, crime, GTA, gta, Boat Theft, boat theft, Extortion, extortion, Mafioso, mafioso, Register, register, Registration, registration" /> <link rel="stylesheet" type="text/css" href="connections/stylereg.css" /> <title>.::NY-Mobster::.</title> </head> <body> <p align="center"> <form action="" method="post"> <table width="30%" align="center" class="tbl"> <tr><td align="center" class="hdr" colspan="2">.::Register::.</td></tr> <tr> <td align="left" class="tbl" width="30%"> <font color="red">Choose Name:</font></td> <td align="left" class="tbl"> <input type="text" name="name" size="20" maxlength="40" class="submit" /></td> </tr><tr> <td align="left" class="tbl" width="30%"> <font color="red">Your Email:</font></td> <td align="left" class="tbl"> <input type="text" name="email" size="25" class="submit" /></td> </tr><tr> <td align="left" class="tbl" width="30%"> <font color="red">Repeat email:</font></td> <td align="left" class="tbl"> <input type="text" name="email2" size="25" class="submit" /></td> </tr><tr> <td align="left" class="tbl" width="30%"> <font color="red">Reffered By:</font></td> <td align="left" class="tbl"> <input type="text" name="refferer" size="20" maxlength="20" class="submit" /></td> </tr><tr> <td align="left" class="tbl" width="30%"> <font color="red">Start Location:</font></td> <td align="left" class="tbl"> <select name="location"> <option value="New Zealand">New Zealand</option> <option value="Australia">Australia</option> <option value="USA">USA</option> <option value="England">England</option> <option value="South Africa">South Africa</option> <option value="Cuba">Cuba</option> </select> </td> </tr><tr> <td align="left" class="tbl" width="30%"> <font color="red">Choose Gender:</font></td> <td align="left" class="tbl"> <select name="gender"> <option value="Un-known">Un-known</option> <option value="Male">Male</option> <option value="Female">Female</option> </select> </td> </tr><tr> <td align="left" class="tbl" width="30%"> <font color="red">Refferal Id</font> </td> <td align="left" class="tbl"> <input type="text" name="promo" class="submit" size="5" maxlength="4" /> </td> </tr><tr> <td align="left" class="tbl" width="30%"> <img src="script.php" /> </td> <td align="left" class="tbl"> <input type="text" name="script" class="submit" size="5" maxlength="4" /> </td> </tr><tr> <td align="center" class="tbl"> </td> </tr><tr> </tr> </table> <br> <center><td align="center" class="tbl" colspan="2"><input type="submit" name="submit" class="submit" value="Register" /></td></center> <br /><br /> </form> <table width="30%" align="center" class="tbl"> <tr><td align="center" class="hdr" colspan="3">.::Navigation::.</td></tr> <tr><td align="center" width="33%" class="tbl"> <a href="index.php"><strong>Login</strong></a> </td> <td align="center" width="33%" class="tbl"> <a href="register.php"><strong><font color="red">Register</font></strong></a> </td> <td align="center" width="33%" class="tbl"> <a href="lost_pass.php"><strong>Lost Password</strong></a> </td> </tr> </table> </body> </html>code] anyone got any idea's? Quote Link to comment https://forums.phpfreaks.com/topic/136115-totally-confused/#findComment-709799 Share on other sites More sharing options...
premiso Posted December 8, 2008 Share Posted December 8, 2008 If this function upd($input){ print ("<br /> <table width=\"30%\" align=\"center\" class=\"tbl\"> <tr><td align=\"center\" class=\"hdr\">Update</td></tr> <tr><td align=\"center\" class=\"tbl\">".$input."</td></tr> </table>"); } Is the same as the one in the require, just remove that... Quote Link to comment https://forums.phpfreaks.com/topic/136115-totally-confused/#findComment-709804 Share on other sites More sharing options...
Alienware Posted December 8, 2008 Author Share Posted December 8, 2008 I have tried that, but then the index page wont load the register page Quote Link to comment https://forums.phpfreaks.com/topic/136115-totally-confused/#findComment-709811 Share on other sites More sharing options...
premiso Posted December 8, 2008 Share Posted December 8, 2008 So you are not including require.php on your index page? if (!function_exists("upd")) { function upd($input){ print ("<br /> <table width=\"30%\" align=\"center\" class=\"tbl\"> <tr><td align=\"center\" class=\"hdr\">Update</td></tr> <tr><td align=\"center\" class=\"tbl\">".$input."</td></tr> </table>"); } } Quote Link to comment https://forums.phpfreaks.com/topic/136115-totally-confused/#findComment-709817 Share on other sites More sharing options...
Alienware Posted December 8, 2008 Author Share Posted December 8, 2008 its still not working at all. Quote Link to comment https://forums.phpfreaks.com/topic/136115-totally-confused/#findComment-709839 Share on other sites More sharing options...
Alienware Posted December 8, 2008 Author Share Posted December 8, 2008 anyone got anymore idea's? Quote Link to comment https://forums.phpfreaks.com/topic/136115-totally-confused/#findComment-709892 Share on other sites More sharing options...
Alienware Posted December 8, 2008 Author Share Posted December 8, 2008 Ok i have found out that the problem with the broken pages is within this code- <?php require("connections/db.php"); require("connections/require.php"); print ("<meta http-equiv=\"refresh\" content=\"60\">"); $cash = $arr['money']; $crimetime = $arr['crimetime']; $gtatime = $arr['gtatime']; $btatime = $arr['btatime']; $exttime = $arr['last_ext']; $family = $arr['family']; $rank = $arr['rank']; $rankpos = $arr['rankpos']; $location = $arr['location']; $bullets = $arr['bullets']; $plane = $arr['plane']; $gun = $arr['weapon']; $pro = $arr['protection']; $health = $arr['health']; $points = $arr['points']; if ($health < 100){ if ($health > 0 && $health <= 20){ $healthadd = 15; }elseif ($health > 20 && $health <= 40){ $healthadd = 10; }elseif ($health > 40 && $health <= 65){ $healthadd = 7; }elseif ($health > 65 && $health <= 85){ $healthadd = 5; }elseif ($health > 85 && $health <= 95){ $healthadd = 100 - $health; }} if ($health < 95){ $newhealth = $health + $healthadd; mysql_query("UPDATE `players` SET `health` = '$newhealth' WHERE `playername` = '$player' LIMIT 1")or die(mysql_error()); } $mm = mysql_query("SELECT * FROM `jail` WHERE `location` = '$location' ORDER BY `id` DESC")or die(mysql_error()); $nn = mysql_numrows($mm); if ($pro == "0"){ $pro = "None"; }elseif ($pro == "1"){ $pro = "Bullet Proof Vest"; }elseif ($pro == "2"){ $pro = "Body Guard"; }elseif ($pro == "3"){ $pro = "Small SafeHouse"; }elseif ($pro == "4"){ $pro = "Large SafeHouse"; }elseif ($pro == "5"){ $pro = "FBI Protection"; }elseif ($pro == "6"){ $pro = "NYM Security System"; } if ($gun == "0"){ $gun = "None"; }elseif ($gun == "1"){ $gun = "HFC M190"; }elseif ($gun == "2"){ $gun = "Endor Blaster Rifle"; }elseif ($gun == "3"){ $gun = "Cheytac M 400"; }elseif ($gun == "4"){ $gun = "527 Varmint Kevlar"; }elseif ($gun == "5"){ $gun = "M77 MkII VLE"; }elseif ($gun == "6"){ $gun = "10 FCP McMillan"; } if ($family == "None"){ $family = "None"; }else{ $family = "<a href=\"famprofile.php?name=".$family."\" target=\"main\">".$family."</a>"; } if ($crimetime > time()){ $crime = "<a href=\"crime.php\" target=\"main\"> <font color=\"red\">Crimes</font> </a>"; }else{ $crime = "<a href=\"crime.php\" target=\"main\"> <font color=\"green\">Crimes</font> </a>"; } if ($gtatime > time()){ $gta = "<a href=\"gta.php\" target=\"main\"> <font color=\"red\">Car theft</font> </a>"; }else{ $gta = "<a href=\"gta.php\" target=\"main\"> <font color=\"green\">GTA</font> </a>"; } if ($btatime > time()){ $bta = "<a href=\"bta.php\" target=\"main\"> <font color=\"red\">BTA</font> </a>"; }else{ $bta = "<a href=\"bta.php\" target=\"main\"> <font color=\"green\">Boat theft</font> </a>"; } if ($exttime > time()){ $ext = "<a href=\"extortion.php\" target=\"main\"> <font color=\"red\">Extortion</font> </a>"; }else{ $ext = "<a href=\"extortion.php\" target=\"main\"> <font color=\"green\">Extortion</font> </a>"; } if ($nn == 0){ $jail = "<a href=\"jail.php\" target=\"main\"><font color=\"red\">Jail</font></a>"; }elseif ($nn > 0){ $jail = "<a href=\"jail.php\" target=\"main\"> <font color=\"green\">Jail(".number_format($nn).")</font> </a>"; } $old = mysql_query("SELECT `id` FROM `inbox` WHERE `playername` = '$player' AND `read` = '1' ORDER BY `id` DESC")or die(mysql_error()); $nold = mysql_numrows($old); $new = mysql_query("SELECT * FROM `inbox` WHERE `playername` = '$player' AND `read` = '0' ORDER BY `id` DESC")or die(mysql_error()); $nnew = mysql_numrows($new); if ($nnew == 0){ $inbox = "Inbox (".$nold." / ".$nnew.")"; }elseif ($nnew > 0){ $inbox = "<font color=\"red\">Inbox (".$nold." / ".$nnew.")"; } $health = $arr['health']; function rankbar(){ $player = $_SESSION['playername']; $qry = mysql_query("SELECT * FROM `players` WHERE `playername` = '$player' LIMIT 1")or die(mysql_error()); $arr = mysql_fetch_array($qry); $rank = $arr['rank']; $rankpoints = $arr['rankpoints']; if ($rank == "Tramp"){ $max = 100; $old = 0; }elseif ($rank == "Civilian"){ $max = 200; $old = 100; }elseif ($rank == "Paper Kid"){ $max = 400; $old = 200; }elseif ($rank == "Thief"){ $max = 800; $old = 400; }elseif ($rank == "Package Boy"){ $max = 1200; $old = 800; }elseif ($rank == "Thug"){ $max = 1700; $old = 1200; }elseif ($rank == "Gangster"){ $max = 2400; $old = 1700; }elseif ($rank == "Associate"){ $max = 3300; $old = 2400; }elseif ($rank == "Body Guard"){ $max = 4500; $old = 3300; }elseif ($rank == "Enforcer"){ $max = 6500; $old = 4500; }elseif ($rank == "Piciotto"){ $max = 8200; $old = 6500; }elseif ($rank == "Hit Man"){ $max = 10200; $old = 8200; }elseif ($rank == "Mobster"){ $max = 15000; $old = 10200; }elseif ($rank == "Wise Guy"){ $max = 20000; $old = 15000; }elseif ($rank == "Made Man"){ $max = 25000; $old = 20000; }elseif ($rank == "Capo"){ $max = 38000; $old = 25000; }elseif ($rank == "Consigliere"){ $max = 50000; $old = 38000; }elseif ($rank == "Local Boss"){ $max = 65000; $old= 50000; }elseif ($rank == "Boss"){ $max = 83000; $old = 65000; }elseif ($rank == "Godfather"){ $max = 100000; $old = 83000; }elseif ($rank == "Don"){ $max = 150000; $old = 100000; }elseif ($rank == "Ny Mobster"){ $max = 250000; $old = 150000; }elseif ($rank == "Editor"){ $max = 500000; $old = 250000; }elseif ($rank == "Entertainer"){ $max = 1000000; $old = 500000; }elseif ($rank == "Help Desk Operator"){ $max = 2000000; $old = 1000000; }elseif ($rank == "HDO Manager"){ $max = 3000000; $old = 2000000; }elseif ($rank == "Junior Moderator"){ $max = 4000000; $old = 3000000; }elseif ($rank == "Moderator"){ $max = 6000000; $old = 400000; }elseif ($rank == "Senior Moderator"){ $max = 8000000; $old = 6000000; }elseif ($rank == "Junior Administrator"){ $max = 10000000; $old = 8000000; }elseif ($rank == "Administrator"){ $max = 12000000; $old = 10000000; }elseif ($rank == "Senior Administrator"){ $max = 14000000; $old = 12000000; }elseif ($rank == "Site Manager"){ $max = 18000000; $old = 14000000; } $arguement1 = $rankpoints - $old; $arguement2 = $max - $old; $equation = $arguement1/$arguement2; $percent = $equation*100; print ("<table width=\"99%\" border=\"1\" cellpadding=\"2\" cellspacing=\"0\" bordercolor=\"#000000\" bgcolor=\"#222222\"> <tr><td> <table width=\"".$percent."%\" border=\"1\" cellpadding=\"0\" cellspacing=\"0\" bordercolor=\"#003300\" bgcolor=\"#003300\"> <tr> <td width=\"".$percent."%\"><font color=\"#737373\"> <strong>".number_format($percent,2)."%</strong></font> </td> </tr> </table> </td></tr> </table>"); } ?> <html> <head> <link rel="stylesheet" type="text/css" href="connections/style.css" /> </head> <table width='100%' border='0' cellspacing='0' cellpadding='0'> <tr><td align='center'><img src="connections/bannernew.jpg" valign="center" width="900px" height="60px"></td></tr> </table> <table width='100%' border='1' cellspacing='0' cellpadding='0'> <tr><th><font color="red">Playername:</font><font color="yellow"><? print $player; ?></font> <font color="red">Inbox:</font><a href="inbox.php" target="main"><strong> <? print $inbox; ?> <img src="images/mail.jpg" title="Check Mail!" width="16" height="11" border="0" /> </strong></a> <font color="red">Money:</font><font color="yellow"><? print "$".number_format($cash); ?></font> <font color="red">Health:</font><font color="yellow"><? print number_format($health)."%"; ?></font> <font color="red">Rank:</font><font color="yellow"><? print $rank; ?></font> <font color="red">Bullets:</font><font color="yellow"><? print number_format($bullets); ?></font> <font color="red">Points:</font><font color="yellow"><? print $points; ?></font></th></tr></table></html> but i have no idea what is causing it to mess the rest of the pages up Quote Link to comment https://forums.phpfreaks.com/topic/136115-totally-confused/#findComment-709922 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.