10-16-2008, 07:15 PM
|
#1 (permalink)
|
|
Super Moderator
Join Date: Sep 2007
Location: Near you.
Posts: 791
Thanks: 241
|
Small php error - Thank you in advance!
there is no error outputted but i know the problem is in the preg_match part. Some assistance would be great!
Thank you!
Rules for preg:match, and to blur for me to read ;)
PHP Code:
int preg_match ( string $pattern , string $subject [, array &$matches [, int $flags [, int $offset ]]] )
The script is small and might be ugly but it is only a practice run ;) so no flame :)
PHP Code:
<?php
error_reporting(E_ALL ^ E_NOTICE);
include "config.php";
if(isset($_POST['submit']))
{
$url=$_POST['url'];
if(strlen($url)<1)
{
print "You did not enter a URL.";
}
}
if (preg_match('~^http://[a-z]{2,3}\.youtube\.com/\?v=[\w-]+(?:&feature=related)?$~i','',$url)) {
$url="INSERT into upload (link) values('$url')";
mysql_query($url) or die(mysql_error());
print "Link added!";
}
else
{
print "<form action='index.php' method='post'>";
print "URL(include http://):<br>";
print "<input type='text' name='url' size='20'><br>";
print "<input type='submit' name='submit' value='submit'></form>";
}
?>
 Code;Freeek,. 
|
|
|
|