Simple Database Operations

Simple Database Operations
Included is a ZIP file with 3 files:

callback.php – main script
jos_alphasuserpoints.sql – The database containing the table in question
op-log.txt – the log file

It is simple database and php operations script in which simple logic will be used to manipulate a database table. The database in question is bigger then one table, but this is the only table that should concern you.

A third party server is going to send a string of data to this script in the the following form:

SUCCESS: Fulfillment: http://myserver.com/callback.php?snuid=FSM-ADMIN&affl=test&currency=1234&id=my_unique_id&verifier=alphanum_string Response: GET 200 OK(

!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”

html xmlns=”http://www.w3.org/1999/xhtml” xml:lang=”en-gb” lang=”en-gb” dir=)

This will be where you come in. The script contains more details in comments. Here is the main part. This is simple database table querying and manipulation. Most of the work has been done, and you should only concern yourself with the following, taken from the script.

//INSERT LOGIC TO CREDIT POINTS TO USERS

//MUST COMPARE SERVER SENT VARIABLE ‘snuid’ AND ALL TABLE FIELDS ‘referreid’

//IF A MATCH EXISTS PROCEED. IF NO MATCH IS DETECTED THE SCRIPT MUST END WITH ‘Callback Validation Failure’

//WITH THE DATABASE MATCH THE SCRIPT MUST THEN GET THE DATA FOR ‘points’ IN THAT ‘referreid’ ROW

//IT MUST THEN ADD THE SERVER SENT VARIABLE ‘currency’ AND TABLE DATA FOR ‘points’

//THEN IT MUST REPLACE ‘points’ IN THE MATCHED ‘referreid’ TABLE ROW WITH THE NEW CALCULATED VALUE

//FINALLY THIS PART OF THE SCRIPT MUST END AND THE DATABASE CLOSED.

//SCRIPT FUNCTIONS
mysql_connect($host,$user,$password);

//SELECT THE DB
mysql_select_db($db) or die( “Unable to select database”);

//DATABASE OPERATION PREP

//CLOSE MySQL
mysql_close();

//THIS IS WHERE THE MOST IMPORTANT PART OF THE SCRIPT SHOULD BE, WHERE YOU WILL CODE THE ABOVE LOGIC

//END INSERT LOGIC TO CREDIT POINTS TO USERS. YOU ARE DONE:) EASY

Serious bids and fluent English speakers only please. I know this is not complicated. I am just not advanced enough to do it. I do understand the logic though.

Leave a Reply

Your email address will not be published. Required fields are marked *