<form id="hz9zz"></form>
  • <form id="hz9zz"></form>

      <nobr id="hz9zz"></nobr>

      <form id="hz9zz"></form>

    1. 明輝手游網中心:是一個免費提供流行視頻軟件教程、在線學習分享的學習平臺!

      用php與mysql的電子賀卡程序

      [摘要]第一步:首先作一個如下面的表單:(注:這個表單里加了php程序) <form method="post" action="mailtocard.php"...
      第一步:首先作一個如下面的表單:(注:這個表單里加了php程序)
      <form method="post" action="mailtocard.php" name="card" onSubmit="return card_Validator(this)">
      <table width="450" border="0" cellspacing="0" cellpadding="0" align="center">
      <tr>
      <td valign="top" width="143">
      <input type="radio" name="inout" value="newyear" checked>
      <img src="http://edu.chinaz.com/images/newyear1.gif" width="75" height="75"> </td>
      <td width="170">
      <input type="radio" name="inout" value="newyear2_2">
      <img src="http://edu.chinaz.com/images/newyear2.gif" width="75" height="75"> </td>
      <td width="137">
      <input type="radio" name="inout" value="newyear3_3">
      <img src="http://edu.chinaz.com/images/newyear1.gif" width="75" height="75"> </td>
      </tr>
      <tr>
      <td valign="top" colspan="3">
      <textarea name="text" rows="7" cols="60" wrap="VIRTUAL">你好朋友:
      </textarea>
      </td>
      </tr>
      <tr>
      <td valign="top" colspan="3">
      <select name="music">
      <option selected>--卡片背景音樂--</option>
      <option value="101marry.mid">一千零一夜</option>
      <option value="canyon.mid">canyon</option>
      </select>
      <input onclick=playSound() type=button value="試聽音樂">
      </td>
      </tr>
      <tr>
      <td valign="top" colspan="3"> </td>
      </tr>
      <tr>
      <td valign="top" colspan="3">
      <table width="370" border="0" cellspacing="0" cellpadding="0" align="center" class="p11">
      <tr>
      <td width="108">

      <?

      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 "<div align='left'>您的姓名:</div>
      </td>
      <td width=342>
      $g_username
      <input type=hidden name=username value=$g_username>
      </td>
      </tr>
      <tr>
      <td width=108>
      <div align=hidden>您的Email:</div>
      </td>
      <td width=342>
      $bbs_email
      <input type=hidden name=email value=$bbs_email>

      ";
      }
      //if (strlen($g_username) < 0)
      else //判斷沒有登陸,需要填寫姓名及Email。
      {
      echo "<div align='left'>您的姓名:</div>
      </td>
      <td width='342'>

      <input type='text' name='username'>
      </td>
      </tr>
      <tr>
      <td width='108'>
      <div align='left'>您的Email:</div>
      </td>
      <td width='342'>

      <input type='text' name='email'>";
      }
      ?>
      </td>
      </tr>
      <tr>

      <td width="108">
      <div align="left">朋友姓名:</div>
      </td>
      <td width="342">
      <input type="text" name="f_name">
      </td>
      </tr>
      <tr>
      <td width="108">
      <div align="left">朋友Email:</div>
      </td>
      <td width="342">
      <input type="text" name="f_email">
      </td>
      </tr>
      <tr>
      <td width="108"> </td>
      <td width="342">

      <input type="button" name="submit" value="預覽" onclick="preview()">
      <input type="submit" name="submit" value="發送">
      <input type="reset" name="Submit3" value="重來">
      第二步:預覽
      <?

      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;

      }
      }
      ?>
      <html>
      <head>
      <title>電子賀卡</title>
      <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
      </head>

      <body bgcolor="#eeeeee">
      <form method="post" action="mailtocard.php">
      <table width="497" border="0" cellspacing="0" cellpadding="0" align="center" height="310">
      <tr>
      <td colspan="2">
      <div align="center">

      <? echo "<img src=/images/".$new.".gif>"; ?>


      </div>
      </td>
      </tr>
      <tr>
      <td width="317" valign="top">
      <p><font size="3" color="#FF0066">您好朋友:</font><br>
      <br>
      <font size="2" color="#3333FF">

      <? echo $text; ?>
      </font></p>

      </td>
      <td width="180" valign="top">
      <div align="right">
      <table width="90%" border="0" cellspacing="0" cellpadding="0">
      <tr>
      <td>
      <p><font size="3" color="#FF0066">寄卡給:</font><font size="2"><br>
      </font></p>
      <p><font color="#3300CC" size="2"><? echo $f_name; ?>
      <input type=hidden name=f_name value=$f_name>
      </font></p>
      <p><font size="3" color="#FF0066">您的朋友:</font></p>
      <p><font size="2" color="#3300CC">
      <? echo $g_username; ?>
      <input type=hidden name=username>
      <input type=hidden name=f_email value="$femail">
      <input type=hidden name=email>

      </font></p>
      </td>
      </tr>
      </table>
      </div>
      </td>
      </tr>
      <tr>
      <td colspan="2" valign="top">

      <div align="center">
      <input type="submit" name="submit" value="發送">
      <input type="button" onclick="javascript:window.close()" name="close" value="關閉窗口">
      </div>

      </td>
      </tr>
      </table>
      </form>
      </body>
      </html>
      第三步:發送賀卡
      <?
      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("<br>","\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 "<script language=\"javascript\">history.back();alert(\"發送成功,謝謝使用!\");</script>";

      $message ="<html>
      <head>
      <title>電子賀卡</title>
      <meta http-equiv='Content-Type' content='text/html; charset=gb2312'>
      </head>

      <body bgcolor='#eeeeee'>
      <table width='497' border='0' cellspacing='0' cellpadding='0' align='center' height='310'>
      <tr>
      <td colspan='2'>
      <div align='center'>

      <img src=http://edu.chinaz.com/images/$inout.gif>


      </div>
      </td>
      </tr>
      <tr>
      <td width='317' valign='top'>
      <p><font size='3' color='#FF0066'>您好朋友:</font><br>
      <br>
      <font size='2' color='#3333FF'>

      $text
      </font></p>

      </td>
      <td width='180' valign='top'>
      <div align='right'>
      <table width='90%' border='0' cellspacing='0' cellpadding='0'>
      <tr>
      <td>
      <p><font size='3' color='#FF0066'>寄卡給:</font><font size='2'><br>
      </font></p>
      <p><font color='#3300CC' size='2'>$f_name
      <input type=hidden name=f_name value=$f_name>
      </font></p>
      <p><font size='3' color='#FF0066'>您的朋友:</font></p>
      <p><font size='2' color='#3300CC'>
      $g_username
      <input type=hidden name=username>
      <input type=hidden name=f_email value='$femail'>
      <input type=hidden name=email>

      </font></p>
      </td>
      </tr>
      </table>
      </div>
      </td>
      </tr>
      <tr>
      <td colspan='2' valign='top'>


      </td>

      </table>

      </body>
      </html>";

      $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





      日韩精品一区二区三区高清