Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- //// usually dbconnect.php situated in /includes/dbconnect.php
- $dbhost = 'localhost';
- $dbuser = 'xxxxxx';
- $dbpass = 'xxxxxx';
- $dbname = "xxxxxx";
- $conn = mysqli_connect($dbhost, $dbuser, $dbpass, $dbname);
- if(! $conn ) {
- die('Could not connect: ' . mysql_error());
- }else{
- echo "connected";
- }
- // End of file
- // create_user.php situated at /create_user.php
- if (empty($_POST)=== FALSE){
- $myusername = $_POST['myusername'];
- $mypassword = $_POST['mypassword'];
- if($mypassword !== $_POST['mypassword_check']){
- echo "Passwords do not match.";
- }
- else{
- $sql = "INSERT INTO users(user_email, user_pass, active) VALUES ('$myusername', '$mypassword', '1')";
- $retval = mysqli_query( $conn, $sql );
- if($retval){
- echo "New record created successfully";
- } else {
- echo "Error: " . $sql . "<br>" . mysqli_error($conn);
- }
- }
- }else{
- echo "How did you even get here?";
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement