View Single Post
Old 10-17-2008, 01:26 AM   #12 (permalink)
Wildhoney
La Vida es Sueño
Advanced Programmer Top Contributor 
 
Wildhoney's Avatar
 
Join Date: Sep 2007
Location: Oldham
Posts: 2,280
Thanks: 90
Wildhoney is on a distinguished road
Default

You don't have an else for if the link is invalid. That would be the reason for your blank page. Try this code:

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/watch\?v=.+$~i'$url))
        {
            
$url="INSERT into upload (link) values('$url')";
            
mysql_query($url) or die(mysql_error());
            print 
"Link added!";
        }
        else
        {
            print 
"Link is invalid";    
        }
    }
}
else
{
    print 
"<form action='YouTube.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>";

__________________
The man who comes back through the Door in the Wall will never be quite the same as the man who went out.
Send a message via AIM to Wildhoney Send a message via MSN to Wildhoney Send a message via Yahoo to Wildhoney
Wildhoney is offline  
Reply With Quote
The Following User Says Thank You to Wildhoney For This Useful Post:
codefreek (10-17-2008)