Discover Habbo's history
Treat yourself with a Secret Santa gift.... of a random Wiki page for you to start exploring Habbo's history!
Happy holidays!
Celebrate with us at Habbox on the hotel, on our Forum and right here!
Join Habbox!
One of us! One of us! Click here to see the roles you could take as part of the Habbox community!


Results 1 to 5 of 5
  1. #1
    Join Date
    Apr 2008
    Location
    Derby
    Posts
    4,668
    Tokens
    262

    Latest Awards:

    Default How can i make this more secure...

    Ok, So youve probably gathered im extremely new PHP, and ive come up with this php to email script form thing... I know nothing about security and how i can stop people from spamming or changing anything, so any tips would be grateful!

    Current code:
    PHP Code:
    <?php 
    if(isset($_POST['submit'])) {
    $to "[email protected]"
    $subject "Job Application"
    $name_field $_POST['name']; 
    $email_field $_POST['email']; 
    $message $_POST['message'];
    $sample $_POST['sample]'];
     
      
    $body "From: $name_field E-Mail: $email_field  Why: $message  Sample report: $sample"
      
    echo 
    "Application submitted!"
    mail($to$subject$body); 
    } else { 
    echo 
    "Failed! Try again soon!"

    ?>
    Thats the sendmail.php file
    HTML Code:
    <form method="POST" action="sendmail.php">
    Habbo name: <br />
       <input type="text" name="name" size="19"><br>
       <br>
       Email: <br />
       <input type="text" name="email" size="19"><br>
       <br>
       Why you want to work with Habben: <br />
       <textarea rows="9" name="message" cols="30"></textarea> <br />
       Sample report: <br />
       <textarea rows="9" name="sample" cols="30"></textarea>
       <br>
       <br>
       <input type="submit" value="Submit" name="submit">
    </form>
    Thats the obviously, extremely basic form lol,

    Now is there anyway i can add to it, how can i change the design of the form (Ive tried googling, come up with nothing!) and generally make it more secure to use!

    Thanks in advance,
    Callum
    Back for a while

  2. #2

    Default

    Well you could verify each individual input, so e.g. check if the email is valid, make sure the message is a certain length same with the sample. etc.

  3. #3
    Join Date
    Oct 2005
    Location
    Melbourne, Australia
    Posts
    7,554
    Tokens
    0

    Latest Awards:

    Default

    You could make a session with how many times they have sent the mail. So when they reach a certain limit (say 3 emails) they get sent to a page that says "email sent" even though it doesn't really send??

  4. #4
    Join Date
    May 2005
    Location
    San Francisco, CA
    Posts
    7,160
    Tokens
    2,331

    Latest Awards:

    Default

    Clean \r and \n from the inputs perhaps?

  5. #5
    Join Date
    Oct 2006
    Location
    Peterborough, UK
    Posts
    3,855
    Tokens
    216

    Latest Awards:

    Default

    The code isn't insecure to begin with there is no way to make it secure.


    visit my internet web site on the internet
    http://dong.engineer/
    it is just videos by bill wurtz videos you have been warned

Posting Permissions

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