ugly-wan Posted June 18, 2009 Share Posted June 18, 2009 Is there a way to delete every thing before a predefined character/s e.g http://www.youtube.com/watch?v=qNuRQmvykwk Every thing in red is deleted if it is entered in to video code <form action="youtube.php" method="get"> Video Code <input type="text" name="vc" /> Video Name <input type="text" name="name" /> <input type="submit" /> </form> I am new to php and don't know much Regards -Ollie Quote Link to comment Share on other sites More sharing options...
flyhoney Posted June 18, 2009 Share Posted June 18, 2009 <?php $url = 'http://www.youtube.com/watch?v=qNuRQmvykwk'; $new_url = str_replace('http://www.youtube.com/watch?v=', '', $url); ?> Quote Link to comment Share on other sites More sharing options...
ugly-wan Posted June 18, 2009 Author Share Posted June 18, 2009 <?php $url = 'http://www.youtube.com/watch?v=qNuRQmvykwk'; $new_url = str_replace('http://www.youtube.com/watch?v=', '', $url); ?> Thanks How would i implement that in to the script i provided? Quote Link to comment Share on other sites More sharing options...
flyhoney Posted June 18, 2009 Share Posted June 18, 2009 <?php $url = 'http://www.youtube.com/watch?v=qNuRQmvykwk'; $new_url = str_replace('http://www.youtube.com/watch?v=', '', $url); ?> Thanks How would i implement that in to the script i provided? The code you provided is actually HTML. I need to see the contents of youtube.php (which may partially be html). Quote Link to comment Share on other sites More sharing options...
ugly-wan Posted June 18, 2009 Author Share Posted June 18, 2009 Youtube.php <? if($_GET['vc']){$vc = $_GET['vc']; $name = $_GET['name'];}else{ die('YOU FUCKED IT UP RETARD');} ?> <head> <title><? print $name; ?> - On YouTube</title></head> <body bgcolor="#222222" text="#FFFFFF"> <center> <font color="#FFFFFF" size="5" face="Verdana"><center>Video Name - <? print $name; ?> <p> <object width="853" height="505"><param name="movie" value="http://www.youtube.com/v/<? print $vc; ?>&hl=en&fs=1&rel=0&hd=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/<? print $vc; ?>&hl=en&fs=1&rel=0&hd=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="853" height="505"></embed></object> </center></body> Quote Link to comment Share on other sites More sharing options...
flyhoney Posted June 18, 2009 Share Posted June 18, 2009 <?php if ($_GET['vc']) { $vc = $_GET['vc']; $vc = str_replace('http://www.youtube.com/watch?v=', '', $vc); $name = $_GET['name']; } else { die('YOU FUCKED IT UP RETARD'); } ?> <head> <title><?php echo $name ?> - On YouTube</title> </head> <body bgcolor="#222222" text="#FFFFFF"> <center> <font color="#FFFFFF" size="5" face="Verdana"> <center> Video Name - <?php echo $name ?> <p> <object width="853" height="505"> <param name="movie" value="http://www.youtube.com/v/<?php echo $vc ?>&hl=en&fs=1&rel=0&hd=1"></param> <param name="allowFullScreen" value="true"></param> <param name="allowscriptaccess" value="always"></param> <embed src="http://www.youtube.com/v/<?php echo $vc ?>&hl=en&fs=1&rel=0&hd=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="853" height="505"></embed> </object> </p> </center> </font> </center> </body> Quote Link to comment Share on other sites More sharing options...
ugly-wan Posted June 18, 2009 Author Share Posted June 18, 2009 Thanks mate ;D Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.