Jump to content


This topic is now archived and is closed to further replies.


Form - kind of deloggin users

Recommended Posts

Hi all, (hope the little french word won't bug you guys)

I have put a form that let any users to send me comments about my website. It is a normal form.. well I think. Their is a problem when we click the submit button.

This is the situation:
[*]We are logged.
[*]We go in support section, where we can fill the form (name, your mail, your message).
[*]You clic the submit button.
[*]You are redirected to a page that says to you that everything was fine and the e-mail was sent.
[*](problem now) If we try to access private section (where you need to be logged in) it does not work anymore. Seems like you have been "unlogged" by sending the form.
[*]I say "OK, let's RELOG". I go in the log in form, log in. And I CAN'T log in. The only way to log in back, is to call the session_destroy() function and then to log in back.


This is the form, how it calls my page. (the support.php page (where you fill in the form) will call the envoie.php page (Where this page have the mail() function))

[code]<form action="index.php?page=envoie" method="post">[/code]

I always call index.php and verify the page variable. If it is a private page, I verify the user is logged in before showing something.

Also, at each start of my page, I verify the session state like this (if it is not good, say plz):


if($_GET['cmd'] == "logout") {

$auth = false;
$auth2 = false;

    $nom = $_SESSION['nom'];
    if($nom == 'theusername') {
        $auth = true;
    } else if($nom == 'another username') {
        $auth2 = true;
    $nom = $_POST['nom'];
    $pwd = $_POST['pw'];
    // Verify login
    if($nom == "username" & $pwd == "password")
        $_SESSION['nom'] = $nom;
        $auth = true;
    else if($nom == "anotheruser" & $pwd == "anotherpass")
        $_SESSION['nom'] = $nom;
        $auth2 = true;

Please, if you guys need more info, say and I will give.

Thank you for all the help.

Share this post

Link to post
Share on other sites


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.