Page 3 of 3 FirstFirst 123
Results 21 to 25 of 25

Thread: Help / Advice please...

  1. #21
    PGD Staff code_glitch's Avatar
    Join Date
    Oct 2009
    Location
    UK (England, the bigger bit)
    Posts
    933
    Blog Entries
    45
    Hmm. I haven't heard from Athena lately (thats AthenaOfDelphi) since I know she does all of the SQL and web stuff for PGD she might know... I run my own site from home, but thats mainly drupal with scarce fragments of hand written PHP and CSS (most of it is just changing elements I don't like in themes). I suppose it depends on what you need done.
    I once tried to change the world. But they wouldn't give me the source code. Damned evil cunning.

  2. #22
    Some advice: Do not waste time checking the same value more than once... and do not bother storing values in a program that you are just going to discard. Your three boolean test condition variables likely are not being used, and it is generally as fast to test a condition as it is to test a boolean...

    What I mean to say, is I'd get rid of the three 'pos, neg and zero' variables, AND I'd not run all three if's every time.

    The reason for this is you are executing code you don't have to, and checking values you may already know the status of -- which means you have more code running than neccessary! You're running three conditional evaluations, three variables and three if statements to do the job of two conditionals INSIDE two if's.

    Code:
    if (numCheck>0) then begin
    	writeln('This is a positive number');
    end else if (numcheck<0) then begin
    	writeln('This is a negative number');
    end else writeln('This number is zero');
    Is all you really need to be doing there. If the first check is true, it writes and ignores the rest of the code. If it's fals, we check the opposite direction, if so write the result, if not -- we know it's not >0, we know it's not <0, so it HAS to be zero, so there's no reason to put an IF there on that.

    Basically, if it's >0 there is NO reason to check for <0 or 0. If it's <0 and we've eliminated >0, there's no reason to check for 0... if neither state is true, it has to be zero.
    The accessibility of a website from time to time must be refreshed with the blood of designers and owners. It is its natural manure

  3. #23
    Quote Originally Posted by code_glitch View Post
    Hmm. I haven't heard from Athena lately (thats AthenaOfDelphi) since I know she does all of the SQL and web stuff for PGD she might know... I run my own site from home, but thats mainly drupal with scarce fragments of hand written PHP and CSS (most of it is just changing elements I don't like in themes). I suppose it depends on what you need done.
    I imagine simple SQL injection testing to see if you can gain access to the db.

  4. #24
    cheers for the advice with the boolean and else if code, it makes it cleaner and when programming i like it to be clean and tidy - nice one!

    as for the sql injection, I've been using eregi to filter out unwanted characters, realised its obsolute and not in the process of checking and replacing with preg. It seems to be sound but as with pascal, theres so much I odn't know it woudl be easy to make a silly mistake.

  5. #25

    oh...

    the read / write text file thing....smashed it

Page 3 of 3 FirstFirst 123

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •