php mysql电子_用php与mysql的电子贺卡代码

简介:这是用php与mysql的电子贺卡代码的详细页面,介绍了和php,有关的知识、技巧、经验,和一些php源码等。 class='pingjiaF' frameborder='0' src='http://biancheng.dnbcw.info/pingjia.php?id=323733' scrolling='no'>

第一步:首先作一个如下面的表单:(注:这个表单里加了php程序)

newyear1.gif

newyear2.gif

newyear1.gif

你好朋友:

--卡片背景音乐--

一千零一夜

canyon

if (strlen($g_username) > 1)

{

//判断是否登陆,若已登陆显示姓名及Email,不用填写。

$db=mysql_connect("localhost","root","");

$result=mysql_db_query("数据库名","select email,http from 数据库表名 where username='$g_username'");

$row=mysql_fetch_array($result);

$bbs_email=$row[email];

echo "

您的姓名:

$g_username

您的Email:

$bbs_email

";

}

//if (strlen($g_username) < 0)

else //判断没有登陆,需要填写姓名及Email。

{

echo "

您的姓名:
您的Email:

";

}

?>

朋友姓名:
朋友Email:

第二步:预览

if (submit=="预览")

{

switch($new)

{

case "newyear":

$new="newyear.gif";

break;

case "newyear2_2":

$query=newyear2_2.gif;

break;

case "newyear3_3":

$query=newyear3_3.gif;

break;

}

}

?>

电子贺卡

echo "%22.%24new.%22.gif"; ?>

您好朋友:

echo $text; ?>

寄卡给:

echo $f_name; ?>

您的朋友:

echo $g_username; ?>

第三步:发送贺卡

if(submit=="发送")

$mainurl = "http://lyjrich.oso.com.cn/card"; //该贺卡文件主目录URL

$dataurl = "$mainurl/store"; //存放产生的贺卡的URL

$userip = getenv("REMOTE_ADDR");

$daten = date("m月d日H点i分");

$roundno = date("mdHis");

$fileno .=$roundno.".html";

$fileurl = $dataurl."/".$fileno; //存放产生的贺卡的URL

$subject="朋友给你邮的贺卡";

$content = eregi_replace("
","\n","$text");

$t_body .= "**************************************\n";

$t_body .= $f_name." 您好:\n";

$t_body .= $g_username." 从http://lyjrich.oso.com.cn 寄了一张贺卡给你。\n";

$t_body .= $g_username."给您的留言上说:\n".$text ."\n\n";

$t_body .= "请你点击http://lyjrich.oso.com.cn/card".$fileurl." 来欣赏这张贺卡\n";

$t_body .= "贺卡最长将为你保存一个月。\n\n";

$t_body .= "\n************************************\n";

$t_body .= "发送时间 $daten\n";

$t_body .= "**************************************\n\n";

$t_body .= "免费电子贺卡由 your web 网站提供\n\n\n";

$t_body .= "程序制作:lyjrich(http://lyjrich.oso.com.cn)\n";

mail($f_email,$subject,$t_body,"From: ".$email."\n");

echo "";

$message ="

电子贺卡

%24inout.gif

您好朋友:

$text

寄卡给:

$f_name

您的朋友:

$g_username

";

$mydir=dir("./store/");

$fp = fopen ("store/$roundno.html","w+") or die("建立文件错误!");;

fwrite ($fp, $message);

fclose ($fp);

?>

运行程序可在本人网站http://lyjrich.oso.com.cn,若对程序有疑问可发mail给我:lyjrich@sina.com

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值