存档

文章标签 ‘PHP’

PHP写的提交表单到E-mail邮箱程序

2010年3月8日 赵健 没有评论

最近网站改版,想弄一个在线提交表单邮箱的程序,找了很多都用不了,最后自己研究了一个。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
<html>
<body>
<?php
function spamcheck($field)
  {
  //filter_var() sanitizes the e-mail
  //address using FILTER_SANITIZE_EMAIL
  $field=filter_var($field, FILTER_SANITIZE_EMAIL);
 
  //filter_var() validates the e-mail
  //address using FILTER_VALIDATE_EMAIL
  if(filter_var($field, FILTER_VALIDATE_EMAIL))
    {
    return TRUE;
    }
  else
    {
    return FALSE;
    }
  }

if (isset($_REQUEST['w_14']))
  {//if "email" is filled out, proceed

  //check if the email address is invalid
  $mailcheck = spamcheck($_REQUEST['w_14']);
  $w_1_check = $_REQUEST['w_1'];
  $w_8_check = $_REQUEST['w_8'];
  $w_13_check = $_REQUEST['w_13'];
  if ($mailcheck==FALSE)
    {
    echo "<script language=\"JavaScript\">\r\n";
    echo " alert(\"请您认真填写 E-Mail,以便工作人员与您取得联系。谢谢合作!\");\r\n";
    echo " history.back();\r\n";
    echo "</script>";
    }
          if ($w_1_check=='')
    {
    echo "<script language=\"JavaScript\">\r\n";
    echo " alert(\"请您认真填写公司名称,以便工作人员与您取得联系。谢谢合作!\");\r\n";
    echo " history.back();\r\n";
    echo "</script>";
    }
          if ($w_8_check=='')
    {
    echo "<script language=\"JavaScript\">\r\n";
    echo " alert(\"请您认真填写姓名,以便工作人员与您取得联系。谢谢合作!\");\r\n";
    echo " history.back();\r\n";
    echo "</script>";
    }        
         if ($w_13_check=='')
    {
    echo "<script language=\"JavaScript\">\r\n";
    echo " alert(\"请您认真填写QQ/MSN号码,以便工作人员与您取得联系。谢谢合作!\");\r\n";
    echo " history.back();\r\n";
    echo "</script>";
    }
  else
    {//send email
    $email = $_REQUEST['w_14'] ;
    $subject = $_REQUEST['w_1'] . " " . $_REQUEST['w_8'] ;
    $message = "公司名称 :". $_REQUEST['w_1'] . "\r\n" . "网页语种 :". $_REQUEST['w_2_1'] . "/" . $_REQUEST['w_2_2'] . "/" . $_REQUEST['w_2_3'] . "/" . $_REQUEST['w_2_4'] . "/" . $_REQUEST['w_2_5'] . "/" . "\r\n" . "需要借鉴的站点 :". $_REQUEST['w_3'] . "\r\n" . "主要业务介绍 :". $_REQUEST['w_4'] . "\r\n" . "建站费用预算 :". $_REQUEST['w_5'] . "-" . $_REQUEST['w_6'] . "\r\n" . "要求建站完成时间 :". "希望完工的日期" . $_REQUEST['w_7'] . "\r\n" . "                  希望完工的天数" . $_REQUEST['w_7_1'] . "\r\n" . "网站建设其他要求 :". $_REQUEST['w_7_2'] . "\r\n" . "=============================================================" . "\r\n" . "姓名 :". $_REQUEST['w_8'] . "\r\n" . "性别 :". $_REQUEST['w_9'] . "\r\n" . "电话 :". $_REQUEST['w_11'] . "\r\n" . "手机 :". $_REQUEST['w_12'] . "\r\n" . "QQ/MSN :". $_REQUEST['w_13'] . "\r\n" . "电子邮箱 :". $_REQUEST['w_14'] . "\r\n" . "Skype :". $_REQUEST['w_15'] . "\r\n" . "邮编 :". $_REQUEST['w_16'] . "\r\n" . "详细地址 :". $_REQUEST['w_17'] . "\r\n";
    mail("jinpaiwww@126.com", "$subject 填写的网站建设意向表。",
    $message, "From: $email");
    echo "<script language=\"JavaScript\">\r\n";  
    echo "alert(\"信息提交成功!请等待工作人员与您取得联系。自动返回首页\");\r\n";  
    echo "location.replace(\"http://www.jinpaiwww.com/\");\r\n";  
    echo "</script>";
    }
  }
else
  {//if "email" is not filled out, display the form
  echo "<form id='form1' action='http://www.jinpaiwww.com/b/b.php' method='post' name='form1'>
    <table class='table_1' cellspacing='0' cellpadding='0' width='675' border='0'>
        <tbody>
            <tr>
                <th colspan='2'>网站建设申请表</th>
            </tr>
            <tr>
                <td class='input_1' width='125'>公司名称</td>
                <td class='input_2' width='550'><input class='input_text' style='width: 300px' name='w_1' type='text' /></td>
            </tr>
            <tr>
                <td class='input_1' width='125'>网页语种</td>
                <td class='input_2' width='550'><input type='checkbox' checked='checked' name='w_2_1' value='中文简体' /> <label for='w_2_1'>中文简体</label> <input type='checkbox' name='w_2_2' value='中文繁体' /> <label for='w_2_2'>中文繁体</label> <input type='checkbox' name='w_2_3' value='英文' /> <label for='w_2_3'>英文</label> <input type='checkbox' name='w_2_4' value='日文' /> <label for='w_2_4'>日文</label> <input type='checkbox' name='w_2_5' value='其它语言' /> <label for='w_2_5'>其它语言</label></td>
            </tr>
            <tr>
                <td class='input_1' width='125'>希望借鉴的站点</td>
                <td class='input_2' width='550'><input style='width: 300px' name='w_3' type='text' /></td>
            </tr>
            <tr>
                <td class='input_1' width='125'>主要业务介绍</td>
                <td class='input_2' width='550'><textarea class='input_text' style='width: 300px' name='w_4'></textarea></td>
            </tr>
            <tr>
                <td class='input_1' width='125'>建站费用预算</td>
                <td class='input_2' width='550'><input class='input_text' name='w_5' type='text' /> -- <input class='input_text' name='w_6' type='text' /> 元</td>
            </tr>
            <tr>
                <td class='input_1' width='125'>要求建站完成时间</td>
                <td class='input_2' width='550'><input class='input_text' name='w_7' value='希望完工的日期' type='text' /> <input class='input_text' name='w_7_1' value='希望完工的天数' type='text' /> 天</td>
            </tr>
            <tr>
                <td class='input_1' width='125'>网站建设其它要求</td>
                <td class='input_2' width='550'><textarea class='input_text' style='width: 300px' name='w_7_2'></textarea></td>
            </tr>
        </tbody>
    </table>
    <table class='table_1' cellspacing='0' cellpadding='0' width='675' border='0'>
        <tbody>
            <tr>
                <th colspan='4'>联系人信息</th>
            </tr>
            <tr>
                <td class='input_1' width='129'>姓  名</td>
                <td class='input_2' width='202'><input name='w_8' type='text' /></td>
                <td class='input_1' width='96'>性  别</td>
                <td class='input_2' width='246'><input type='radio' checked='checked' name='w_9' value='小姐' />小姐 <input type='radio' name='w_9' value='先生' />先生</td>
            </tr>
            <tr>
                <td class='input_1' align='left'>电  话</td>
                <td class='input_2'><input class='input_text' name='w_11' type='text' /></td>
                <td class='input_1'>手  机</td>
                <td class='input_2'><input name='w_12' type='text' /></td>
            </tr>
            <tr>
                <td class='input_1'>QQ / MSN</td>
                <td class='input_2'><input class='input_text' name='w_13' type='text' /></td>
                <td class='input_1'>电子邮箱</td>
                <td class='input_2'><input name='w_14' type='text' /></td>
            </tr>
            <tr>
                <td class='input_1'>Skype</td>
                <td class='input_2'><input class='input_text' name='w_15' type='text' /></td>
                <td class='input_1'>邮  编</td>
                <td class='input_2'><input name='w_16' type='text' /></td>
            </tr>
            <tr>
                <td class='input_1'>详细地址</td>
                <td class='input_2'><input name='w_17' type='text' /></td>
                <td class='input_1'>公司地址</td>
                <td class='input_2'><input name='w_172' type='text' /></td>
            </tr>
        </tbody>
    </table>
                     
    <table class='table_1' cellspacing='0' cellpadding='0' width='675' border='0'>
        <tbody>
            <tr>
                <td class='input_2'>
                <div align='center'><input id='send_mail_agent' type='submit' name='w_18' value='Submit' /></div>
                </td>
            </tr>
        </tbody>
    </table>
  </form>";
  }
?>

</body>
</html>
标签:, , , , , , ,

相关日志

Windows下的Apache+PHP+MySQL绿色环境套件包PHPnow1.5.5发布

2010年2月8日 赵健 1 条评论

PHPnow 是 Win32 下绿色的 Apache + PHP + MySQL 环境套件包。简易安装、快速搭建支持虚拟主机的 PHP 环境。附带 PnCp.cmd 控制面板,帮助你快速配置你的套件,使用非常方便。
安装 PHPnow 只需解压、初始化,就可得到一个标准的 PHP + MySQL 的服务器环境。然后就可以直接安装 Discuz! 等程序,或者进行 PHP 开发调试。

国内的专业PHP集成环境,在中国农历新年即将到来时候发布,一个更新。这的确让人激动。希望这个让初 学者上手的套件环境不要离们远去。
官方主页:http://www.phpnow.org

最新版本包含:

* 默认没有启用。执行 PnCp.cmd 选 3 启用。

下载:PHPnow-1.5.5

标签:, , , , , , , , , , ,

相关日志

推荐一个德国10G可绑米免费PHP空间

2009年12月9日 赵健 1 条评论

kilu.de免费空间来自德国,10G容量,无限月流量,FTP方式上传管理文件,支持PHP5(非安全模式),提供3个300M容量的 MySQL数据库,500多种后缀的免费二级域名供你选择,也可以绑定你自己的域名,每个用户最多可创建100个网站。另外,你也可以不用kilu.de 提供的免费PHP空间而仅使用500种后缀的免费二级域名,其中不是好域名,支持隐藏原URL转发。

网址:http://www.kilu.de

kilu.de免费空间绑米演示:http://kilu.aldsd.com

进入kilu.de免费空间后,点右上角下拉列表可选英文版。点击左面的“Join Now”,填写申请表注册帐户。提交后,你会收到帐户开通邮件,里面有你的登陆密码。

登陆kilu.de免费空间,点“User Area”,再点“New Project”,如果你仅需要免费二级域名,就点“Create redirect”,如果是需要免费空间和免费二级域名点“Webspace Create”,填写网站名称并选择类别后,点按钮进入下一步选择免费二级域名,提交完成申请。

点“My Projects”,点你创建的网站

点“Separate domains”再点“Domain intrude”可以绑定你自己的域名,然后将你的域名通过CNAME别名解析到你刚刚申请的kilu.de提供的免费二级域名即可。

FTP项目下有你的免费空间FTP地址、FTP用户名,FTP密码就是你的登陆密码,网页文件传到www目录下。

MySQL项目下,点“MySQL database select”激活数据库,然后会显示给你MySQL服务器地址、MySQL用户名、MySQL用户密码就是你的登陆密码、MySQL数据库名、PHPMyAdmin管理面板地址等信息。

Free8提醒大家注意一下,kilu.de免费空间不是添加成功了通过FTP上传了网页文件就能用,要等差不多几十分钟后才能正常访问。

kilu.de免费空间常见问题:http://www.kilu.de/help

标签:, , , , , ,

相关日志

推荐个免费PHP空间123bemyhost 5.5G vistapanel面板

2009年11月25日 赵健 1 条评论

主机介绍:

vistapanel控制面板

空间大小:5.5GB

月流量:200GB

无广告

50个免费MySQL数据库

支持域名绑定、域名停放、子域名

支持 FTP

空间类型 PHP

申请地址:http://123bemyhost.com/signup.php

注意:用户名必须要以字母开头

申请后会收到一封验证邮件,把最长的连接copy到浏览器

输入验证码,提示成功。验证码看起来会有些困难。

接着页面显示账户的详细信息,邮件里也会有一份。

至此你已拥有此免费美国PHP主机了

赵健是拿来给学生讲课做实践用,还是不错的,只是学校的IP申请过多了会被封。

标签:, , ,

相关日志

php Undefined index和Undefined variable的解决方法

2009年9月20日 赵健 1 条评论

这段时间在做项目过程中老是出现这个提示
Notice: Undefined index: act in *:\***\***.php on line *
另外,有时还会出现
引用内容
Notice: Undefined variable: Submit ……
等一些这样的提示
原因:由于变量未定义引起的
解决方法
1) error_reporting设置:
找到error_reporting = E_ALL
修改为error_reporting = E_ALL & ~E_NOTICE
2) register_globals设置:
找到register_globals = Off
修改为register_globals = On

标签:, , ,

相关日志