954,587 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Header location php (help)

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.

arjani10
Newbie Poster
24 posts since Apr 2011
Reputation Points: 10
Solved Threads: 0
 

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.

cwarn23
Occupation: Genius
Team Colleague
3,033 posts since Sep 2007
Reputation Points: 413
Solved Threads: 259
 

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

arjani10
Newbie Poster
24 posts since Apr 2011
Reputation Points: 10
Solved Threads: 0
 

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.

arjani10
Newbie Poster
24 posts since Apr 2011
Reputation Points: 10
Solved Threads: 0
 

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.

cwarn23
Occupation: Genius
Team Colleague
3,033 posts since Sep 2007
Reputation Points: 413
Solved Threads: 259
 

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

arjani10
Newbie Poster
24 posts since Apr 2011
Reputation Points: 10
Solved Threads: 0
 


Try the following:

<?php echo 'http://mysite.com/header.php?id='.$id; ?>
cwarn23
Occupation: Genius
Team Colleague
3,033 posts since Sep 2007
Reputation Points: 413
Solved Threads: 259
 

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

arjani10
Newbie Poster
24 posts since Apr 2011
Reputation Points: 10
Solved Threads: 0
 


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>
cwarn23
Occupation: Genius
Team Colleague
3,033 posts since Sep 2007
Reputation Points: 413
Solved Threads: 259
 

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

urlencode(base64_encode


is impossible?

arjani10
Newbie Poster
24 posts since Apr 2011
Reputation Points: 10
Solved Threads: 0
 

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?

cwarn23
Occupation: Genius
Team Colleague
3,033 posts since Sep 2007
Reputation Points: 413
Solved Threads: 259
 

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.

arjani10
Newbie Poster
24 posts since Apr 2011
Reputation Points: 10
Solved Threads: 0
 


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

cwarn23
Occupation: Genius
Team Colleague
3,033 posts since Sep 2007
Reputation Points: 413
Solved Threads: 259
 

Ok that code is an embed vlc player


that link i need protect encrypt.

arjani10
Newbie Poster
24 posts since Apr 2011
Reputation Points: 10
Solved Threads: 0
 


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 '">';
cwarn23
Occupation: Genius
Team Colleague
3,033 posts since Sep 2007
Reputation Points: 413
Solved Threads: 259
 

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>
arjani10
Newbie Poster
24 posts since Apr 2011
Reputation Points: 10
Solved Threads: 0
 

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

arjani10
Newbie Poster
24 posts since Apr 2011
Reputation Points: 10
Solved Threads: 0
 

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.

arjani10
Newbie Poster
24 posts since Apr 2011
Reputation Points: 10
Solved Threads: 0
 

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 :)');
}
cwarn23
Occupation: Genius
Team Colleague
3,033 posts since Sep 2007
Reputation Points: 413
Solved Threads: 259
 
<?php
header("location:/path/?id=".$_GET['id']);
?>
happytogether
Junior Poster in Training
84 posts since Mar 2011
Reputation Points: 16
Solved Threads: 14
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
 
View similar articles that have also been tagged: