Jump to content

make it where users can't put < or leave form blank?


A2xA

Recommended Posts

I wan't to make my form secure.  Which means no / or < or leave it blank.  You get my point.  Would it be best to add it to the code that the form is processing, or the actual form itself?  If you could point me to a tutorial I could also follow that.  I just couldn't find anything!  ;)

 

 

Form Code:

<form name="hubmove" action="taken out" method="post">

<h3>Step 1. Enter Hub ID or Name To Make Hub, Then Come Back And Proceed to Step 2<h3>
  <input name="dir" value="" type="text">

<INPUT TYPE="submit">
</form>

 

Processing code:

<html>
<?php

$dir = $_POST[dir];

mkdir("taken out", 0755);
chmod("taken out", 0777);  

?>
<h3> Click <a href="taken out">Here</a> to return back to hubs Complete Step 2. To Activate your Hubs<h3>
</html>

 

Thanks, I appreciate it!  I need to secure my stuff so I can release it.  This is the last step.  All who helps Thanks!  ;)

This will make sure they filled the dir out, and also strip any HTML tags.

 

<?php

//check if they filled it out
if ((!isset($_POST['dir'])) || (empty($_POST['dir'])){
   echo "You didn't fill the form out!";
} else {
   $dir = strip_tags($_POST['dir']);
}

?>

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.