| View previous topic :: View next topic |
| Author |
Message |
saddlebite
Joined: 17 Feb 2009 Posts: 20
|
Posted: Wed Feb 25, 2009 5:03 pm Post subject: |
|
|
i could not find the mhash extension when I ran phpinfo()...
I did find this however:
hash
hash support enabled
Hashing Engines md2 md4 md5 sha1 sha256 sha384 sha512 ripemd128 ripemd160 ripemd256 ripemd320 whirlpool tiger128,3 tiger160,3 tiger192,3 tiger128,4 tiger160,4 tiger192,4 snefru gost adler32 crc32 crc32b haval128,3 haval160,3 haval192,3 haval224,3 haval256,3 haval128,4 haval160,4 haval192,4 haval224,4 haval256,4 haval128,5 haval160,5 haval192,5 haval224,5 haval256,5 |
|
| Back to top |
|
 |
mark

Joined: 07 Jan 2007 Posts: 1210
|
Posted: Wed Feb 25, 2009 5:19 pm Post subject: |
|
|
According to the PHP manual, hash made mhash obsolete (but that doesn't mean that you can't use mhash anymore, of course). I guess that the php_mhash.dll file is missing or cannot be found. The Apache error log should show you a message if this is the case.
The file can be found here: http://windows.php.net/download/
(in the 9.88 MB archive) |
|
| Back to top |
|
 |
saddlebite
Joined: 17 Feb 2009 Posts: 20
|
Posted: Wed Feb 25, 2009 5:26 pm Post subject: |
|
|
thanks for the link mark... I am downloading the 9.88MB Archive...
I ran a search and found the php_mhash.dll in php/ext directory...
I figured that the mhash extension is workning because I installed Pear's Net_DNS which required mhash...
I am still unable to use the mhash function in the php script though... |
|
| Back to top |
|
 |
mark

Joined: 07 Jan 2007 Posts: 1210
|
Posted: Wed Feb 25, 2009 5:36 pm Post subject: |
|
|
| Did previously the PEAR installer complain about the missing extension? If that's the case, you're having two different PHP installations, with two different php.ini files. You need to enable the extension in both of these files. |
|
| Back to top |
|
 |
saddlebite
Joined: 17 Feb 2009 Posts: 20
|
Posted: Wed Feb 25, 2009 10:48 pm Post subject: |
|
|
Hi Mark... The PEAR installation, previously did complain about the mhash extension, but not anymore...
I found a php.ini-recommended file, where I enabled the mhash extension as well...
The following is the code I am trying to execute:
<?php
$usrpswd="mysecretpswd";
$pswdhash=mhash(MHASH_SHA1,$usrpswd);
echo"The Hashed Password is ".bin2hex($pswdhash);
?>
The error message I get is:
Fatal error: Call to undefined function mhash() in C:\Apache2\htdocs\1\coding\mhash1.php on line 6 |
|
| Back to top |
|
 |
mark

Joined: 07 Jan 2007 Posts: 1210
|
Posted: Thu Feb 26, 2009 12:04 am Post subject: |
|
|
| saddlebite wrote: | | I found a php.ini-recommended file, where I enabled the mhash extension as well... |
This file is delivered with PHP, and it is meant to be renamed to just php.ini. Anyway, if you execute phpinfo() in a script on your web server (i.e. called via your browser, just like the last example code that you've showed), you'll find a row named "Loaded Configuration File" in the first table. This is the php.ini file that needs the mentioned modification. |
|
| Back to top |
|
 |
saddlebite
Joined: 17 Feb 2009 Posts: 20
|
Posted: Thu Feb 26, 2009 5:56 am Post subject: |
|
|
Hi Mark... I've tried everything possible... I even downloaded the 9.8MB archive link and replaced the php_mhash.dll file in the php5/ext/ directory.
(I've loaded php in a directory called php5)
I uncommented the 'extension=php_mhash.dll' line in the 'php.ini' file as well...
The following is the error I noticed in the Apache error logs
PHP Warning: PHP Startup: Unable to load dynamic library 'c:\\php5\\ext\\php_mhash.dll' - The specified module could not be found.\r\n in Unknown on line 0 |
|
| Back to top |
|
 |
mark

Joined: 07 Jan 2007 Posts: 1210
|
Posted: Thu Feb 26, 2009 2:04 pm Post subject: |
|
|
Maybe a version conflict? Is your PHP version on the web server older than the downloaded archive (5.2. ?
Is the "extension_dir" set correctly in the php.ini?
If you use Google with the mentioned error message, you'll get a lot of results. There might be some other ideas that help you solving this problem. |
|
| Back to top |
|
 |
saddlebite
Joined: 17 Feb 2009 Posts: 20
|
Posted: Fri Feb 27, 2009 9:02 am Post subject: |
|
|
I will try and google it and try to solve it that way... Thanks for your help though MARK, much appreciated  |
|
| Back to top |
|
 |
saddlebite
Joined: 17 Feb 2009 Posts: 20
|
Posted: Wed Mar 04, 2009 12:15 pm Post subject: Transferring Variable Values |
|
|
Hi Mark... I wanted to know if it is possible to transfer variable values between scripts... For example, if I have 2 PHP scripts called '3.php' and '2.php' and if the code of '3.php' is as follows:
<?php //3.php
$form=new HTML_QuickForm('form','post','3.php');
$form->addElement('text','myName','Name:');
$form->addElement('submit','submit','submit');
$name=$form->exportValue('myName');
$form->display();
?>
Is it possible to transfer the variable($name) along with the same value to the script named "2.php"?
Thanks |
|
| Back to top |
|
 |
mark

Joined: 07 Jan 2007 Posts: 1210
|
Posted: Wed Mar 04, 2009 4:19 pm Post subject: |
|
|
How do you redirect to 2.php? I only see code that is related to 3.php.
A possible solution is to use session variables to store the value in 3.php and to read it in 2.php. => www.php.net/session |
|
| Back to top |
|
 |
saddlebite
Joined: 17 Feb 2009 Posts: 20
|
Posted: Wed Mar 04, 2009 7:34 pm Post subject: |
|
|
Assuming I redirect it to '2.php', either using the header function or setting the action to '2.php'.... will check out the link...
Thanks Mark |
|
| Back to top |
|
 |
saddlebite
Joined: 17 Feb 2009 Posts: 20
|
Posted: Tue Jun 30, 2009 8:59 pm Post subject: Sessions and cookies |
|
|
Hi Mark... How are you doing... got 2 doubts with respect to sessions
1.)
I want to know if it is possible for a user to access and manipulate session variables...
For example if I set a session variable as
$_SESSION['user']="David"
Can a user access this Session Variable and change it to John
2.)
I got the following error message:
Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at C:\php5\PEAR\HTML\Common.php:432) in C:\Apache2\htdocs\boot2h\login.php on line 21
Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\php5\PEAR\HTML\Common.php:432) in C:\Apache2\htdocs\boot2h\login.php on line 21
I then changed session_start(); to appear on the first line of code and the error message disappeared
I have installed php on 2 different computers...
Both run on windows XP
I did not have this problem with my 1st computer
Why is this happening?
Thanks |
|
| Back to top |
|
 |
mark

Joined: 07 Jan 2007 Posts: 1210
|
Posted: Wed Jul 01, 2009 10:37 pm Post subject: Re: Sessions and cookies |
|
|
| saddlebite wrote: | 1.)
I want to know if it is possible for a user to access and manipulate session variables...
For example if I set a session variable as
$_SESSION['user']="David"
Can a user access this Session Variable and change it to John |
This isn't related to PEAR ...
=> http://de.php.net/manual/en/session.security.php
| saddlebite wrote: | 2.)
I got the following error message:
Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at C:\php5\PEAR\HTML\Common.php:432) in C:\Apache2\htdocs\boot2h\login.php on line 21 [...] |
Well, the message tells you where the problem is: line 432 of Common.php. Maybe on old version that ends with whitespace after the closing PHP tag? |
|
| Back to top |
|
 |
saddlebite
Joined: 17 Feb 2009 Posts: 20
|
Posted: Thu Jul 02, 2009 5:25 pm Post subject: Thanks |
|
|
Thanks Mark.. You're reply helped a lot...
The reason I asked the PHP question is cause I could not find any PHP forums to join...
Thanks once again...
 |
|
| Back to top |
|
 |
|