Jump to content


 


Register a free account to unlock additional features at BleepingComputer.com
Welcome to BleepingComputer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.


Click here to Register a free account now! or read our Welcome Guide to learn how to use this site.

Photo

scoreboard


  • Please log in to reply
9 replies to this topic

#1 hintswen

hintswen

  • Members
  • 57 posts
  • OFFLINE
  •  
  • Local time:08:26 PM

Posted 22 June 2005 - 09:04 AM

hi. there's a bot which saves people's scores in a ini file and i was wondering if there is a way to get php to read the file, display the information in a table and sort it.

BC AdBot (Login to Remove)

 


#2 hintswen

hintswen
  • Topic Starter

  • Members
  • 57 posts
  • OFFLINE
  •  
  • Local time:08:26 PM

Posted 02 November 2005 - 04:24 AM

still no luck on this. awaiting sugestions...

#3 groovicus

groovicus

  • Security Colleague
  • 9,963 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Centerville, SD
  • Local time:07:26 PM

Posted 02 November 2005 - 08:39 AM

It sort of depends on whose system the .ini file is, what encoding may have been used on the data, if you have a means of decoding the data, etc.

#4 Grinler

Grinler

    Lawrence Abrams


  • Admin
  • 43,503 posts
  • ONLINE
  •  
  • Gender:Male
  • Location:USA
  • Local time:09:26 PM

Posted 03 November 2005 - 02:56 PM

Where is the .ini file located? Same as where the script will be? What is the format of the ini file?

#5 hintswen

hintswen
  • Topic Starter

  • Members
  • 57 posts
  • OFFLINE
  •  
  • Local time:08:26 PM

Posted 04 November 2005 - 06:43 PM

ini files would be in same place as the script and i think the format is like this:

[nickname]
win=10
loss=3
score=40

it would be similar to that maybe with a few more lines.

#6 groovicus

groovicus

  • Security Colleague
  • 9,963 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Centerville, SD
  • Local time:07:26 PM

Posted 04 November 2005 - 07:56 PM

Something like this?
http://www.metalshell.com/view/source/96/

That's as far as I can help, but I found about 1000 unique pages for using PHP. :thumbsup: It doesn't look too complex.

#7 hintswen

hintswen
  • Topic Starter

  • Members
  • 57 posts
  • OFFLINE
  •  
  • Local time:08:26 PM

Posted 04 November 2005 - 08:24 PM

kinda, i need it displayed in table format, nicknames down the left and scores going across. later i'll try edit that script but i'm no good at php.

#8 groovicus

groovicus

  • Security Colleague
  • 9,963 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Centerville, SD
  • Local time:07:26 PM

Posted 04 November 2005 - 10:31 PM

I'm sorry. I just re-read your question..

The answer is.. Yes. :thumbsup:

EDIT: Umm.. I guess that sounds a little harsh.... let me rephrase things a little. The script I put up there was the first one I found when I Googled. All it does is reads a file. I don't know how it is stored, or how to manipulate it after that. That was probably a little further down on the search list. :flowers:

It is completely possible to do everything that you want to do. There is plenty of sample code available on the web, you will just have to learn to manipulate the language. I don't know anything about php at all, but I bet I could find enough examples and tuts that I could noodle together a passable script before too terribly long. It probably wouldn't be pretty, but I have no doubt I could do it. I happen to like scripting languages though because they are pretty simple.

Is there any reason in particular that you want to do it in php? I am assuming that like jsp that one needs some kind of server software in order to serve up the web pages.. do you have that?

#9 hintswen

hintswen
  • Topic Starter

  • Members
  • 57 posts
  • OFFLINE
  •  
  • Local time:08:26 PM

Posted 05 November 2005 - 05:09 AM

you've lost me there but it doesn't really matter anymore.

I was going to host a site for a friends IRC bot. it's a game and the highscores are saved in ini files. i was looking for this script so that he could just upload the ini file and the scores would be displayed. I don't think he runs his bot anymore thow.

#10 Grinler

Grinler

    Lawrence Abrams


  • Admin
  • 43,503 posts
  • ONLINE
  •  
  • Gender:Male
  • Location:USA
  • Local time:09:26 PM

Posted 05 November 2005 - 05:28 PM

I found this code off of http://us3.php.net/parse_ini_file. Copyright © 2005 Justin Frim <phpcoder@cyberpimp.pimpdomain.com>


<?

$ini_array = readINIfile("scoreboard.ini","");


foreach($ini_array as $value=>$key) {

//  Your code here for reading the array ini_array and displaying the variables.


}


function readINIfile ($filename, $commentchar) {
  $array1 = file($filename);
  $section = '';
  foreach ($array1 as $filedata) {
   $dataline = trim($filedata);
   $firstchar = substr($dataline, 0, 1);
   if ($firstchar!=$commentchar && $dataline!='') {
	 //It's an entry (not a comment and not a blank line)
	 if ($firstchar == '[' && substr($dataline, -1, 1) == ']') {
	   //It's a section
	   $section = strtolower(substr($dataline, 1, -1));
	 }else{
	   //It's a key...
	   $delimiter = strpos($dataline, '=');
	   if ($delimiter > 0) { 
		 //...with a value
		 $key = strtolower(trim(substr($dataline, 0, $delimiter)));
		 $value = trim(substr($dataline, $delimiter + 1));
		 if (substr($value, 1, 1) == '"' && substr($value, -1, 1) == '"') { $value = substr($value, 1, -1); }
		 $array2[$section][$key] = stripcslashes($value);
	   }else{
		 //...without a value
		 $array2[$section][strtolower(trim($dataline))]='';
	   }
	 }
   }else{
	 //It's a comment or blank line.  Ignore.
   }	
  }
  return $array2;
}

?>





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users