Jump to content

forget password, send password to gmail


vermouth

Recommended Posts

i do not know how to do the forget password,

 

the doForgetPassword php page. which is once i click the submit buttom then will go to the page that shows the message: the password has already send into your email. my code is not show anything inside the page.

doForgetPassword.php

forgetPassword.php

Link to comment
https://forums.phpfreaks.com/topic/284641-forget-password-send-password-to-gmail/
Share on other sites

<center><h2>Forget Password ?</h2></center><br/>

        

            <center><table border="0" cellpadding="10">
    </head>
                <tr>
                    <td>Username</td>
                    <td><input type="text" name="username" /></td>
                </tr>
                <tr>
                    <td>Email</td>
                    <td><input type="text" name="email" /></td>
                </tr>
               
            </table>

            <div class="form-actions">

                <input type="submit" class="btn btn-primary" value="Reset" />

            </div>

            <?php if( isset($info)): ?>

                <div class="alert alert-success">

                    <?php echo($info) ?>

                </div>

            <?php elseif( isset($error)): ?>

                <div class="alert alert-error">

                    <?php echo($error) ?>

                </div>

            <?php endif; ?>

            

        </fieldset>

    </form>

</div>
    </body>
</html>

<?php
    function doforget()

{

    $this->load->helper('url');

    $email= $_POST['email'];

    $q = $this->db->query("select * from users where email='" . $email . "'");

    if ($q->num_rows > 0) {

        $r = $q->result();

        $user=$r[0];

        $this->resetpassword($user);

        $info= "Password has been reset and has been sent to email id: ". $email;

        redirect('/index.php/login/forget?info=' . $info, 'refresh');

    }

    $error= "The email id you entered not found on our database ";

    redirect('/index.php/login/forget?error=' . $error, 'refresh');
}
       
 ?>

<!DOCTYPE HTML>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title></title>
    </head>
    <body>
        <p>
            <?php
            echo "<br/>";
            ?>
            <a href="index.php">Home</a>
        </p>
       
       
    </body>
</html>

Archived

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

×
×
  • 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.