[PHP] problem looping through records
I have a sql statement which brings about 15 records... inside the while loop i am trying to get data from another table by passing an id, the problem is i am only getting the first record .. not the whole 15 records.. any suggestion?? function list_ss_cats(){ global $db; $sql = SELECT DISTINCT(new_cat) FROM logos WHERE format =3; $result = $db-sql_query($sql); $num = $db-sql_numrows(); while($row = $db-sql_fetchrow()){ $sql2 = SELECT * FROM cats WHERE id='$row[new_cat]'; $result1 = $db-sql_query($sql2); $row1 = $db-sql_fetchrow($result1); echo $row1[en]; // this should show all 15 records but only shows the first record } } Many thanks in advance huzz -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] cookie problem
I am using the following codes to create cookie and validate login, but some members can't login, I checked their username and password is correct.. function docookie($id, $username, $passwd,$fname, $lname, $suspended,$rememberme) { $info = base64_encode($id:$username:$passwd:$fname:$lname:$suspended); if($rememberme) { setcookie(user,$info, time()+15552000,/,domain.com); } else { setcookie(user,$info); } } function cookiedecode($user) { global $cookie, $prefix; dbconnect(); $user = base64_decode($userinfo); $cookie = explode(:, $userinfo); $result = mysql_query(select passwd from profile where username='$cookie[1]'); list($pass) = mysql_fetch_row($result); if ($cookie[2] == $pass $pass != ) { return $cookie; } else { unset($user); unset($cookie); } } what i am i doing wrong?? They're sending email from hotmail account sop i am assuming their browser supports cookie.. please help... many thanks in advance huzz -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] strange crypt() problem
I have this bit of code to crypt user password in user registration as shown below. $cryptpass=crypt($makepass); which generated crypted password like eg 37Q9fppLHc4fQ with php 4.0 And am using the codes below to check for valid login.. // $pass - from login page // $dbpass - from the database $pass=crypt($pass,substr($dbpass,0,2)); } if (strcmp($dbpass,$pass)) { return(0); } Recently i have moved the same file to a new server with php 4.3.1 the problem is the same piece of codes above generates completely differen crypted value eg.$1$RjZHv7qx$h/L9ZUNT48rilHB6fGoMP/ .. hence the login codes above does not work... :( Please someone tell me that i am not going mad please help huzz -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] strange crypt() problem
I already have about 1000 members their password crypted using crypt(); would they able to login using their password or they have to change it again?? Thanks SævË Ölêöyp [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Try using md5() instead because it is more widely supported than crypt() and it leaves no room for errors. Hope it helps, Sævar ICELAND -Original Message- From: Huzz [mailto:[EMAIL PROTECTED] Sent: 19. júní 2003 21:43 To: [EMAIL PROTECTED] Subject: [PHP] strange crypt() problem I have this bit of code to crypt user password in user registration as shown below. $cryptpass=crypt($makepass); which generated crypted password like eg 37Q9fppLHc4fQ with php 4.0 And am using the codes below to check for valid login.. // $pass - from login page // $dbpass - from the database $pass=crypt($pass,substr($dbpass,0,2)); } if (strcmp($dbpass,$pass)) { return(0); } Recently i have moved the same file to a new server with php 4.3.1 the problem is the same piece of codes above generates completely differen crypted value eg.$1$RjZHv7qx$h/L9ZUNT48rilHB6fGoMP/ .. hence the login codes above does not work... :( Please someone tell me that i am not going mad please help huzz -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] strange crypt() problem
Thanks guys for your suggestions ... Jeff Harris [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] It looks like Some operating systems support more than one type of encryption. In fact, sometimes the standard DES-based encryption is replaced by an MD5-based encryption algorithm. The encryption type is triggered by the salt argument. At install time, PHP determines the capabilities of the crypt function and will accept salts for other encryption types. If no salt is provided, PHP will auto-generate a standard two character salt by default, unless the default encryption type on the system is MD5, in which case a random MD5-compatible salt is generated. PHP sets a constant named CRYPT_SALT_LENGTH which tells you whether a regular two character salt applies to your system or the longer twelve character salt is applicable. The first server you were using was using DES, this new server is using MD5. Since hashes are one-way algorithms, you appear to be SOL. However, you might be able to work something with mcrypt and someone who knows anything about it. http://www.php.net/manual/en/ref.mcrypt.php Jeff On Jun 19, 2003, Sævar Öfjörð claimed that: | |Well, if you don't find another solution for this, you could generate |random passwords for each member and mail them to them. Then you would |md5() them and update the DB with new md5()'ed passwords... This is not |the easy way out so I hope someone finds out why the crypt() is behaving |strangely. | |Sævar - ICELAND | |-Original Message- |From: Huzz [mailto:[EMAIL PROTECTED] |Sent: 19. júní 2003 22:43 |To: [EMAIL PROTECTED] |Subject: Re: [PHP] strange crypt() problem | |I already have about 1000 members their password crypted using crypt(); |would they able to login using their password or they have to change it |again?? | |Thanks | | |SævË Ölêöyp [EMAIL PROTECTED] wrote in message |news:[EMAIL PROTECTED] |Try using md5() instead because it is more widely supported than crypt() |and it leaves no room for errors. | |Hope it helps, |Sævar ICELAND | | |-Original Message- |From: Huzz [mailto:[EMAIL PROTECTED] |Sent: 19. júní 2003 21:43 |To: [EMAIL PROTECTED] |Subject: [PHP] strange crypt() problem | |I have this bit of code to crypt user password in user registration as |shown |below. | | $cryptpass=crypt($makepass); |which generated crypted password like eg 37Q9fppLHc4fQ with php 4.0 | |And am using the codes below to check for valid login.. |// $pass - from login page |// $dbpass - from the database | $pass=crypt($pass,substr($dbpass,0,2)); |} |if (strcmp($dbpass,$pass)) { |return(0); |} | | |Recently i have moved the same file to a new server with php 4.3.1 the |problem is the same piece of codes above generates completely differen |crypted value eg.$1$RjZHv7qx$h/L9ZUNT48rilHB6fGoMP/ .. hence the login |codes above does not work... :( | |Please someone tell me that i am not going mad | |please help |huzz | -- Registered Linux user #304026. lynx -source http://jharris.rallycentral.us/jharris.asc | gpg --import Key fingerprint = 52FC 20BD 025A 8C13 5FC6 68C6 9CF9 46C2 B089 0FED -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php