Hello!I need help about this code

<? Header( "Location: http://mysite.info/video.php?id=myid" ); ?>

can someone help me please how to get id in that header?
i try this

<? Header( "Location: http://mysite.info/video.php?id=$id" ); ?>

but i get error in that code.Thank you in advance.

Recommended Answers

All 25 Replies

Well in future could you please post the error. But assuming that it's the error I think it is then you will need to do the following. First of all make sure the page starts with <?php instead of <? for compatibility reasons. Also make sure the header() function has a lower 'h'. Then most importantley of all make sure there is no html or browser output before the header function. The header function is one of the few special functions that can not be used after an echo or print statement due to the way php is designed. Hope that solves it.

Really genius like your ocupation (lol).thank you very mutch was that <?php string do it all error.

Something strange hapened when i embed and encode

<?php echo urlencode(base64_encode("http://mysite.com/header.php?id=$id")); ?>

i find an number 7 in the end of my link ,why happened this.Thanks for your time dedicated.

The code you have submitted contains the base64_encode() function which turns the string into an encrypted result. Then you have encoded it for url variable/$_GET[] input. So as that code stands it is very unreadable without the help of php to decode it. And that would be why a number 7 may occur on the displayed string. Also if it is after it is decoded you see the number 7 than that is what $id contains at time of encode.

Thanks cwarn23 ,what i have to put for that?have a solution for me please?.

Thanks this is working nice.This link for me is important, can i hide or encrypt it ?Best regard .

To hide it you could just delete that line or use css to hide it. For example:

<span style="display:none;"><?php echo 'http://mysite.com/header.php?id='.$id; ?></span>

Thank you for your time ,i mean to encrypt that link like before

urlencode(base64_encode

is impossible?

Thank you for your time ,i mean to encrypt that link like before

urlencode(base64_encode

is impossible?

Well that turns the link into a way that it cannot be clicked or read. I think what you are after is the apache mod rewrite. This will allow you to have all sorts of crazy url's using a .htaccess file. But it all depends how do you want the link to be displayed as?

i use that link into embed code i only want no body see the real link directly,all modes bu not direkt link see.Thanks again.

Is this code a javascript redirect or something because I need to see what context the link is used in for relevant encoding.

Well you could encode it with base64_encode then in your java or flash applet, edit the java/flash source so that it decodes the string upon receiving. So below is the php code but I'm not sure what the java or flash code would be.

echo '<param name="MRL" value="'
echo base64_encode('http://mysite.com/header.php?id='.$id);
echo '">';

This is my copmlet code that i use

<object id="vlc" codebase="http://downloads.videolan.org/pub/videolan/vlc/latest/win32/axvlc.cab#Version=0,8,6,0" classid="clsid:9BE31822-FDAD-461B-AD51-BE1D1C159921" width="500" height="400" events="True">
        <param name="AutoLoop" value="-1">
        <param name="AutoPlay" value="-1">
        <param name="ExtentWidth" value="11641">
        <param name="ExtentHeight" value="10371">
        <param name="MRL" value="<?php echo 'http://mysite.com/abc.php?id='.$id; ?>">
        <param name="Visible" value="0">
        <param name="Volume" value="90">
        <param name="StartTime" value="0">

		<param name="vlc2.jpg"> 
        <param name="BaseURL" value="http://www.mysite.com">
        <embed pluginspage="#" type="application/x-vlc-plugin" progid="VideoLAN.VLCPlugin.2" name="vlc" width="500" height="400" target="<?php echo 'http://mysite.com/abc.php?id='.$id; ?>" autoplay="true" loop="yes" volume="90"></embed>
      </object>

Can you please put the right php in example above?Thank you.

I have this error with that code Parse error: syntax error, unexpected T_ECHO, expecting ',' or ';' how can i fix that please.Thank you in advance.

As far as I can see the T_ECHO isn't comming from the piece of code you have posted. the error normally means there is a missing ; symbol near an echo statement.
Also if you don't want people to willing nilling to view abc.php then use the following code:

<?php session_start(); //line 1
$_SESSION['securityid']=dechex(microtime());
?><object id="vlc" codebase="http://downloads.videolan.org/pub/videolan/vlc/latest/win32/axvlc.cab#Version=0,8,6,0" classid="clsid:9BE31822-FDAD-461B-AD51-BE1D1C159921" width="500" height="400" events="True">
        <param name="AutoLoop" value="-1">
        <param name="AutoPlay" value="-1">
        <param name="ExtentWidth" value="11641">
        <param name="ExtentHeight" value="10371">
        <param name="MRL" value="<?php echo 'http://mysite.com/abc.php?id='.$id.'&sec='.$_SESSION['securityid']; ?>">
        <param name="Visible" value="0">
        <param name="Volume" value="90">
        <param name="StartTime" value="0">

		<param name="vlc2.jpg"> 
        <param name="BaseURL" value="http://www.mysite.com">
        <embed pluginspage="#" type="application/x-vlc-plugin" progid="VideoLAN.VLCPlugin.2" name="vlc" width="500" height="400" target="<?php echo 'http://mysite.com/abc.php?id='.$id.'&sec='.$_SESSION['securityid']; ?>" autoplay="true" loop="yes" volume="90"></embed>
      </object>

Then in abc.php place the following at the very top:

session_start();
if (!isset($_SESSION['securityid']) || !isset($_GET['sec']) || $_GET['sec']!==$_SESSION['securityid']) {
exit ('No hackers allowed. sorry :)');
}
<?php
header("location:/path/?id=".$_GET['id']);
?>

Thank you so mutch ,now i get this error for this code
Cannot send session cache limiter - headers already sent (output started at/mysite my.php on line 23..dont know what to do.

I use only 2 files header and another 1 when embed direkt header with id.Header had path and in embed get id for header and for embed too,get id in same time.that abc.php in embed is header .

Also note that when using the header(), session_start() and set_cookie() functions, you may not have any html or text output before the functions appearance. So according to the error you are receiving you have echoed something or put a white space before <?php causing the header function not to work properly.

Hello!My php is poor,i am sorry for that if is possible to have an example to do it please.I need encrypt that link in embed base64 or something more secure .Thank you guys.

Hello! can somebody tell me please how to do it run this header with no access direct?Thank you .i have 2 php files
1.

<?php  
session_start();
if (!isset($_SESSION['securityid']) || !isset($_GET['sec']) || $_GET['sec']!==$_SESSION['securityid']) {
exit ('No hackers allowed. sorry :)');}
header("location:http://path/video?id=".$_GET['id']); 
?>

2-this is my embed

<?php if($id = $_REQUEST['id']){ } ?>
<?php session_start(); //line 1
$_SESSION['securityid']=dechex(microtime());
?><object id="vlc" codebase="http://downloads.videolan.org/pub/videolan/vlc/latest/win32/axvlc.cab#Version=0,8,6,0" classid="clsid:9BE31822-FDAD-461B-AD51-BE1D1C159921" width="500" height="400" events="True">
        <param name="AutoLoop" value="-1">
        <param name="AutoPlay" value="-1">
        <param name="ExtentWidth" value="11641">
        <param name="ExtentHeight" value="10371">
        <param name="MRL" value="<?php echo 'header.php?id='.$id.'&sec='.$_SESSION['securityid']; ?>">
        <param name="Visible" value="0">
        <param name="Volume" value="90">
        <param name="StartTime" value="0">
        <param name="vlc2.jpg"> 
        <param name="BaseURL" value="http://www.mysite.com">
        <embed pluginspage="#" type="application/x-vlc-plugin" progid="VideoLAN.VLCPlugin.2" name="vlc" width="500" height="400" target="<?php echo 'header.php?id='.$id.'&sec='.$_SESSION['securityid']; ?>" autoplay="true" loop="yes" volume="90"></embed>
      </object>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.