コード例 #1
0
 <label><input name="captcha" type="text" placeholder="Please Enter Captcha Above" size="6"/>
 <span>Please Enter Captcha Above</span></label>
 
        
    
    <input type="submit" value="Sign Up" name="signup"/>

</form></p>
		</div></body>




<?php 
include 'authenticate.php';
if (isset($_POST['signup'])) {
    if (isset($_POST['captcha']) && $_POST['captcha'] != "" && $_SESSION['code'] == $_POST['captcha']) {
        $usrName = $_POST['username'];
        $paswrd = md5($_POST['password']);
        $email = $_POST['email'];
        $register = new Authenticate();
        if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
            echo "Invalid email format";
        } else {
            $register->Register($usrName, $paswrd, $email);
            mail('$email', 'Welcome to RANT FORUMS', 'Hello' . $usrName . ',/nWelcome to Rant Forum where you can rant about anything that come to your mind with picture and words.');
        }
    } else {
        echo "Captcha was wrong";
    }
}