PDA

View Full Version : Any PHP Veterans, please help!



JetBlackRX89
November 20th, 2005, 01:05
I need a simple php script that does the following:


[PHP CODE]
if cat = 8, then category="game"
if cat = 7, then category="game"
if cat = 6, then category="game"
if cat = 5, then category="Season 4"
if cat = 4, then category="Season 3"
if cat = 3, then category="Season 2"
if cat = 2, then category="Season 1"
if cat = 1, then category="movie"

if cat = (1-5), then extension=".rm" and type="realmedia video file"
if cat = (6-8), then exntenson=".game"
if cat = 6, type="game 1 file"
if cat = 7, type="game 2 file"
if cat = 8, type="game 3 file"
[END PHP CODE]

[HTML IMPLEMENTATION]
You are downloading File<?php echo("$extension"); ?>! This file is in the <?php echo("$category"); ?> area and is a <?php echo("$type"); ?>.
[END HTML IMPLEMENTATION]


Any PHP geniuses know how to translate that all into real php code? I'm sort of a beginner at this and would appreciate a solution. Basically, I want it so that if i type:

Http://mysite.com/download.php?cat=4

"It would yeild:"

"You are downloading File.rm! This file is in the Season 3 area and is a RealMedia video file."

Thanks for any help!

JetBlackRX89
November 20th, 2005, 02:35
Nevermind. I used trial and error with different functions until I got something that works and only uses 10 lines of code. Maybe I could've done it with less, but it's good enough. :P


<?
if ($cat > 5) {$section = ("Game Downloads"); $extension = (".zip"); $folder = ("Roms");}
if ($cat == 9) {$type = ("Game Tool");}
if ($cat == 8) {$type = ("Color Game");}
if ($cat == 7) {$type = ("Black and White Game");}
if ($cat == 6) {$type = ("3D Game");}
if ($cat == 5) {$section = ("Season 4 Clips"); $folder = ("Season 4");}
if ($cat == 4) {$section = ("Season 3 Clips"); $folder = ("Season 3");}
if ($cat == 3) {$section = ("Season 2 Clips"); $folder = ("Season 2");}
if ($cat == 2) {$section = ("Season 1 Clips"); $folder = ("Season 1");}
if ($cat == 1) {$section = ("Movies"); $folder = ("Movies");}
if ($cat > 0 and $cat < 6) {$type = ("Realmedia Video"); $extension = (".rm"); $subfolder = ("Video/");}
?>