Hi, i know this is really basic and stuff.
But i dont quite understand how sessions work with a login script, i have always done it with cookies. but i have been told and from readin up session is much better although i have neva used them.
So i have my basic login ( its something i made so it got email init aswell coz its for security on something im doin
[code=php]
//calling required files
require_once(‘../common/easy_link.php’);
session_start();
//connect to db form db_connect.php
$conn = mysql_connect(“localhost”,”apccompunet”,”sepultura”) or die(mysql_error());
//connect to table
mysql_select_db(“apccompunet”,$conn) or die(mysql_error());
//create query to let users in
$adminsql = “SELECT FirstName, LastName, UserName, EmailAddress FROM members WHERE UserName = ‘$_POST[UserName]’ AND Password = password(‘$_POST[Password]’) AND EmailAddress = ‘$_POST[EmailAddress]'”;
//the result to the access query
$admin_res = mysql_query($adminsql, $conn) or die(mysql_error());
//get the number of rows in the result should be 1 due to primary key
if (mysql_num_rows($admin_res) ==1) {
//if there is 1 row (Authorised)
$FirstName = mysql_result($admin_res, 0,’FirstName’);
$LastName = mysql_result($admin_res, 0,’LastName’);
$UserName = mysql_result($admin_res, 0,’UserName’);
$EmailAddress = mysql_result($admin_res, 0,’EmailAddress’);
this is where i take it the session must start but i really dont have a clue. and what else i dont understand is how the other pages are restricted so it links to somewhere if they r not logged in ?????? i dont get that if you could explain it in sense of a login that would be great.
Thanks Adam