473,378 Members | 1,522 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Problems with PayPal Payments

133 100+
Hi,

I am trying to set up so that users on my site can pay to upgrade there account. What i thought would work but does not seem to be is this:

Expand|Select|Wrap|Line Numbers
  1. <input type="hidden" name="return" value="http://www.web.com/upgrade-account-process.php?id={$sessionid}">
Then in the upgradeaccount-process.php i have done:

[PHP]
if (isset($_GET['type'])){

$sdate = date("Y-m-d");

$query = mysql_query("UPDATE `users` SET type='1', sdate='$sdate' WHERE id = '$_GET[id]'");

header("Location: members.php"); /* Redirect browser */
exit();

}
[/PHP]

But when i tried this it does not upgrade, have i done something wrong?

Cheers,
Adam
Apr 4 '08 #1
4 1444
Markus
6,050 Expert 4TB
[PHP]
if (isset($_GET['type'])){

$sdate = date("Y-m-d");

$query = mysql_query("UPDATE `users` SET type='1', sdate='$sdate' WHERE id = '$_GET[id]'");

header("Location: members.php"); /* Redirect browser */
exit();

}
[/PHP]

That ^ will only execute if $_GET['type'] is found - and by looking at the url you pass, it doesn't contain a type=

regards.
Apr 4 '08 #2
coolsti
310 100+
There could be many reasons why this does not work. Are you connecting to the database somewhere?

But more importantly, you are developing very dangerous and insecure code here!!!!

You should never place the input from a $_GET or $_POST array directly into an SQL query statement!

A malicious user could easilly enter as a $_GET value something that will do something very unnice if your statement is carried out.

Always validate and properly filter any variable that can come from the user before using it in a query statement (or anything else that can be executed for that matter).

Steve, Denmark
Apr 4 '08 #3
adamjblakey
133 100+
Sorry there is a type there as i posted an old version of the URL.
Apr 4 '08 #4
coolsti
310 100+
By the way, here is something that may help you with problems like this.

When I cannot get PHP run queries to work I debug with the following procedure:

Firstly, I open a mysql console to the database and try typing in (copy and pasting) the query into the console to see if the query works or if I get some sort of mysql error. Of course I substitute any PHP variables with actual values when I do this.

Secondly, I add echo statements to my code to find out why things may not be working. You can do an

echo $query . "<br>";

to see what the actual query statement is that you are submitting.

You can also look in the PHP documentation under mysql functions for a function that gives you information on what happened during the query and then echo the output of the function to the page, e.g. using echo statements. This will give you information on any errors, any warning, on how many rows were affected by the query, etc. You will also find out if for some reason you are not connecting to the database properly.

This should be sufficient for you to debug the problem.

Steve, Denmark
Apr 4 '08 #5

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

Similar topics

0
by: Kev T | last post by:
Hi, OK Bare with me.New to php and trying to figure this out I trying to do the follwing. I have apage with a checkbox.. It posts to a new page to allow a user to make a paypal order. If...
3
by: John Buchmann | last post by:
I know this is kind of off topic, but i am thinking of integrating it in my asp.net site... My question is: If someone buys something from my site (using Paypal), and they are NOT a registered...
7
by: Alan Silver | last post by:
Hello, I've just been looking at the free PayPal component from ComponentOne and am somewhat amazed how insecure it is. They include all the transaction details in plain text in the querystring,...
5
by: Jason James | last post by:
Guys, it seems that several people have enquired about how to communicate with Paypal as securely as possible. It is obvious that placing the shopping cart details in the URL is about as...
0
tolkienarda
by: tolkienarda | last post by:
hi all most of you have seen this form, mostly it has hidden attributes some of which can be changed to select boxes. the part that seems to be a security flaw is that people can edit live html...
4
by: Charles | last post by:
We want to provide to hotel guests in a number of hotels gateway/ISP services. Which Paypal suites this type of transaction that require irrevocable confirmation. The guest wants to go onto...
1
by: empiresolutions | last post by:
I'm looking for a PHP class scripts to work with Paypal's Website Payments Pro API. The API itself is massive so im looking for some pre-developed free/pay PHP software. I have tried PHPpayPalPro...
3
by: samatair | last post by:
Has anyone done website payments pro direct payments (recurring) with pay pal? I need to implement the same in my server. Could anyone help in this regard? I need to know whether I need to...
3
Jezternz
by: Jezternz | last post by:
Hey, I would like to use credit card payments or/and paypal payments, to activate something on my website. ie. A user is sent to a page and pays (via cc or pp) and once the money is accepted the...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.