General Automotive Chat all general talk about cars. if they dont have a home below or you feel it doesnt fit, post in here.

Quick Computer Type Question

Thread Tools
 
Search this Thread
 
Rate Thread
 
Old Jul 17, 2005 | 02:48 AM
  #1  
Mike Jones's Avatar
Thread Starter
GTcars - Post God !
iTrader: (1)
 
Joined: Jan 2002
Posts: 13,249
Rep Power: 0
Mike Jones street rep is low. keep goingMike Jones street rep is low. keep goingMike Jones street rep is low. keep goingMike Jones street rep is low. keep goingMike Jones street rep is low. keep goingMike Jones street rep is low. keep goingMike Jones street rep is low. keep going
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?
Old Jul 17, 2005 | 03:16 AM
  #2  
Adric's Avatar
GTcars - Post God !
 
Joined: Apr 2005
Posts: 4,556
From: La Crosse, WI / Minneapolis, MN
Rep Power: 856
Adric street rep is low. keep going
Whenever I have coding questions I just type in what I need in google, and I usually find a page or form with what I need.
Old Jul 17, 2005 | 04:04 AM
  #3  
archemedes's Avatar
GTcars - Post God !
 
Joined: Apr 2004
Posts: 15,868
From: Saraland AL
Rep Power: 1121
archemedes street rep is low. keep going
if you can't get an answer off google, ask madmike at nastyz28, he wrote teh code for that board (well he modified the code) and they do just what you're wanting
Old Jul 17, 2005 | 12:00 PM
  #4  
meissen's Avatar
GTcars - Post God !
 
Joined: Sep 2003
Posts: 6,032
From: Macomb, Michigan
Rep Power: 947
meissen has a spectacular aura aboutmeissen has a spectacular aura aboutmeissen has a spectacular aura about
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.
Old Jul 17, 2005 | 08:04 PM
  #5  
Mike Jones's Avatar
Thread Starter
GTcars - Post God !
iTrader: (1)
 
Joined: Jan 2002
Posts: 13,249
Rep Power: 0
Mike Jones street rep is low. keep goingMike Jones street rep is low. keep goingMike Jones street rep is low. keep goingMike Jones street rep is low. keep goingMike Jones street rep is low. keep goingMike Jones street rep is low. keep goingMike Jones street rep is low. keep going
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.
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...
Old Jul 17, 2005 | 11:45 PM
  #6  
meissen's Avatar
GTcars - Post God !
 
Joined: Sep 2003
Posts: 6,032
From: Macomb, Michigan
Rep Power: 947
meissen has a spectacular aura aboutmeissen has a spectacular aura aboutmeissen has a spectacular aura about
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...
What's your point? Make the PHP script able to read the VB database, and then add a table to it for your advertisement links, and then however many rows you want there...

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";
In your case, it would just be something like...
echo "<td><a href=\".$row[site_address]."\"><img src=\".$row[site_logo]." border=0></a></td>\n";
Old Jul 17, 2005 | 11:50 PM
  #7  
meissen's Avatar
GTcars - Post God !
 
Joined: Sep 2003
Posts: 6,032
From: Macomb, Michigan
Rep Power: 947
meissen has a spectacular aura aboutmeissen has a spectacular aura aboutmeissen has a spectacular aura about
If you need more help, lemme know... I'm no whiz at PHP, but if I don't know it I can always go on IRC and ask some people lol
Related Topics
Thread
Thread Starter
Forum
Replies
Last Post
jdmkid69
Car Parts For Sale
3
Aug 31, 2005 02:07 PM
ryann
General Automotive Chat
5
Jul 16, 2005 01:59 PM
palominoxp
Miscellaneous Stuff For Sale
0
Jun 20, 2005 04:33 PM
chevylover930
Car Audio & Electronics
17
Feb 3, 2005 01:04 PM
imported_Sincere
Chit Chat
4
Nov 23, 2004 04:29 AM

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 


You have already rated this thread Rating: Thread Rating: 0 votes,  average.


All times are GMT -4. The time now is 07:06 AM.

Page generated in 1.20181 seconds with 17 queries