Jump to content

ginerjm

Members
  • Posts

    6,906
  • Joined

  • Last visited

  • Days Won

    99

Posts posted by ginerjm

  1. That code is pretty weak looking.  You test two things to see if they failed, but when they do you don't output anything to tell you they failed.  Echo-ing out an empty string as you do is not very helpful when something didn't work. And if it didn't work you continue on with the rest of the script anyway.  Why?

     

    To top it all off - you then do your update query and once again you test for failure but don't put out a message whether it actually updated or not. 

     

    As for caching - how does a php script get cached on the browser since it only exists on the server?

  2. I don't know how you are doing this that makes the cache affect you.  I do this all the time.  Every time my script executes it checks if it has already been run and is processing a response, or if it is the "first" time it has been called.  If it is the "first" then I increment my counter.  Obviously this won't tally up refreshes, but why would you want to do that?  It doesn't tell you anything about usage.

     

    So - show us your code for keeping your hit counts so we can see why the cache is affecting you.

  3. It's simply a matter of uploading a file - video or not.  Plus - you really shouldn't be saving video files (or image files) in a table.  There is no reason to do that.  The file can be pointed to (by name) from a db table that may contain information about it, but you don't need to save the file also in that table. 

     

    Create a default folder for your video/image files and link to them from the  table.

     

    Also - do some googling (or read the manual) for how to upload files with php.

  4. My phpinfo does not show an element called HTTP_CACHE_CONTROL  - does yours?

     

    I realize that you are trying to avoid repeated F5 hits here but is it really necessary.  Why not just trigger "new" hits on a page with a snippet of code and a function that logs the data?  I woule just check if there existed a submit value that comes from the current page; if it doesn't then it is a new visit to the page and  I would log it.  If not, I wouldn't.

  5. You are doing a bindvalue as well as including an array in the execute call.  More importantly you are assigning different values to your parm in each case.  I'm confused and I am sure the SQL Server is more confused.

     

    Personally I stick to the array method and never use the bindvalue one.  That said - you should do ONLY this:

    if (!$Startoff->execute(array('boxingid'=>$PostIdThing)))
    {//show error}
    else
    {//show success msg}
    

    and leave out the bindvalue as well as the first call to execute.

  6. If you are storing a timestamp in the "kick" field, it must be hard to store a text value in there.  I'm guessing that you don't have that field defined as a time-related field which makes it hard to use that comparison you have in your where clause.

     

    Try defining your kick field as a timestamp and then add another field as a flag to be set when you want "permanent" status set on this record.

  7. I really think that if you did RTFM you would have a better mental outlook on how a query works and how various functions enable you to get what you want out of it.  If you think that you can actually become a 'good' programmer without ever availing yourself of the specific knowledge available in the documentation for the tools that you may use in that learning process, you are sorely disillusioned.

  8. As previously mentioned - you should really send an email asking the user if he wants to reset his password to avoid someone hacking and causing you to make a change that the user didn't request.  Add a hidden field to the reset form that you provide the user if he responds 'Yes' to be able to detect a valid reset request from the user as opposed to the perhaps invalid request from a hacker.

  9. So where is your query defined?  $sql?

     

    You could also read up on html tags that are deprecated.  Such as <font>.  And how to use css to make styling your html much simpler. 

     

    A major  improvement in script development would be to learn how to keep you html block of code completely separate from the php block of code.  You begin your script with the start of an html doc.  What's the rush?  You should begin with the php code and the logic to determine what exactly you are supposed to do at this instant.  Then do it.  If it involves building some formatted (ie, html) output, then do that as part of your query results loop and store it in a php var that you then embed in your html block where it needs to go.

     

    Splitting things up like that makes it Sooooo much easier to follow - for you and for us - and easier to debug later on and easier to enhance and add features such as more html or more php logic.

  10. IMHO - When a user enters incorrect credentials you should simply put back the login screen with/without the incorrect userid and NO password and a message saying that the entries were invalid.  This way they get to try again without having to click on boxes.

     

    Don't send back the password, just the userid entry to avoid multiple transmissions of a possibly valid pswd.

    • Like 1
  11. A good model for script design is to set your php code all up front and your html all at the end.  They don't need to mix unless you are using php vars to convey html with dynamic embedded data into the final webpage output.

     

    Keeps the logic and heavy work away from the presentation and display work.  No need to output intermittent dribs and drabs of html while you are trying to write the "serious" code.

×
×
  • 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.