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 07-17-2005, 02:48 AM
  #1  
GTcars - Post God !
Thread Starter
iTrader: (1)
 
Mike Jones's Avatar
 
Join Date: 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?
Mike Jones is offline  
Old 07-17-2005, 03:16 AM
  #2  
GTcars - Post God !
 
Adric's Avatar
 
Join Date: Apr 2005
Location: La Crosse, WI / Minneapolis, MN
Posts: 4,556
Rep Power: 786
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.
Adric is offline  
Old 07-17-2005, 04:04 AM
  #3  
GTcars - Post God !
 
archemedes's Avatar
 
Join Date: Apr 2004
Location: Saraland AL
Posts: 15,868
Rep Power: 1051
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
archemedes is offline  
Old 07-17-2005, 12:00 PM
  #4  
GTcars - Post God !
 
meissen's Avatar
 
Join Date: Sep 2003
Location: Macomb, Michigan
Posts: 6,032
Rep Power: 877
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.
meissen is offline  
Old 07-17-2005, 08:04 PM
  #5  
GTcars - Post God !
Thread Starter
iTrader: (1)
 
Mike Jones's Avatar
 
Join Date: 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...
Mike Jones is offline  
Old 07-17-2005, 11:45 PM
  #6  
GTcars - Post God !
 
meissen's Avatar
 
Join Date: Sep 2003
Location: Macomb, Michigan
Posts: 6,032
Rep Power: 877
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";
meissen is offline  
Old 07-17-2005, 11:50 PM
  #7  
GTcars - Post God !
 
meissen's Avatar
 
Join Date: Sep 2003
Location: Macomb, Michigan
Posts: 6,032
Rep Power: 877
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
meissen is offline  
Related Topics
Thread
Thread Starter
Forum
Replies
Last Post
jdmkid69
Car Parts For Sale
3
08-31-2005 02:07 PM
ryann
General Automotive Chat
5
07-16-2005 01:59 PM
palominoxp
Miscellaneous Stuff For Sale
0
06-20-2005 04:33 PM
chevylover930
Car Audio & Electronics
17
02-03-2005 01:04 PM
imported_Sincere
Chit Chat
4
11-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.

Quick Reply: Quick Computer Type Question



All times are GMT -4. The time now is 09:52 AM.

Page generated in 0.08469 seconds with 16 queries