喜悦国际村 
» 游客:  注册 | 登录 | 搜索 | 统计 | 喜悦证交所 | 帮助

RSS 订阅当前论坛  

$5.95 Web Hosting     

上一主题 下一主题
     
标题: [求助] 这两个代码怎么弄在一起?  
 
kmin95
新手上路
Rank: 1



UID 75222
精华 0
积分 9
帖子 13
金钱 9 喜悦币
威望 0
人脉 0
阅读权限 10
注册 2006-6-20
状态 离线
[广告]: 代充Paypal帐号美元
[求助] 这两个代码怎么弄在一起?

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

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

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

form.html 包含的全部代码

<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 包含的全部代码:

<?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";

?>
authimg.php 包含的全部代码

<?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);
?>
authpage.php 包含的全部代码

<?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);
?>
<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=<? echo $authnum; ?>>
<img src=authimg.php?authnum=<? echo $authnum; ?>>
</table>
</form>
2006-6-20 03:38 AM#1
查看资料  发短消息  顶部
 
蟋蟀
版主
Rank: 7Rank: 7Rank: 7
村里巡逻队长


UID 67242
精华 0
积分 2035
帖子 1762
金钱 2035 喜悦币
威望 0
人脉 0
阅读权限 100
注册 2005-12-17
来自 福建
状态 离线
[广告]: 代充Paypal帐号美元
1、把你的验证码程序修改一下,写入全局变量session
2、把你的验证码<input type="text"><img="验证码.php">和这个放到<form.html》的发送
    邮件表单里面
3、在验证里面if($_SESSION['authnum"]==$_POST['authnum'])就是通过验证了。




吉林php群
27089230
2006-6-20 08:25 AM#2
查看资料  Blog  发短消息  QQ  顶部
     


  可打印版本 | 推荐给朋友 | 订阅主题 | 收藏主题 | 开通个人空间  


 




Powered by Discuz! 6.1.0  © 2001-2010 Comsenz Inc.
Processed in 0.023220 second(s), 6 queries

(冀ICP备05009913号) 管理员:sadly 邮箱/MSN: sadly@phpx.com QQ:824008(长隐) 清除 Cookies - - Archiver - WAP