public static function add_user() { $userEmail = $_POST['email']; $userPassword = $_POST['password']; $userFirstName = $_POST['firstName']; $userLastName = $_POST['lastName']; $User = new User($userEmail, $userPassword, $userFirstName, $userLastName); print_r($User); if (Auth::check_if_user_exists($User)) { header('Location: /public_html/register?message=user_exists'); } else { User::save_user($User); header('Location: /public_html/login?message=user_saved'); } }
public function signup() { $user = new User(); $user->name = $this->input("Name"); $user->email = $this->input("Email"); $user->phone_on = $this->input("Phone No."); $user->password = $this->input("Password"); do { $password = $this->input("Password Again"); if ($user->password != $password) { $user->password = $this->input("correct Password"); } } while ($user->password != $password); echo "\n\n********** Do u want to continue Signup (y/n) ***********\n\n"; $input = readLine(); if ($input === 'n' || $input === 'N') { return; } $user->save_user(); $this->profile($user); }
function display() { User::save_user(); // call function in parent class. // we can also do Subscriber::function_name(); echo "Name: " . $this->name . "<br>"; echo "Password: {$this->password} <br>"; echo "Phone: {$this->phone} <br>"; echo "Email: {$this->email} <br>"; }
<?php require_once './classes/user.php'; $obj = new User(); if (isset($_POST['btn'])) { $obj->save_user($_POST); } ?> <html> <head><title> Database Basic</title></head> <body> <form action="sign_up.php" method="post"> <table border="1"> <tr><td>Personal Information</td><td></td></tr> <tr> <td> First Name</td> <td> <input type="name" name="first_name" value="<?php if (isset($_POST['first_number'])) { echo htmlentities($_POST['first_name']); } ?> "/> </td> </tr> <tr> <td> Last Name</td> <td> <input type="name" name="last_name" value="<?php if (isset($_POST['last_name'])) {