Subversion Repositories cheapmusic

Rev

Rev 36 | Rev 43 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 36 Rev 41
Line 13... Line 13...
13
require_once 'includes/User.class.php';
13
require_once 'includes/User.class.php';
14
$user = new User();
14
$user = new User();
15
 
15
 
16
if(isset($_POST['signupSubmit'])){
16
if(isset($_POST['signupSubmit'])){
17
	$valErr = 0;
17
	$valErr = 0;
-
 
18
	$captchaErr = 0;
18
 
19
 
19
	// Store post data into session
20
	// Store post data into session
20
	$_SESSION['signup_post_data'] = $_POST;
21
	$_SESSION['signup_post_data'] = $_POST;
-
 
22
 
-
 
23
    if (!empty($_POST['g-recaptcha-response'])) {
-
 
24
        $secretKey = GR_SECRET_KEY;
-
 
25
        $ch = curl_init('https://www.google.com/recaptcha/api/siteverify?secret=' . $secretKey . '&response=' . $_POST['g-recaptcha-response']);
-
 
26
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
-
 
27
        $verifyResponse = curl_exec($ch);        
-
 
28
        $responseData = json_decode($verifyResponse);
-
 
29
 
-
 
30
        if ($responseData->success){
-
 
31
            if ($responseData->score < 0.6) {
-
 
32
            	$captchaErr = 1;
-
 
33
                $sessData['status']['type'] = 'error';
-
 
34
                $sessData['status']['msg'] = 'Robot verification failed, please try again.';
-
 
35
            }
-
 
36
        } else {
-
 
37
        	$captchaErr = 1;
-
 
38
            $sessData['status']['type'] = 'error';
-
 
39
            $sessData['status']['msg'] = 'Robot verification failed, please try again.';
-
 
40
        }
-
 
41
    } else {
-
 
42
    	$captchaErr = 1;
-
 
43
        $sessData['status']['type'] = 'error';
-
 
44
        $sessData['status']['msg'] = 'Robot verification failed, please try again.';
-
 
45
    }
-
 
46
    
-
 
47
    if ($captchaErr == 1) {
-
 
48
    	// Redirect back to the registration page
-
 
49
        $_SESSION['sessData'] = $sessData;
-
 
50
        MySessionHandler::commit(session_id());
-
 
51
        header("Location:registration.php");
-
 
52
    	exit;
-
 
53
    }
21
 
54
 
22
	// Get user inputs
55
	// Get user inputs
23
	$first_name = sanitizeInput($_POST['first_name']);
56
	$first_name = sanitizeInput($_POST['first_name']);
24
	$last_name = sanitizeInput($_POST['last_name']);
57
	$last_name = sanitizeInput($_POST['last_name']);
25
	$email = sanitizeInput($_POST['email']);
58
	$email = sanitizeInput($_POST['email']);