Jnerocorp Posted November 29, 2009 Share Posted November 29, 2009 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: <?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"><br> <input type="submit" value="Get Thumbnail!"> </form> </center> <?php } else { echo "<div class='thumbs'>Youtube Video ID: <b> $get_id <b> <br> Thumbails::<br> <br> Default:<br> <img src='$thumbnail_default'> <br> Thumbnail 1: <br> <img src='$thumbnail_1'> <br> Thumbnail 2: <br> <img src='$thumbnail_2'> <br> Thumbnail 3: <br> <img src='$thumbnail_3'> <br> "; if(isset($_GET['id'])) { $id = $_GET['id']; echo "PlayButton Thumb: <br> <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> -John Link to comment https://forums.phpfreaks.com/topic/183257-header-redirect-problems-please-help/ Share on other sites More sharing options...
abazoskib Posted November 29, 2009 Share Posted November 29, 2009 i just tested it with a url and i didnt see any errors. Link to comment https://forums.phpfreaks.com/topic/183257-header-redirect-problems-please-help/#findComment-967348 Share on other sites More sharing options...
Jnerocorp Posted November 29, 2009 Author Share Posted November 29, 2009 sorry i was messing with the codes trying to fix it I tried using a meta refresh but now it just constantly refreshes non stop even though i use this code: if(!isset($_GET['id'])) { //Checks if ID is note if not continue to redirect to url with set id ?> <META http-equiv="refresh" content="0;URL=http://www.JneroCorp.com/youtube.php?url=<?php echo $original; ?>&?id=<?php echo $get_id; ?>"> <?php //Code above redirects to the same page but with ?id= set } -John Link to comment https://forums.phpfreaks.com/topic/183257-header-redirect-problems-please-help/#findComment-967471 Share on other sites More sharing options...
MisterWebz Posted November 29, 2009 Share Posted November 29, 2009 Could you cut the meta refresh code out for a second? I can't quite understand the error. Link to comment https://forums.phpfreaks.com/topic/183257-header-redirect-problems-please-help/#findComment-967504 Share on other sites More sharing options...
Jnerocorp Posted November 29, 2009 Author Share Posted November 29, 2009 If i cut it out there is no errors thats the problem but i need it to redirect to that url with youtube.php?id=idhere set but it just keeps refreshing the page over and over again when you visit the url http://jnerocorp.com/youtube.php and you type in a url -John Link to comment https://forums.phpfreaks.com/topic/183257-header-redirect-problems-please-help/#findComment-967519 Share on other sites More sharing options...
mrMarcus Posted November 29, 2009 Share Posted November 29, 2009 forget about <meta> refresh. you have an extra ? in your URL: Location: http://www.JneroCorp.com/youtube.php?url=$original&?id=$get_id ...$original&?id=... Link to comment https://forums.phpfreaks.com/topic/183257-header-redirect-problems-please-help/#findComment-967520 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.