dezkit Posted September 14, 2008 Share Posted September 14, 2008 I have a index.php with a login form, when somebody enters information it goes into check_login.php and checks if the username and password is correct, if it is correct, a session registers. So everytime a session registers the index.php shows a link called "Administrator Panel" to /administrator/ folder. So when i press on it, it doesn't show the "Administrator Panel" link anymore, instead, it shows a the form. Link to comment https://forums.phpfreaks.com/topic/124137-solved-weird-problem/ Share on other sites More sharing options...
Garethp Posted September 14, 2008 Share Posted September 14, 2008 Have you remembered to start session? Link to comment https://forums.phpfreaks.com/topic/124137-solved-weird-problem/#findComment-640871 Share on other sites More sharing options...
dezkit Posted September 14, 2008 Author Share Posted September 14, 2008 Yeah. I have. Link to comment https://forums.phpfreaks.com/topic/124137-solved-weird-problem/#findComment-640872 Share on other sites More sharing options...
Garethp Posted September 14, 2008 Share Posted September 14, 2008 Can I get the source code? Link to comment https://forums.phpfreaks.com/topic/124137-solved-weird-problem/#findComment-640874 Share on other sites More sharing options...
dezkit Posted September 14, 2008 Author Share Posted September 14, 2008 What page? Link to comment https://forums.phpfreaks.com/topic/124137-solved-weird-problem/#findComment-640875 Share on other sites More sharing options...
Garethp Posted September 14, 2008 Share Posted September 14, 2008 The check login that shows the form or admin panel thing Link to comment https://forums.phpfreaks.com/topic/124137-solved-weird-problem/#findComment-640877 Share on other sites More sharing options...
dezkit Posted September 14, 2008 Author Share Posted September 14, 2008 <? $myusername = $_SESSION["myusername"]; if(session_is_registered(myusername)){ echo " <tr> <td align=\"center\">Hello $myusername</td> <td align=\"right\"><a href=\"http://www.xxx.com/administrator/\" class=\"oran\">Administrator Panel</a></td> <td align=\"right\"><a href=\"logout.php\" class=\"oran\">Log Out</a></td> </tr>"; } else { ?> <tr align="left" valign="middle"> <td width="100"> <?php $type = $_GET["type"]; if($type == "841927408208"){ echo "<font color='red'>Wrong Password. </font>"; }elseif($type == "412942414209"){ echo "<font color='red'>You Logged Out. </font>"; }elseif($type == "609421098494"){ echo "<font color='red'>Not Logged In. </font>"; }elseif($type == ""){ echo ""; }else{ echo "<font color='red'>Unkown Error! </font>"; } ?> </td> <td width="100"><input name="text2532" type="text" class="intext" style="width:90px; height:17px" onClick="this.value=''" value="Username"></td> <td width="100"><input name="text25322" type="password" class="intext" style="width:90px; height:17px" onClick="this.value=''" value="Password"></td> <td width="100"><input name="submit2222" type="submit" style="width:56px; height:18px; background-image:url(images/LogIn.jpg); border:0px none; cursor:hand; cursor:pointer; " value=""></td> </tr> <?php } ?> This is the login.php that i have include()'ed into the administrator panel. Link to comment https://forums.phpfreaks.com/topic/124137-solved-weird-problem/#findComment-640880 Share on other sites More sharing options...
Garethp Posted September 14, 2008 Share Posted September 14, 2008 Ok, first, I don't see a session_start() there, it's good practice to have it in one file and include it where needed, next, change if(session_is_registered(myusername)) to if(isset($_SESSION['myusername'])) Link to comment https://forums.phpfreaks.com/topic/124137-solved-weird-problem/#findComment-640882 Share on other sites More sharing options...
dezkit Posted September 14, 2008 Author Share Posted September 14, 2008 Oh, session_start() is on the page that include()s login.php BTW: I Just Dragged the Login.php into the /administrator/ folder, and it started working, but i don't like the fact that if i want to change Login.php, i have to change it in 2 places, any suggestions? Link to comment https://forums.phpfreaks.com/topic/124137-solved-weird-problem/#findComment-640888 Share on other sites More sharing options...
dezkit Posted September 14, 2008 Author Share Posted September 14, 2008 i have found the problem, topic has been teh solved Link to comment https://forums.phpfreaks.com/topic/124137-solved-weird-problem/#findComment-640899 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.