Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- include('db.php');
- $action = $_GET['action'];
- $username = $con->real_escape_string($_GET['username']);
- $password = $con->real_escape_string($_GET['password']));
- if(!$action)
- {
- echo "Please enter an action.";
- }
- else
- {
- if($action == "register")
- {
- if($query = $con->query("INSERT INTO toolusers (username,password) VALUES ('$username','$password')"))
- {
- echo "1";
- }
- else
- {
- echo "0";
- }
- }
- else if($action == "login")
- {
- $query = $con->query("SELECT * FROM toolusers WHERE username = '$username' and password = '$password'");
- $cnt = $query->num_rows;
- if($cnt > 0)
- {
- echo "1";
- }
- else
- {
- echo "1";
- }
- }
- else
- {
- echo "Invalid action.";
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement