Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- include_once('assets/inc/db_login.inc');
- session_start();
- function sql_entry($user,$pass,$phone,$points){
- //do not touch anything beyond this part
- $conn = mysqli_connect(DB_HOST,DB_USERNAME,DB_PASSWORD,DB_NAME);
- //error catcher for connection failure
- if($conn->connect_error){
- die("Connection failed: " . $conn->connect_error);
- }
- date_default_timezone_set('America/Chicago');
- //grabs the time
- $time = date('H:i:s');
- //$time = $time->format();
- $date = date('Y-m-d');
- //$date = $date->format();
- //clean themmmmmm!
- $clean_user = mysqli_real_escape_string($conn, $user);
- $clean_pass = mysqli_real_escape_string($conn, $pass);
- $clean_phone = mysqli_real_escape_string($conn, $phone);
- $clean_points = mysqli_real_escape_string($conn, $points);
- //prepare queries
- $verification = "SELECT * FROM ".DB_TBL."WHERE phone =".$clean_phone;
- $verification_result = mysqli_query($conn,$verification); //run query to validate user
- $count = mysqli_num_rows($verification_result); //
- //error catcher for non-existing username or wrong user/pass
- if($count < 1){
- $account_registration = "INSERT INTO ".DB_TBL." (username,password,register_date,phone,points,notes) VALUES ('$clean_user','$clean_pass','$date','$clean_phone','$clean_points','')";
- $registration_result = mysqli_query($conn,$account_registration);
- mysqli_close($conn);
- return 1;
- }
- else
- mysqli_close($conn);
- return 0;
- }
- //here's the other variables for login (all are correct, i have triple checked them already countless times)
- <?php
- define ("DB_HOST", "127.0.0.1");
- define ("DB_USERNAME", "root");
- define ("DB_PASSWORD", "ragnarok");
- define ("DB_NAME", "houseofvbi");
- define ("DB_TBL", "users");
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement