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

Link to comment
Share on other sites

<?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
Share on other sites

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
Share on other sites

<?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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.