麻辣堂|资源主站|开发论坛|在线手册
首页 Apache Linux Java MySQL 注册帮助 
PHP项目开发组是PHP开发资源网于2007组年建成立的项目开发团队,目前核心开发成员有27人, 项目协作成员8名.下设7个开发组,主要承接大/中型网站项目开发任务。

    由于开发任务较多,人员比较紧张,现面向社会招聘全职或者兼职开发人员,不管你是在校大学生,还是全职开发人员,以及SOHO都可以联系本站,我们可以长期合作,并为您带来丰厚的报酬。
  您现在的位置:PHP开发资源网 > 麻辣堂 > 详细资料
待解决
[求助] 这两个代码怎么弄在一起?
悬赏分:20 - 2007年08月22日

一个是“在线E-mail 发送”的代码,共两个文件 form.htmlcontactmail.php
一个是可以 “变换图片的登录验证码” 代码,共两个文件 authimg.phpauthpage.php

需要解决的:
把这两个整合在一起,当在线发送Email 的时候,必须按照图片上的显示正确数字填入验证码,才可以正常提交信息,发送邮件....

我是不太懂的,在这里谢谢大家了!

form.html 包含的全部代码

CODE:
<u>Email Form</u> - Please be specific.</font>
<form method="post" action="contactmail.php" name="form2"><font size="2">
<B><BR>Your Name:</B><br><input type="TEXT" name="name" width="28"><BR><br>
<B>Your Email Address:</B><br><input type="TEXT" name="email" width="28"><BR><BR><BR>
<B>Department</B>
<SELECT NAME="dep">
<OPTION VALUE="support">Please Choose
<OPTION VALUE="webmaster">WebMaster
<OPTION VALUE="support">Support
<OPTION VALUE="sales">Sales
<OPTION VALUE="technical">Technical
</SELECT> <font size="1"><font color="red">*</font>Defaults to Support</font><BR><BR>
<BR><font size="2"><B>Query</B></font><BR><TEXTAREA NAME="reason" ROWS=10 COLS="45"></TEXTAREA><br><BR>
<input type="SUBMIT" value="Submit">
<input type="reset" value="Reset"></font>
</form>

contactmail.php 包含的全部代码:
CODE:
&lt;?php

// ##########################################
// Set the below value to your email address
$to = "you@yourdomain.com";
// ##########################################

// EDIT BELOW AT YOUR OWN RISK

function check_email($email){
if (eregi("^[a-z0-9]+([-_\.]?[a-z0-9])+@[a-z0-9]+([-_\.]?[a-z0-9])+\.[a-z]{2,4}", $email)){
return TRUE;
} else {
return FALSE;
}
}

$poster = $_POST['name'];
$postemail = $_POST['email'];
$department = $_POST['dep'];
$postreason = $_POST['reason'];

if (!check_email($postemail)) {
echo "<META HTTP-EQUIV=Refresh CONTENT=3;URL=javascript:window.history.back(-1)>";
$messege = "<center>
Email address<br><u> $postemail </u><br><FONT COLOR=\"#990000\">NOT VALID</FONT>
<br>Taking you back now... ";
} else {
$messege = "Thank you $poster for your submission.<BR> We will get back to you within the next 24 hours.";
$subject = "Contact Submission";
$message = "
<html>
<head>
<title>Contact Submission</title></head>
<body>
<b>To Department</b> -- $department <br>
<b>Poster</b> -- $poster <br>
<b>Poster Email</b> -- $postemail <br>
<b>Poster Submitted:</b> <br><br>
$postreason </body></html>";

$headers?= "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .= "To: Contact Submit <$to> \r\n";
$headers .= "From: $postemail <$postemail>\r\n";
mail($to, $subject, $message, $headers);

}

echo "$messege";

?&gt;

authimg.php 包含的全部代码
CODE:
&lt;?php

//生成验证码图片
Header("Content-type: image/PNG");
srand((double)microtime()*1000000);
$im = imagecreate(62,20);
$black = ImageColorAllocate($im, 0,0,0);
$white = ImageColorAllocate($im, 255,255,255);
$gray = ImageColorAllocate($im, 200,200,200);
imagefill($im,68,30,$gray);
while(($authnum=rand()%100000)<10000);
//将四位整数验证码绘入图片
imagestring($im, 5, 10, 3, $HTTP_GET_VARS['authnum'], $white);

for($i=0;$i<300;$i++) //加入干扰象素
{
$randcolor = ImageColorallocate($im,rand(0,255),rand(0,255),rand

(0,255));
imagesetpixel($im, rand()%70 , rand()%30 , $randcolor);
}
ImagePNG($im);
ImageDestroy($im);
?&gt;

authpage.php 包含的全部代码
CODE:
&lt;?php

srand((double)microtime()*1000000);

//验证用户输入是否和验证码一致
if(isset($HTTP_POST_VARS['authinput']))
{
if(strcmp($HTTP_POST_VARS['authnum'],$HTTP_POST_VARS['authinput'])==0)
echo "验证成功!";
else
echo "验证失败!";
}

//生成新的四位整数验证码
while(($authnum=rand()%10000)<1000);
?&gt;
<form action=authpage.php method=post>
<table>
请输入验证码:<input type=text name=authinput style="width: 80px"><br>
<input type=submit name="验证" value="提交验证码">
<input type=hidden name=authnum value=&lt;? echo $authnum; ?&gt;>
<img src=authimg.php?authnum=&lt;? echo $authnum; ?&gt;>
</table>
</form>

提问者:kmin95   08-22 08:08
答复
路过。。。顺便帮顶:)
回答者:玉米づ冰冻可乐 - 瓦岗村民 8-22 09:10
我也来回答:
不管你有没有帮助我们,瓦岗寨8万村民将感谢你。。。。。

为防止灌水,您需要计算一道数学题: 答案:
22 + 99 = ? 请将计算结果填在上面

 
[]
©2007 PhpRes.COM