douyi7055 2014-01-26 12:35
浏览 100

php mail onclick on link execute mysql命令

I'm trying to do a password reset using mail, so what will happen is the user will enter his email on the forgot password and on button click it will be sent to the email that is on the database. Now what i will do is give the user a new random password and to do this the user should click on the link on the email to verify that he really wants to change the password, will that be possible? Here is my code

    if (isset($_POST['mytxtmail']))
    {
        $newid = ($_POST['mytxtmail']);

    $result = mysqli_query($con,"SELECT EMAIL FROM members WHERE EMAIL='$newid'");
    if($result->num_rows == 0) {
    echo 'Mail  Successfully Sent to '.$newid;
    return false;   
    }
    else
    $to      = $newid;
    $subject = 'the subject';
    $message = 'Please Click here to Verify the Change of Password';
    $headers = 'From: webmaster@example.com' . "
" .
        'Reply-To: webmaster@example.com' . "
" .
        'X-Mailer: PHP/' . phpversion();

    mail($to, $subject, $message, $headers);

    echo 'Mail  Successfully Sent to '.$newid;

    }
  • 写回答

2条回答 默认 最新

  • dongwu5743 2014-01-26 12:42
    关注

    You should include the link in the email which would take the user to the password verification script (it could be the same you are using here, only add needed functionality).

    评论

报告相同问题?

悬赏问题

  • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line
  • ¥500 火焰左右视图、视差(基于双目相机)
  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?