Log in

View Full Version : ]need help urgent][$GET, If, else]



dj30324
10-09-2009, 10:27 PM
<?php

$v = $_GET["v"];



$url = "http://www.megavideo.com/?$v="."$v";


$soubor = file_get_contents("$url");


preg_match("/<embed src=\"http:\/\/www.megavideo.com\/v\/$v(.*)\" type=\"application\/x-shockwave-flash/i", $soubor, $tag_contents);
$obrazek = $tag_contents[1];
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> preview player </TITLE>
</HEAD>

<BODY bgcolor="white" style="margin:0;">
<TABLE cellpadding="0" cellspacing="0" width="100%" height="100%">
<TR>
<TD valign="middle" align="center">
<object width="100%" height="100%" data="http://wwwstatic.megavideo.com/mv_player.swf?image=http://img1.megavideo.com/<?php echo $obrazek; ?>.jpg&userid=cookie&v=<?php echo $v; ?>+++" id="video" type="application/x-shockwave-flash"><param name="allowFullScreen" value="true"><param name="wmode" value="transparent"><param name="allowscriptaccess" value="never"><param name="allowNetworking" value="internal"><param name="movie" value="http://wwwstatic.megavideo.com/mv_player.swf?image=http://img1.megavideo.com/<?php echo $obrazek; ?>.jpg&userid=cookie&v=<?php echo $v; ?>+++"></object>
</TD>

</TR>
</TABLE>

</BODY>
</HTML>

above is this script of mv, what i am trying to do is as you know mv has both query string like both ?v= ?d=

i need some help, as you can see right now i already have ?v=4KY6SVFL working fine but i want to add some thing like when ever i use ?v= or ?d=, as soon as i excute one of this , i want to do this in php

<object width="100%" height="100%" data="http://wwwstatic.megavideo.com/mv_player.swf?image=http://img1.megavideo.com/<?php echo $obrazek; ?>.jpg&userid=cookie&v=<?php echo $v; ?>+++" id="video" type="application/x-shockwave-flash"><param name="allowFullScreen" value="true"><param name="wmode" value="transparent"><param name="allowscriptaccess" value="never"><param name="allowNetworking" value="internal"><param name="movie" value="http://wwwstatic.megavideo.com/mv_player.swf?image=http://img1.megavideo.com/<?php echo $obrazek; ?>.jpg&userid=cookie&v=<?php echo $v; ?>+++"></object>
i want this to change in php look at the object
userid=cookie&v=<?php echo $v; ?>
so when i excute ?d= i want that v to change to d

right now i am using v as default so can some help out their help how do i do this in php i did try yo add if end if but it doesn't help at all. some 1 please help me i want to for if $_GET[v] else $_GET[d] i did try this but doesnt work i need help.

dj30324
10-11-2009, 05:02 AM
if any 1 knows how to do it in any way plz help me i dont care how u do it just need help!

djr33
10-11-2009, 05:05 PM
It's really hard to understand what you wrote. Breaking apart your sentences will help.

Based on what I think you're looking for, it isn't that difficult.


<?php
if (isset($_GET['d'])) { $v = $_GET['d']; } //set $v to the SECONDARY value
if (isset($_GET['v'])) { $v = $_GET['v']; } //set $v to primary value
//now $v is not set if neither was sent, or
//d if only d was sent, or
//v if only v or both v and d were sent
//.......
//if you want to avoid errors if no value is sent, add this at the top, before the ifs above:
$v = ''; //defaults it to an empty string
//.......
echo $v;
?>