Login

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Drachlen
Forum Contributor
Posts: 153
Joined: Fri Apr 25, 2003 1:16 am

Login

Post by Drachlen »

This is suppost to be a login script, but i get 3 errors which make no sense, and i think they might have to do with my settings...
Heres the code:

Code: Select all

<?php
$_POST['username'] = addslashes($_POST['username']);
$_POST['password'] = addslashes($_POST['password']);
session_start();
$link = mysql_connect("localhost", "Drachlen", "*") 
        or die("Could not connect"); 
    mysql_select_db("game", $link) or die("Could not select database"); 


$query = mysql_query("select username from test where username="$username" and password="$password" limit 1");
if (mysql_num_rows($query) == '1') { 



   $_SESSION['auth'] = true; 
   $_SESSION['username'] = $_POST['username']; 
echo "You have logged in.";
} else { 
   $_SESSION['auth'] = false; 
   $_SESSION['username'] = ''; 
echo "Incorrect username or password.";
} 
?>
heres the errors:
Warning: open(/tmp\sess_5890a67e5f0aaa4b24910dfb25e547cc, O_RDWR) failed: m (2) in C:\apache\htdocs\my\verify.php on line 4
You have logged in.
Warning: open(/tmp\sess_5890a67e5f0aaa4b24910dfb25e547cc, O_RDWR) failed: m (2) in Unknown on line 0

Warning: Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/tmp) in Unknown on line 0


I know its logging in correctly, but theres somethin wrong with the session..
User avatar
trollll
Forum Contributor
Posts: 181
Joined: Tue Jun 10, 2003 11:56 pm
Location: Round Rock, TX
Contact:

Post by trollll »

I don't really have a lot of experience successfully troubleshooting PHP installations, but you may want to check out thi s thread. I remembered running across it while looking for answers and it should help you out a bit.

I hope. :)
Drachlen
Forum Contributor
Posts: 153
Joined: Fri Apr 25, 2003 1:16 am

Post by Drachlen »

Hmmm.. This is being tested offline using PHPtriad, and ive used sessions before online and they worked fine, but i dont have access to a database yet, so im just doing this all from phptriad... I wasnt able to find any 'temp' or 'tmp' folder, is it trying to find something? It must have to do with php triad..
qartis
Forum Contributor
Posts: 271
Joined: Sat Dec 14, 2002 4:43 pm
Location: BC, Canada
Contact:

Post by qartis »

Your php.ini has a setting, session.save_path, which is now set for default unix servers. If you're on windows, you need to create a directory for temporary data, and set session.save_path to this temp directory. If you're on unix, and you have a /tmp folder, chmod it to 666 or 777. It needs to be writable by the user the webserver is running as.
Drachlen
Forum Contributor
Posts: 153
Joined: Fri Apr 25, 2003 1:16 am

Post by Drachlen »

Okay cool. i created a few folders, now it works, but it says this:
X-Powered-By: PHP/4.0.5 Content-type: text/html
...Why?
qartis
Forum Contributor
Posts: 271
Joined: Sat Dec 14, 2002 4:43 pm
Location: BC, Canada
Contact:

Post by qartis »

It outputs that to the screen, instead of the content of index.php?
Drachlen
Forum Contributor
Posts: 153
Joined: Fri Apr 25, 2003 1:16 am

Post by Drachlen »

Well it places it right before the You have logged in. message
Post Reply