View Single Post
Old 10-18-2008, 03:36 PM   #32 (permalink)
codefreek
Super Moderator
Inquisitive 
 
codefreek's Avatar
 
Join Date: Sep 2007
Location: Near you.
Posts: 791
Thanks: 241
codefreek is on a distinguished road
Bug

i am not going with that just yet.

this is how the script is looking right now.
it wont take in i think it's something with the preg_match maybe
the two vars, don't know,
any ideas would be great.
Thank you!

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.";
        
        }
    
    else
    
        {
        
                
if(
preg_match('~^http://(?:[a-z]{2,3}\.)?youtube\.com/\?v=([\w-]+)~i'$url$id))    {
    
    echo 
$id[1]; // This is the ID.
    
$sql ="INSERT into upload (link) values(". (int) $id[1].")";
    
    
mysql_query($sql) or die(mysql_error());

    print 
"Link added!";
}

        else
         {
            print 
"Link is invalid or the link is already in are system!";   
        }
    }
}


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>";







include 
"watch.php";




?>
codefreek is offline  
Reply With Quote