View Single Post
Old 10-18-2008, 04:59 PM   #35 (permalink)
sketchMedia
The Prestige
Advanced Programmer Top Contributor Good Samaritan 
 
sketchMedia's Avatar
 
Join Date: Oct 2007
Location: Manchester, UK
Posts: 854
Thanks: 32
sketchMedia is on a distinguished road
Default

PHP Code:
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.";
    } else {
        
        if(
preg_match('~^http://(?:[a-z]{2,3}\.)?youtube\.com/\?v=([\w-]+)~i'$url)) {

            
$sql "INSERT IGNORE INTO `upload` (`link`) VALUES('$url')";

            
mysql_query($sql) or die(mysql_error());

            if(!
mysql_affected_rows()) {
                echo 
'Link already exists';
            } else {
                echo 
'Your link was added to the database';
            }
            
        } else {
            echo 
'Your link was invalid or malformed';
        }
    }
} 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>";

Try that and see what it outputs.
__________________
mysql> SELECT * FROM `users` WHERE `users`.`clue` > 0;
Empty set (0.00 sec)
sketchMedia is offline  
Reply With Quote
The Following User Says Thank You to sketchMedia For This Useful Post:
codefreek (10-18-2008)