Jump to content

Newbie! Questions on where to start and general questions


interpim

Recommended Posts

hiya all...

 

I've done a bit of programming in the past, Taken a few basic programming classes in #C and taught myself a little bit of Visual Basic.  I am also self taught HTML, and have now decided to move on to some PHP.

 

I have PHP installed on my webserver now, and am using some programs that I have installed.  The most I have done with PHP so far is built a generic php include to quickly change or add to my website navigation.

 

I am ready to build a program in PHP and have the idea of what I need, but not really sure on how to go about it.

 

What i need is a page where someone can point to a local file on their computer... this is a log file for a online video game.

Then i want my program to process that file to basically pull out information from each of the lines.

 

I was thinking through this a bit, and have an idea how to go about it, but not really sure how to start since I have very little PHP experience.

 

Any help will be GREATLY appreciated.

Thank you.

A very basic system would be to make a file uploader (after you have created a registration and login system), and allow the users to upload the game log to your website. From there, you can write a parsing function that will run through each line and pick out the info that you want.

 

If you can be more specific, there is a large group of people on here who can really help you out.

I honestly don't want to have to use usernames/passwords.  I really don't want the files permanently on my server either.  I just want a form that someone can point to a file on their computer and basically click a button that parses that file and displays the results.  i don't want to save the results... just display them after the parse.

 

I don't have a log with me now at work, but they go similar to

 

[00:00:00] you hit name for 888 damage

[00:00:00] name hits you for 888 damage

[00:00:01] namey heals you for 500 hit points

[00:00:02] you killed name

[00:00:03] you earned 8 gold

 

etc. etc.

 

Basically i want to pull out kill counts, average damage done to you, done by you, and gold etc. earned by you.

OK... i got someone to send me a snippet of an actual log file...

I think i figured out how to pass an uploaded file to a script... Now I just have to figure out how to parse the Data I want out of the log.

 

[21:23:21] You cast a Greater Rune of Shadow Spell!
[21:23:21] You hit Tiestoxl for 439 (-194) damage!
[21:23:21] You just killed Tiestoxl!
[21:23:21] Tiestoxl just died. His corpse lies on the ground.
[21:23:21] You get 307 realm points!
[21:23:21] You earn 9 extra realm points for outpost ownership!
[21:23:21] You get 8 bounty points!
[21:23:21] You get 41,943,040 experience points!
[21:23:21] Your share of the loot is 2 gold, 17 silver, and 55 copper pieces.
[21:23:21] You deposit 4 silver, and 43 copper pieces in your guild bank.
[21:23:21] Tiestoxl is dead!
[21:23:22] You are no longer facing your target.
[21:23:23] Vastagor's strength returns. 


[01:06:00] Matado attacks you with his sword!
[01:06:00] You evade Matado's attack!
[01:06:00] You must perform the Perforate Artery style before this one!
[01:06:00] (Region) You have entered Northern Suspiro Pass.
[01:06:01] You prepare to perform a Hamstring!
[01:06:01] You are now preparing to perform a Garrote style as a backup for Hamstring!
[01:06:02] 98 style damage was blocked by the defender's magic shielding.
[01:06:02] You perform your Hamstring perfectly. (+32)
[01:06:02] You attack Matado with your falchion and hit for 186 (-38) damage!
[01:06:02] A barrier absorbs 93 damage of your attack!
[01:06:02] Matado resists the effect!
[01:06:02] You attack Matado with your axe and hit for 106 (-33) damage!
[01:06:02] You critical hit for an additional 21 damage!
[01:06:02] A barrier absorbs 7 damage of your attack!
[01:06:02] Matado is bleeding!
[01:06:02] You hit Matado for 3 damage!
[01:06:03] Matado performs the Remedy ability, protecting himself from the effect of envenomed weapons.
[01:06:03] You prepare to perform a Leaper!
[01:06:03] Matado casts a spell!
[01:06:04] Matado attacks you with his sword!
[01:06:04] You evade Matado's attack!
[01:06:04] Matado casts a spell!
[01:06:04] 101 style damage was blocked by the defender's magic shielding.
[01:06:04] You perform your Leaper perfectly. (+34)
[01:06:04] You attack Matado with your falchion and hit for 173 (-35) damage!
[01:06:04] You critical hit for an additional 46 damage!
[01:06:04] You attack Matado with your axe and hit for 141 (-45) damage!
[01:06:04] Matado looks resigned to their doom.
[01:06:05] You attempt to use the Battler.
[01:06:05] You must wait 1 more minutes and 43 seconds to discharge an item!
[01:06:05] You prepare to perform a Hamstring!
[01:06:05] You are now preparing to perform a Garrote style as a backup for Hamstring!
[01:06:05] You resist the effect!
[01:06:05] (Region) You have left Northern Suspiro Pass.
[01:06:07] 110 style damage was blocked by the defender's magic shielding.
[01:06:07] You perform your Hamstring perfectly. (+37)
[01:06:07] You attack Matado with your falchion and hit for 209 (-43) damage!
[01:06:07] Matado is bleeding!
[01:06:07] You hit Matado for 3 damage!
[01:06:07] Matado attacks you with his sword!
[01:06:07] Matado hits you for 103 damage.
[01:06:07] You are poisoned!
[01:06:07] Matado hits you for 39 damage.
[01:06:07] Matado attacks you with his axe!
[01:06:07] Matado misses!
[01:06:07] Your movement is slowed!
[01:06:07] You prepare to perform a Leaper!
[01:06:08] 140 style damage was blocked by the defender's magic shielding.
[01:06:08] You perform your Leaper perfectly. (+46)
[01:06:08] You attack Matado with your falchion and hit for 238 (-49) damage!
[01:06:08] You critical hit for an additional 47 damage!
[01:06:08] You attack Matado with your axe and hit for 192 (-61) damage!
[01:06:08] Matado looks resigned to their doom.
[01:06:09] Matado attacks you with his sword!
[01:06:09] Matado hits you for 93 damage.
[01:06:09] Matado's armor appears to crumble away before your eyes!
[01:06:09] Your armor is imbued with a brilliant spectral aura!
[01:06:09] You are poisoned!
[01:06:09] Matado hits you for 33 damage.
[01:06:09] Matado attacks you with his axe!
[01:06:09] Matado hits you for 50 damage.
[01:06:09] Your physical essence is weakened!
[01:06:09] Your Constitution has decreased.
[01:06:09] Your hits have decreased.
[01:06:09] Your physical essence is weakened!
[01:06:09] Your attacks are slowed by an unseen force!
[01:06:09] You prepare to perform a Rib Separation!
[01:06:11] 101 style damage was blocked by the defender's magic shielding.
[01:06:11] You perform your Rib Separation perfectly. (+33)
[01:06:11] You attack Matado with your falchion and hit for 185 (-38) damage!
[01:06:11] You attack Matado with your axe and hit for 128 (-41) damage!
[01:06:11] Your knowledge of the ways of subterfuge increases
[01:06:11] You just killed Matado-Kay!
[01:06:11] Matado's extra strength fades.
[01:06:11] Matado's extra health fades.
[01:06:11] The protection around Matado fades.
[01:06:11] Matado's armor returns to normal.
[01:06:11] Matado's enhanced vigor fades.
[01:06:11] Matado's enhanced agility fades.
[01:06:11] Matado's extra strength fades.
[01:16:07] Matado's enhanced vigor fades.
[01:06:11] Matado's form is restored.
[01:06:11] Matado's form is restored.
[01:06:11] Matado's meditative state fades.
[01:06:11] Matado is defending wholeheartedly again.
[01:06:11] Matado's aura of magnanimity fades.
[01:06:11] Matado just died. His corpse lies on the ground.
[01:06:11] You get 1684 realm points!
[01:06:11] You get 76 bounty points!
[01:06:11] You get 146,006,907 experience points!
[01:06:11] You pick up 17 gold, 40 silver, and 34 copper pieces.

I somewhat built a simple upload form that will take an uploaded file and send it to another script that will process, then display the results on the webpage.

 

Using this code

<?php
$file=fopen($uploadedfile,"r") or exit("Unable to open file!");
while (!feof($file)) 
  { 
  echo fgets($file);
  echo "<br>";
  }
fclose($file);
?>

 

Now, I know this only spits out the same data that it is given, but my question is, how would I go about parsing the individual lines for the data I want to keep??  I am thinking the best way for me to do that is to create variables for each item I want to track and give it a ++ for each occurance.  My question is how do i know what to search to pull it out.

 

Is it possible to put a giant loop of if/then statements, or maybe a switch?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.