Hi all.
I have a text file that looks like the one below.
I know how to open the text file but I need to get the php pointer to take a value suck as $username. Once it finds $username, i need it to move to the next following MonthUp"> and then read the number after it and save it to the string $monthup. I will be doing the same for $monthdown and then closing the file.
Eg. If the value is $username, i need to find the first occurance of that username, find the number after MonthUp"> and read it to $monthup, then move to MonthDown"> and then read the number after it to $monthdown.
I will then use php to add the numbers together so that I can show the user when they enter their username into the website, how much they have used for the month.
I am just learning php and all I can find so far from google is reading line-by-line which i want to read after a specific word as I need to do this for a few different files and line by line wont work.
File - stats.cfg - can be renamed to stats.txt easily.
<config>
<list name="UserStats">
<listitem>
<variable name="Id">288A5772-2964-4701-9E66-765F3CECE522</variable>
<variable name="Name">all users</variable>
<variable name="DayUp">32729762</variable>
<variable name="DayDown">336451305</variable>
<variable name="WeekUp">982718994</variable>
<variable name="WeekDown">5711384480</variable>
<variable name="MonthUp">15542938381</variable>
<variable name="MonthDown">106022753555</variable>
<variable name="TotalUp">441879285577</variable>
<variable name="TotalDown">1763579705023</variable>
<variable name="Since">1210849661</variable>
<variable name="Timestamp">1256258234</variable>
<variable name="FullName">all users</variable>
</listitem>
<listitem>
<variable name="Id">807459fd-71a9-467d-bf0c-f0ce98fef937</variable>
<variable name="Name">Administrator</variable>
<variable name="DayUp">0</variable>
<variable name="DayDown">0</variable>
<variable name="WeekUp">0</variable>
<variable name="WeekDown">0</variable>
<variable name="MonthUp">0</variable>
<variable name="MonthDown">0</variable>
<variable name="TotalUp">995621942</variable>
<variable name="TotalDown">6089875753</variable>
<variable name="Since">1210849662</variable>
<variable name="Timestamp">1256224866</variable>
<variable name="FullName"></variable>
</listitem>
<listitem>
<variable name="Id">9cd97dd4-f902-4811-ad05-372658c8ec64</variable>
<variable name="Name">Mathew</variable>
<variable name="DayUp">0</variable>
<variable name="DayDown">0</variable>
<variable name="WeekUp">0</variable>
<variable name="WeekDown">0</variable>
<variable name="MonthUp">36809697</variable>
<variable name="MonthDown">565151504</variable>
<variable name="TotalUp">1739819196</variable>
<variable name="TotalDown">26628701150</variable>
<variable name="Since">1210849662</variable>
<variable name="Timestamp">1256257815</variable>
<variable name="FullName">mathew</variable>
</listitem>
login form can you find my error?
registrationform.php seems fine send data to registration.phpregistration.php seems fine checks all data then send it to function.phpconnection.php does its job and connects to database also calls
Curly Bracket Delimeters.
I'd always believed that the starting and ending delimeters in preg_ functions had to be the same character, but recently discovered that you can use the curly brackets.Example:Code:
Amend code to allow multiple attachments
Hi I have a php page that allows the user to browse to a file (image) then sumbit, the confirmation page then has the following code which uploads the said file to the hosting server, but also appends
Sharing PHP Sessions Across Domains
I am in the process of writing a script to share a php session across various domains I have.The problem I have, is getting php to access the php session. It gives me a persmission error. It seems the
PECL uploadprogress for php5.2
Hey, I just installed PHP5 via .htaccess on my 1and1 Shared Hosting Account.How would I exactly install the "PECL uploadprogress"?http://pecl.php.net/package/uploadprogress---There are
finding key position of specified value in multi-dimensional array
Code: $openedfile = fopen($tfc_file4, "r");$rc = 1;while(!feof($openedfile)){$rc++;$hold[$rc] = explode("|" , trim(fgets($openedfile)));}fclose($openedfile);How can I loop through
How could I combine these arrays??
Hello.. I'm trying to figure out a way to combine these first two arrays to get the last array.. 1st array:Code: Array( [0] => zero [1] => one [2] => two)2nd array:Code:
Output Full URL of Current Page
Let's say I am currently viewing a dynamic page: http://www.mydomain.com/directory/index.php?type=flowers I want this URL to be output on the page, but not including the end parameters.
Help? Need help on project with templates involving mysql and php.
I'm having a hard time explaining what I want but basically here is what I have in place:-Database with 500 members signed up and using under a table called 'users'-Php page that people click a link
Logic question
im wondering what's the best method to do the above list:it is for alliance @ MMORPG game -the administrator of alliance have 10 slots for creating ranks ... each rank have it's own permissions (in