Results 1 to 8 of 8

Thread: Please help corect my php code

  1. #1
    Join Date
    Aug 2010
    Location
    Indonesia at Jakarta
    Posts
    23
    Thanks
    15
    Thanked 0 Times in 0 Posts

    Default Please help corect my php code

    the issue is resolved
    Last edited by xaverius; 10-17-2011 at 08:59 PM. Reason: the issue is resolved

  2. #2
    Join Date
    Apr 2008
    Location
    So.Cal
    Posts
    3,643
    Thanks
    63
    Thanked 516 Times in 502 Posts
    Blog Entries
    5

    Default

    use the forum [.php.] tags to make your code more readable.

    the variable names you use in your email template do not match the names you assign to the form values:
    PHP Code:
    $emailField $_POST['email'];
    $bankField $_POST['bank'];
    $rekeningField $_POST['rekening'];
    $namaField $_POST['nama'];
    $gameField $_POST['game'];

    $body = <<<EOD
    <br><hr><br>
    Email: 
    $email <br>
    Lokasi: 
    $bank <br>
    Rekening: 
    $rekening <br>
    Nama: 
    $nama<br>
    Game: 
    $game <br>
    EOD; 
    for example, $_POST['bank'] is assigned to $bankField, but later, you try to use $bank.

    in addition, you need to sanitize user input before sending it to your email. Since your email is being sent with a text/html mime type, a malicious user could send some javascript or an image tag inside their message, which could be executed when you read the email (depending on your email client settings). You should use something like strip_tags() on every form field before putting them in the email.

  3. The Following User Says Thank You to traq For This Useful Post:

    xaverius (10-13-2011)

  4. #3
    Join Date
    Aug 2010
    Location
    Indonesia at Jakarta
    Posts
    23
    Thanks
    15
    Thanked 0 Times in 0 Posts

    Default

    the issue is resolved
    Last edited by xaverius; 10-17-2011 at 08:57 PM. Reason: the issue is resolved

  5. #4
    Join Date
    Aug 2010
    Location
    Indonesia at Jakarta
    Posts
    23
    Thanks
    15
    Thanked 0 Times in 0 Posts

    Default

    the issue is resolved
    Last edited by xaverius; 10-17-2011 at 08:57 PM. Reason: the issue is resolved

  6. #5
    Join Date
    Aug 2010
    Location
    Indonesia at Jakarta
    Posts
    23
    Thanks
    15
    Thanked 0 Times in 0 Posts

    Default

    the issue is resolved
    Last edited by xaverius; 10-17-2011 at 08:58 PM.

  7. #6
    Join Date
    Apr 2008
    Location
    So.Cal
    Posts
    3,643
    Thanks
    63
    Thanked 516 Times in 502 Posts
    Blog Entries
    5

    Default

    Quote Originally Posted by xaverius View Post
    I have tried to equalize between the form and the variable, but my email is still not working.
    You haven't changed them. for example:

    PHP Code:
    // name of variable holding form data: $bankField
    $bankField $_POST['bank']; 
    PHP Code:
    // name of variable used in email: $bank
    Bank$bank <br>
    // this variable is empty (actually, it is not even set), so there is no info in you email.
    // you must use the name you assigned to the value - random names will not work. 
    This problem exists with every variable you are using.

  8. The Following User Says Thank You to traq For This Useful Post:

    xaverius (10-14-2011)

  9. #7
    Join Date
    Aug 2010
    Location
    Indonesia at Jakarta
    Posts
    23
    Thanks
    15
    Thanked 0 Times in 0 Posts

    Default

    thanks for the explanation. The fault is I have to upload all my files first to hosting. Thanks for helping.

  10. #8
    Join Date
    Apr 2008
    Location
    So.Cal
    Posts
    3,643
    Thanks
    63
    Thanked 516 Times in 502 Posts
    Blog Entries
    5

    Default

    no problem. glad I could help

    If your question has been answered, please mark your thread "resolved":
    • On your original post (post #1), click [edit], then click [go advanced].
    • In the "thread prefix" box, select "Resolved". Click [save changes].

  11. The Following User Says Thank You to traq For This Useful Post:

    xaverius (10-17-2011)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •