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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.