Welcome! Log In Create A New Profile

Advanced

Session and access to insert.php

Posted by 44024738_tai 
Announcements Last Post
Announcement SoC Curricula 09/30/2017 01:08PM
Announcement Demarcation or scoping of examinations and assessment 02/13/2017 07:59AM
Announcement School of Computing Short Learning Programmes 11/24/2014 08:37AM
Announcement Unisa contact information 07/28/2011 01:28PM
Session and access to insert.php
October 09, 2012 01:30PM
Quicky- Should the user be able to go onto the insert.php page if he/she has not logged in yet, if not how do we prevent access to those pages
Re: Session and access to insert.php
October 09, 2012 02:06PM
Hi Tai,

If i understand the instructions then NO, they should not be able to go into List, Insert, Edit or Delete without being logged in.
In your login page set a session to the user id, then in those other pages call on the session and check if its set if not it returns if it is it allows access.
avatar
Mac
Re: Session and access to insert.php
October 09, 2012 02:20PM
Did you work through the H&L tutorials? Sessions is described there in detail.
Re: Session and access to insert.php
October 09, 2012 02:52PM
homeandlearn/php/php14p3.html OK I see now.. the user can only view the pages insert;list;edit;delete once they have logged in because those pages will check the session.. Thanks
Re: Session and access to insert.php
October 10, 2012 12:10PM
Is there a limit on how many session how can have on the server?
avatar
Mac
Re: Session and access to insert.php
October 10, 2012 03:00PM
You only need one session?

Max sessions are linked to max_connections as set on the server.
Re: Session and access to insert.php
October 24, 2012 11:23AM
Hi

My site seem to allow anyone in, I am suspecting the following code
Language: PHP
if ($result) { if ($num_rows > 0) {

$num_rows always print 1 even if I purposely type an in-existing username and password, so everyone is directed to insert page, how can I correct this. Below is my query
Language: PHP
$SQL = "SELECT username, password FROM user WHERE username = $username AND password = $password"; $result = mysql_query($SQL) or die("Invalid query"); $num_rows = mysql_num_rows($result);
avatar
Mac
Re: Session and access to insert.php
October 24, 2012 02:44PM
Language: PHP
username = ';$username'; AND password = ';$password';";
Re: Session and access to insert.php
October 24, 2012 04:43PM
Hi

if I code like what Mac said, this is the error message I am receiving.

"You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'ngu'' AND password = ''''' at line 1"

What can cause this?
avatar
Mac
Re: Session and access to insert.php
October 25, 2012 11:03AM
Look carefully at that line.
Sorry, only registered users may post in this forum.

Click here to login