Jump to content

[SOLVED] automaticly delete parts of a query


ugly-wan

Recommended Posts

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

<?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).

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>

 

<?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>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.