1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

[Please Help] Collecting data.

Discussion in 'BlackHat Lounge' started by bornformoney, Nov 23, 2011.

  1. bornformoney

    bornformoney BANNED BANNED

    Joined:
    Feb 22, 2011
    Messages:
    1,192
    Likes Received:
    1,516
    So, I am trying to collect data using an html form, but after the user clicks "submit", I want it to either appear in my email or have it on my server.

    I think it's the PHP 'get' function, but not too sure about it.

    Can anybody help me out or have an example I can use? Thanks.
     
  2. scraper1

    scraper1 Regular Member

    Joined:
    May 28, 2011
    Messages:
    214
    Likes Received:
    207
    Location:
    Kontiki
    Home Page:
    For example, if you have this form:
    Code:
    <form action="post.php" method="post">
    	First name:<input type="text" name="firstname"/>
    	Last name:<input type="text" name="lastname" />
    	E-mail:<input type="text" name="email" />
    	<input type="submit" value="Submit" />
    </form>
    When the user submits his info, the varibles firstname, lastname, email are sent using POST requests to the post.php script.
    In post.php you can have:
    Code:
    $EmailFrom = "[email protected]";
    $EmailTo = "[email protected]";
    $Subject = "New whatever";
    $FirstName = Trim(stripslashes($_POST['firstname'])); 
    $LastName = Trim(stripslashes($_POST['lastname']));
    $NewUserEmail = Trim(stripslashes($_POST['email']));
    $Body = "New user: ".$FirstName." ".$LastName." with email ".$NewUserEmail;
    then you use the mail function to send a new email to your email address:
    Code:
    $success = mail($EmailTo, $Subject, $Body, "From: <$EmailFrom>");
    
    // redirect to success page 
    if ($success){
      print "<meta http-equiv=\"refresh\" content=\"0;URL=http://www.yourwebsite.com\">";
    }
    else{
      print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">";
    }
    Hope this makes sense to you.
     
    • Thanks Thanks x 2