php and wordpress

Discussion in 'Web Design and Development' started by Captain Xarzu, Sep 6, 2010.

  1. Captain Xarzu macrumors newbie

    Captain Xarzu

    Joined:
    Dec 27, 2007
    #1
    I have a question about referrals for my wordpress blog. This might be more of a PHP question than a wordpress question. After I manage to add the field to the sign-up page where the user can add a referral ID, how do I add the functionality where that referral ID can be inserted automatically in the sign-in page? I know that in PHP you can add strings at the end of a URL like?this or like?this=that but how does one make sure that this translates to a string being added to a field in the web page?
     
  2. ezkimo macrumors regular

    Joined:
    Sep 12, 2002
    #2
    http://www.example.com?referralID=ABCDEF
    <input type="text" value="<? echo $_GET['referralID']; ?>" />
     
  3. DJBenE macrumors member

    Joined:
    Jul 9, 2010
    Location:
    Rowland Heights, California
    #3
    And that easily your website just got powned. ALWAYS, ALWAYS, ALWAYS sanitize your variables!!!

    <input type="text" value="<?php echo htmlentities($_GET['referralID']); ?>" />

    If you're going to use the variable with a mysql database, be sure to escape the string before use:
    PHP:
    $refID mysql_real_escape_string($_GET['referralID']);
     

Share This Page