Jump to content

Filtering


tommr

Recommended Posts

I have a form and script that is used to collect information from users.

There is one field that is url.

There is one field that is email.

 

I want to filter out scripts.  I also only want to allow url in the url field and email in the email field.

 

Is there an easy way to filter?  I have tried several pieces of code to no avail.

 

<?php
$root = $_SERVER['DOCUMENT_ROOT'];
include('/home/arts/public_html/shows/includes/config.db.php');
if ($link)
{
  foreach ($_POST as $k => $v)
  {
    if (($k == "start_date") || ($k == "end_date") || ($k == "application_dead"))
  {
  $varray = explode("/",$v);
  $v = $varray[2] . "-" .  $varray[0] . "-" . $varray[1];  
  }
   
  $v = "'" . addslashes($v) . "'";
  
      
  if($k != "captcha_code") 
{
  
$keys[] = $k;
$vals[] = $v;
} 
  }
  
  $fields = implode(",", $keys);  
  $values = implode(",", $vals);
  //$fields = "id," . $fields;
  //$values = "null," . $values;  

  $sql = "INSERT into craft_shows ($fields) VALUES ($values)";  
  
  $result = mysql_query($sql,$link);
if (!$result) {
    die('There was a problem with your submission. Refresh the page to try again');
}
else
{
  echo "Thank you for your submission.<br>";
  echo "<a href=\"http://www.artsandcraftsnetwork.com/shows/\">Back to shows</a><br>";
  echo "<a href=\"http://www.artsandcraftsnetwork.com/shows/shows_submit.php\">Submit another show</a>";
}

  	
}
?>

 

 

Link to comment
https://forums.phpfreaks.com/topic/226680-filtering/
Share on other sites

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.