Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <body>
- <h1>User Creation</h1>
- <?php
- session_start();
- if($_SESSION['login'] !="OK")
- {
- header('Location:login.php');
- exit();
- }
- $new_user = $_POST["new_username"];
- $new_pass = $_POST["new_password"];
- if($new_user!=""&&$new_pass!="")
- {
- $host = "localhost";
- $admin_user ="username";
- $admin_pass ="user_password";
- $db="database_name";
- $conn = @mysql_connect($host,$admin_user,$admin_pass) or die ("Sorry - unable to connect to
- MYSQL database.");
- $rs = @mysql_select_db($db,$conn) or die ("error");
- $sql = "INSERT INTO table_name (username, password) VALUES ('$new_user', '$new_pass')";
- mysql_query($sql,$conn) or die ("User creation failed.");
- echo"<p>User created successfully.</p>";
- echo"<p>Return to <a href='protected.php'>application</a> or <a href='login.php'>log
- out</a></p>";
- }
- else
- header('Location: create_user.php');
- ?>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement