Current location: Hot Scripts Forums » Programming Languages » PHP » PHP header login validation script


PHP header login validation script

Reply
  #1 (permalink)  
Old 12-28-09, 08:31 PM
ben_johnson1991 ben_johnson1991 is offline
Newbie Coder
 
Join Date: Dec 2009
Posts: 11
Thanks: 4
Thanked 0 Times in 0 Posts
Exclamation PHP header login validation script

Hey, I have a homepage which include the main header, the main header include the log in fields for the user, and the header submits to a scripts called login.php which re-directs to homepage after it has ran.

my problem now is when I run the validation ( check to see if all fields are filled or match) nothing appears on the main screen..

How can I set variables in the scrip.php and run them on the header inside of the homepages when a user signs in as at the moment there is no error messages appearing and it is pretty vital to have some form of feedback.

If someone could help i would be very greatful as this really puzzles me!

Many thanks
Ben.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 12-28-09, 09:48 PM
Jcbones Jcbones is offline
Aspiring Coder
 
Join Date: Mar 2009
Location: North Carolina, USA
Posts: 516
Thanks: 5
Thanked 47 Times in 44 Posts
Without any code, it will be next to impossible to give you code.

But, you can use Sessions to achieve your task.

PHP: Session Functions - Manual
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #3 (permalink)  
Old 12-29-09, 04:05 AM
ben_johnson1991 ben_johnson1991 is offline
Newbie Coder
 
Join Date: Dec 2009
Posts: 11
Thanks: 4
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by Jcbones View Post
Without any code, it will be next to impossible to give you code.

But, you can use Sessions to achieve your task.

PHP: Session Functions - Manual
What script do you need to see?
it is only a box standard login script.

I thought of using sessions, however, I wouldn't know how to remove the session after each use of it as obviously if someone did occur an error before they managed to log in, and then they logged out, the session would still be printed.

However I suppose I could set the session to nothing once they do log in, but if they close the page and come back on later without closing the browser the sessions would still be there?

Cheers for the reply
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #4 (permalink)  
Old 12-29-09, 10:13 AM
Jcbones Jcbones is offline
Aspiring Coder
 
Join Date: Mar 2009
Location: North Carolina, USA
Posts: 516
Thanks: 5
Thanked 47 Times in 44 Posts
You should re-direct ONLY if the log in is successful. If there is an error, give them the form again.

To kill a session variable.
PHP Code:

unset($_SESSION['variable']); 


To kill a session.
PHP Code:

<?php
// Initialize the session.
// If you are using session_name("something"), don't forget it now!
session_start();

// Unset all of the session variables.
$_SESSION = array();

// If it's desired to kill the session, also delete the session cookie.
// Note: This will destroy the session, and not just the session data!
if (ini_get("session.use_cookies")) {
    
$params session_get_cookie_params();
    
setcookie(session_name(), ''time() - 42000,
        
$params["path"], $params["domain"],
        
$params["secure"], $params["httponly"]
    );
}

// Finally, destroy the session.
session_destroy();
?>

Last edited by Jcbones; 12-29-09 at 10:19 AM. Reason: Proof reading sucks
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
2 profitable script sites for sale cms-master.com General Advertisements 3 07-03-07 11:17 AM
Need a PHP login script that will do this... Vertical Terrain Script Requests 1 11-05-06 10:03 PM
Little Help needed 4 login php & MySQL to check 3 values classifieds100 PHP 2 09-17-06 11:27 PM
PHP Login Script for Multi Domain kamikaze Script Requests 0 03-05-06 06:15 PM
Login Script problem Justin171985 Script Requests 0 07-02-05 01:10 AM


All times are GMT -5. The time now is 01:56 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.