cloaking

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
gilliepit
Forum Newbie
Posts: 9
Joined: Sat Oct 12, 2002 12:52 pm
Location: usa.sc.cola
Contact:

cloaking

Post by gilliepit »

I've been looking for a while now for some sort of cloaking script so that I can finish hacking up my 404 :)

I am redirecting with JavaScript out of my 404, I pass in the URI through the query string.. but I want to eliminate the new file name and whathaveyou.. any suggestions?

Looks a little something like this after redirected from the 404...

http://www.site.com/error_handler.php?r ... erequested

and I want it to look like..

http://www.site.com/foldernamerequested

What am I trying to do, you ask? -- make it look like a bagillion folders exist that really don't.

Am I going about this the wrong way?
User avatar
mydimension
Moderator
Posts: 531
Joined: Tue Apr 23, 2002 6:00 pm
Location: Lowell, MA USA
Contact:

Post by mydimension »

this is possible but not using client side tools. you can use the Apache module ModRewrite provided your host has it and allows you to use it. aside from that im not sure how else you might accomplish it.
crazyjimsmith
Forum Commoner
Posts: 28
Joined: Sat Jan 11, 2003 1:46 pm
Location: Sydney
Contact:

Cloaking Database

Post by crazyjimsmith »

<?
/*This is a link cloaker that require a database. Database name must be given and the table name needs to be redirects
*/

$db_name = "linkcloak";
$table_name = "redirects";
$pathstring = getenv("HTTP_HOST") == "localhost" ? getenv("PATH_INFO") : $PHP_SELF ;

$id = $id;

$connection = mysql_connect("localhost", "linkcloak","")
or die("Couldn`t connect.");

$db = mysql_select_db($db_name, $connection) or die("Couldn`t select database.");

$sql = "SELECT id, address FROM $table_name";
$sql .= " WHERE id = " . $id . ";";

$result = mysql_query($sql,$connection) or die("Couldn`t execute query.");

while ($row = @mysql_fetch_array($result))
{
$id = $row["id"];
$address = $row["address"];
}

print "<HTML><HEAD>\n";
print "<SCRIPT language=\"JavaScript1.1
\">\n";
print "<!--\n";
print "location.replace(\"".$address."\");\n";
print "//-->\n";
print "</SCRIPT>\n";
print "<NOSCRIPT>\n";
print "<META http-equiv=\"Refresh\"content=\"0;URL=".$address."\">\n";
print "</NOSCRIPT>\n";
print "</HEAD>\n";
print "<BODY>\n";
print "Click <A href=\"".$address."\">here</A> to continue.\n";
print "</BODY>\n";
print "</HTML>\n";
?>

I found it somewhere. Don't ask me how it works. You have to make your database and insert the links you want cloacked. I think they are referenced by the id.
User avatar
mydimension
Moderator
Posts: 531
Joined: Tue Apr 23, 2002 6:00 pm
Location: Lowell, MA USA
Contact:

Post by mydimension »

probably should have updated this but we resolved this privately.
Post Reply