[HTML/MYSQL] Funds raised tracking page

Discussion in 'Web Design & Coding' started by Mainframeguy, Mar 22, 2006.

  1. Mainframeguy

    Mainframeguy Debiant by way of Ubuntu Folding Team

    Messages:
    3,763
    Location:
    London, UK
    OK - if this thread needs merging, by all means merge it. There is a general one where it can go - but I have reached a point where I have a good idea what i want to achieve for completion on a small set of pages that, if I make them a little smoother and sort out certain linkages and apply a little smoothing design I might even glorify to call a "website".

    The Domain in question is here

    And what I would like to set up is something like this but I realise this is far from the standard PayPal donate button i have put in now - I'll need to box that up and have front end that gets it into an SQL database I guess.

    I've tried hunting about for Brion to ask for his source without any joy this far - the wikipedians channel on freenode looks deader than OSNN! Maybe someone on OSNN has set up similar or might feel like rising to the coding challenge. I just know that people will be more encouraged to daonate with this kind of live feedback to show progress being made.
     
  2. ming

    ming OSNN Advanced

    Messages:
    4,252
    Location:
    UK
    whats the donation for? probably attract the attention of hackers to be honest (if there lots of donations made).
     
  3. Mainframeguy

    Mainframeguy Debiant by way of Ubuntu Folding Team

    Messages:
    3,763
    Location:
    London, UK
    I said what the donations were for in the post - see the first link!
     
  4. Mainframeguy

    Mainframeguy Debiant by way of Ubuntu Folding Team

    Messages:
    3,763
    Location:
    London, UK
    It occurs to me that Ming has a point here though - can anyone advise what security would be advisable and protocols best employed - I can imagine a hacker might try to subvert anything I implemented like this with a change to the redirect if they hacked into the hosting - well I guess that is slightly outside my control.

    Funds are way lower than those wikipedians may raise - you can see the target - so surely any hackers are just not going to see this as worth their while? Plus surely they tend to avoid the worthy causes? Don't even hackers have some code of honor?

    Again - maybe I am being impatient - but disappointed at feedback - think I may stop posting anything here and just struggle along as best I can cobbling something together that looks as good as it can....
     
  5. kcnychief

    kcnychief █▄█ ▀█▄ █ Political User Folding Team

    Messages:
    16,948
    Location:
    Massachusetts
    Well, I am not the best "back-end" coder, so I may be a bit biased.

    BUT - if you are looking for security and ease of use, perhaps try posting a screenshot of your PayPal balance, which would in turn post how much has been donated. The negative side to this, is when you withdraw, obviously the total in the shot would be tainted. However, what you could do is weekly balances, then a simple formula to give a running balance.

    Might be more work than I had originally thought, but I posted a screenie for point of reference. I'm not very rich right now, but people don't donate to me :lick:
     

    Attached Files:

  6. Mainframeguy

    Mainframeguy Debiant by way of Ubuntu Folding Team

    Messages:
    3,763
    Location:
    London, UK
    nah- that would be just as easy to simply type n a number.

    I have two aims here - the first is that I am trying to set up a site for Agneta and that she needs it to largely be set and go - she may check email and read the guest book - but that is about it, she will certainly not be doing any site admin on the scale of updating a .jpg file - I am not sure whe would know what FTP was, OK?

    The second, probably more important, is that people like to see their donation make a difference. So I was proposing an online tracker - I think you'd fnd the wikipedia page would update itself as you donated. There's no reason I can see why a donation should not be entered and passed through to the paypal link - just that I do not know how to do it. Then capture into an SQL database and use a query to populate the page to show funds raised.

    This has the advantage it is totally deparate from a PayPal account and funds could be withdrawn from there to the secure bank account, covering the security angle a little more.

    Here is a post and reply I made at another forum where they seemed to understand the requirement.

    Not saying you do not understand, mind, and thanks for the idea! Never know, we might use some variation of that in the end....
     
  7. kcnychief

    kcnychief █▄█ ▀█▄ █ Political User Folding Team

    Messages:
    16,948
    Location:
    Massachusetts
    I understood completely - just wanted to offer an alternative :)
     
  8. Mainframeguy

    Mainframeguy Debiant by way of Ubuntu Folding Team

    Messages:
    3,763
    Location:
    London, UK
    OK I have gotten far enough to realise that automating the PayPal donations requires IPN to be turned on and then there are code fragments I can get from the PayPal developer forums so hopefully I can get as far as having a php variable containing an amount..... when I hear back from Agneta, who owns the PayPal account and wil need to activate IPN for me.

    I thought in the meantime there's two things I ought to get on with here:-

    Firstly I need an SQL/PHP enquiry to a database which will retain donations and dates with optional comments - all this needs to do really primarily is to run a TOTAL function on the donations column and display that nice and visible on the main page.

    Secondly I need a password secured page or dialog for Agneta to access to input Values, dates, comments, to cover funds received outside PayPal.

    With this revised requirement could anyone offer help now? I guess I need to install some stuff here to operate server side admin tasks like creation of the database and table.... see I am at such a starting out, steep learning curve, that any and all help may be appreciated.

    [EDIT]OK so I am up to phpMyadmin and I have the idea that basically everything should execute at the server side - I'll need a couple of pages with php scripts to get th total back fromt he database and another secured soemhow for data to be put in to the database... does PHPmyAdmin allow me to CREATE my table and suchlike? Surely some folks here have done this kind of stuff?[/EDIT]
     
    Last edited: Mar 30, 2006
  9. dubstar

    dubstar format c:

    Messages:
    1,357
    Location:
    Southern California
    i know very little php (from internet tutorials) but i can help with a layout! the site looks unhappy and i would love to help re-organize it.

    www.quistlogic.com for a ref.
     
  10. X-Istence

    X-Istence * Political User

    Messages:
    6,498
    Location:
    USA
    MFG: phpMyAdmin will allow you to create your tables, and or other things, it even allows you to insert data into the MySQL database.
     
  11. Mainframeguy

    Mainframeguy Debiant by way of Ubuntu Folding Team

    Messages:
    3,763
    Location:
    London, UK
    cool - thanks - created my first table - (not counting the DB2 ones from my past) - now on to the php to update it!
     
  12. X-Istence

    X-Istence * Political User

    Messages:
    6,498
    Location:
    USA
    I would be willing to help if I get some free time this weekend.
     
  13. Mainframeguy

    Mainframeguy Debiant by way of Ubuntu Folding Team

    Messages:
    3,763
    Location:
    London, UK
    HMMmmm well I have a form input page and a php page to make that insert into a table - this is all dead simple stuff....

    BUT it is not working! Trouble is there's no way for me to see what is going wrong and it is strating to drive me a bit nuts - the form takes data and posts - the action goes to the php - but that just sits there and there's nothing going on! I don't get it - if I even try to view source for the page it shows me nothing.... but I have put some HTML around the php and some echos in there along with the MYsql query to insert... any ideas how to proceed to debug this? Anyone?

    [EDIT] I was aware of the register globals thinger from PHP4 and have now found that the hosting service allows me to set this alongside reporting for php errors and I get to chose if I wish to run php4 or five, guess I may make some progress once this change goes through, hopefully.... [/EDIT]
     
    Last edited: Mar 31, 2006
  14. Mainframeguy

    Mainframeguy Debiant by way of Ubuntu Folding Team

    Messages:
    3,763
    Location:
    London, UK
    OK - pardon me sort of bumping this - I got my form to work and my PHP script SEEMS to be going through taking values and forming an INSERT - least no errors are popping out - yet when I uses phpAdmin to query the table there's no rows! Any ideas now... I have to take a break for some real life stuff....

    [EDIT]HMMMmmm print mysql_error() is my friend and it helps to name the columns right..... working so far so good now[/EDIT]
     
    Last edited: Mar 31, 2006
  15. Mainframeguy

    Mainframeguy Debiant by way of Ubuntu Folding Team

    Messages:
    3,763
    Location:
    London, UK
    OK - so you can guess what I am working on now - table output

    It just got pretty late pretty fast - I can't debug this at this late hour and thought someone here may spot the error in this code fragment:-

    Code:
    <?php
    $db=mysql_connect("localhost","agnetamills_net","notmypassword");
    if (! $db)
    die("Couldn't connect to MySQL");
    mysql_select_db("agnetamills_net",$db)
    or die("Couldn't open $db: ".mysql_error());
    $result = mysql_query( "SELECT * FROM donations",$db)
    or die("SELECT Error: ".mysql_error());
    $num_rows = mysql_num_rows($result);
    print "There are $num_rows recorded donations.<P>";
    print "<table width=400 border=1>\n";
    while ($get_info = mysql_fetch_row($result)){
      print "<tr>\n";
      foreach ($get_info as $field)
      print "\t<td><font face=arial size=1/>$field</font></td>\n";
      print "</tr>\n";
    }
    print "</table>\n";
    mysql_close($db);
    ?>
    for some reason this never gets to outpuyt number of donations or anything.... I'm puzzled... it's late... the output i do get is like

    "; print "\n"; while ($get_info = mysql_fetch_row($result)){ print "\n"; foreach ($get_info as $field) print "\t\n"; print "\n"; } print "
    then a table with just $field - and then the close,

    all coming out on my page - it is like the parsing has gone badly wrong but stayed valid and I cannot see it.... must be obvious surely?
     
  16. Mainframeguy

    Mainframeguy Debiant by way of Ubuntu Folding Team

    Messages:
    3,763
    Location:
    London, UK
    OK - excuse bump again - I need to save some poor soul from trying to find any error there though! And no wonder I was banging my head against a wall, because there is no error (least I do not think there is!).

    Thing is I had that php code in the middle of my HTML page, and that seems to trip things up (still do not fully understand).... once I moved my start/end php tags to the top and bottom of my HTML page and had it PRINT <HEAD> etc etc the page worked fine. If anyone wants to post back quite why this was necessary and what is best practice here that would be good, because I would hate to get into cludgey and clumsey habits early!

    My next task, surely very simple? Is just to get the total to display in a nicely formatted box on the main page.... then I need some input as to how to make a very simple basic password input for the site owner to use my input form. On that line would anyone like to comment on best practice or where to read about the database password and how it should be concealed. I am aware it is in a script file on the server and that seems an exposure. There's nothing critical there certaily not as yet, but I'd like to take a semi-professional approach here and input would be appreciated.
     
  17. Mainframeguy

    Mainframeguy Debiant by way of Ubuntu Folding Team

    Messages:
    3,763
    Location:
    London, UK
    I have pretty much achieved what I set out to on this one now - not tried to interface with paypal's IPN system I believe that may get a little complex - especially if they do not supply me the amount!

    The site remains sad and incomplete to my view - I may bump the previous thread to see if anyone would care to help overhaul it so that it wil ldisplay better with different resolutions etc.

    Also although I have implemented a simple MySQL table that will show contributions and a total raised I have not got that displaying on the front page and I see that as a defficiency in the aim of the site.

    So maybe for a closing note on this thread could anyone give a guidance on how best to achieve that given that index is an .SHTML file... I am not sure if I am at liberty to change that one to .php filetype so I do not have access to the include script I wrote to give me a total figure - also I'd like to jazz it up a bit on the title page maybe?

    Incidentally, since I trust you guys here do feel fre to check out how I have set the site for security with the database and the sites owner having update access... I am not aiming for professional levels of ultra security since the data is just site internal, but it would be nice to have it secure enough to discourage dumb pranksters so to speak.