Problems with PayPal Payments

Discussion in 'PHP' started by adamjblakey, Apr 4, 2008.

  1. #1
    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:

    <input type="hidden" name="return" value="http://www.web.com/upgrade-account-process.php?id={$sessionid}">
    Code (markup):
    Then in the upgradeaccount-process.php i have done:

    
    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
     
    adamjblakey, Apr 4, 2008 IP
  2. jayshah

    jayshah Peon

    Messages:
    1,126
    Likes Received:
    68
    Best Answers:
    1
    Trophy Points:
    0
    #2
    Hello,

    Check that you need to actually output PHP, not HTML:

    
    <input type="hidden" name="return" value="http://www.web.com/upgrade-account-process.php?id=<?=$sessionid;?>">
    
    PHP:
    Also, your SQL can suffer from injection* so, I'd add some mysql_real_escape_string in there.

    Jay

    * Depending on your PHP configuration (i.e. magic quotes).
     
    jayshah, Apr 4, 2008 IP
  3. raleagh

    raleagh Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    ($_GET['type']) should be ($_GET['return'])

    the isset condition can't see $_GET['type'] because there is none

    <input type="hidden" name="return" value="http://www.web.com/upgrade-account-process.php?id={$sessionid}">


    maybe

    sdate=".'$sdate'."
     
    raleagh, Apr 4, 2008 IP
  4. jayshah

    jayshah Peon

    Messages:
    1,126
    Likes Received:
    68
    Best Answers:
    1
    Trophy Points:
    0
    #4
    Incorrect. The MySQL Query is within double quotes, therefore variables are parsed. Also, your syntax is wrong as it would simply add $sdate, and not's it's value.

    Jay
     
    jayshah, Apr 4, 2008 IP
  5. Sygon

    Sygon Peon

    Messages:
    439
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    0
    #5
    <input type="hidden" name="return" value="http://www.web.com/upgrade-account-process.php?id=<? echo $sessionid;?>">
    PHP:
    Try that, also you should try using $_POST. and a proper form.
     
    Sygon, May 7, 2008 IP