huiu Posted April 7, 2013 Share Posted April 7, 2013 (edited) i cant get my index page to hold my information, every time i login it says field are blank the code is as follows index.php <!-- Source Protected --><!-- Your IP has been logged --> <html><head><?$title = "DragonSwords - Join now!";include("style5.css");?> </head> <BODY TOPMARGIN="0" LEFTMARGIN="0" bgcolor=000000> <center><img src="image/top.gif" border=0><table width="700" border="0" cellspacing="0" cellpadding="0"><tr><td width="121" valign=top><table style="BORDER-RIGHT: #000000 1px solid; BORDER-LEFT: #000000 1px solid; BORDER-BOTTOM: #000000 1px solid;" width="121" border="0" cellspacing="0" cellpadding="0"><tr><td> <img src="image/left-section.gif"><DIV id="topmenucell"> User not logged in.</div> <img src="image/left-menu-top.gif"><br /><font size=1 face=verdana><DIV id="topmenucell">- <a href="index.php">Home</a><br />- <a href="signup.php<? if ($ref) {echo "?ref=$ref";}?>">Signup</a><br />- <a href="about.php">About</a><br />- <a href="tos.php">Terms of Service</a><br />- <a href="rules2.php">Game Rules</a><br />- <a href="staff2.php">Staff</a><br />- <a href="help2.php">Help</a><br /></div> </td></tr></table><td width="*" valign=top><center><img src="image/content.gif"><table width="450" cellspacing="0" cellpadding="0" style="BORDER-RIGHT: #000000 1px solid; BORDER-TOP: #000000 1px solid; BORDER-LEFT: #000000 1px solid; BORDER-BOTTOM: #000000 1px solid;"><tr><td><font size=1 face=verdana><DIV id=bottommenucell> <? if (!$action){ ?> <form action=check.php method=post> <p>DragonSwords is an online RPG that started in 2001. Since then, we have accumulated a large populace. The game undergoes regular updates, and there is an excellent staff team to help you. So consider signing up from the link on the left. Remember, we're free so why not play today! <p> <b>Email Address:</b> <br> <input type="text" name="email" size="20" style="border: 1px solid white; background-color: #000020; color: white"> <br> <b>Password:</b> <br> <input type="password" name="password" size="20" style="border: 1px solid white; background-color: #000020; color: white"> <br> <input type="submit" value="Log In" style="border: 1px solid white; background-color: #000020; color: white"> </form> <p><form action=index.php method=post><b>Lost your password?</b><br />Just enter your email here to have it sent.<br /> <b>Email:</b> <br /> <input type=text name=email size=20 style="border: 1px solid white; background-color: #000020; color: white"> <br /> <input type=hidden name=action value=password> <input type=submit value=Send style="border: 1px solid white; background-color: #000020; color: white"> </form> <?}elseif ($action == "password" && $email){ include ("config.php");$select = mysql_query("select * from userdb where email='$email'");$userinfo = mysql_fetch_array($select);if ($userinfo) { echo "Information emailed."; $message = "You appear to have lost your password.\n\nPassword: $userinfo[password]\n\nIf you did not ask for this to be sent then ask an admin for an email change."; $headers = "From: DragonSwords Admin <lostpassword@dsrpg.com>\r\n"; mail($email,"Lost password for DragonSword account: $userinfo[username]",$message,$headers); } else { echo "Non existant account."; }} ?> </div></td></tr></table></td><td width="121" valign=top><table style="BORDER-RIGHT: #000000 1px solid; BORDER-LEFT: #000000 1px solid; BORDER-BOTTOM: #000000 1px solid;" width="100" border="0" cellspacing="0" cellpadding="0"><tr><td> <img src="image/right-section-top.gif"><br><font size=1 face=verdana><DIV id=bottommenucell></div> </td></tr></table></td></tr></table></body></html> ################################################################################# and my config file that checks the passwords are ############################################################################### <?php @session_start();$selectaccount = rand(1,3);if($selectaccount == 1){$db = mysql_connect("localhost","ssrpg","Nw}9gpd0sOsk") or mysql_connect("localhost","ssrpg","Nw}9gpd0sOsk") or Die("I cannot connect to the database because: " . mysql_error());}if($selectaccount == 2){$db = mysql_connect("localhost","ssrpg","Nw}9gpd0sOsk")or mysql_connect("localhost","ssrpg","Nw}9gpd0sOsk") or Die("I cannot connect to the database because: " . mysql_error());}if($selectaccount == 3){$db = mysql_connect("localhost","ssrpg","Nw}9gpd0sOsk") or mysql_connect("localhost","ssrpg","Nw}9gpd0sOsk") or Die("I cannot connect to the database because: " . mysql_error());} mysql_select_db("ssrpg_ds") or Die("DB Error !"); $res = mysql_query("SELECT * FROM userdb WHERE email = '$email'");$playerinfo = mysql_fetch_array($res);mysql_free_result($res);$time = date("j\/m H:i:s");$realtime = date("YzHis"); mysql_query("update userdb set active='$time' where email='$email'");mysql_query("update userdb set active2='$realtime' where email='$email'");mysql_query("update userdb set ipaddress='$REMOTE_ADDR' where email='$email'"); $date2 = date("H:i"); $rankname = array("Peasent","Valet","Squire","Knight","Lord","Dol","Earl","Count","Thane","Duke","Archduke","Royal");$rankypanky = $playerinfo[rank];$merank = "$rankname[$rankypanky]"; // Days, months....etc..$dayday = date ("D");if ($dayday == "Mon"){$newday == "Lunae Dies";}if ($dayday == "Tue"){$newday == "Martis Dies";}if ($dayday == "Wed"){$newday == "Mercurii Dies";}if ($dayday == "Thu"){$newday == "Jovis Dies";}if ($dayday == "Fri"){$newday == "Veneris Dies";}if ($dayday == "Sat"){$newday == "Saturni Dies";}if ($dayday == "Sun"){$newday == "Solis Dies";}$monmon = date ("M");if ($monmon == "Jan"){$newmon == "Month of Janus, God of doors and gates";}if ($monmon == "Feb"){$newmon == "Month of Februalia, sacrifices are made to atone for sins";}if ($monmon == "Mar"){$newmon == "Month of Mars, God of War";}if ($monmon == "Apr"){$newmon == "Month of Aperire, The buds open";}if ($monmon == "May"){$newmon == "Month of Maia, the Goddess of growth of plants";}if ($monmon == "Jun"){$newmon == "Month of Juno, time of Goddess Junius";}if ($monmon == "Jul"){$newmon == "Month of Quintilis Julius";}if ($monmon == "Aug"){$newmon == "Month of Sextilis, Augustus Caesar";}if ($monmon == "Sep"){$newmon == "Month of Septem";}if ($monmon == "Oct"){$newmon == "Month of Octo";}if ($monmon == "Nov"){$newmon == "Month of Novem";}if ($monmon == "Dec"){$newmon == "Month of Decem";} include "money_fns.php"; function jailerror($type, $email){ if($type == "jail"){ $res = mysql_query("SELECT * FROM userdb WHERE email='$email'"); $playerinfo = mysql_fetch_array($res); include("style5.css"); Echo "<center><img src=\"image/top.gif\" border=0 height=51 width=350><br><br></center>"; //echo "<body text=\"#800000\" bgcolor=\"#000000\"></body><font face=Arial>"; echo "<font color=red>You are in jail for another $playerinfo[jailtime] days.<p>Jailed by: <b>$playerinfo[jail_by]</b> for reason: <b>$playerinfo[jail_reason]</b>"; }} function gem($type){if($type == "c"){ echo "<img src=\"image/gem_crystal.gif\">";}if($type == "d"){ echo "<img src=\"image/gem_diamond.gif\">";}if($type == "e"){ echo "<img src=\"image/gem_emerald.gif\">";}if($type == "r"){ echo "<img src=\"image/gem_ruby.gif\">";}} function error($type){ if($type == "field"){ include("style5.css"); Echo "<center><img src=\"image/top.gif\" border=0 height=51 width=350><br><br></center>"; //echo "<body text=\"#800000\" bgcolor=\"#000000\"></body><font face=Arial>"; echo "<font color=red>You have left fields blank. Please <a href=\"index.php\">relogin</a></font>"; } if($type == "password"){ include("style5.css"); Echo "<center><img src=\"image/top.gif\" border=0 height=51 width=350><br><br></center>"; // echo "<body text=\"#800000\" bgcolor=\"#000000\"></body><font face=Arial>"; echo "<font color=red>Incorrect password. Please <a href=\"index.php\">relogin</a></font>"; } if($type == "jail"){ include("style5.css"); Echo "<center><img src=\"image/top.gif\" border=0 height=51 width=350><br><br></center>"; // echo "<body text=\"#800000\" bgcolor=\"#000000\"></body><font face=Arial>"; $res = mysql_query("SELECT * FROM userdb WHERE email='$email'"); $playerinfo = mysql_fetch_array($res); echo "<font color=red>You are in jail for another $playerinfo[jailtime] days.<p>Jailed by: <b>$playerinfo[jail_by]</b> for reason: <b>$playerinfo[jail_reason]</b>"; } if($type == "verify"){ include("style5.css"); Echo "<center><img src=\"image/top.gif\" border=0 height=51 width=350><br><br></center>"; //echo "<body text=\"#800000\" bgcolor=\"#000000\"></body><font face=Arial>"; echo "<font color=red>Verification required. Please <a href=verify.php>login</a> here.</font>"; }}?> any help would be great it just wont accept a login Edited April 7, 2013 by huiu Quote Link to comment Share on other sites More sharing options...
mac_gyver Posted April 7, 2013 Share Posted April 7, 2013 the code you found or wherever you learned php is 11 years out of date and won't work on current versions of php. throw that code away and find an up to date source of php information to code from. Quote Link to comment Share on other sites More sharing options...
huiu Posted April 7, 2013 Author Share Posted April 7, 2013 it works, i had it working a year or 2 ago but cant remember what i did to fix it, is there anyway to keep the email and password to be remembered Quote Link to comment Share on other sites More sharing options...
Andy-H Posted April 7, 2013 Share Posted April 7, 2013 Please use b1bc30a58b6ac5c9d1852f6bde30710e tags in future; my eyes hurt Quote Link to comment 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.