Quick Computer Type Question
#1
Quick Computer Type Question
I have a quick question.
For the new layout I'm having a place with random pictures that come up every time a page is loaded. For the advertiser's I'd like to do this as well but when their logo is up I'd like a link to go to them. Right now here's what I'm doing for the random picture.
I made a file called advertise.php and put this in there:
[CODE]<?php
Header("Content-type: image/gif");
Header("Cache-Control: no-cache, must-revalidate");
srand((double)microtime()*1000000);
$nr = rand(1, 8);
$fn = fopen("$nr.gif","r");
fpassthru($fn);
?> [/CODE]
Where the different logo's are 1.gif, 2.gif, etc... up to 8.gif
Then I call it up using:
[CODE]<img src="advertise.php"[/CODE]
So how would I make the link change with each picture?
For the new layout I'm having a place with random pictures that come up every time a page is loaded. For the advertiser's I'd like to do this as well but when their logo is up I'd like a link to go to them. Right now here's what I'm doing for the random picture.
I made a file called advertise.php and put this in there:
[CODE]<?php
Header("Content-type: image/gif");
Header("Cache-Control: no-cache, must-revalidate");
srand((double)microtime()*1000000);
$nr = rand(1, 8);
$fn = fopen("$nr.gif","r");
fpassthru($fn);
?> [/CODE]
Where the different logo's are 1.gif, 2.gif, etc... up to 8.gif
Then I call it up using:
[CODE]<img src="advertise.php"[/CODE]
So how would I make the link change with each picture?
#5
Originally Posted by meissenation
Database it. Use mysql and have it pick a random row, then when it picks the random row, get the address and image ID from the row.
#6
Originally Posted by ProjectCamaro
I only get like five databases to use and they're being used for things like the forum, chat, user's uploading their pictures, etc...
You might have to look at how VBulletin is written, but I know with like PHP Nuke, all the database-accessing functions are in "mainfile.php" so in my AIM Link Tracker script, I just had it include the mainfile.php at the top, and then I can use PHP Nuke's database commands.
Edit, don't know how firmiliar with PHP you are, but here's an example of my link tracker (which displays a table and part of it is someone's SN from the table added into a link)
$i=0;
while($row = mysql_fetch_array($result)) {
$i++;
echo " <tr>\n";
echo " <td>".$i.".</td>\n";
echo " <td><a href=\"aim:goim?screenname=".$row[screen_name]."\"><img src=\"images/aim.gif\" border=0></a></td>\n";
echo " <td>".$row[screen_name]."</td>\n";
echo " <td>".$row[url]."</td>\n";
echo " <td>-Logged-</td>\n";
echo " <td>".$row[tracktime]."</td>\n";
echo " <td>".$row[times]."</td>\n";
echo " </tr>\n";
**
mysql_free_result($result);
echo "</table>\n";
while($row = mysql_fetch_array($result)) {
$i++;
echo " <tr>\n";
echo " <td>".$i.".</td>\n";
echo " <td><a href=\"aim:goim?screenname=".$row[screen_name]."\"><img src=\"images/aim.gif\" border=0></a></td>\n";
echo " <td>".$row[screen_name]."</td>\n";
echo " <td>".$row[url]."</td>\n";
echo " <td>-Logged-</td>\n";
echo " <td>".$row[tracktime]."</td>\n";
echo " <td>".$row[times]."</td>\n";
echo " </tr>\n";
**
mysql_free_result($result);
echo "</table>\n";
echo "<td><a href=\".$row[site_address]."\"><img src=\".$row[site_logo]." border=0></a></td>\n";
Thread
Thread Starter
Forum
Replies
Last Post
palominoxp
Miscellaneous Stuff For Sale
0
06-20-2005 04:33 PM
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)