Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


anything wrong with this script?

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
deleted user 111213
Grandmaster Cheater
Reputation: 0

Joined: 09 Nov 2007
Posts: 714

PostPosted: Fri Jan 23, 2009 3:46 am    Post subject: anything wrong with this script? Reply with quote

Code:
<html>

<head>

<link rel="stylesheet" href="style3.css" type="text/css" />
<center><h1><font color="#CC0000">Login</font></h1></center>

<?php
include'./global.php';
session_start();

echo "<title>Login</title>\n";
echo "</head>";

if($_SESSION['uid']){
   echo "<font color=\"#CC0000\">You are already logged in, if you wish to log out, please <a href='logout2.php'>click here</a></font>";
}else{
        echo "<center>";
        echo "<div id=\"holder\" align=\"left\">";
   if(!$_POST['submit']){
      echo "<table border='0' cellspacing='3'>\n";
      echo "<form method='post' action='login2.php'>\n";
      echo "<tr><td><font color=\"#CC0000\">Username: </font> </td><td><input type='text' name='username'></td></tr>\n";
      echo "<tr><td><font color=\"#CC0000\">Password: </font></td><td><input type='password' name='password'></td></tr>\n";
      echo "<tr><td colspan='2' align='right'><input type='submit' name='submit' value='Login!'></td></tr>\n";
      echo "</form></table>\n";
                echo "</div>";
                echo "</center>";
   }else{
      $user = mss($_POST['username']);
      $pass = $_POST['password'];
      
      if($user && $pass){
         $sql = "SELECT id FROM users WHERE username = '".$user."'";
         $res = mysql_query($sql) or die(mysql_error());
         
         if(mysql_num_rows($res) > 0){
            $sql2 = "SELECT id FROM users WHERE username='".$user."' AND password='".$pass."'";
            $res2 = mysql_query($sql2);
            if(mysql_num_rows($res2) > 0){
               $row = mysql_fetch_assoc($res2);
               $_SESSION['uid'] = $row['id'];
               
               echo "<font color=\"CC0000\">You have successfully logged in as " . $user . "</font><br><br><a href='index.php'>Proceed to the forum's index page<a>\n";
            }else{
               echo "<font color=\"CC0000\">Username and password combination are incorrect!</font>\n";         
         }
      }else{
         echo "<font color=\"CC0000\">The username you supplied does not exist!</font>\n";
      }
   }else{
      echo "<font color=\"CC0000\">You must supply both the username and the password in order to login!</font>\n";
   }
}
}

?>

</html>


cause i get the error

Code:

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /usr/home/matt/public_html/forum/login2.php:8) in /usr/home/matt/public_html/forum/login2.php on line 10
and it will still let me login and stuff but i want to get rid of the error.
Back to top
View user's profile Send private message
dnsi0
I post too much
Reputation: 0

Joined: 04 Jan 2007
Posts: 2674

PostPosted: Fri Jan 23, 2009 2:57 pm    Post subject: Reply with quote

U have to get all the session set stuff before in <head> cause when it reaches body, the header is sent and u cant change it.

call session start before your html codes.
Back to top
View user's profile Send private message
NINTENDO
Grandmaster Cheater Supreme
Reputation: 0

Joined: 02 Nov 2007
Posts: 1371

PostPosted: Fri Jan 23, 2009 3:41 pm    Post subject: Reply with quote

it's just like ,dnsi0, said. You cant modify a header after html is sent.
Allways start a session at the top of the page or before any html is sent.

Flushing the code might work too but even if it does it's not recomended.

_________________
Intel over amd yes.
Back to top
View user's profile Send private message Send e-mail AIM Address Yahoo Messenger MSN Messenger
deleted user 111213
Grandmaster Cheater
Reputation: 0

Joined: 09 Nov 2007
Posts: 714

PostPosted: Sat Jan 24, 2009 6:19 am    Post subject: Reply with quote

thanks, no more errors now.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites