php - Keeps redirecting to my error page -
so, reason whenever go website. session 'loggedin' set true automatically, , reason automatically re-directs me error page. here's site code: login.php:
<?php session_start(); if($_session['loggedin'] == true){ header("location: /index.php"); } $user = stripslashes($_post['user']); $pass = stripslashes($_post['pass']); if((!user == "") && (!$pass == "") && file_exists("/home/manseld/public_html/accounts/$user.txt")){ $file = explode(":", file_get_contents("/home/manseld/public_html/accounts/$user.txt")); if(($file[0] == $user) && ($file[1] == md5($pass))){ $_session['loggedin'] = true; }else{ header("location: /error.php?e=badlogin"); } }else{ header("location: /error.php?e=doesnotexist"); } ?> <?php include('/home/manseld/public_html/scripts/config.php'); ?> <title><?php echo "$title"; ?></title> <head> <link href="/stylesheets/stylesheet1.css" rel="stylesheet" type="text/css"> <link rel="shortcut icon" href="/images/favicon.ico"/> </head> <style type="text/css"> body { background: url("<?php echo "$background"; ?>") 50% 50% repeat; } </style> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <center> <div class="menu"> <div style="border:3px groove white"> <table> <form action="" method="post"> <tr> <td align="right"><font color=white>username:</font></td> <td align="left"><input type="text" name="user"/></td> </tr> <tr> <td align="right"><font color=white>password:</font></td> <td align="left"><input type="password" name="pass"/></td> </tr> </table> <input type="submit" value="login" name="submit" name="submit"/> </form> </div> </div> </center>
now here's index page:
<?php session_start(); if($_session['loggedin'] == false){ header("location: /login.php"); } ?> <?php include('/home/manseld/public_html/scripts/config.php'); ?> <title><?php echo "$title"; ?></title> <a name="#top"></a> <head> <link href="/stylesheets/stylesheet1.css" rel="stylesheet" type="text/css"> <link rel="shortcut icon" href="/images/google%20drive%20favicon.ico"/> </head> <style type="text/css"> body { background: url("<?php echo "$background"; ?>") 50% 50% repeat; } </style> <?php echo "$menu"; ?> <div class="main"> <div class="games" bgcolor=black> <font size=4 color=white> <div style="text-align:left"> <li><a href="/scripts/startgme.php?&name=airbttle2&width=720&height=480" style="color: #cccccc">air battle 2</a><br></li> <li><a href="/scripts/startgme.php?&name=aow&width=780&height=540" style="color: #cccccc">age of war</a><br></li> <li><a href="/scripts/startgme.php?&name=aow2&width=720&height=480" style="color: #cccccc">age of war 2</a><br></li> <li><a href="/scripts/startgme.php?&name=aryofags&width=720&height=500" style="color: #cccccc">army of ages (age of war 3)</a><br></li> <li><a href="/scripts/startgme.php?&name=arcne&width=640&height=480" style="color: #cccccc">arcane</a><br></li> <li><a href="/scripts/startgme.php?&name=arcnorm&width=700&height=525" style="color: #cccccc">arcanorum</a><br></li> <li><a href="/scripts/startgme.php?&name=awsumplnes&width=600&height=600" style="color: #cccccc">awesome planes</a><br></li> <li><a href="/scripts/startgme.php?&name=awsumtnks2&width=600&height=600" style="color: #cccccc">awesome tanks 2</a><br></li> <li><a href="/scripts/startgme.php?&name=bbltnks2&width=500&height=400" style="color: #cccccc">bubble tanks 2</a><br></li> <li><a href="/scripts/startgme.php?&name=bdeggs&width=640&height=530" style="color: #cccccc">bad eggs online</a><br></li> <li><a href="/scripts/startgme.php?&name=blxorz&width=550&height=300" style="color: #cccccc">bloxorz</a><br></li> <li><a href="/scripts/startgme.php?&name=brtbson&width=720&height=480" style="color: #cccccc">burrito bison</a><br></li> <li><a href="/scripts/startgme.php?&name=btd4&width=640&height=660" style="color: #cccccc">bloons tower defence 4</a><br></li> <li><a href="/scripts/startgme.php?&name=bttlepanic&width=800&height=620" style="color: #cccccc">battle panic</a><br></li> <li><a href="/scripts/startgme.php?&name=bttlgar&width=800&height=500" style="color: #cccccc">battle gear</a><br></li> <li><a href="/scripts/startgme.php?&name=bxhd&width=640&height=480" style="color: #cccccc">boxhead</a><br></li> <li><a href="/scripts/startgme.php?&name=bxhd2ply&width=640&height=480" style="color: #cccccc">boxhead 2play</a><br></li> <li><a href="/files/loaders/canyndefnce2.php" style="color: #cccccc">canyon defence 2</a><br></li> <li><a href="/scripts/startgme.php?&name=chsfctn&width=800&height=600" style="color: #cccccc">chaos faction</a><br></li> <li><a href="/scripts/startgme.php?&name=chsfctn2&width=800&height=600" style="color: #cccccc">chaos faction 2</a><br></li> <li><a href="/scripts/startgme.php?&name=corpratininc&width=800&height=500" style="color: #cccccc">corporation inc</a><br></li> <li><a href="/scripts/startgme.php?&name=cyclmniacs&width=640&height=480" style="color: #cccccc">cyclomaniacs</a><br></li> <li><a href="/scripts/startgme.php?&name=cyclmniacs2&width=750&height=500" style="color: #cccccc">cyclomaniacs 2</a><br></li> <li><a href="/scripts/startgme.php?&name=deadlyneihbrs2&width=720&height=480" style="color: #cccccc">deadly neighbors 2</a><br></li> <li><a href="/scripts/startgme.php?&name=drodasslt&width=640&height=480" style="color: #cccccc">droid assault</a><br></li> <li><a href="/scripts/startgme.php?&name=ducklfe4&width=750&height=480" style="color: #cccccc">duck life 4</a><br></li> <li><a href="/scripts/startgme.php?&name=efinwrms2&width=640&height=480" style="color: #cccccc">effing worms 2</a><br></li> <li><a href="/scripts/startgme.php?&name=elctrcmn2&width=640&height=400" style="color: #cccccc">electric man 2</a><br></li> <li><a href="/scripts/startgme.php?&name=endlsswr3&width=727&height=600" style="color: #cccccc">endless war 3</a><br></li> <li><a href="/scripts/startgme.php?&name=endlszombrmpge&width=550&height=400" style="color: #cccccc">endless zombie rampage</a><br></li> <li><a href="/scripts/startgme.php?&name=endlszombrmpge2&width=550&height=400" style="color: #cccccc">endless zombie rampage 2</a><br></li> <li><a href="/scripts/startgme.php?&name=enigmta-stellr-wr&width=700&height=550" style="color: #cccccc">enigmata stellar war</a><br></li> <li><a href="/scripts/startgme.php?&name=eridni&width=580&height=500" style="color: #cccccc">eridani</a><br></li> <li><a href="/scripts/startgme.php?&name=erntodi&width=700&height=500" style="color: #cccccc">earn die</a><br></li> <li><a href="/scripts/startgme.php?&name=erntodi2012&width=750&height=500" style="color: #cccccc">earn die 2012</a><br></li> <li><a href="/scripts/startgme.php?&name=flght&width=720&height=480" style="color: #cccccc">flight</a><br></li> <li><a href="/scripts/startgme.php?&name=fncypnts&width=720&height=480" style="color: #cccccc">fancy pants adventure world 1</a><br></li> <li><a href="/scripts/startgme.php?&name=fncypnts2&width=720&height=480" style="color: #cccccc">fancy pants adventure world 2</a><br></li> <li><a href="/scripts/startgme.php?&name=fncypnts3&width=720&height=480" style="color: #cccccc">fancy pants adventure world 3</a><br></li> <li><a href="/scripts/startgme.php?&name=frwyfry2&width=450&height=565" style="color: #cccccc">freeway fury 2</a><br></li> <li><a href="/scripts/startgme.php?&name=gdsplyngfild&width=550&height=400" style="color: #cccccc">gods playing field</a><br></li> <li><a href="/scripts/startgme.php?&name=ghstgidnce&width=550&height=400" style="color: #cccccc">ghost guidance</a><br></li> <li><a href="/scripts/startgme.php?&name=gmcorp&width=640&height=480" style="color: #cccccc">gam-e corp</a><br></li> <li><a href="/scripts/startgme.php?&name=gnblodwestrnshotout&width=720&height=425" style="color: #cccccc">gunblood western shootout</a><br></li> <li><a href="/scripts/startgme.php?&name=gnbot&width=700&height=550" style="color: #cccccc">gunbot</a><br></li> <li><a href="/scripts/startgme.php?&name=goalsothafric&width=640&height=480" style="color: #cccccc">goal south africa</a><br></li> <li><a href="/scripts/startgme.php?&name=hliattck3&width=450&height=320" style="color: #cccccc">heli attack 3</a><br></li> <li><a href="/scripts/startgme.php?&name=inftntr2&width=720&height=480" style="color: #cccccc">infectonator 2</a><br></li> <li><a href="/scripts/startgme.php?&name=intospc2&width=600&height=600" style="color: #cccccc">into space 2</a><br></li> <li><a href="/scripts/startgme.php?&name=intractvbddy&width=550&height=400" style="color: #cccccc">interactive buddy</a><br></li> <li><a href="/scripts/startgme.php?&name=intractvbddy2&width=550&height=400" style="color: #cccccc">interactive buddy 2</a><br></li> <li><a href="/scripts/startgme.php?&name=lrn2fly&width=640&height=480" style="color: #cccccc">learn fly</a><br></li> <li><a href="/scripts/startgme.php?&name=lrn2fly2&width=640&height=480" style="color: #cccccc">learn fly 2</a><br></li> <li><a href="/scripts/startgme.php?&name=mazegme&width=727&height=556" style="color: #cccccc">the maze</a><br></li> <li><a href="/scripts/startgme.php?&name=mgamnr&width=800&height=600" style="color: #cccccc">mega miner</a><br></li> <li><a href="/scripts/startgme.php?&name=nclrgn&width=640&height=480" style="color: #cccccc">nuclear gun</a><br></li> <li><a href="/scripts/startgme.php?&name=ntebokwrs3unleashd&width=600&height=600" style="color: #cccccc">notebook wars 3 unleashed</a><br></li> <li><a href="/scripts/startgme.php?&name=nxgme&width=725&height=340" style="color: #cccccc">nex gam-e</a><br></li> <li><a href="/scripts/startgme.php?&name=obltratevrythng&width=640&height=480" style="color: #cccccc">obliterate everything</a><br></li> <li><a href="/scripts/startgme.php?&name=obltratevrythng2&width=640&height=480" style="color: #cccccc">obliterate 2</a><br></li> <li><a href="/scripts/startgme.php?&name=phgwrs&width=728&height=611" style="color: #cccccc">phage wars</a><br></li> <li><a href="/scripts/startgme.php?&name=plntjucer&width=640&height=480" style="color: #cccccc">planet juicer</a><br></li> <li><a href="/scripts/startgme.php?&name=pndmc2&width=700&height=500" style="color: #cccccc">pandemic 2</a><br></li> <li><a href="/scripts/startgme.php?&name=potonpnc2&width=800&height=600" style="color: #cccccc">potion panic 2</a><br></li> <li><a href="/scripts/startgme.php?&name=pperidr&width=640&height=480" style="color: #cccccc">pipe riders</a><br></li> <li><a href="/scripts/startgme.php?&name=pttyrcrs3&width=800&height=600" style="color: #cccccc">potty racers 3</a><br></li> <li><a href="/scripts/startgme.php?&name=rbokll&width=800&height=600" style="color: #cccccc">robokill</a><br></li> <li><a href="/scripts/startgme.php?&name=robtsvszombs&width=760&height=570" style="color: #cccccc">robots vs zombies</a><br></li> <li><a href="/scripts/startgme.php?&name=shdz2&width=700&height=500" style="color: #cccccc">shadez 2</a><br></li> <li><a href="/scripts/startgme.php?&name=spllstrm&width=800&height=600" style="color: #cccccc">spellstorm</a><br></li> <li><a href="/scripts/startgme.php?&name=ss3&width=850&height=550" style="color: #cccccc">sas3</a><br></li> <li><a href="/scripts/startgme.php?&name=stkemprs&width=850&height=700" style="color: #cccccc">stick empires</a><br></li> <li><a href="/scripts/startgme.php?&name=stkwr2&width=850&height=700" style="color: #cccccc">stick war 2</a><br></li> <li><a href="/scripts/startgme.php?&name=stmpnktwrdefnce&width=800&height=500" style="color: #cccccc">steampunk tower defence</a><br></li> <li><a href="/scripts/startgme.php?&name=strkforchroes&width=800&height=600" style="color: #cccccc">strike forcefulness heroes</a><br></li> <li><a href="/scripts/startgme.php?&name=strmwindthelstcampagn&width=700&height=375" style="color: #cccccc">stormwinds lost campaigns</a><br></li> <li><a href="/scripts/startgme.php?&name=territrywr3&width=700&height=500" style="color: #cccccc">territory war 3</a><br></li> <li><a href="/scripts/startgme.php?&name=thegngme2&width=550&height=400" style="color: #cccccc">the gun gam-e 2</a><br></li> <li><a href="/scripts/startgme.php?&name=thelststnd2&width=700&height=400" style="color: #cccccc">the lastly stand 2</a><br></li> <li><a href="/scripts/startgme.php?&name=trckwrs&width=800&height=480" style="color: #cccccc">truck wars</a><br></li> <li><a href="/scripts/startgme.php?&name=upgrdcmplte2&width=400&height=500" style="color: #cccccc">upgrade finish 2</a><br></li> <li><a href="/scripts/startgme.php?&name=vrsumbr&width=800&height=400" style="color: #cccccc">versus umbra</a><br></li> <li><a href="/scripts/startgme.php?&name=wndrptt&width=750&height=650" style="color: #cccccc">wonderputt</a><br></li> <li><a href="/scripts/startgme.php?&name=wrldshrdstgme&width=728&height=529" style="color: #cccccc">worlds hardest gam-e</a><br></li> <li><a href="/scripts/startgme.php?&name=wrldshrdstgme2&width=728&height=520" style="color: #cccccc">worlds hardest gam-e 2</a><br></li> <li><a href="/scripts/startgme.php?&name=zombetrlrprk&width=800&height=600" style="color: #cccccc">zombie trailer park (hillbillys vs zombies)</a><br></li> </div> </div> <hr> <center><div class="title" style="border:2px groove white;"> <a href="#top">back top</a> | <a href="/request.php">want game added?</a> </center></div> </font>
and custom error page:
<?php $msg = stripslashes($_get['e']); if($msg == "badlogin"){ $error = 'you have entered invalid login... <a href="index.php">please seek again!</a>'; }elseif($msg = "doesnotexist"){ $error = "invalid login; user doesn't exist"; }else{ $error = 'an unknown error occured!'; } ?> <center> <img src="/images/me_gusta.png" alt="me gusta"></img><br> <font color="red" size=3><?php echo $error; ?></font> </center>
i have no thought why it's re-directing error page
in case of $_session['loggedin'] == true need stop code execution , return.
if($_session['loggedin'] == true){ header("location: /index.php"); return; }
php
No comments:
Post a Comment