header redirect problems? please help


Posted on 16th Feb 2014 07:03 pm by admin

Ok i am making a site that generates youtube thumbnails and i am generating an image that displays 1 image with a playbutton image on top of it

here is the page that generates the image:
http://jnerocorp.com/playbutton.php?id=J7VjUYGpsWM

and that works fine

but this requires that I get the id in this code which if ?id= is not set then it redirects and sets it and then that link will work but i am getting a redirection error

the url is here:
http://jnerocorp.com/youtube.php
here is the code:
Code: <?php

if(isset($_GET['url'])) {

$original = $_GET['url'];
$youtubelink = $_GET['url'];
$youtubelink = str_replace("http://", "", "$youtubelink");
$youtubelink = str_replace("www.", "", "$youtubelink");
$get_id = explode("/", $youtubelink);
$get_id = explode("&", $get_id[1]);
$get_id = str_replace("watch?v=", "", "".$get_id[0]."");

$thumbnail_default = str_replace("%id%", "$get_id", "http://img.youtube.com/vi/%id%/default.jpg");
$thumbnail_1 = str_replace("%id%", "$get_id", "http://img.youtube.com/vi/%id%/1.jpg");
$thumbnail_2 = str_replace("%id%", "$get_id", "http://img.youtube.com/vi/%id%/2.jpg");
$thumbnail_3 = str_replace("%id%", "$get_id", "http://img.youtube.com/vi/%id%/3.jpg");

$image = str_replace("%id%", "$get_id", "http://img.youtube.com/vi/%id%/0.jpg");


if(!isset($_GET['id'])) {
header("Location: http://www.JneroCorp.com/youtube.php?url=$original&?id=$get_id");
}

}


?>
<html>
<head>
<title> Youtube Thumbnail grabber </title>
<style type="text/css">
div.thumbs
{
position:absolute;
left:5px;
top:20px;
}

div.video
{
position:absolute;
left:400px;
top: 150px;
}

div.bigimage
{
position:absolute;
left: 850px;
top: 150px;
border: 1px;
}
</style>
</head>
<body>
<center>
<h1> Youtube Thumbnail Grabber </h1>
</center>
<?php
if(!isset($_GET['url'])) {
?>
<center>
<form action="" method="GET">
URL: <input type="text" name="url" size="35">

<input type="submit" value="Get Thumbnail!">
</form>
</center>
<?php
} else {

echo "<div class='thumbs'>Youtube Video ID: <b> $get_id <b>

Thumbails::


Default:
<img src='$thumbnail_default'>


Thumbnail 1:
<img src='$thumbnail_1'>


Thumbnail 2:
<img src='$thumbnail_2'>


Thumbnail 3:
<img src='$thumbnail_3'>

";

if(isset($_GET['id'])) {
$id = $_GET['id'];

echo "PlayButton Thumb:
<img src='http://JneroCorp.com/playbutton.php?id=$id'></div> ";
}

?>
<div class='video'>
<object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/<?php echo $get_id; ?>&hl=en_US&fs=1&"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/<?php echo $get_id; ?>&hl=en_US&fs=1&" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"></embed></object>
</div>

<?php echo "<div class='bigimage'><img src='$image'></div>"; ?>

<?php
}
?>

</body>
</html>

No comments posted yet

Your Answer:

Login to answer
83 Like 29 Dislike
Previous forums Next forums
Other forums

email CODING Problem
Email coding problem.

I need to send a section of the info to $tf and the same as a Cc to $em

Checking if field is empty AND using !is_numeric
Hi lads,

Need to be able to display an error message (using isset?) that says "Cant lea

Displaying an image using echo command
I had done a query on my database, one of the fields being an image reference to a directory where a

Not capturing all the information we require in the form.......
Hi Guys,

I was wondering if you would share some more of your knowledge today, I'm hoping it

urldecode question
How would I format this line of code properly?

<?php echo urldecode($_GET['Title']); ?

Packet Design
Hi All,
Im new about network programming and I want to design a protocol but I have some question

simplexml and xpath - Need some help
Hello,

I am trying to parse an xml which comes back from Amazon and I am trying to know how m

Execure stored procedure on a timer
Can someone tell me an easier way to execute a stored procedure on a timer? I am using Oracle 10g R

Click counter to ignore traffic from search bots
I have a click counter on my site that...well, counts the number of clicks a link gets on the frontp

Passing vars to the DB
I have 3 small testing tables:

ID TYPE
1 pepperoni
2 C. bacon
3 taco

ID TY

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash