Permalink
Find file
Fetching contributors…
Cannot retrieve contributors at this time
77 lines (64 sloc) 1.94 KB
<HTML>
<HEAD>
<TITLE>New Document</TITLE>
</HEAD>
<BODY>
<?php
$con = mysql_connect("localhost","root","");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("openspace", $con);
$act = $_POST['activities'];
$int = $_POST['interests'];
$mus = $_POST['music'];
$mov = $_POST['movies'];
$tel = $_POST['television'];
$id = $_POST['l_id'];
$boo = $_POST['books'];
$oth = $_POST['other_details_likes'];
if(!filter_var("$act", FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>"/^[a-zA-Z,.:]+$/"))))
{
echo " Activity is invalid";
die('Error ' . mysql_error());
}
if(!filter_var("$int", FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>"/^[a-zA-Z,.:]+$/"))))
{
echo " Interests is invalid";
die('Error ' . mysql_error());
}
if(!filter_var("$mus", FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>"/^[a-zA-Z,.:]+$/"))))
{
echo " Music is invalid";
die('Error ' . mysql_error());
}
if(!filter_var("$mov", FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>"/^[a-zA-Z,.:]+$/"))))
{
echo " Movies is invalid";
die('Error ' . mysql_error());
}
if(!filter_var("$tel", FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>"/^[a-zA-Z,.:]+$/"))))
{
echo " television is invalid";
die('Error ' . mysql_error());
}
if(!filter_var("$boo", FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>"/^[a-zA-Z,.:]+$/"))))
{
echo " books is invalid";
die('Error ' . mysql_error());
}
if(!filter_var("$oth", FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>"/^[a-zA-Z,.:]+$/"))))
{
echo " Other is invalid";
die('Error ' . mysql_error());
}
else
{
$query = "UPDATE `likes_interests` SET activities='$act',interests='$int',music='$mus',movies='$mov',television='$tel',books='$boo',other_details_likes='$oth' where l_id='$id'";
mysql_query($query);
echo mysql_affected_rows();
}
?>
</BODY>
</HTML>