 |
Warning: mail() [function.mail]: Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in |
|
 |
|
|
 |
 |
|
Code
Register Completed!
Please check your email to activate account
Warning: mail() [function.mail]: Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in D:\AppServ\www\electricalman\memberregister\save_register.php on line 65
Code (PHP)
<?php
session_start();
mysql_connect("localhost","root","1234");
mysql_select_db("memberregister");
if(trim($_POST["txtUsername"]) == "")
{
echo "Please input Username!";
exit();
}
if(trim($_POST["txtPassword"]) == "")
{
echo "Please input Password!";
exit();
}
if($_POST["txtPassword"] != $_POST["txtConPassword"])
{
echo "Password not Match!";
exit();
}
if(trim($_POST["txtName"]) == "")
{
echo "Please input Name!";
exit();
}
if(trim($_POST["txtEmail"]) == "")
{
echo "Please input Email!";
exit();
}
$strSQL = "SELECT * FROM member WHERE Username = '".trim($_POST['txtUsername'])."' ";
$objQuery = mysql_query($strSQL);
$objResult = mysql_fetch_array($objQuery);
if($objResult)
{
echo "Username already exists!";
}
else
{
$strSQL = "INSERT INTO member (Username,Password,Name,Email,Status,SID,Active) VALUES ('".$_POST["txtUsername"]."',
'".$_POST["txtPassword"]."','".$_POST["txtName"]."' ,'".$_POST["txtEmail"]."','USER','".session_id()."','No')";
$objQuery = mysql_query($strSQL);
$Uid = mysql_insert_id();
echo "Register Completed!<br>Please check your email to activate account";
$strTo = $_POST["txtEmail"];
$strSubject = "Activate Member Account";
$strHeader = "Content-type: text/html; charset=windows-874\n"; // or UTF-8 //
$strHeader .= "From: [email protected]\nReply-To: [email protected]";
$strMessage = "";
$strMessage .= "Welcome : ".$_POST["txtName"]."<br>";
$strMessage .= "=================================<br>";
$strMessage .= "Activate account click here.<br>";
$strMessage .= "https://www.thaicreate.com/activate.php?sid=".session_id()."&uid=".$Uid."<br>";
$strMessage .= "=================================<br>";
$strMessage .= "ThaiCreate.Com<br>";
$flgSend = mail($strTo,$strSubject,$strMessage,$strHeader);
}
mysql_close();
?>
Tag : PHP, MySQL, Web Service
|
|
 |
 |
 |
 |
Date :
2015-02-07 16:49:33 |
By :
nanazaro |
View :
1579 |
Reply :
2 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
Error นี้เกิดจากยังไม่ได้ติดตั้ง SMTP หรือ Mail Server ครับ 
|
 |
 |
 |
 |
Date :
2015-02-07 19:37:31 |
By :
mr.win |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
คุณโชคดีจริง ๆ วันนี้ได้เขียนบทความ

ติดตั้ง SMTP Service สำหรับส่งอีเมล์บน Windows 7 (PHP,ASP.Net,IIS,Apache)
|
 |
 |
 |
 |
Date :
2015-02-10 14:07:47 |
By :
mr.win |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|