runnerjp Posted October 13, 2006 Share Posted October 13, 2006 hey all... i got a post script and well you can view it by going to www.runnerselite.com and on marquee area their is a post link... click that then takes u to pop up link that is where u can entre text you want to add... iit then asks you to login so sends you to page login all clear so far but then when u try login it takes you to a blank page.,... i think its because i have done comethign wrong within the code on my page ...can any one help me???here is the code for the page[code]<?phpinclude "connect.php";if (isset($_POST['submit'])) // name of submit button{ $chatter=$_POST['chatter']; $password=$_POST['password']; $password=md5($password); $query = "select * from ch_chatters where chatter='$chatter' and password='$password'"; $result = mysql_query($query) or die("No te Gusta") ; $isAuth = false; //set to false originally while($row = mysql_fetch_array($result)) { $isAuth=true; session_start(); $_SESSION['chatter']=$chatter; } if($isAuth==true) { print "logged in successfully<br><br>"; print "<A href='index.php'>Go to Chat</a>"; $check="SELECT * from ch_online where sessionname='$chatter'"; $check2=mysql_query($check) or die("2"); $check3=mysql_fetch_array($check2); if(!$check3) { $day=date('U'); $s="INSERT into ch_online (sessionname, time) values ('$chatter','$day' )"; $s2=mysql_query($s) or die("not queried"); } } else { print "Wrong username or password"; }}?>[/code] Quote Link to comment Share on other sites More sharing options...
redarrow Posted October 13, 2006 Share Posted October 13, 2006 Session_start() has to be at the beging of the page and at the beging of all pages try. Quote Link to comment Share on other sites More sharing options...
runnerjp Posted October 13, 2006 Author Share Posted October 13, 2006 like so,,,,[code]<?phpSession_start() include "connect.php";if (isset($_POST['submit'])) // name of submit button{ $chatter=$_POST['chatter']; $password=$_POST['password']; $password=md5($password); $query = "select * from ch_chatters where chatter='$chatter' and password='$password'"; $result = mysql_query($query) or die("No te Gusta") ; $isAuth = false; //set to false originally while($row = mysql_fetch_array($result)) { $isAuth=true; session_start(); $_SESSION['chatter']=$chatter; } if($isAuth==true) { print "logged in successfully<br><br>"; print "<A href='index.php'>Go to Chat</a>"; $check="SELECT * from ch_online where sessionname='$chatter'"; $check2=mysql_query($check) or die("2"); $check3=mysql_fetch_array($check2); if(!$check3) { $day=date('U'); $s="INSERT into ch_online (sessionname, time) values ('$chatter','$day' )"; $s2=mysql_query($s) or die("not queried"); } } else { print "Wrong username or password"; }}?>[/code] Quote Link to comment Share on other sites More sharing options...
runnerjp Posted October 13, 2006 Author Share Posted October 13, 2006 still just a blank page :( Quote Link to comment Share on other sites More sharing options...
gmwebs Posted October 13, 2006 Share Posted October 13, 2006 Try using exit(); to debug the different stages. For example...[code] while($row = mysql_fetch_array($result)) { $isAuth=true; session_start(); $_SESSION['chatter']=$chatter;echo $isAuth;exit(); } [/code]That will then obviously echo the value of that variable at that stage and exit to show it to you... Quote Link to comment Share on other sites More sharing options...
runnerjp Posted October 13, 2006 Author Share Posted October 13, 2006 nope that didnt work...it has worked b4 and i leave it for a month come back to it and dnt work...wierd Quote Link to comment Share on other sites More sharing options...
gmwebs Posted October 13, 2006 Share Posted October 13, 2006 What happened when you tried to debug the script? Did it still show nothing? If so, then obviously your $isAuth variable is empty/null. You are depending on values of variables to evaluate true in your if/while statements, but they might not be. For instance, if $isAuth evaluates to false, then the 2nd stage won't be processed, and will therefore give you a blank screen. Also, try and explicitly set $isAuth to true and see if it then processes the rest of the script. 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.