473,806 Members | 2,583 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

MySQL pingback code help needed

1 New Member
I am not very good with MySQL server side scripts. So any help would be awesome! My database info is as follows:

Expand|Select|Wrap|Line Numbers
  1.  <?php
  2. define('DB_HOST', 'pingback.db.5645640.hostedresource.com');
  3. define('DB_USER', 'pingback');
  4. define('DB_PASSWORD', 'Wind**p1');
  5. define('DB_DATABASE', 'pingback');
  6. ?>
This is how my sql is setup:
http://i52.tinypic.com/2lsv19t.jpg

And under ultrapoints is were the points are stored. I don't know if that will help you with the code or not.

Now below is that code I am suppose to use to have my site listen for payment wall to send a pinkback or callback to my site.

Where // Give credits to user I am suppose to make my own code with the database connect thing using the info above... Please help!!
Expand|Select|Wrap|Line Numbers
  1.  <?php
  2.  
  3. define('SECRET', '1b229e***d5f8c***ab5a0ac****');
  4. define('CREDIT_TYPE_CHARGEBACK', 2);
  5.  
  6. $ipsWhitelist = array(
  7. '174.36.92.186',
  8. '174.36.96.66',
  9. '174.36.92.187',
  10. '174.36.92.192',
  11. '174.37.14.28'
  12. );
  13.  
  14. $userId = isset($_GET['uid']) ? $_GET['uid'] : null;
  15. $credits = isset($_GET['currency']) ? $_GET['currency'] : null;
  16. $type = isset($_GET['type']) ? $_GET['type'] : null;
  17. $refId = isset($_GET['ref']) ? $_GET['ref'] : null;
  18. $signature = isset($_GET['sig']) ? $_GET['sig'] : null;
  19.  
  20. $result = false;
  21.  
  22. if (!empty($userId) && !empty($credits) && isset($type) && !empty($refId) && !empty($signature)) {
  23.  
  24. $signatureParams = array(
  25. 'uid' => $userId,
  26. 'currency' => $credits,
  27. 'type' => $type,
  28. 'ref' => $refId
  29. );
  30.  
  31. $signatureCalculated = generateSignature($signatureParams, SECRET);
  32.  
  33. // check if IP is in whitelist and if signature matches
  34. if (in_array($_SERVER['REMOTE_ADDR'], $ipsWhitelist) && ($signature == $signatureCalculated)) {
  35.  
  36. $result = true;
  37.  
  38. if ($type == CREDIT_TYPE_CHARGEBACK) {
  39.  
  40. // Deduct credits from user
  41. // This is optional, but we recommend this type of crediting to be implemented as well
  42. // Note that currency amount sent for chargeback is negative, e.g. -5, so be caferul about the sign
  43. // Don’t deduct negative number, otherwise user will get credits instead of losing them
  44.  
  45. }
  46. else {
  47.  
  48. // Give credits to user
  49.  
  50. }
  51. }
  52. }
  53.  
  54. if ($result) {
  55. echo 'It works';
  56. }
  57.  
  58. function generateSignature($params, $secret) {
  59. $str = '';
  60.  
  61. foreach ($params as $k=>$v) {
  62. $str .= "$k=$v";
  63. }
  64. $str .= $secret;
  65.  
  66. return md5($str);
  67. }
  68. ?>
Mar 29 '11 #1
1 2973
code green
1,726 Recognized Expert Top Contributor
code help needed
Is not really a question and from the code posted I can't work out what you are trying to do.
So please define the problem and ask a specific question.
Mar 30 '11 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

0
6011
by: Kenneth Illingsworth | last post by:
I cannot seem to find this in the MYSQL Reference. Are there other places = I should check? The message text in my log started out with 'You have...'. = But, it was truncated and I could not see the rest. It occurred on a = submitted insert statement originating in an application. The insert = statement works ok directly on the MySQL server. The ODBC connector = performs its function in the application without any errors.=20 Thanks in...
0
4562
by: Kenneth Illingsworth | last post by:
--=_603E7359.5B3A569C Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Content-Disposition: inline I suspect that this is some kind of issue with privileges. However, the = account I am using has been given 'ALL' privileges to the database I am = trying to insert to. Am I save to assume that ALL includes insert = privileges?
0
2988
by: Kenneth Illingsworth | last post by:
--=_603E7359.5B3A569C Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Content-Disposition: inline I suspect that this is some kind of issue with privileges. However, the = account I am using has been given 'ALL' privileges to the database I am = trying to insert to. Am I save to assume that ALL includes insert = privileges?
1
1443
by: tread | last post by:
Objective: The primary table I loaded into MySql has 2.5 MM records: ID, Ticker, Date, Price; and all works well. My need is to write a QUERY to export outfile?) multiple text files. For example, I have 6 years worth of data, and need to generate 1 file per day that contains all the Tickers and Prices for that day. Furthermore, I need the text file name to be the name of the date (e.g. April 4, 1998 with 1000 Tickers & Prices would result...
1
1587
by: Shilpa | last post by:
Hi All, I need C# code needed to open the windows "Open with" dialog Regards, Shilpa
5
2535
by: bromio | last post by:
can someone help me to make code for digital clock using AT89S52. The specs of clock are 12 hour clock,am-pm display,use timer interrupts to have delay.two external inputs to adjust hours and minutes,use 4 digit hex display multiplexing.
0
1498
by: ultradiv | last post by:
I have a VB.NET application partly built that produces an xml output (just a file at present) I have a .NET webserver and SQLserver 2000 I need to be able to send the xml to the webserver/database (some crunching is needed before the data is stored) The database (stored proc.) will reply with several small pieces of data which need to be sent back to the client app. I am thinking that all of this could be accomplished in one call to a...
3
4283
by: manigattani | last post by:
Please let me know of some java code for converting dbf file to text file
1
1664
by: janetopps | last post by:
I receive this error in an asp login page. I recently transferred my data from Access to MySQL and have to sort out a few glitches in the code. I know i need to change the TOP 1 to a limit but i cant get it right. Could someone show me what i need to put in the line of code beginning SQL.... This is the error i get Microsoft OLE DB Provider for ODBC Drivers error '80040e14' You have an error in your SQL syntax; check the...
1
2689
by: raamay | last post by:
I want to run the mysql generated dump values of a database through a textarea in php. I am copying the whole dump code in a textarea and then let the php run the entire code. But here the problem is that the unwanted tags or lines like the mysql comments needs to be ignored and only the actual sql queries should run. How do i do it? May be this is not very clear. Well, i have a database which needs to be updated in every 3 or 6 months for...
0
9719
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9598
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10373
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9192
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7650
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6877
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5546
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5683
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
3010
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.