suck4it Posted February 22, 2009 Share Posted February 22, 2009 Hi so I have a problame I need to encode like this .base64_encode(pack('H*', sha1($_POST['p']))). when I putting it into mysql everything works fine, but when I try to do like this: $a=".base64_encode(pack('H*', sha1($_POST['p'])))."; I getting this error syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING. So any suggestions? Link to comment https://forums.phpfreaks.com/topic/146356-encode/ Share on other sites More sharing options...
redarrow Posted February 22, 2009 Share Posted February 22, 2009 <?php $a=".base64_encode(pack('H*', sha1({$_POST['p']})))."; ?> suggestion, learn to format code sorry. Link to comment https://forums.phpfreaks.com/topic/146356-encode/#findComment-768384 Share on other sites More sharing options...
suck4it Posted February 22, 2009 Author Share Posted February 22, 2009 Well I already know that the code format of this is wrong, but can u show me how to make it work? :-) Link to comment https://forums.phpfreaks.com/topic/146356-encode/#findComment-768390 Share on other sites More sharing options...
redarrow Posted February 22, 2009 Share Posted February 22, 2009 just did i corrected your error as below, Dont you try our suggestions. if you look at my posted code i added {} to populate the posted variable. Link to comment https://forums.phpfreaks.com/topic/146356-encode/#findComment-768392 Share on other sites More sharing options...
suck4it Posted February 22, 2009 Author Share Posted February 22, 2009 Wooops sorry missed that.. Well thanks now error have beend fixed, but encode won't work.. When I put to the mysql like that: VALUES ('$r', '".base64_encode(pack('H*', sha1($_POST['p'])))."', '$ip')"); everything works great, but now I need to check is password correct so I have to encode posted password and compare it with one from mysql, but it's don't work and I don't know how to fix it.. ;/ So does any1 have more suggestions? :-) Link to comment https://forums.phpfreaks.com/topic/146356-encode/#findComment-768415 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.