Secure form using sessions issue!!

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
cap2cap10
Forum Contributor
Posts: 158
Joined: Mon Apr 14, 2008 11:06 pm

Secure form using sessions issue!!

Post by cap2cap10 »

Hello for the umpteenth time, php technorati. I am trying to create a login page that automaticaly redirects you to a form. How do I fool my sessions script into accepting the username and password variables with out having them submitted via a form submit button? Here is the script I have but it does not work:

Code: Select all

<?php
 
$_SESSION['login_username']= $_POST['**********'];
$_SESSION['login_password']= $_POST['***********'];
include "sessions.php";
if( ($login->authorised()) )
    if($login->didLogin())
        if($login->getType() == 2)
            header("Location: recruit.php");
    if($login->didFail())
            header("Location: join.php");
            
 
?>
I want this script to automatically redirect me to the recruit.php form.

As always, thanks in advance

Batoe
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: Secure form using sessions issue!!

Post by requinix »

You need to call session_start before you can do anything with sessions.

I'm guessing sessions.php has that, so it needs to be included before anything else.
Post Reply