View Single Post
Old 02-24-2004, 04:05 PM   #1 (permalink)
Imon Fyre
Recruit
 
Imon Fyre's Avatar
 
Join Date: Mar 2003
Location: Muskoka, Canada
Posts: 19
Imon Fyre is on a distinguished road
header not working the way i want it too

ok, this is probly an incompatibility with older php software, but at one point i had made a login screen that work perfectly (this was almost exactly a year ago)

and now when i try to do something similar with my old code, it will not do what i want... heres the code that is giving me a headache

and i would also like to iterate that i have no access to configuring php, as it is not my server that i am testing code on

basically the role of the function where the header() is called is just supposed to look at the password the user entered, and then redirect to the survey page
PHP Code:
<?php
    
//session_start();
    //$_SESSION['password'];
    
$passwordcheck '';
    
    if(!isset(
$_REQUEST['enter']))
    {
        
login_page();
    }
    else
    {
        
password_verify($_REQUEST['pass']);
    }
    
    
/******************************************************************
    **this function authenticates an entered password                **
    **against a supplied password                                      **
    ******************************************************************/ 
    
function password_verify($pass)
    {
            
$password "booger";
            
//echo "$pass";
            
if($pass===$password)
            {                
                
header("location: survey.php"); // <--- this is the line that is being bitchy!!
            
}
            else 
            {
                
login_page();
            }
        
//session_start();        
       
}
    
    function 
login_page()
    {
        
$self $_SERVER['PHP_SELF'];
        
?>
        
        <html>
        <body>
        <h2>Please Enter the Correct Password to Proceed</h2>
        <form name='passcheck' method='post' action='<?php echo $self?>'>
            <table>
                <tr>
                    <td>Password</td>
                    <td><input type='password' name='pass' /></td>
                </tr>
                <tr>
                    <td><input type='submit' name='enter' value='enter'></td>
                </tr>
            </table>
        </form>
        </body>
        </html>
<?php
    
}
    
    
?>
Imon Fyre is offline   Reply With Quote