Jump to content

Jenk

Members
  • Posts

    778
  • Joined

  • Last visited

    Never

Posts posted by Jenk

  1. actually, sha1 is the one truly breakable hashing algorithm and use of it is discouraged, even md5 has preference.

    but with vulnerabilities like you have in your SQL statements, no hashing algoritm is worth bothering with.

    I go to your site and enter the following credentials, what happens?

    [code]Username: ' OR '' = '' --
    Password: whatever[/code]
  2. [quote author=Crayon Violent link=topic=105876.msg424127#msg424127 date=1156871329]
    jenk- just so you know, mysql_field_type() returns what php thinks the column type is, based on the data retrieved from the column. This does not necessarily make it the same data type as what you actually have in your database.  Your column type could be something else and php could get it wrong.  therefore you should do it my way, as you are getting the datatype directly from sql, not php.
    [/quote]Actually, no it doesn't. It is a direct shortcut to the C function which is used within MySQL. It returns whatever value is in the TYPE column when you run a DESC `table` statement.
  3. Why remove the submit variable?!

    Why remove anything from $_POST in fact?

    Also, extracting variables frmo user input is not a wise idea. This is why regsiter_globals is frowned upon.

    It is best practice to explicitly use the data you require, $_POST can contain as many fields as the user wishes. You will also have problems if the user submits an array within $_POST if you use that snippet.
  4. [quote author=ToonMariner link=topic=106246.msg424675#msg424675 date=1156946138]
    from the manual

    Note: Prior to PHP 4.0.2, the following applies: require() will always attempt to read the target file, even if the line it's on never executes. The conditional statement won't affect require(). However, if the line on which the require() occurs is not executed, neither will any of the code in the target file be executed. Similarly, looping structures do not affect the behaviour of require(). Although the code contained in the target file is still subject to the loop, the require() itself happens only once.

    apology accepted ;)
    [/quote]No apology given. Take note of "prior to 4.0.2"

    Any host still running < 4.0.2 is a poor host ;) Your apology accepted.

    Also note that the code will not be executed even in < 4.0.2. require() just tries to read the file. Another apology accepted.
  5. [quote author=ToonMariner link=topic=106246.msg424672#msg424672 date=1156945987]
    include will include your file whenever the flow of code calls it.

    require will include your file regardless...

    eg.

    if ($string == 'yep')
    {
    include('file.php);
    }

    will only include your file if $string is 'yep'.

    if ($string == 'yep')
    {
    require('file.php);
    }

    will include it no matter what $string is.
    [/quote]Incorrect.
  6. eregi is deprecated, use preg_* functions instead.

    Otherwise use stri* functions for direct matches:
    [code]<?php

    $string = 'FoO';

    if (stripos($string, 'foo') !== false) {
        //case insentivie match for foo found
    }

    if (preg_match('/foo/i', $string)) {
        //case insensitive match for foo found
    }

    ?>[/code][/code]
  7. mysql_real_escape_string() is all you need to make a variable safe for inserting to mysql. strip_tags() is not necessary (and is not favored over htmlentities(),) trim is just not necessary.

    Escaping characters only turns them to literal values. You will not see the escaping character ("\") in your MySQL database. Inserting a value of: O'Reilly (when escaped will appear as O\'Reilly) will appear in your database as O'Reilly.

    If you do not escape, the query will fail.
×
×
  • 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.