[siteorigin_widget class=”Thim_Heading_Widget”][/siteorigin_widget]
The following are the possible callbacks – SELECTING single data from MySQL database.
- “Success” – User inputs and database value corresponds.
- “Incorrect” – User password is incorrect.
- “Unknown” – Username not available to the database.
- “Failed” – Failed to connect to the database.
- “Error” – User authentication is not valid.
<?php //Variables for Authentication. $server_key = "defaultkey123"; $server_auth = $_POST["serverKeycode"]; if($server_auth == $server_key) { //Variables for SQL Server. $server_mainname = $_POST["serverMainName"]; $server_username = $_POST["serverUsername"]; $server_password = $_POST["serverPassword"]; $server_database = $_POST["serverDatabase"]; //Established the connection to the mySQL server. $connection = new mysqli($server_mainname, $server_username, $server_password, $server_database); if($connection) { //Variables for userdatabase. $username = $_POST["check_username"]; $password = $_POST["check_password"]; //Check data to the database. $sql = "SELECT password FROM userinfo WHERE username = '".$username."' "; $result = mysqli_query($connection, $sql); if($result) { if(mysqli_num_rows($result) > 0) { while($row = mysqli_fetch_assoc($result)) { if($row['password'] == $password) { echo("Success"); } else { echo("Incorrect"); } } } else { echo("Unknown"); } } else { echo("Failed"); } } else { die("Coonection Failed.".mysql_connect_error()); echo("Failed"); } } else { echo("Error"); } ?>
[siteorigin_widget class=”Thim_Heading_Widget”][/siteorigin_widget]
The following are the possible callbacks – INSERTING single data from MySQL database.
- “Success” – Successfully adding inputs to the database.
- “Existed” – Username existed from the database
- “Failed” – Failed adding inputs to the database.
- “Error” – User authentication is not valid.
<?php //Variables for Authentication. $server_key = "defaultkey123"; $server_auth = $_POST["serverKeycode"]; if($server_auth == $server_key) { //Variables for SQL Server. $server_mainname = $_POST["serverMainName"]; $server_username = $_POST["serverUsername"]; $server_password = $_POST["serverPassword"]; $server_database = $_POST["serverDatabase"]; //Established the connection to the mySQL server. $connection = new mysqli($server_mainname, $server_username, $server_password, $server_database); if($connection) { //Variables for userdatabase. $username = $_POST["set_username"]; $password = $_POST["set_password"]; $email = $_POST["set_email"]; $firstname = $_POST["set_firstname"]; $lastname = $_POST["set_lastname"]; $gender = $_POST["set_gender"]; $age = $_POST["set_age"]; //Getting data from the database. $sqlCheck = "SELECT identity FROM userinfo WHERE username = '".$username."' "; $resultCheck = mysqli_query($connection, $sqlCheck); if($resultCheck) { if(mysqli_num_rows($resultCheck) < 1) { //Insert data to the database. $sqlSet = "INSERT INTO userinfo (username, password, email, firstname, lastname, gender, age) VALUES('".$username."','".$password."','".$email."','".$firstname."','".$lastname."','".$gender."','".$age."')"; $resultSet = mysqli_query($connection, $sqlSet); if($resultSet) { echo("Success"); } else { echo("Failed"); } } else { echo("Existed"); } } else { echo("Failed"); } } else { die("Coonection Failed.".mysql_connect_error()); echo("Failed"); } } else { echo("Error"); } ?>
[siteorigin_widget class=”Thim_Heading_Widget”][/siteorigin_widget]
The following are the possible callbacks – SELECTING single/multiple data from MySQL database.
- “Success” – User inputs and database value corresponds.
- “Unknown” – User inputs not available to the database.
- “Failed” – Failed to connect to the database.
- “Error” – User authentication is not valid.
<?php //Variables for Authentication. $server_key = "defaultkey123"; $server_auth = $_POST["serverKeycode"]; if($server_auth == $server_key) { //Variables for SQL Server. $server_mainname = $_POST["serverMainName"]; $server_username = $_POST["serverUsername"]; $server_password = $_POST["serverPassword"]; $server_database = $_POST["serverDatabase"]; //Established the connection to the mySQL server. $connection = new mysqli($server_mainname, $server_username, $server_password, $server_database); if($connection) { //Variables for userdatabase. $username = $_POST["get_username"]; //Getting data from the database. $sql = "SELECT username, password, email, firstname, lastname, gender, age FROM userinfo WHERE username = '".$username."' "; $result = mysqli_query($connection, $sql); if($result) { if(mysqli_num_rows($result) > 0) { while($row = mysqli_fetch_assoc($result)) { echo "Success:".$row['username'].":".$row['password'].":".$row['email'].":".$row['firstname'].":".$row['lastname'].":".$row['gender'].":".$row['age'].""; } } else { echo("Unknown"); } } else { echo("Failed"); } } else { die("Coonection Failed.".mysql_connect_error()); echo("Failed"); } } else { echo("Error"); } //dns1.register.com ?>
[siteorigin_widget class=”Thim_Heading_Widget”][/siteorigin_widget]
The following are the possible callbacks – UPDATING single data from MySQL database.
- “Success” – Successfully adding inputs to the database.
- “Existed” – Username existed from the database
- “Failed” – Failed adding inputs to the database.
- “Error” – User authentication is not valid.
<?php //Variables for Authentication. $server_key = "defaultkey123"; $server_auth = $_POST["serverKeycode"]; if($server_auth == $server_key) { //Variables for SQL Server. $server_mainname = $_POST["serverMainName"]; $server_username = $_POST["serverUsername"]; $server_password = $_POST["serverPassword"]; $server_database = $_POST["serverDatabase"]; //Established the connection to the mySQL server. $connection = new mysqli($server_mainname, $server_username, $server_password, $server_database); if($connection) { //Variables for userdatabase. $identity = $_POST["update_identity"]; $username = $_POST["update_username"]; $password = $_POST["update_password"]; $email = $_POST["update_email"]; $firstname = $_POST["update_firstname"]; $lastname = $_POST["update_lastname"]; $gender = $_POST["update_gender"]; $age = $_POST["update_age"]; //Getting data from the database. $sqlCheck = "SELECT identity FROM userinfo WHERE identity = '".$identity."' "; $resultCheck = mysqli_query($connection, $sqlCheck); if($resultCheck) { if(mysqli_num_rows($resultCheck) > 0) { //Insert data to the database. $sqlUpdate = "UPDATE userinfo SET username = '".$username."', password = '".$password."', email = '".$email."', firstname = '".$firstname."', lastname = '".$lastname."', gender = '".$gender."', age = '".$age."' WHERE identity = '".$identity."' "; $resultUpdate = mysqli_query($connection, $sqlUpdate); if($resultUpdate) { echo("Success"); } else { echo("Failed"); } } else { echo("Unknown"); } } else { echo("Failed"); } } else { die("Coonection Failed.".mysql_connect_error()); echo("Failed"); } } else { echo("Error"); } ?>
[siteorigin_widget class=”Thim_Heading_Widget”][/siteorigin_widget]
The following are the possible callbacks – SELECTING multiple data rows from MySQL database.
- “Success” – User inputs and database value corresponds.
- “Unknown” – User inputs not available to the database.
- “Failed” – Failed to connect to the database.
- “Error” – User authentication is not valid.
<?php //Variables for Authentication. $server_key = "defaultkey123"; $server_auth = $_POST["serverKeycode"]; if($server_auth == $server_key) { //Variables for SQL Server. $server_mainname = $_POST["serverMainName"]; $server_username = $_POST["serverUsername"]; $server_password = $_POST["serverPassword"]; $server_database = $_POST["serverDatabase"]; //Established the connection to the mySQL server. $connection = new mysqli($server_mainname, $server_username, $server_password, $server_database); if($connection) { //Check data to the database. $sql = "SELECT identity, username, password, email, firstname, lastname, gender, age FROM userinfo"; $result = mysqli_query($connection, $sql); if($result) { if(mysqli_num_rows($result) > 0) { while($row = mysqli_fetch_assoc($result)) { echo "\n" .$row['identity'].":" .$row['username'].":" .$row['password'].":" .$row['email'].":" .$row['firstname'].":" .$row['lastname'].":" .$row['gender'].":" .$row['age'].""; } } else { echo("Unknown"); } } else { echo("Failed"); } } else { die("Coonection Failed.".mysql_connect_error()); echo("Failed"); } } else { echo("Error"); } ?>
[siteorigin_widget class=”Thim_Heading_Widget”][/siteorigin_widget]
The following are the possible callbacks – DELETING single data from MySQL database.
- “Success” – Successfully adding inputs to the database.
- “Existed” – Username existed from the database
- “Failed” – Failed adding inputs to the database.
- “Error” – User authentication is not valid.
<?php //Variables for Authentication. $server_key = "defaultkey123"; $server_auth = $_POST["serverKeycode"]; if($server_auth == $server_key) { //Variables for SQL Server. $server_mainname = $_POST["serverMainName"]; $server_username = $_POST["serverUsername"]; $server_password = $_POST["serverPassword"]; $server_database = $_POST["serverDatabase"]; //Established the connection to the mySQL server. $connection = new mysqli($server_mainname, $server_username, $server_password, $server_database); if($connection) { //Variables for userdatabase. $identity = $_POST["delete_identity"]; //Getting data from the database. $sqlCheck = "SELECT identity FROM userinfo WHERE identity = '".$identity."' "; $resultCheck = mysqli_query($connection, $sqlCheck); if($resultCheck) { $sqlDelete = "DELETE FROM `userinfo` WHERE identity = '".$identity."' "; $resultDelete = mysqli_query($connection, $sqlDelete); if($resultDelete) { echo("Success"); } else { echo("Failed!"); } } else { echo("Failed"); } } else { die("Coonection Failed.".mysql_connect_error()); echo("Failed"); } } else { echo("Error"); } ?>
No Comments