forgot password temporary page php
<p>As i have it right now, any user could type an email on forgot.php page and if the email exists, the user assigned to that email's password would be changed.  How would i change my code so that it sends a link to the users email which directs to a temporary page where they change their password.  I know how to do a change password script but how do i create a link to a temporary page?</p>

<p>forgot.php</p>

<pre><code>echo "&lt;div id='sign-parent-container'&gt;
        &lt;div class='form-title'&gt;Forgotten Username/Password&lt;/div&gt;
            &lt;form action='/login' action='post' id='forgot-form'&gt;
                &lt;ul&gt;
                &lt;li&gt;Type the email address you registered with, a link to a temporary page where you can change your password will be sent.&lt;/li&gt;
                &lt;li&gt;
                    &lt;ul&gt;
                        &lt;li&gt;&lt;input type='text' name='email' value='Type Registered Email Here' class='signupfield-2' /&gt;&lt;li&gt;
                        &lt;li style='display:none;'&gt;&lt;span class='error'&gt;This email doesn't exist&lt;/span&gt;&lt;/li&gt;
                    &lt;/ul&gt;
                &lt;/li&gt;

                &lt;li class='form-submit' data-type='forgot'&gt;&lt;a&gt;Request Password Change&lt;/a&gt;
                &lt;input type='hidden' name='forgot' value='1' /&gt;&lt;/li&gt;
                &lt;/ul&gt;
            &lt;/form&gt;
        &lt;/div&gt;";
</code></pre>

<p>/email</p>

<pre><code>          $to = $email;
          $subject = "example - New Password Request.";
          $headers = "From: example.com";
          $server = "http://www.example.com";

          ini_set("SMTP",$server);
          $body="


          Hello $username,\r\r

          Your login details are below;\r\r


          Click the link below to change password:\r
          http://www.exmaple.com/temporarylink
           \n\n



          ";
          //function to send email


          mail($to, $subject, $body, $headers);
</code></pre>
