Jump to content

Submit Button Does Not Seem to Work


Glese

Recommended Posts

<?php
    include('../../header.php');
?>

<from method="post" action="">
    <input type="checkbox" name="confirmation" value="yes" /> I do confirm to get my password reseted.<br />
    <input type="submit" name="submit_confirmation" value="Confirm" />
</from>

<?php

if (isset($_POST['submit_confirmation']))
    $submit_confirmation = $_POST['submit_confirmation'];
if (isset($_POST['confirmation'])) {
    $confirmation_checkbox = $_POST['confirmation'];
}





if (isset($submit_confirmation)) {
        echo "works";
}



// Check if the user has confirmed the resetting.

if (isset($submit_confirmation) && isset($confirmation_checkbox) && $confirmation_checkbox == 'yes') {

 

 

 

This is a password resetting script, this script in example occurs after confirmation to have the password reset, the problem I am experiencing is that the script does not get executed and seems that the submit button does not even work to execute the script.

 

I tried to test the submit button by printing out a message stating "works" when pressing the submit button, but that one does not work either.

 

The execution of the whole script does not go path the conditional if statement check in the bottom area, and the statement "works" does not become printed out.

 

Any ideas what is going on here?

 

 

Here is the whole php file:

 

<?php
    include('../../header.php');
?>

<from method="post" action="">
    <input type="checkbox" name="confirmation" value="yes" /> I do confirm to get my password reseted.<br />
    <input type="submit" name="submit_confirmation" value="Confirm" />
</from>

<?php

if (isset($_POST['submit_confirmation']))
    $submit_confirmation = $_POST['submit_confirmation'];
if (isset($_POST['confirmation'])) {
    $confirmation_checkbox = $_POST['confirmation'];
}





if (isset($submit_confirmation)) {
        echo "works";
}



// Check if the user has confirmed the resetting.

if (isset($submit_confirmation) && isset($confirmation_checkbox) && $confirmation_checkbox == 'yes') {
    

    
    
    // Reset the password of the user
    
    $random_password = random(111111, 999999);

    $query_get = "UPDATE user SET password = '$random_password' WHERE user_id = '{$_GET['id']}' and random = '{$_GET['code']}'";

    $query_run = mysqli_query($dbc, $query_get);
    
    
    
    
    
    // Get the email address and user name of the user
    
    $query_get = "SELECT nickname, email FROM user WHERE user_id = '{$_GET['id']}'";
    
    $query_run = mysqli_query($dbc, $query_get);
    
    $assoc = mysqli_fetch_assoc($query_run);
    
    
    
    
    $to = $assoc['email'];
    $subject = "Your Reseted Password";
    $sender = 'From: rochoven@googlemail.com';
    $body = '
    Hello' .$assoc['nickname']. ', \n\n
    
    you requested and confirmed to have your password reseted, here is your new password, please use it to
    log in and change it to your desired password. \n\n
    
    New Reseted Password:' .$random_password. '\n\n
    
    Greetings!


    ';

    mail($to, $subject, $body, $sender);
    
    mysqli_close($dbc);
    
    
    header('Location:'.$password_reset_success);
        

}
?>




<?php
    include('../../footer.php');

?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.