Webmaster Forums - Webmaster forum for HTML, PHP, ASP, CSS and more

Go Back   Webmaster Forums - Webmaster forum for HTML, PHP, ASP, CSS and more > Web Programming > PHP Development
User Name
Password

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 05-17-2007, 05:01 PM   #1 (permalink)
shedokan
Junior Member
 
Join Date: Apr 2007
Posts: 36
Question help me with high score table script?

can you tell me what's wrong with this php script?
here is the script:

Code:
<?php $winscore = (int)$winscore; // Create a Blank File if it doesn't already exist if (!file_exists($filename)) { $file=fopen($filename, "w"); fclose ($file); } // Read the file in $oscores = file ($filename); $numreadin = count($oscores); // Break out the data into a new 2-d array called $tscores for ($i = 0; $i < $numreadin; $i++) { $g = unserialize($oscores[$i]); $tscores[$i][0] = $g[0]; $tscores[$i][1] = $g[1]; } // Fill in any missing data with none/0 for ($i = $numreadin; $i < $scoresize; $i++) { $tscores[$i][0] = 0; $tscores[$i][1] = "none"; } // Process the actions // Insert a score/name if ($action == "INSERT") { // Add name to end of list, and sort $tscores[$scoresize + 1][0] = $winscore; $tscores[$scoresize + 1][1] = $winname; rsort ($tscores); $file=fopen($filename, "w"); // Write them out for ($i = 0; $i < $scoresize; $i++) { $st = serialize($tscores[$i]) . "\n"; fputs($file, $st); } fclose($file); } // Clear the list if ($action == "CLEAR") { $k[0] = 0; $k[1] = "none"; $ser = serialize($k); $file=fopen($filename, "w"); for ($i = 0; $i < $scoresize; $i++) { $st = $ser . "\n"; fputs($file, $st); } fclose($file); } // Process the OUTPUT options if ($viewtype == "HTML") { // HTML PAGE CREATED HERE ?> <table cellpadding=2 cellspacing=2 border=0 width="152"> <tr align=center> <th bgcolor="#000033"><font color="#FFFFFF" face="Arial, Helvetica, sans-serif">#</font></th> <th bgcolor="#000033"><font color="#FFFFFF" face="Arial, Helvetica, sans-serif">Name</font></th> <th bgcolor="#000033"><font color="#FFFFFF" face="Arial, Helvetica, sans-serif">Score</font></th> </tr> <? for ($i = 0; $i < $scoresize; $i++) { echo ("<tr bgcolor='#666666' align='center'><td><font size='2' face='Arial, Helvetica, sans-serif'>"); echo ($i + 1); echo ("</font></td><td><font size='2' face='Arial, Helvetica, sans-serif'>"); echo ($tscores[$i][1]); echo ("</font></td><td><font size='2' face='Arial, Helvetica, sans-serif'>"); echo ($tscores[$i][0]); echo ("</font></td></tr>"); } ?> </table> <? } // FLASH DATA CREATED HERE if ($viewtype == "FLASH") { for ($i = 0; $i < $scoresize; $i++) { echo ("NAME" . $i . "="); echo ($tscores[$i][1]); echo ("&SCORE" . $i . "="); echo ($tscores[$i][0]); echo ("&"); } } ?>

if you can thank you so much!
shedokan is offline   Reply With Quote
Sponsored Links
Old 06-06-2007, 10:59 PM   #2 (permalink)
tjtravis
Junior Member
 
Join Date: Nov 2006
Posts: 44
Default Re: help me with high score table script?

Why not use an Sql
tjtravis is offline   Reply With Quote
Old 06-07-2007, 08:24 AM   #3 (permalink)
shedokan
Junior Member
 
Join Date: Apr 2007
Posts: 36
Default Re: help me with high score table script?

you probably right and I'm already working on this,thanks for your opinion
shedokan is offline   Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Points Per Thread View: 1.00
Points Per Thread: 11.00
Points Per Reply: 5.00



» Sponsors

» Links

» Affiliates
Web Hosting
Online Backup Reviews
Marketing Find
Merchant Select
SiteMap Builder
Host Compare
Dedicated Servers

» Links

» Sports Network
Paintball Forum
Football Forum
Hockey Forum
Golf Forum
Boxing Forum
Lacrosse Forum
Baseball Forum
SnowBoarding Forum
Soccer Forum
MMA Forum


All times are GMT -4. The time now is 10:30 PM.



LinkBacks Enabled by vBSEO 3.0.0 RC8
Webmaster Forums