Mini Shell Moded By TiGER HeX
Home
||
Turbo Force
||
B-F Config_Cpanel
Current Path :
/
var
/
www
/
ridazz
/
Linux midnightridazz 4.19.0-11-cloud-amd64 #1 SMP Debian 4.19.146-1 (2020-09-17) x86_64
Upload File :
New :
File
Dir
//var/www/ridazz/registerCAPTCHA.php
<?php include_once('includes/static/configure.php'); include_once('includes/static/util.php'); include_once('includes/static/dbcon2.php'); include_once('includes/static/gdimg.php'); include_once('includes/static/sessions.php'); include_once('includes/appTop2.php'); require_once('recaptchalib.php'); include_once('includes/header.php'); define('USERNAME_IN_USE', 1); define('INVALID_EMAIL', 2); define('CAPTCHA_FAILED', 3); define('EMAIL_IN_USE', 4); define('INVALID_USERNAME', 5); define('INVALID_PASSWORD', 6); define('PASSWORD_DONT_MATCH', 7); $publickey="6LesURsUAAAAAHzSNrNezPAUoiWt9dhBfgbdLodV"; //$publickey="6LeAFwUAAAAAAJfQbthf3FllWiof9koZaAqcuG5n"; // for ReCAPTCHA $username_return = ''; $email_return = ''; if(isset($_POST['register'])) { if ($_POST['register']=="true") { // header("Location: regSuccess.php"); print "Registration successful!"; return; } else { $errorCode = performRegistration(); } } # modified for debugging function die2($err) { die( $err); } function performRegistration() { global $db; global $username_return; global $email_return; if(isset($_POST['refurl'])){ $refurl = addslashes($_POST['refurl']); }else{ $refurl = "/"; } $uname = $db->sanitize_input(stripslashes(strip_tags(trim($_POST['username'])))); $unameTest = preg_match("/[\w\d ]+/", $uname, $matches); $username_return = $matches[0]; if (strlen($uname)==0 || $uname !=$_POST['username'] || $uname != $matches[0]) { return INVALID_USERNAME; } $sql = "SELECT user_id FROM 50mm_users WHERE username ='$uname'"; //first check for unique name if( !($result = $db->sql_query($sql)) ){ $sql_error = $db->sql_error(); die2($uname. " " . $sql_error['message']); } if($db->sql_numrows($result) > 0){ return USERNAME_IN_USE; } $email = $db->sanitize_input(preg_replace("/[^A-Za-z0-9_.@+-]/","",$_POST['email'])); if (strlen($email)<3 || $email != $_POST['email']) { return INVALID_EMAIL; } $email_return = $email; $url = $_POST['website']; // and unique email $sql = "SELECT user_id FROM 50mm_users WHERE email ='$email'"; if( !($result = $db->sql_query($sql)) ){ $sql_error = $db->sql_error(); die2($sql_error['message']); } if($db->sql_numrows($result) > 0){ return EMAIL_IN_USE; } $password = preg_replace('/["\']/','',$_POST['password']); $password2 = preg_replace('/["\']/','',$_POST['password2']); if (strlen($password)<6 || $password != $_POST['password']) { return INVALID_PASSWORD; } if ($password != $password2) { return PASSWORD_DONT_MATCH; } $profile = $db->sanitize_input(sanitize_body(get_html_text($_POST['profile']))); $ip = get_client_ip(); $cur_file = $_FILES['file']['name']; $cur_temp = $_FILES['file']['tmp_name']; $cur_mime = $_FILES['file']['type']; $cur_size = $_FILES['file']['size']; $cur_error = $_FILES['file']['error']; # CAPTCHA CHECK $privatekey = "6LesURsUAAAAAK2oMXUf0gYkXBD5KFaNAGlomQ2i"; //$privatekey = "6LeAFwUAAAAAABSrv8g8bQCSOscG-2DJZoRMghlC"; // $resp = recaptcha_check_answer ($privatekey, // $_SERVER["REMOTE_ADDR"], // $_POST["recaptcha_challenge_field"], // $_POST["recaptcha_response_field"]); // if (!$resp->is_valid) { // return CAPTCHA_FAILED; // } //username is unique so add this user //store profile image on the server $unique_name = ""; $valid = validate_content($cur_error,$cur_mime,$cur_size,$cur_file,PROFILE_MAX_KB); if($valid['result']){ $type = explode("/",$cur_mime); $cur_type = trim($type[0]); $unique_name = get_unique_filename($cur_file); $image_info = getimagesize($cur_temp); //check to see if image needs resizing if(($image_info[0] > PROFILE_IMG_WIDTH) || ($image_info[1] > PROFILE_IMG_HEIGHT)){ //create image res $gd = new gd_img($cur_mime,$cur_temp); if(!$gd->img_id){ die2($gd->gd_error);} //scale image $id = $gd->gd_scale_img(PROFILE_IMG_WIDTH,PROFILE_IMG_WIDTH,IMG_QUALITY); if(!$id){ die2($gd->gd_error);} //create image $res = $gd->gd_create_img($id,ROOT_DIR.PROFILE_IMG_DIR.$unique_name); if(!$res){ die2($gd->gd_error);} }else{ if (!copy($cur_temp, ROOT_DIR.PROFILE_IMG_DIR.$unique_name)) { die2("Failed Image Upload"); } } } $sql = "INSERT INTO 50mm_users (user_type,email,username,password,image,profile,url,ip,verified,entry_time) VALUES ('WEB','$email','$uname','$password','$unique_name','$profile','$url','$ip',0,NOW())"; if( !($result = $db->sql_query($sql)) ){ $sql_error = $db->sql_error(); die2($sql_error['message']); } $sql = "SELECT LAST_INSERT_ID() AS user_id"; if( !($result = $db->sql_query($sql)) ){ $sql_error = $db->sql_error(); die2($sql_error['message']); } $row = $db->sql_fetchrow($result); $uid = $row['user_id']; //send email $query = "uid=$uid&uname=$uname&refurl=$refurl"; $link = ROOT_URL."/login.php?id=".base64_encode($query); $link = "<a href=\"$link\">$link</a>"; $body = "Please click the link below to complete registration for ".SITE_TITLE."<br><BR>Depending on your email program, you may need to COPY and paste the ENTIRE link into a new browser window.<br><br>"; $body.= "Username: ".$uname."<br>"; $body.= "Password: ".$password."<br>"; $body.= $link; $headers = "MIME-Version: 1.0\r\n"; $headers .= "Content-type: text/html; charset=iso-8859-1\r\n"; $headers .= "To: ".$email." <".$email.">\n"; $headers .= "From: ".SITE_TITLE." <".ADMIN_EMAIL.">\r\n"; $mresult = mail($email,SITE_TITLE,$body,$headers); if(!$mresult){ // die2("Unable to send email notification!"); header("Location: regSuccess.php"); } $vendor_headers = "From: ".SITE_TITLE." <".ADMIN_EMAIL.">\r\n"; $vendor_register = "general_registration@50mmlosangeles.com"; mail($vendor_register,'General Registration',$body,$vendor_headers); header("Location: regSuccess.php"); print "Registration sucesss! Please check your email.<br/><br/><br/>"; } function getErrorString($code) { switch($code) { case USERNAME_IN_USE: return "That username is already in our records. Please try another one."; case EMAIL_IN_USE: return "That email is already in our records. Please try another one."; case INVALID_EMAIL: return "Invalid email address"; case CAPTCHA_FAILED: return "I couldn't tell if you were human or not. Try again"; case INVALID_USERNAME: return "That username is all full of junk or too short. Please pick another"; case INVALID_PASSWORD: return "Please supply a valid password at least six characters long, containing no quotes"; case PASSWORD_DONT_MATCH: return "Passwords don't match, try again"; } return "something didn't work here..."; } session_destroy(); session_write_close(); $pg_name = basename($_SERVER['PHP_SELF']); include_once('includes/header.php'); if(!$errorCode) { $errorCode = $_POST['errorCode']; } ?> <script type="text/javascript"> function submitForm(e) { var response = grecaptcha.getResponse(); // grecaptcha.execute(); if (!response || response.length === 0) { return false; } onSubmit(); return true; } function onSubmit(token) { document.getElementById("reg-form").submit(); } </script> <div class="title">REGISTRATION<P> <br><br>PS: WE HATE SPAM! Your email will never be sold, shared, or marketed to in any way ever.<br><br> Thanks.</div> Please note, your account will take some time to process. Please be patient. Choose your desired username and email address to register your account to. Once submited please allow up to 24 hours for your confirmation email to be sent to the email address you have specified in the form below. <p> <? if ($errorCode) { ?> <div class="error"><?=getErrorString($errorCode)?></div> <? } ?> <div class="reg-form-container" style="height: 0; width: 0; overflow: hidden"> <form id="reg-form-real" name="register" method="POST" action="?" "<?=$_SERVER[PHP_SELF]?>"> <input name="register" type="hidden" value="true"> <input type="text" name="username" maxlength="200" value="<?=$username_return?>"> <input type="text" name="email" maxlength="200" value="<?=$email_return?>"> <input type="password" name="password" maxlength="200" value=""> <input type="password" name="password2" maxlength="200" value=""> <input type="submit" value="Sign up!"> </form> </div> <form id="reg-form" name="register" method="POST" action="?" "<?=$_SERVER[PHP_SELF]?>"> <input name="register" type="hidden" value="1"> <table> <tr> <td align="right" valign="top"><b><font size="3">Desired Username:</font></b><br> <br> </td> <td valign="top"><input type="text" name="username" maxlength="200" value="<?=$username_return?>"> <div style="width:200px; padding:2px"> Your username must be unique.</div> </td> </tr> <tr> <td align="right" valign="top"><b><font size="3">Email Address:</font></b><br> </td> <td valign="top"><input type="text" name="email" maxlength="200" value="<?=$email_return?>"> <div style="width:200px; padding:2px">MAKE SURE YOUR EMAIL ADDRESS IS ACCURATE! A confirmation email will be sent to this address. Please SET YOUR SPAM FILTER to accept all emails from midnightridazz.com! If you do not receive a confirmation email check your SPAM folder. </div> </td> </tr> <tr> <td align="right" valign="top"><b><font size="3">Password:</font></b><br> </td> <td valign="top"><input type="password" name="password" maxlength="200" value=""> <div style="width:200px; padding:2px">Please make up a password at least 6 characters long </div> </td> </tr> <tr> <td align="right" valign="top"><b><font size="3">Confirm Password:</font></b><br> </td> <td valign="top"><input type="password" name="password2" maxlength="200" value=""> <div style="width:200px; padding:2px">Please re-type your password </div> </td> </tr> <tr> <td align="right" valign="top"><b><font size="3">Humanity Check:</font></b><br> </td> <td valign="top"> <div id="captchadiv"></div> </td> </tr> <tr> <td></td> <td> <div class="g-recaptcha" data-sitekey="6LesURsUAAAAAHzSNrNezPAUoiWt9dhBfgbdLodV"></div> <button class="g-recaptcha" data-sitekey="6LesURsUAAAAAHzSNrNezPAUoiWt9dhBfgbdLodV" data-callback="submitForm" > Submit </button> </td> </tr> </table> </form> <script src="https://www.google.com/recaptcha/api.js" async defer> </script> <? include_once('includes/footer.php'); include_once('includes/appBottom.php'); ?>