Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- $dbhost = '';
- $dbuser = '';
- $dbpass = '';
- $con=mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error Connection to MySQL');
- $dbname = 'a1059070_users';
- mysql_select_db($dbname);
- if($_POST['fun']=='signup')
- {
- $poke = new Homepage();
- $poke->signup();
- }
- else
- echo "Error in selecting function";
- class Homepage
- {
- var $username;
- var $pass1;
- var $pass2;
- var $email;
- var $timezone;
- var $agree1;
- var $agree2;
- function __construct()
- {
- $this->username = $_POST['username'];
- $this->pass1 = $_POST['pass1'];
- $this->pass2 = $_POST['pass2'];
- $this->email = $_POST['email'];
- $this->timezone = $_POST['timezone'];
- $this->agree1 = $_POST['agree1'];
- $this->agree2 = $_POST['agree2'];
- }
- function signup()
- {
- if($this->pass1 == $this->pass2 && $this->agree1 == 'on' && $this->agree2 == 'on')
- {
- $check1 = mysql_query("SELECT username FROM `users` WHERE username='$this->username'");
- $check2 = mysql_num_rows($check1);
- if($check2 > 0)
- {
- echo "Error, username has already been taken.";
- }
- else
- {
- mysql_query("INSERT INTO `users` (username, password, email, timezone) VALUES ('$this->username', '$this->pass1', '$this->email', '$this->timezone')")or die(mysql_error());
- echo "You have successfully signed up.";
- }
- }
- else
- {
- echo "Error. Did you fill the form out fully, and check the check boxes?";
- }
- }
- }
- ?>
Add Comment
Please, Sign In to add comment