PDA
Partners

View Full Version : quick code i came up with


heil
January 2nd, 2004, 04:22 PM
<?php

if ($site=="rpp"){ $url = "http://www.aol.com";
}
else if ($site == "rpp") { $url = "http://yahoo.com";
}
?>

<HTML><HEAD>
<TITLE>Title</TITLE></HEAD>
<FRAMESET rows="100%,*" border=0 frameborder=0 framespacing=0>
<FRAME SRC="<?php echo $url; ?>" NAME="frames" MARGINWIDTH=0 MARGINHEIGHT=0 SCROLLING=auto noresize>
</frameset></HTML>

ZYV
January 3rd, 2004, 06:45 AM
Hi,

You are most probably mistaken while typing your PHP into this post...

<?php

if ($site=="rpp"){ $url = "http://www.aol.com";
}
else if ($site == "rpp") { $url = "http://yahoo.com";
}
?>

does not make sense because if $site = "rpp", then the second condition will never be reached. If $site != "rpp" the second condition won't be reached as well and $url will be empty.

Finally you might want to use $_GET['rpp'] or $_POST['rpp'] to make the script support new register_globals = off PHP style...

Hope that helps,
Z.

airnine
January 20th, 2004, 01:57 PM
I'm really not sure what you guys are up to

Airnine

KMxRetro
January 20th, 2004, 03:58 PM
I'm guessing we're looking at some sort of redirect script here...

The database would be named "links" and would contain four fields.

Fields
-------
ID = Unique ID number (auto_increment)
url = Full URL (inc http://)
code = Three letter code for site
sitename = Name of site.

So one row would have:-
1,http://www.rewiredmind.com ,RWM,RewiredMind.com

Then your scripts would be like this...

links.php
<?php
$dbc = mysql_connect("yourhost","yourusername","yourpassword");
$sql = "SELECT * FROM links ORDER BY code ASC";
$result = mysql_query($sql,$dbc);
?>

<HTML><HEAD>
<TITLE>Title</TITLE></HEAD>
<BODY>
<? while($row = mysql_fetch_array($result)) {
echo "<a href='http://www.yoursitename.com/out.php?site=".$row[code]."'>"
.$row[sitename]."</a><br>";
}
?>
</BODY></HTML>


out.php
<?php
$dbc = mysql_connect("yourhost","yourusername","yourpassword");
$sql = "SELECT url FROM links WHERE code = '".$_POST["site"]."'";
$result = mysql_query($sql,$dbc);
$desturl = mysql_result($result, 0);
?>

<HTML><HEAD>
<TITLE>Title</TITLE></HEAD>
<FRAMESET rows="100%,*" border=0 frameborder=0 framespacing=0>

<FRAME SRC="<?php echo $desturl; ?>" NAME="frames"
MARGINWIDTH=0 MARGINHEIGHT=0 SCROLLING=auto noresize>
</frameset></HTML>

...should do the job.


We'll call that script a donation to WebmasterLingo.com! Use it for whatever you like...hope it helps someone. :D

airnine
January 20th, 2004, 04:05 PM
I realized they were after dynamic inclusions,

just seemed a bit funky to me, that's all

I support dynamic content big time, though

good luck

Airnine