Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // Connection details
- $servername = "YOUR_SERVER_NAME E.G. WWW.BRAZZERS.COM";
- $user = "YOUR_DATABASE_USERNAME";
- $password = "YOUR_DATABASE_PASSWORD";
- $dbname = "THE_NAME_OF_THE_DATABASE";
- // Your data variables, you can have as many as you want.
- $timetemp = $_GET ['time']; // The total time ran
- $exptemp = $_GET ['exp']; // The total EXP gained
- $nametemp = $_GET ['name']; // The username of the botter.
- $premium = $_GET ['premium']; // "YES" if the user is premium, "NO" if they are using the free script
- // Variable conn is used to determine the new mysql connection for above data
- // If you are running this script off the same webserver that the database is stored on, the servername can be NULL.
- $conn = mysqli_connect ($servername, $user, $password, $dbname );
- // Checking if the connection is valid, if not, killing the process and throwing a error message
- if ($conn->connect_error) {
- die ( "Connection failed: " . $conn->connect_error );
- }
- if (mysqli_connect_errno ()) {
- echo "Failed to connect to the mySQL server ";
- die ();
- }
- $setResult = mysqli_query ( $conn, "SELECT * FROM Data WHERE Username='$nametemp'" ); // Selects all fields from the Data table, based on the username supplied
- if ($setResult) {
- /*
- If the Table already contains some data for this user,
- it will instead ADD the new data onto the old data, then insert it back into the table.
- */
- $resultArray = mysqli_fetch_row($setResult);
- $time = $resultArray[1];
- $exp = $resultArray[2];
- $exp2 = $exp + $exptemp;
- $time2 = $time + $timetemp;
- // Query for inserting the wanted data into the mysql - Where Data is the table name
- $sql = "REPLACE INTO Data (Username, timeran, expgained, premium)
- VALUES ('$nametemp', '$time2',' $exp2', '$premium')";
- if (mysqli_query ( $conn, $sql )) {
- echo "Recorded Data";
- } else {
- echo "Error: " . $sql . "<br>" . mysqli_error ( $conn );
- }
- } else{ // If there is currently no user data, it will insert a fresh sample.
- $sql = "INSERT INTO Data (Username, timeran, expgained, premium)
- VALUES ('$nametemp', '$timetemp',' $exptemp', '$premium')";
- if (mysqli_query ( $conn, $sql )) {
- echo "Recorded new Data";
- } else {
- echo "Error: " . $sql . "<br>" . mysqli_error ( $conn );
- }
- }
- $conn->close ();
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement