<body> <article> <?php $generateCode = FALSE; if ($row) { //Limit one verification email per day, unless already verified if ($row['VerifyCode'] === NULL) { $generateCode = TRUE; } elseif ($row['VerifyCode'] !== $code) { if ($code) { echo '<div class="commentError">Invalid code.</div>'; } $vd = strtotime($row['VerifyDate']); if ($vd > time() + 3600 * 2) { $generateCode = TRUE; } else { echo '<div class="commentStatus">Wait 2 hours and try again, or find the latest email.<br/>You can still continue to post comments.</div>'; } } } else { $generateCode = TRUE; } if ($generateCode) { GenerateAndSendVerificationCode($email, service_url); echo '<div class="commentStatus">New code sent, check your email.</div>'; } ?> </article> </body> </html>
\'' . mysql_real_escape_string($commentText) . '\', \'' . mysql_real_escape_string($commentEmail) . '\' )') or die('<div class="commentError">' . mysql_error() . '</div>'); $id = mysql_insert_id(); if ($commentEmail) { //Get Author $verificationCode = TRUE; $res = @mysql_query('SELECT * FROM Authors WHERE Email=\'' . mysql_real_escape_String($commentEmail) . '\'') or die('<div class="commentError">' . mysql_error() . '</div>'); $row = mysql_fetch_assoc($res); if ($row) { //Limit one verification email per day, unless already verified if ($row['VerifyCode'] !== NULL) { $vd = strtotime($row['VerifyDate']); if ($vd < time() + 3600 * 24) { echo '<div class="commentOk">Email verification already sent.</div>'; $verificationCode = FALSE; } } } //Create new VerifyCode if ($verificationCode === TRUE) { GenerateAndSendVerificationCode($commentEmail, $site['SiteUrl'] . $page); } echo '<div class="commentOk">Comment awaits your verification, check your email</div>'; } else { echo '<div class="commentOk">Comment awaits moderation</div>'; } } //Send email to site owner $headers = "From: " . service_email . "\nReply-To: " . $commentEmail; mail($site['AdminEmail'], "New comment on " . $page, "Dashboard: " . service_url . "/dashboard/\n" . "Referrer: " . $_SERVER['HTTP_REFERER'] . "\n" . "From: " . $_SERVER['REMOTE_ADDR'] . "\n" . "Email: " . $commentEmail . ($commentEmail == $session['Email'] ? '(verified)' : '(not checked)') . "\n" . "To: " . $page . "\n" . $commentText, $headers);