如何为此要求写忘记密码

时间:2015-04-10 11:29:25

标签: php

我有三个表:tutorregistration,studentregistration,Instituteregistration.Now我想写忘记密码代码:我知道如何为此发送邮件,指导我的逻辑方法是正确的。如果是错的,请给我一个正确的代码。

<form name="f1" action="" method="post">
<strong>Email</strong>
<input type="text" name="email" value="" class="buttonlength"/>
<strong>Password</strong>
<input type="password" name="password" value="" class="buttonlength"/>
<input type="radio" name="type" value="student" />Student <input type="radio" name="type" value="tutor" />Tutor <input type="radio" name="type" value="institute" />Institute</td>
<input type="submit" name="Submit" value="Submit" class="btn" id="submit"/>
</form>



      In forget.php file:
        <form name="f1" action="" method="post">
        enter email:<input type="text" name="email" value=''/>
                     <input type="submit" name="Submit"/>
        </form>

    if(isset($_POST['Submit']))
    {
    $email = $_POST['email'];
    $sqlstudent=mysql_query("SELECT * FROM  studentregistration WHERE  email='".$email."'") or die(mysql_error());
     $row_rsinfo=mysql_fetch_assoc($sqlstudent))
    $sqltutor=mysql_query("SELECT * FROM  tutorregistration WHERE  email='".$email."'") or die(mysql_error());
  $row_rsinfo=mysql_fetch_assoc($sqltutor))
    $sqlinstitute=mysql_query("SELECT * FROM  Instituteregistration WHERE  email='".$email."'") or die(mysql_error());
    $row_rsinfo=mysql_fetch_assoc($sqlinstitute))
    if(count($row_rsinfo)>=1)
    {
    //mail work here
    }
    }
    ?>
So far what  I have tried.I have given,I know how to send mail for registered mail id.Here I want to know how to check which query is executing, check and give me the answer for this.

1 个答案:

答案 0 :(得分:1)

你应该忘记密码。

        输入电邮:                               
 <?php
        if(isset($_POST['Submit']))
        {
        $email = $_POST['email'];

        $sqlstudent=mysql_query("SELECT * FROM  studentregistration WHERE  email='".$email."'") or die(mysql_error());
         $row_rsinfo=mysql_fetch_assoc($sqlstudent));
  if(count($row_rsinfo)==1)
        {
        //mail work here
        }
        $sqltutor=mysql_query("SELECT * FROM  tutorregistration WHERE  email='".$email."'") or die(mysql_error());
      $row_rsinfo=mysql_fetch_assoc($sqltutor));
    if(count($row_rsinfo)==1)
        {
        //mail work here
        }
        $sqlinstitute=mysql_query("SELECT * FROM  Instituteregistration WHERE  email='".$email."'") or die(mysql_error());
        $row_rsinfo=mysql_fetch_assoc($sqlinstitute))

        if(count($row_rsinfo)==1)
        {
        //mail work here
        }
        }
        ?>