Re: Re: User Logon Procedure Fails

From: Date: Mon, 05 Jul 2004 21:30:03 +0000
Subject: Re: Re: User Logon Procedure Fails
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-189753@lists.php.net to get a copy of this message
Curt Zirzow wrote:
$userid = (int) $_POST['TXT_UserID']; $sql = "... WHERE UserID = $userid"; Seing that I have a question around. Most cases I validate the $userid by using the function inval() in that way:
    $userid = inval($_POST['TXT_UserID'];
    $sql = "... WHERE UserID = $userid";
I thinkl that in both cases (Curt and mine) results are the same, and $userid will get the digits from the begining of $_POST['TXT_UserID'] to the first non digit char. I made this test: <?PHP $value = intval($_GET['val']); echo "value: $value <br>"; $value = (int) $_GET['val']; echo "value: $value <br>"; ?> Then I passed on the GET, different values: - ?val=me123 // Displays 0 in both cases as expected.
- ?val=123me    // Displays 123 in both cases.
- ?val=12me3    // Displays 12 in both cases.
- ?val=46.5 // Displays 46 in both cases. Just my questions: Are I correct assuming that the both aproaches give always the same result? Which one is more polite and/or correct to filter the user data? and faster ? Thanks in advance, Jordi.

« previous php.general (#189753) next »