Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
fletcher
Jun 27, 2003

ken park is my favorite movie

Cybernetic Crumb

Hootie Hoo posted:

I tried my own cack-handed editing and it just resulted in a php error. I'm stupid and unsure of what to delete and what to leave. Please help.

Download Firebug and use the element inspector and you should be on your way in no time!

Adbot
ADBOT LOVES YOU

revmoo
May 25, 2006

#basta
Go check your widgets page in Wordpress admin. I'm pretty sure most of those can be removed from there.

cka
May 3, 2004
Is this common PHP behaviour or just some wacky configurations by the hosting company: I'm writing a script right now that should handle specific script-created directory removal, but specifying any sort of path value in a variable adds in data that I don't want and fucks up the directory checking/manipulation functions, eg:

php:
<?
// for the sake of reference, I'm passing script.php?mode=del&amp;dir=1234-20100503
$rm_dir = preg_replace("#^[a-zA-Z0-9\-]#", "", $_GET['dir']); // quick & dirty injection protection
$my_path_check = "/home/*******/images/{$rm_dir}/";
echo "<xmp>";
echo var_dump(is_dir($my_path_check));
echo $my_path_check;
echo "</xmp>";
?>
echoes out

bool(false)
/home/********/images/1234-20100503/.htaccess/

Now because PHP (or whatever modifications were done to the php installation) adds in that .htaccess bit, I can't reliably check if that 1234-20100503 directory is legit or not so I can't get the script to do what I want it to do. I don't work with directory manipulation much, but whenever I did I don't think I ever ran into this problem so I'm thinking it's just a hinky setting or patch on the host machine. Is there a better way of quickly checking directory existence that won't be impeded with random poo poo getting added into my code?

FWIW, before I had it set to remove single files and that worked fine, but I have to make the jump to directories because I need to delete collections of files.

McGlockenshire
Dec 16, 2005

GOLLOCKS!
The regex "^[a-zA-Z0-9\-]" says "find one lowercase/uppercase/number/dash at the beginning of the string". You probably want to move the caret inside the square brackets, "[^a-zA-Z0-9\-]", which means "find anything that is not a lowercase/uppercase/number/dash" instead.

What's var_dump($_GET['dir']) before and after the regex?

No idea where the .htaccess is coming from.

Acer Pilot
Feb 17, 2007
put the 'the' in therapist

:dukedog:

Has anyone come up with/found any way to implement a low footprint chat system with PHP? I'm running Apache 2 so probably no Comet.

I was thinking of temporarily storing messages in xcache or memcache but not really sure if that's a good way to go.

cka
May 3, 2004
Ugh yeah, I always get tripped up on that quick regex character strip (but that's neither here nor there).

Also as far as my problem goes, I think I've figured out what it was. I'm just a big dummy on Monday mornings. Referencing pre-existing php files in the application I'm adding to gave me the impression that all the get/post vars got processed out of the $_GET/$_POST arrays and sanitized/globalized but apparently that wasn't the case. Instead of using $_GET['dir'] (and previously $_GET['file']) like I should have done as per the pseudo-code posted, I was referencing $dir and $file, both of which inexplicably kept showing up as ".htaccess" strings. I've since fixed my code and all is well with my directory check/delete function and I feel like a giant idiot.

Mondays :rolleyes: Thanks for the assistance though.

MrMoo
Sep 14, 2000

quote:

// quick & dirty injection protection
Quickest as easiest is to do a strncmp() on realpath().
php:
<?
$root_dir = '/home/clap/images/';
$target_dir = realpath("{$root_dir}/{$_POST['dir']}");
if (0 != strncmp ($target_dir, $root_dir, strlen($root_dir)))
{
...
}
?>
You should be using POST for any actions that modify anything.

MrMoo
Sep 14, 2000

drcru posted:

Has anyone come up with/found any way to implement a low footprint chat system with PHP? I'm running Apache 2 so probably no Comet.

Very low footprint, Facebook Live Stream:

http://developers.facebook.com/docs/reference/plugins/live-stream

Acer Pilot
Feb 17, 2007
put the 'the' in therapist

:dukedog:

MrMoo posted:

Very low footprint, Facebook Live Stream:

http://developers.facebook.com/docs/reference/plugins/live-stream

That's kinda cool, don't know how comfortable people would be displaying their real names in a game though. Know of anything that you can run locally?

MrMoo
Sep 14, 2000

Try the APE real time chat,

http://www.ape-project.org/demos/1/ape-real-time-chat.html

Got Haggis?
Jul 28, 2002
Great chieftain o' the puddin-race!
I'm planning on using PHP to parse a HUGE xml file (10 gb or so). It seems PHPs XMLReader will do the job, since it streams the file and doesn't load it all into memory at once. However, I need to store all the xml data in MySQL.

I don't have the tables set up yet....I do have an XSD file that the XML must conform to. I was hoping to somehow use this XSD file to automatically create the MySQL tables. XMLSpy sort of did the trick I guess - it created about 40 tables with foreign keys - seems like it may be a pain in the rear end to manage.

So anyway, I really don't want to hardcode field names into the script that will be inserting the data into the database....is there some way to get the node name, if it doesn't exist create the table, then create the fields?

I'm a bit of an XML noob so I may not be wording this correctly. I guess one of the main issues is some of the nodes have children with the same attribute name (like multiple photos):

<photos><url>whatever.com</url><url>whatever2.com</url></photos>

<- a bunch of issues like that. In this case there would be a photos table with a url field and then a foreign key field that relates to this record.

There is so much data here that I want to try to make this script "automatic" as possible but I'm not really sure where to start. Any suggestions on resources to use or where to even start?

I did find a tool called PhRETS that is made for dealing with the type of data I have (real estate data based on RETS) however I am reading it from a file, not connecting to a service and this library seems to be made for connecting to a service.

epswing
Nov 4, 2003

Soiled Meat
You might not want to be using PHP / MySQL for this. I'm not saying it can't be done, but there are other tools which are much better suited for your task.

For example, eXist is a free document database (as opposed to a relational database) which stores xml. You can then query the data using xquery/xpath to pull out what you want. I'm not sure what freedom you have regarding running non-php-mysql-type software on your host, but I feel like you're in for a world of pain by shredding xml into relational tables.

Got Haggis?
Jul 28, 2002
Great chieftain o' the puddin-race!
yeah, originally I was looking at a product called Talend to basically map the xml file to fields in mysql.....it works great with small files - for this huge file it can't load it into memory so it crashes. That is the main reason I'm looking at PHP and XMLReader/SAX. I'll check eXist out to see if it can help...ultimately the data does need to be in MySQL however.

Acer Pilot
Feb 17, 2007
put the 'the' in therapist

:dukedog:

I'm trying to make sure players only hit with their weapons a percentage of the time (70%, 34%, etc) but it doesn't seem that my functions are very accurate.

Attempt 1:
code:
	private function weighted_random(&$weight)
	{
		$weights = array(($weight/100), (100-$weight)/100);
		$r = mt_rand(1,1000);
		$offset = 0;
		foreach($weights as $k => $w)
		{
			$offset += $w*1000;
			if($r <= $offset)
				return $k;
		}
	}
Attempt 2:
code:
	private function weapon_fired(&$weight)
	{
		$hit = array();
		for($i = 0; $i < $weight; $i++)
			$hit[] = true;
		for($i = $weight; $i < 100; $i++)
			$hit[] = false;
		shuffle($hit);
		return $hit[mt_rand(0,100)];
	}
What's wrong with these?

Begby
Apr 7, 2005

Light saber? Check. Black boots? Check. Codpiece? Check. He's more machine than kid now.

drcru posted:

I'm trying to make sure players only hit with their weapons a percentage of the time (70%, 34%, etc) but it doesn't seem that my functions are very accurate.

I have no idea what your functions are supposed to be doing, they seem a bit convoluted with the arrays and all.

Instead, imagine you are rolling a 100 sided die to compute this. Lets say your hit percentage is 65%. In that case when you roll the die if the number is 65 or less, thats a hit. If the number is 66 or greater, then that is a miss.

So all you need to do is pick a random number between 1 and 100 for each shot, then see how that number compares to your hit percentage.

Acer Pilot
Feb 17, 2007
put the 'the' in therapist

:dukedog:

Begby posted:

I have no idea what your functions are supposed to be doing, they seem a bit convoluted with the arrays and all.

Instead, imagine you are rolling a 100 sided die to compute this. Lets say your hit percentage is 65%. In that case when you roll the die if the number is 65 or less, thats a hit. If the number is 66 or greater, then that is a miss.

So all you need to do is pick a random number between 1 and 100 for each shot, then see how that number compares to your hit percentage.

Thanks, the way I had it was a bit much.

Got Haggis?
Jul 28, 2002
Great chieftain o' the puddin-race!
in regards to my php question earlier, I have the tables created but am now running into some issues with XMLReader:

I'm trying to parse a HUGE xml file and store the values in MySQL. XMLReader seems to the solution since I won't have to read the entire file into memory - I can stream it in (the file is like 5 gigs). Main problem I'm having is the documentation on XMLReader blows.

If my XML file looks something like this
code:
<Listings>
 <Listing>
   <Address>
    <Street>123 Street</Street>
    <City>Anywhere</City>
    <State>SomeState</State>
    <Zip>12345</Zip>
   </Address>
 </Listing>
  <Listing>
   <Address>
    <Street>123 Street</Street>
    <City>Anywhere</City>
    <State>SomeState</State>
    <Zip>12345</Zip>
   </Address>
 </Listing>
</Listings>
I can use XMLReader to go through it and print out the info inbetween tags - the problem I'm having is that it will print out the entire file (so in this case, it prints out both addresses..but i only want one, then process it and continue to the next)...I need to stop at each /Listing then insert it into Mysql, then continue to the next Listing for memory purposes...but I can't seem to figure out how to do this.

Here is code that I have written that just spits all addresses out:

code:
$reader = new XMLReader();
$reader->open("my.xml");

while ($reader->read()) {
   if ($reader->nodeType == XMLREADER::ELEMENT) {
      if ($reader->localName == "Street"){
          $reader->read();
          $address = $reader->value;
          echo $address . "<br>";
      }
      if ($reader->localName == "City"){
          $reader->read();
          $city = $reader->value;
          echo $city . ", ";
      }
      if ($reader->localName == "State"){
          $reader->read();
          $state = $reader->value;
          echo $state . "<hr>";
          
      }
      // have tried doing processing here of what I would think would be 1 record but instead it processes after each new node (fulladdress, city, state, etc)
   }
}
any ideas?

TKE248
Oct 8, 2004
Does anyone know of a free RSVP script similar to what facebook has?

Found one on my own if anyone needs one this works well

http://www.dbscripts.net/poll/

TKE248 fucked around with this message at 19:13 on May 7, 2010

blunt
Jul 7, 2005

Somethings wrong with this SQL query and i have no idea what. I'm not getting an error message either because its a paypal ipn repsonse that says its going through fine.

quote:

$sql = "INSERT INTO orders (email, paypal_tx, paypal_status, payer_id, payer_status, name, address_name, address_street, address_city, address_state, address_country, address_postcode, address_status, items,prices, promo, promovalue, gross_value, net_value, shipping, paypal_protection, timestamp) VALUES ($email, $paypal_tx, $paypal_status, $payer_id, $payer_status, $name, $address_name, $address_street, $address_city, $address_state, $address_country, $address_postcode, $address_status, $items, $prices, $promo, $promovalue, $gross_value, $net_value, $shipping, $paypal_protection, $timestamp)";
mysql_query($sql) or die(mysql_error());

I assume its some ridiculous formatting error but i'm totally at a loss.

Alex007
Jul 8, 2004

blunt posted:

Somethings wrong with this SQL query and i have no idea what. I'm not getting an error message either because its a paypal ipn repsonse that says its going through fine.

I assume its some ridiculous formatting error but i'm totally at a loss.

None of your string values have quotes around them, and if any of your values have a comma, quote of other breaking character, your SQL becomes invalid.

Use prepared statements, or add quotes to your query values and escape your variables.

Begby
Apr 7, 2005

Light saber? Check. Black boots? Check. Codpiece? Check. He's more machine than kid now.
^^^ is correct

blunt posted:

I assume its some ridiculous formatting error but i'm totally at a loss.

In the future to troubleshoot this kind of stuff, its good to use dummy data then echo the sql query, then paste it into a mysql gui and troubleshoot and fix it there.

blunt
Jul 7, 2005

Alex007 posted:

None of your string values have quotes around them, and if any of your values have a comma, quote of other breaking character, your SQL becomes invalid.

Use prepared statements, or add quotes to your query values and escape your variables.

Found the problem, i was missing quotes ($items is a x,x,x, string) and the while() that was around it was also wrong.

PHP :(

e;

quote:

In the future to troubleshoot this kind of stuff, its good to use dummy data then echo the sql query, then paste it into a mysql gui and troubleshoot and fix it there.

Thanks for the headsup :)

karms
Jan 22, 2006

by Nyc_Tattoo
Yam Slacker

blunt posted:


PHP :(


This 'error' has nothing to do with PHP and everything with the SQL standard. Sorry mate!

Jesus Stick
Dec 14, 2004

Bomb Hills, Not Countries
I am having trouble getting a simple monthly interest calculator to work. I am entirely new to PHP, and don't understand my problem.

calculator.html

code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
</head>
<body>

<h4>Future Monthly Interest Calculator</h4>

<form action="results.php" method="post">
<p>Starting Balance: (Starting balance of the savings account)<br />
<input name="startbalance" type="text" /></p>
<p>Monthly Deposit: (Amount deposited in the savings account each month.)<br />
<input name="deposit" type="text" /></p>
<p>Annual Interest Rate: (The interest rate stated as an annual percentage.)<br />
<input name="interestrate" type="text" /></p>
<p>Term: (The number of months to calculate the savings interest.)<br />
<input name="term" type="text" /></p>
<input type="submit" />
</form>

</body>
</html>
results.php
code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
</head>
<body>
<?php

$startBalance = $_POST['startbalance'];
$deposit = $_POST['deposit'];
$interestRate = $_POST['interestrate'];
$term = $_POST['term'];
$counter = 1;

echo "<table border=\"1\">";
echo "<tr><th>Month</th>";
echo "<th>New Balance</th></tr>";

while ( $counter <= $term ) {
    echo "<tr><td>";
    echo $counter;
    echo "</td><td>";
    echo $startBalance;
    echo "</td></tr>";
    $counter = $counter + 1

echo "</table>";

echo $startBalance;

?>
</body>
</html>
I want it to make a table based on the term that the user enters in calculator.html

I can upload it to my host if you need to see it.

Anyone that can help, thanks!

Hammerite
Mar 9, 2007

And you don't remember what I said here, either, but it was pompous and stupid.
Jade Ear Joe
At present your script has two syntax errors (that I can see). All statements need to be terminated by a semicolon; you are missing a semicolon after $counter = $counter + 1. Also, your while loop is missing a closing brace.

Hammerite
Mar 9, 2007

And you don't remember what I said here, either, but it was pompous and stupid.
Jade Ear Joe
Also: you don't have to type out a new "echo" command for every little piece of data you want to output. If you have a lot of things to output, you can use string concatenation:
code:
echo "<tr><td>".$counter."</td><td>".$startBalance."</td></tr>";

echo "<tr><td>".
     $counter.
     "</td><td>".
     $startBalance.
     "</td></tr>";
When using double-quoted strings you can just embed the names of variables in the string to get them included in the output:
code:
echo "<tr><td>$counter</td><td>$startBalance</td></tr>";
I prefer straightforward concatenation though.

Jesus Stick
Dec 14, 2004

Bomb Hills, Not Countries

Hammerite posted:

At present your script has two syntax errors (that I can see). All statements need to be terminated by a semicolon; you are missing a semicolon after $counter = $counter + 1. Also, your while loop is missing a closing brace.

Thanks a lot man! The table now works just as it should. Now I just have to add the actual calculations and test it out.

Yay
Aug 4, 2007

Hammerite posted:

Also: you don't have to type out a new "echo" command for every little piece of data you want to output. If you have a lot of things to output, you can use string concatenation:
[snip]
When using double-quoted strings you can just embed the names of variables in the string to get them included in the output:
[snip]
I prefer straightforward concatenation though.

To expand further; you don't even need to do concatenation, you can pass it comma separated arguments, and it'll handle them:
code:
echo 1, 2, '3', 4;
And if you're the dirty kind of person who wants complex variables interpreted, inside double quotes, you can wrap them in curly braces:
code:
echo "I am {$a['string']} and an {$object->value}";

Cpt.Wacky
Apr 17, 2005
I foolishly volunteered to help someone with a project and now I'm suffering for my lack of PHP experience. I'm using Drupal with the Webform and Webform PHP module. It lets you put in a chunk of PHP code to do additional validation and processing after the form is submitted.

I've got some code in the processing section that isn't working.

code:
<?php

$total = 0;

if ($form_values['submitted_tree']['some_key'] == 'Stuff') {
  $total += 10;
}

$total = strval($total);
$form_values['submitted_tree']['total'] = $total;
$form_values['submitted'][22] = $total;

?>
When I run this I get a blank for the total value. I know it's doing something because if I make a typo (like forget a semicolon) then the default text for the total field is unchanged. If I just assign a literal string to the variable then the value shows the change.

Your Computer
Oct 3, 2008




Grimey Drawer
I'm currently toying a bit with PHP to make a web-game for my SO (think along the lines of Neopets or Gaia, just... actually don't.)

Now, I have never used PHP before and I learn as I go. Having some background with other programming languages (mostly java) everything goes pretty smooth. I've made a registration page, a login page, member profiles, etc. mostly to get a feel for the language (will probably have to drastically change the structure once I actually design the page).

The game will revolve around "pets" (think Pokémon. Pokémon is good.) and incorporate many RPG elements, one of which is equipment or accessories. This is where I'm stuck.

Looking around google I've found the function "imagecopymerge" which does part of what I want (take the 'pet', take the 'accessory', merge them) but my current script is awfully clunky.

Click here to take a look

Right now I use two PHP scripts, one which generates the image based on a GET request (php?on = add hat, php?off = don't add hat) and the other which displays the image. The img src in the display-page is a string where the value if determined by the button you press (party.php?on or party.php?off)

Now, this is where it gets clunky. GET is far too exploitable when it comes to things like this (only a user that actually HAS the hat should be able to use the hat) and I have no idea how I would add (and remove) more items.

I'm sorry if my explanation is terrible, I'll get to the point.
What I want is to be able to equip several items, and then be able to unequip them one by one in any possible combination (say, add party hat, add glasses, remove party hat without removing the rest).

I also want to get rid of the GET or at least make the resulting image a .png (so when you save it it won't save as "party.php?on.png")

Any ideas? :shobon:

Yay
Aug 4, 2007

Your Computer posted:

The game will revolve around "pets" (think Pokémon. Pokémon is good.) and incorporate many RPG elements, one of which is equipment or accessories. This is where I'm stuck.

Now, this is where it gets clunky. GET is far too exploitable when it comes to things like this (only a user that actually HAS the hat should be able to use the hat) and I have no idea how I would add (and remove) more items.
Any ideas? :shobon:
Store and validate the data against the session, rather than a querystring? Ultimately, get is not exploitable unless you leave it to exploitation. If you can secure the input in such a way as you always know what to expect (check the string is in an array of valid scalars, etc), then there's much less of a problem.

Your Computer
Oct 3, 2008




Grimey Drawer

Yay posted:

Store and validate the data against the session, rather than a querystring? Ultimately, get is not exploitable unless you leave it to exploitation. If you can secure the input in such a way as you always know what to expect (check the string is in an array of valid scalars, etc), then there's much less of a problem.

:doh:

Of course, sessions. I'm still not very good with those. I suppose I would use both cookies and sessions, then? I currently use cookies for user login and sessions for... nothing. Any good resource for using sessions in this manner?

Cpt.Wacky
Apr 17, 2005

Cpt.Wacky posted:

I foolishly volunteered to help someone with a project and now I'm suffering for my lack of PHP experience. I'm using Drupal with the Webform and Webform PHP module. It lets you put in a chunk of PHP code to do additional validation and processing after the form is submitted.

I've got some code in the processing section that isn't working.

Well it looks like Webform wasn't meant to be used this way. I'm building the form as a custom content type with the CCK and Computed Field modules now.

spiritual bypass
Feb 19, 2008

Grimey Drawer
I've recently set up a Drupal site on an Amazon EC2 machine running Fedora 8. On this site I have just activated the "Contact Form" module. For some reason, it doesn't seem to be sending any email. Where should I be looking to fix this? Is this the wrong thread? I'm clueless about email.

spiritual bypass fucked around with this message at 05:31 on May 12, 2010

revmoo
May 25, 2006

#basta
Edit:

Mail() won't work, you'll need to get SMTP support from a drupal module. Or configure sendmail, which I don't feel is worth the hassle.

Bob Morales
Aug 18, 2006


Just wear the fucking mask, Bob

I don't care how many people I probably infected with COVID-19 while refusing to wear a mask, my comfort is far more important than the health and safety of everyone around me!

Let's pretend we have an imaginary message board. The messages are stored in a table with a thread_id and sub_forum_id. Threads and forums are stored in their own tables.

The threads have a sub_forum_id, so if you click on sub forum 'games', all the threads that have the sub_forum_id of '5' or whatever games is, will show up. Likewise, when you click on the thread 'Super Mario Brothers', all the messages with the thread_id '50' show up.

Here's my question: Which way would be commonly used to keep track of the replies, views, and post counts in each forum?

Forum: Threads: Posts
Games 57 302
Chat 23 98

Thread: Posts: Views:
Hello! 23 299
Anyone play it? 56 23432

Would it be stupid to query the database for all threads, and then posts that belong in each forum, every time someone calls up the forum index page? I guess we're already querying the DB for all the thread titles etc each time, or is that something that shouldn't be done every time either?

What about updating the thread counters (and then the sub forum counters) every time a post is made?

What about having an automated process just update the numbers every 1 or 5 minutes? Would I do that with just a cron job? Or would I have some custom maintenance script that is running all the time, doing things as I set them up (sounds like re-writing cron)

Acer Pilot
Feb 17, 2007
put the 'the' in therapist

:dukedog:

Bob Morales posted:

Let's pretend we have an imaginary message board. The messages are stored in a table with a thread_id and sub_forum_id. Threads and forums are stored in their own tables.

The threads have a sub_forum_id, so if you click on sub forum 'games', all the threads that have the sub_forum_id of '5' or whatever games is, will show up. Likewise, when you click on the thread 'Super Mario Brothers', all the messages with the thread_id '50' show up.

Here's my question: Which way would be commonly used to keep track of the replies, views, and post counts in each forum?

Forum: Threads: Posts
Games 57 302
Chat 23 98

Thread: Posts: Views:
Hello! 23 299
Anyone play it? 56 23432

Would it be stupid to query the database for all threads, and then posts that belong in each forum, every time someone calls up the forum index page? I guess we're already querying the DB for all the thread titles etc each time, or is that something that shouldn't be done every time either?

What about updating the thread counters (and then the sub forum counters) every time a post is made?

What about having an automated process just update the numbers every 1 or 5 minutes? Would I do that with just a cron job? Or would I have some custom maintenance script that is running all the time, doing things as I set them up (sounds like re-writing cron)

Well, Invision Board has a table just for topics and it stores the total number of posts, threads, the last topic id, and last poster name. Take it as you will.

Edit: It's probably best to do it this way since you don't want to scan through all your posts every time someone loads the index. If my Invision forum did that it'd probably eat up all the RAM going through 400,000 poo poo posts.

Yay
Aug 4, 2007
You'll hear arguments from both sides, but mostly people (who can reconcile everything not being normalized to the optimum) just deal with the minor denormalisation and have a separate field to keep a reasonably up-to-date count of various bits like that.

(Edit: ultimately, object counts don't need to be accurate (see post below) because once they pass a certain thresh-hold (say, 5-10), they're irrelevant for a while.

For example, the difference between 11 and 16 objects is measurable, but not by enough for it to matter. You don't suddenly hit object 14 and declare that due to an inaccurate representation on the previous page, you shan't continue.

Page counts matter slightly more, as they're an indication of the overall timesink, but still)

Yay fucked around with this message at 22:18 on May 12, 2010

epswing
Nov 4, 2003

Soiled Meat
Ah just store the values, you're not writing bank software, it's really, really ok if your post count is off for whatever reason. If you want, write a "regenerate totals" function which does the full aggregate scan and comes up with the true values, and run it once an hour/day, and in the meantime just increment the values as necessary and get on with your life.

:)

Adbot
ADBOT LOVES YOU

spiritual bypass
Feb 19, 2008

Grimey Drawer

revmoo posted:

get SMTP support from a drupal module

Good suggestion; the day is saved :)

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply