Forum Moderators: coopster

Message Too Old, No Replies

Can someone convert this from ASP to PHP AND PERL?

         

MyBootDisks

5:15 pm on Aug 29, 2003 (gmt 0)

10+ Year Member




<%
If Mid(Request.ServerVariables("HTTP_REFERER"), 8, 3)="www" then

If Mid(Request.ServerVariables("HTTP_REFERER"), 12, 16)="site.com" then
%>
<!--#include file="file.asp" -->
<%
End If
ElseIf Mid(Request.ServerVariables("HTTP_REFERER"), 8, 16)="site.com" then
%>
<!--#include file="file.asp" -->
<%
Else
Response.write "Don't Work!"
End If
%>

file.asp


<%
Select case Request.QueryString("dl")
Case "1"
response.redirect "http://www.hotmail.com"
End Select
%>

This is what I have right now:

found the

- Server Varaibles:
<snip>
- IF Statement and Switch Statement for PHP...
<snip>

Now how do I TRIM or request a quantity of characters from the varaible?

Example: Mid(Request.ServerVariables("HTTP_REFERER"), 12, 16)

What that example will do it take the server varaible for HTTP_REFERER and return 16 characters, starting from the 12th character in the varaible.

[edited by: jatar_k at 5:18 pm (utc) on Sep. 5, 2003]
[edit reason] removed urls [/edit]

MyBootDisks

5:49 pm on Aug 29, 2003 (gmt 0)

10+ Year Member



OK. I think i got most of it.
But how do you redirect using PHP?

Here is what I got:

--------------------------------------------------------------------------------
<?

if ((substr($HTTP_REFERER, 8, 3)) == 'www')
{
if ((substr($HTTP_REFERER, 12, 16)) == 'webpromo-inc.com')
{include("file.php");}
}elseif
{if ((substr($HTTP_REFERER, 8, 16)) == 'webpromo-inc.com')
{include("file.php");}
}else
echo 'Don't Work!'
{

?>


--------------------------------------------------------------------------------

file.php

--------------------------------------------------------------------------------
<?php

switch ($_GET['dl'])
{
case '1';
echo 'works!';
break;
default:
echo 'can not find.';
}
?>

--------------------------------------------------------------------------------

Just need to get the redirect.

I haven't tested it yet...anyone see anything wrong with it?

san_garrafa

11:47 pm on Sep 4, 2003 (gmt 0)

10+ Year Member



To perform the redirect on file.php

<?php
switch ($_GET['dl'])
{
case '1': header("location: http://www.hotmail.com");
exit;
break;
default:
echo 'can not find.';
}
?>

Look at the examples and the user notes on the php docs for the header() function [php.com].