doulu1325 2014-05-05 13:59
浏览 20
已采纳

我的PHP脚本有什么问题? [关闭]

I want this php script to first decide whether or not it should send the following emails, all using data received from a form in another html file. At the moment I'm really not sure what I'm doing with php nor do I know where to start. For the sake of the task, I want the person to correctly identify the picture and match it with pre-assigned passwords. Once they have done this correctly 2 emails would be sent. How would I go about formatting this?

I've adjusted my code with Ian and ThomasEliss' help (Thank you for your insight), however, when I click submit on my form, it simply takes me to the php file, displaying a blank screen. What am I doing wrong. Thank you for your help :)

<?php 
$captcha = $_REQUEST['captcha'] ;
$passwords = array();
$passwords[] = '2Vd27VFfkK' ;
$passwords[] = 'MjgxfNA5Qn' ;
$passwords[] = 'tg3K3GhS6W' ;
$passwords[] = 'n2m6GHfVSK' ;
$passwords[] = 'RTxqN5euFX' ;
$passwords[] = 'AJzsWwES6D' ;
$passwords[] = '24hAgsHuW3' ;
$passwords[] = 'xHzvW9kyFk' ;
$passwords[] = 'CyXH7VRhyp' ;
$passwords[] = 'QshfjUn75Z' ;
if(in_array($usrpassword, $passwords)) {
 $to1 = $_REQUEST['usremail'] ;
 $subject1 = "Joining"; 
 $email = "me@email.com" ; 
 $name = $_REQUEST['name'] ;
 $message1 = "
** This is an automated email, please do not reply **

Hello $name,

This email has been sent because this email address was submitted to our site requesting signup documents. 
If this was not you please ignore this email.
If it was you follow the link below to receive the required documents.

If you have any other questions feel free to email our Administration Officer.

Kind regards.
" ; 
 $headers = "From: Recruiting";
 $sent = mail($to1, $subject1, $message1, $headers) ;
    if($sent) 
    print "Your mail was sent successfully"; }
    else 
    print "We encountered an error sending your submission.
 Please refresh the page to try again."; })
 }
 $to2 = "me@email.com" ;
 $subject = "Signup Forms Requested" ; 
 $from = $_REQUEST['name'] ;
 $usremail = $_REQUEST['usremail'] ;
 $comment = $_REQUEST['comment'] ;
 $email = "me@email.com" ; 
 $message2 = "
  ** This is an automated email, please do not reply **

 Hello Administration Officer,

 The following email is to advise you that $from submitted a request for sign up forms.
 The email submitted was: $usremail

 They have recieved the required documents and have included the following comment in their submission:

 $comment

 If you have any questions or problems please email the Webmaster.

 Regards.

 email: me@email.com
" ; 
 $headers = "From: $email"; 
 $sent = mail($to2, $subject2, $message2, $headers) ; 
 if($sent) 
 {header( 'Location: http://example.com' ) ; }
 else 
 {print "We encountered an error sending your submission."; }
}
else {
 {header( 'Location: http://example.com' ) ; }
}
?>
  • 写回答

2条回答 默认 最新

  • douzi115522 2014-05-05 14:06
    关注

    You could change the following

    $password1 = '2Vd27VFfkK' ;
    $password2 = 'MjgxfNA5Qn' ;
    $password3 = 'tg3K3GhS6W' ;
    $password4 = 'n2m6GHfVSK' ;
    $password5 = 'RTxqN5euFX' ;
    $password6 = 'AJzsWwES6D' ;
    $password7 = '24hAgsHuW3' ;
    $password8 = 'xHzvW9kyFk' ;
    $password9 = 'CyXH7VRhyp' ;
    $password10 = 'QshfjUn75Z' ;
    
    if $usrpassword == $password1 || $usrpassword == $password2 || $usrpassword == $password3 || $usrpassword == $password4 || $usrpassword == $password5 || $usrpassword == $password6 ||$usrpassword == $password7 || $usrpassword == $password8 || $usrpassword == $password9 || $usrpassword == $password10
    

    To

    $passwords = array();
    $passwords[] = '2Vd27VFfkK' ;
    $passwords[] = 'MjgxfNA5Qn' ;
    $passwords[] = 'tg3K3GhS6W' ;
    $passwords[] = 'n2m6GHfVSK' ;
    $passwords[] = 'RTxqN5euFX' ;
    $passwords[] = 'AJzsWwES6D' ;
    $passwords[] = '24hAgsHuW3' ;
    $passwords[] = 'xHzvW9kyFk' ;
    $passwords[] = 'CyXH7VRhyp' ;
    $passwords[] = 'QshfjUn75Z' ;
    
    if(in_array($usrpassword, $passwords))
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 PointNet++的onnx模型只能使用一次
  • ¥20 西南科技大学数字信号处理
  • ¥15 有两个非常“自以为是”烦人的问题急期待大家解决!
  • ¥30 STM32 INMP441无法读取数据
  • ¥15 R语言绘制密度图,一个密度曲线内fill不同颜色如何实现
  • ¥100 求汇川机器人IRCB300控制器和示教器同版本升级固件文件升级包
  • ¥15 用visualstudio2022创建vue项目后无法启动
  • ¥15 x趋于0时tanx-sinx极限可以拆开算吗
  • ¥500 把面具戴到人脸上,请大家贡献智慧,别用大模型回答,大模型的答案没啥用
  • ¥15 任意一个散点图自己下载其js脚本文件并做成独立的案例页面,不要作在线的,要离线状态。