2015-11-24 78 views
0

我創建了一個包含電子郵件驗證的註冊系統,當我註冊時,一切正常。但是當我點擊電子郵件中的鏈接時,它說錯誤。你能幫我嗎?在php中註冊 - 電子郵件驗證不起作用

<?php session_start(); 
include_once 'dbconnect.php'; 

if (isset($_GET['email'])){ 
$email = $_GET['email']; 
} 
if (isset($_GET['status']) && (strlen($_GET['status']) == 32)) { 
$status = $_GET['status']; 
} 

if (isset($email) && isset($status)) { 

$query_activate_account = "UPDATE users SET status='Active' WHERE(email ='$email' AND status='$status')"; 
$result_activate_account = mysqli_query($query_activate_account); 

echo '<div>Your account is now active. You may now <a href="signin.php">Log in</a></div>'; 

} else { 
echo '<div>Oops !Your account could not be activated. Please recheck the link or contact the system administrator.</div>'; 

} 
?> 
+0

[你的腳本是在對SQL注入攻擊的風險。(http://stackoverflow.com/questions/60174/how-can-i-prevent-sql-injection-in-php) –

+0

什麼樣的* *錯誤的是你得到了嗎? –

+0

謝謝你,它會工作後,我會解決這個問題。這:糟糕!您的帳戶無法啓動。請重新檢查鏈接或聯繫系統管理員。 – iWispy

回答

0

要發送到用戶的URL是錯誤的

它不包含emailstatus

要使用這樣的代碼,

if (isset($_GET['email'])){ 
    $email = $_GET['email']; 
} 
if (isset($_GET['status']) && (strlen($_GET['status']) == 32)) { 
$status = $_GET['status']; 
} 

您的電子郵件應該是這樣的,

$email = "email here"; 
$message = "http://chat-web.net/activate.php?status=$status&email=$email"; 
+0

它說:警告:mysqli_query()預計至少2個參數,1給出/數據/網絡/虛函數/ 115709 /虛擬/網絡/第14行的activate.php 您的帳戶現在處於活動狀態。你現在可以 – iWispy

+0

通連接對象作爲第一個參數記錄到mysqli_query() –

+0

我不明白這一點現在... – iWispy