Jump to content

Newbie Needs Some Help


elexion

Recommended Posts

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

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
I 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

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

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...