Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- * Created by PhpStorm.
- * User: root
- * Date: 31/03/16
- * Time: 00:38
- */
- require "../ConfigDB/DBenv.php";
- class Auth
- {
- private $username;
- private $password;
- private $email;
- /**
- *
- */
- public function register()
- {
- $this->username = $_POST['Username'];
- $this->password = $_POST['Password'];
- $this->email = $_POST['Email'];
- echo $this->username;
- echo $this->password;
- echo $this->email;
- $this->username = mysql_real_escape_string($this->username);
- $this->password = mysql_real_escape_string($this->password);
- $mysql = "SELECT * FROM Users WHERE username = $this->username";
- $query = Mysql_query($mysql);
- $count = mysql_num_rows($query);
- if($count==0){
- echo "you can register";
- $this->insert();
- }else{
- echo"you are allready registerd";
- }
- }
- public function insert(){
- if(mysql_query("INSERT INTO Users ('Username', 'Password', 'Email')VALUES ('$this->username', '$this->password', '$this->email')")){
- echo "registerd";
- }
- else
- {
- echo "not registerd";
- }
- }
- /*close class Auth*/
- }
- $obj = new Auth();
- var_dump($obj);
- if(isset($_POST['Register']))
- {
- $obj->register();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement