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 Link to comment https://forums.phpfreaks.com/topic/162807-solved-automaticly-delete-parts-of-a-query/ 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); ?> Link to comment https://forums.phpfreaks.com/topic/162807-solved-automaticly-delete-parts-of-a-query/#findComment-859101 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? Link to comment https://forums.phpfreaks.com/topic/162807-solved-automaticly-delete-parts-of-a-query/#findComment-859104 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). Link to comment https://forums.phpfreaks.com/topic/162807-solved-automaticly-delete-parts-of-a-query/#findComment-859107 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> Link to comment https://forums.phpfreaks.com/topic/162807-solved-automaticly-delete-parts-of-a-query/#findComment-859112 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> Link to comment https://forums.phpfreaks.com/topic/162807-solved-automaticly-delete-parts-of-a-query/#findComment-859119 Share on other sites More sharing options...
ugly-wan Posted June 18, 2009 Author Share Posted June 18, 2009 Thanks mate ;D Link to comment https://forums.phpfreaks.com/topic/162807-solved-automaticly-delete-parts-of-a-query/#findComment-859123 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.