meaning of the code

Discussion in 'PHP' started by rrn, Mar 1, 2009.

  1. #1
    while (list($k, $v) = each($_POST))
    {
    if(eregi("subs_",$k)) {
    if ($set != "")
    $set .= " , ";
    $set .= " `$k`='$v'";
    }
    }

    wat does this line of code means?
    pls giv a solution..
     
    rrn, Mar 1, 2009 IP
  2. gapz101

    gapz101 Well-Known Member

    Messages:
    524
    Likes Received:
    8
    Best Answers:
    2
    Trophy Points:
    150
    #2
    reads contents of $_POST, then store to $set variable like: , `test`='testing' , `x`='2'
    if error, declare $set='' before while clause
     
    gapz101, Mar 2, 2009 IP
  3. rrn

    rrn Peon

    Messages:
    54
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    thank u..

    i have a php page for sending mails..
    whenever i send a mail from the page.. i receive 2 or 3 times the same email in my id..
    y is it so? pls help me to solve this..
     
    rrn, Mar 2, 2009 IP
  4. gapz101

    gapz101 Well-Known Member

    Messages:
    524
    Likes Received:
    8
    Best Answers:
    2
    Trophy Points:
    150
    #4
    the mail code might have be inside a loop
     
    gapz101, Mar 2, 2009 IP
  5. rrn

    rrn Peon

    Messages:
    54
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    thank u...

    tried commenting the loop..but no use..

    this is the code that is sending email..
    wats wrong in this code???
    pls help..
     
    rrn, Mar 2, 2009 IP
  6. SmallPotatoes

    SmallPotatoes Peon

    Messages:
    1,321
    Likes Received:
    41
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Just to let you know, as it is written, your form will be located by bots and they will use it to send millions of spam emails.

    Since you don't filter newlines from $_POST['subs_name'] and $_POST['subs_email'], the bots will be able to stuff cc: lines and custom content into emails.

    This may result in you losing your hosting account.

    Please be careful with anything that makes it into an email header. You must filter out dangerous characters or you will have problems, it's only a question of how long it takes the bots to find you.
     
    SmallPotatoes, Mar 2, 2009 IP
  7. rrn

    rrn Peon

    Messages:
    54
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    thank u for the information..

    i am new to php... and a beginner..

    can u pls explain how can i apply it in the code? , the one that u explained above..

    thank u...
     
    rrn, Mar 3, 2009 IP