Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

PHP application help

edited March 2006 in Vanilla 1.0 Help
I am currently working on a small php application with a flat file database. It is a small backend for a service called "Stooge List". It lets a user add a 'stooge' to the list, and also supports multiple entries bu adding a [x2] next to their name. (eg. Nathan Wheatley[x2].) I basically have it working, but I can't get the count to work correctly. Could anyone take a look at it for me? I think it should bea relatively simple thing that I am missing here, but, I can't seem to find it. If anyoe could take a quick look and see if they can find the problem, or where I am goinf wrong, I would appreciate it. Here are the files (all 2 of them). http://server.skoap.com/stooge.zip Thanks.

Comments

  • First change your line

    $new = $old +1;

    to

    $new = $old;

    Or leave and take out the

    $old++;

    Otherwise the count increases by 2 each time.

    Second your problem is the 'x' you have to catch the 'x' as well

    $search = array($_REQUEST['stooge'], '[x', ']'); // catch the x
  • That and you could really clean up and shorten the code quite a bit. Just a suggestion, not everyone likes it but if you are just counting and adding try using an INI file.

    http://de2.php.net/parse_ini_file

    Just a thought though, for something like this I don't see a real drawback.
  • Cool. I don't usually write this sort of application, so it i smore of a test that anything else. I will endevour to tidy it up and use the best and/or accepted practices when it is all done. I will try it and let you know how it goes.
  • Well, the count now increases correctly, but it does not hold the right count. i.e. 1st Submission: Nathan Wheatley 2nd Submission: Nathan Wheatley[x1] 3rd Submission: Nathan Wheatley[x2] The count is off by one. Any ideas with that one?
  • Disregard. All sorted now. Thanks for your help.
This discussion has been closed.