elexion Posted January 11, 2009 Share Posted January 11, 2009 hello people, well like topic title said i'm a not an expert in PHP webscripting. So i've been working on this website with a log in system but it doesn't seem to work can anyone help me point out what's wrong in my script? and where do i destroy the session? do i need to make a log out page or can i just give the session destroy with the link to the homepage?this is my code:<?php include ("connect.php"); $wachtwoord = md5($_POST["wachtwoord"]); $query = "SELECT * from inlog_gegevens; WHERE user = '".$_POST['gebnaam']."' AND password = '".$wachtwoord."'"; $result = "mysql_query($query, $db) or die('the query failed')"; if (mysql_num_rows($result) > 0)any help is very much apreaciated Link to comment Share on other sites More sharing options...
Yvil Posted January 11, 2009 Share Posted January 11, 2009 hello people, well like topic title said i'm a not an expert in PHP webscripting. So i've been working on this website with a log in system but it doesn't seem to work can anyone help me point out what's wrong in my script? and where do i destroy the session? do i need to make a log out page or can i just give the session destroy with the link to the homepage?this is my code:<?php include ("connect.php"); $wachtwoord = md5($_POST["wachtwoord"]); $query = "SELECT * from inlog_gegevens; WHERE user = '".$_POST['gebnaam']."' AND password = '".$wachtwoord."'"; $result = "mysql_query($query, $db) or die('the query failed')"; if (mysql_num_rows($result) > 0)any help is very much apreaciatedI don't see a PHP closing tag, but I asume you do have one..?That's all I can hink off, but I'm just new to PHP..Btw, leuk om nog een Nederlander tegen te komen! Link to comment Share on other sites More sharing options...
elexion Posted January 11, 2009 Author Share Posted January 11, 2009 ja inderdaad erg toevallig, Yes i do have a php closing tag this is the part of code giving me problems Link to comment Share on other sites More sharing options...
zppblood Posted January 11, 2009 Share Posted January 11, 2009 Take out the semi-colon from thisSELECT * from inlog_gegevens;Take out the " " around the expression$result = "mysql_query($query, $db) or die('the query failed')";Also use mysql_real_escape_string around any data you want to enter that will be submitted by a user in a MySQL database. Link to comment Share on other sites More sharing options...
jlhaslip Posted January 12, 2009 Share Posted January 12, 2009 I would assume the script also has a session_start() in the top part? Link to comment Share on other sites More sharing options...
Synook Posted January 12, 2009 Share Posted January 12, 2009 Also, make sure connect.php has the correct information! Link to comment Share on other sites More sharing options...
jeffman Posted January 12, 2009 Share Posted January 12, 2009 You can have a log-out button or link on any page. It would link to a script that destroys the session. Having one is a good idea if security is important, as when a client might be on a shared computer. But sessions do expire when the browser quits, or after a certain time of inactivity. The default is 1440 seconds (24 minutes). Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.