ªð¦^¦Cªí ¤W¤@¥DÃD µo©«

10-2-4 ³B²zµn¿ý¸ê®Æ

10-2-4 ³B²zµn¿ý¸ê®Æ

10-2-4   ³B²zµn¿ý¸ê®Æ
²×©ó¨Ó¨ì§Ú­Ì¡uaddin.php¡vµ{¦¡¼¶¼gªº³Ì«á¶¥¬q¡A§Ú­Ì¦bÅçÃÒ¡u¥[¤J·|­û¡vªí³æ¤¤ªºÄæ¦ì¸ê®Æ¡A³£¦³¶ñ¼g¤Î¶}±Ò¸ê®Æ®w«á¡A±µ¤U¨Ó´N¬O­n±N±µ¦¬¦Û¡u¥[¤J·|­û¡vªí³æ¤¤ªºÄæ¦ì¸ê®Æ¼g¤J¸ê®Æ®wÀɮפ¤¡C

¦b±N·|­û¸ê®Æ¼g¤J¸ê®Æ®w¤§«e¡AÁÙ­n¥ý§PÂ_¤@¤U·s·|­û©Òµn¿ýªº¡uµn¤J¦WºÙ¡v¬O§_¤w¸g¦³¤H¨Ï¥Î¦Ó­«½Æ¡G
  1. //«Ø¥ß¬d¸ß¦r¦ê¥Î¥H§PÂ_µn¤J¦WºÙ¬O§_­«½Æ
  2. $SQL="Select ID From membertest Where ID='" . $ID . "'";
  3. $RS=mysql_query($SQL);
  4. if (!mysql_fetch_array($RS))
  5. {
  6. //¦pªGµn¤J¦WºÙ¨S¦³¤H¨Ï¥Î«h¼g¤J·|­û¸ê®Æ
  7. $sql = "Insert Into membertest (ID, Password, Name, Email) Values ('";
  8. $sql = $sql . $ID . "', '";
  9. $sql = $sql . $Password . "', '";
  10. $sql = $sql . $Name . "', '";
  11. $sql = $sql . $Email . "')";
  12. mysql_query($sql);
  13. msg("½u¤W¥[¤J·|­û¦¨¥\\!!");
  14. }
  15. else  //µn¤J¦WºÙ­«½Æ
  16. {
  17. msg("±zªºµn¤J¦WºÙ $ID ¤w¸g¦³¤H¨Ï¥Î!!");
  18. }
½Æ»s¥N½X
­Y¡uµn¤J¦WºÙ¡v¦³¤H¨Ï¥Î¤F¡A¦P¼Ë­n©I¥s¡umsg¡v°Æµ{¦¡¨Ó²£¥Í¤@­Ó¡u±zªºµn¤J¦WºÙXXX¤w¸g¦³¤H¨Ï¥Î!!¡vªº¿ù»~°T®§ºô­¶¡A¦p¤U¹Ï©Ò¥Ü¡G

¹Ï10-11  ¡uµn¤J¦WºÙ¡v­«½Æ¡C

¦pªG·s·|­ûµn¿ýªº¸ê®Æ³£¨S¦³°ÝÃD¡A«h¨Ï¥Îmysql_query()¨ç¼Æ°õ¦æ¦ê±µªºSQL«ü¥O±Ô­z¡A±N·s·|­ûªº¸ê®Æ¼g¤J¸ê®Æ®w¡C
¤ß¦w¡A¥­¦w   
µoªí¥ô¦óµL·N¸qªº·PÁ©ÎÄé¤ô¤å³¹¤@«ß¬å,¬Ã±¤±b¸¹,½Ð¸Ô¾\ª©³W!!

addin.php
  1. <?
  2. //§PÂ_Äæ¦ì¸ê®Æ¬O§_¬°ªÅ¥Õ
  3. //­YÄæ¦ì¸ê®ÆªÅ¥Õ«h©I¥smsg°Æµ{¦¡
  4. if (empty($_REQUEST["Name"]))
  5. {
  6. msg("±z§Ñ°O¿é¤J¤j¦W°Õ!!");
  7. }
  8. else if(empty($_REQUEST["Email"]))
  9. {
  10. msg(!"±z§Ñ°O¿é¤JE-Mail°Õ!!");
  11. }
  12. else if(empty($_REQUEST["ID"]))
  13. {
  14. msg("±z§Ñ°O¶ñ¼gµn¤J¦WºÙ°Õ!!");
  15. }
  16. else if(empty($_REQUEST["Password"]))
  17. {
  18. msg("±z§Ñ°O¶ñ¼gµn¤J±K½X°Õ!!");
  19. }
  20. else
  21. {
  22. //±µ¦¬¨Ó¦Û¡y¥[¤J·|­û¡zªí³æ¤¤ªºÄæ¦ì¸ê®Æ
  23. $Name = $_REQUEST["Name"];
  24. $Email = $_REQUEST["Email"];
  25. $ID = $_REQUEST["ID"];
  26. $Password = $_REQUEST["Password"];
  27. }

  28. //³sµ²MySQL Server
  29.     $conn = mysql_connect("127.0.0.1", "root", "12345a");
  30. //¿ï¾Ü¸ê®Æ®w
  31.     mysql_select_db("Member", $conn);      
  32. //«ü©w´£¨ú¸ê®Æªº®Õ¹ï¦r¤¸ªí
  33.     mysql_query("set character set big5");
  34. //«Ø¥ß¬d¸ß¦r¦ê¥Î¥H§PÂ_µn¤J¦WºÙ¬O§_­«½Æ
  35. $SQL="Select ID From membertest Where ID='" . $ID . "'";
  36. $RS=mysql_query($SQL);

  37. if (!mysql_fetch_array($RS))
  38. {
  39. //¦pªGµn¤J¦WºÙ¨S¦³¤H¨Ï¥Î«h¼g¤J·|­û¸ê®Æ
  40. $sql = "Insert Into membertest (ID, Password, Name, Email) Values ('";
  41. $sql = $sql . $ID . "', '";
  42. $sql = $sql . $Password . "', '";
  43. $sql = $sql . $Name . "', '";
  44. $sql = $sql . $Email . "')";
  45. mysql_query($sql);
  46. msg("½u¤W¥[¤J·|­û¦¨¥\\!!");
  47. }
  48. else  //µn¤J¦WºÙ­«½Æ
  49. {
  50. msg("±zªºµn¤J¦WºÙ $ID ¤w¸g¦³¤H¨Ï¥Î!!");
  51. }
  52. ?>

  53. <?
  54. function msg($info)
  55. {
  56. ?>
  57. <HTML>
  58. <head>
  59. <meta http-equiv="Content-Type" content="text/html; charset=big5">
  60. <title>¥[¤J·|­ûª¬ªp</title>
  61. </head>
  62. <BODY>
  63.    <CENTER>
  64.    <H2><Font Color=red><?=$info?><HR size="1" color="#FF0066">
  65.    <FORM>
  66.    <INPUT Type=Button Value="¤W¤@­¶" OnClick="history.back();">
  67.    </FORM>
  68.    </CENTER>
  69.    </font>
  70. </BODY>
  71. </HTML>
  72. <?
  73. exit();   
  74. }
  75. ?>
½Æ»s¥N½X
¤ß¦w¡A¥­¦w   
µoªí¥ô¦óµL·N¸qªº·PÁ©ÎÄé¤ô¤å³¹¤@«ß¬å,¬Ã±¤±b¸¹,½Ð¸Ô¾\ª©³W!!

TOP

¤p»x¤j­ô½Ð°Ý2­ÓºÃ°Ý
¥ýÂ_§Pªí³æ¦A³sµ²¸ê®Æ®w©M¥ý³sµ²¸ê®Æ®w¦A§PÂ_ªí³æ¦³¤°»ò®t²§¶Ü?
$_REQUEST ¤£¬O¯à¥ý«Å§i¦¨ÅܼƦA§PÂ_ªí³æ¤º®e ½d¨Ò«o¬O¥ý¥Î $_REQUEST ¦b§PÂ_ªí³æ ¤GªÌ¤§¶¡
§PÂ_¦³¤°»ò®t²§©O?

TOP

        ÀR«ä¦Û¦b : ¤H¥Í¤£¤@©w²y²y¬O¦n²y¡A¦ý¬O¦³¾ú½mªº±j¥´ªÌ¡AÀH®É³£¥i¥H´§´Î¡C
ªð¦^¦Cªí ¤W¤@¥DÃD