Results 1 to 10 of 25

Thread: Help / Advice please...

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    PGD Staff code_glitch's Avatar
    Join Date
    Oct 2009
    Location
    UK (England, the bigger bit)
    Posts
    933
    Blog Entries
    45
    read & write files? Think logically, slowly and in simple instructions. Then its simple. The more procedure to treat information the better. Oh, and dont forget the else statement in case you find data you did not expect and that sometimes its good for the program to say 'error' than hang forever that really is all theory to that bit ahead of time.
    I once tried to change the world. But they wouldn't give me the source code. Damned evil cunning.

  2. #2
    Thanks code dude! I got it sorted, well the intially part of the excercise anyways, just need to print it to a file and job done. Out of curiosity...Do you know of anyone thats a dab hand in php that woudln't mind trying to "nicely" infiltrate a site i'm working on.

  3. #3
    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.

  4. #4
    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.

  5. #5
    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.

  6. #6

    oh...

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

  7. #7
    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

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
  •