if ($_SERVER["REQUEST_METHOD"] == "POST") { $full_name=trim($_POST['fullname']); $user_id=trim($_POST['username']); $password=trim($_POST['password']); $pass=md5($password); $c_password=trim($_POST['confirmpassword']); $comp_name=trim($_POST['companyname']); $designation=trim($_POST['designation']); $comp_address=trim($_POST['companyaddress']); $telephone=trim($_POST['telephone']); $country=trim($_POST['country']); $email=trim($_POST['email']); include("connection.php"); if(!$db) { http_response_code(401); echo '
Connection problem. Please try again.
'; exit; } $date_array = getdate(); $dat=$date_array['year']."-".$date_array['mon']."-".$date_array['mday']; //echo $dat; $ip = getenv('HTTP_CLIENT_IP')?: getenv('HTTP_X_FORWARDED_FOR')?: getenv('HTTP_X_FORWARDED')?: getenv('HTTP_FORWARDED_FOR')?: getenv('HTTP_FORWARDED')?: getenv('REMOTE_ADDR'); //echo $ip; //$ip='192.44.55.0'; $query='INSERT INTO user_detail values(" ","'.$dat.'","'.$user_id.'","'.$pass.'","'.$full_name.'","'.$comp_name.'","'.$designation.'","'.$comp_address.'","'.$telephone.'"," ","'.$country.'","'.$email.'",0,"'.$ip.'")'; //echo $query; $result = mysqli_query($connection, $query); $user_detail_id=mysqli_insert_id($connection);//echo $user_detail_id; if($user_detail_id==0) { http_response_code(402); echo 'Connection problem. Please try again.
'; exit; } else { $app_link="Click approve to approve the registration"; $message="USER INFORMATION | |
User Name | $user_id |
Password | $password |
Full Name | $full_name |
Company Name | $comp_name |
Designation | $designation |
Company Address | $comp_address |
Telephone | $telephone |
Country | $country |
$app_link
"; $subject="Teofila User Registration, Encryption id=".$ip; //echo $subject; $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $headers .= 'From: '.$email. "\r\n"; $formsent=mail("info@teofila.com",$subject,$message,$headers); if($formsent) { http_response_code(200); echo '
Thank You! Registration is successfull.
'; } else { # Set a 500 (internal server error) response code. http_response_code(500); echo 'Oops! Something went wrong, please try again.
'; } } } else { # Not a POST request, set a 403 (forbidden) response code. http_response_code(403); echo 'There was a problem with your submission, please try again.
'; } ?>