From b1381b40302ad1594b0c501f92b3a30eaaa2685f Mon Sep 17 00:00:00 2001 From: jaydeep123s <132106205+jaydeep123s@users.noreply.github.com> Date: Mon, 15 Jul 2024 02:58:37 +0530 Subject: [PATCH] Update register.php --- register.php | 408 +++++++++++++++++++++++++-------------------------- 1 file changed, 203 insertions(+), 205 deletions(-) diff --git a/register.php b/register.php index 122b202..1fcc2bb 100644 --- a/register.php +++ b/register.php @@ -1,209 +1,207 @@ + + + + + + Registration Page - BodhiVivah.com + + + + +
+ - - .pga { width: 100%;} - - - - + if(isset($_POST['email'], $_POST['name'], $_POST['password'], $_POST['city'], $_POST['mob_no'], $_POST['subscribe'])) { + $email = $_POST['email']; + $name = $_POST['name']; + $password = $_POST['password']; + $city = $_POST['city']; + $mob_no = $_POST['mob_no']; + $profile = $_POST['relation']; + $gender = $_POST['sex']; + $religion = $_POST['religion']; + $dob = $_POST['dob']; + $state = $_POST['state']; + + $errors = array(); + + // Validation checks + if(empty($email) || empty($name) || empty($password) || empty($city) || empty($mob_no) || empty($profile) || + empty($gender) || empty($religion) || empty($dob) || empty($state)) { + $errors[] = 'All fields are required'; + } else { + if(filter_var($email, FILTER_VALIDATE_EMAIL) === false) { + $errors[] = 'Email address is not valid'; + } + if(strlen($email) > 255 || strlen($name) > 35 || strlen($city) > 35) { + $errors[] = 'One or more fields contain too many characters'; + } + if(user_exists($email)) { + $errors[] = 'That email has already been registered'; + } + if (!preg_match("/^[a-zA-Z ]*$/", $name)) { + $errors[] = "Only letters and white space allowed in name"; + } + if (!preg_match("/^[a-zA-Z ]*$/", $city)) { + $errors[] = "Only letters and white space allowed in city name"; + } + if (!preg_match("/^[0-9 ]*$/", $mob_no)) { + $errors[] = "Only numbers allowed in mobile number"; + } + } - -
- + // Display errors if any + if(!empty($errors)) { + echo ''; + } else { + // Registration successful + $register = user_register($profile, $name, $gender, $dob, $religion, $city, $state, $mob_no, $email, $password); + if($register !== 0) { + $_SESSION['user_id'] = $register; + header('Location: index.php'); + exit(); + } + } + } + ?> + +
+
+
    +

    Take the 1st step to your happy marriage! Register FREE!

    +
  • + +
  • +
  • + +
  • +
  • + Male + Female +
  • +
  • + +
  • +
  • + +
  • +
  • + +
  • +
  • + +
  • +
  • + +
  • +
  • +
  • +
+
+
-255 || strlen($email)>35 || strlen($email)>35) - { - $errors[]='One or more fields contains too many characters'; - } - if(user_exists($email)== true) - { - $errors[]='That email has already been registered'; - } - if (!preg_match("/^[a-zA-Z ]*$/",$name)) - { - $errors[] = "Only letters and white space allowed in name"; - } - if (!preg_match("/^[a-zA-Z ]*$/",$city)) - { - $errors[] = "Only letters and white space allowed in city name"; - } - if (!preg_match("/^[0-9 ]*$/",$mob_no)) - { - $errors[] = "Only letters and white space allowed in mobile number"; - } - } - if(!empty($errors)) - { - foreach($errors as $error) - { - echo $error,'
'; - } - } - else - { - //echo $profile,$name,$gender,$day,$month,$year,$religion,$city,$state,$mob_no,$email; - $register = user_register($profile,$name,$gender,$dob,$religion,$city,$state,$mob_no,$email,$password); - if($register !== 0) - $_SESSION['user_id'] = $register; - //echo $_SESSION['user_id']; - //echo $register; - header('Location: index.php'); - //exit(); - } -} -?> - -
-
-
-
    -

    Take the 1st step to your happy marriage! Register FREE!

    -
  • - -
  • -
  • -
  • - Male - Female
  • -
  • -
  • -
  • -
  • -
  • -
  • -
  • -
  • -
  • -
  • -
  • -
  • -
  • -
  • -

  • - -
-
-
- - -
- \ No newline at end of file + +
+ +