Which of the following code is wrong? $ aid & nbsp ;=& nbsp; 11387; $ _ G ['uid'] & nbsp ;=& nbsp; 332; $ tid & nbsp; = 50; function & nbsp; aidencode ($ aid, & nbsp; $ type & nbsp; = & nbsp; 0, where is the error of the following code?
$aid = 11387;
$_G['uid'] = 332;
$tid =50;
function aidencode($aid, $type = 0, $tid = 0) {
$s = !$type ? $aid.'|'.substr(md5($aid.md5('asdfasfas'.TIMESTAMP.$_G['uid']), 0, 8).'|'.TIMESTAMP.'|'.$_G['uid'].'|'.$tid : $aid.'|'.md5($aid.md5
('asdfasfas').TIMESTAMP).'|'.TIMESTAMP;
return rawurlencode(base64_encode($s));
}
echo aidencode(11387);
Thank you for sharing the complete code:
------ Solution --------------------
$ Aid = 11387;
$ _ G ['uid '] = 332;
$ Tid = 50;
Function aidencode ($ aid, $ type = 0, $ tid = 0 ){
$ S =! $ Type? $ Aid .'
------ Solution --------------------
'. Substr (md5 ($ aid. md5 ('asdfasfas'. TIMESTAMP. $ _ G ['uid']), 0, 8 ).'
------ Solution --------------------
'. TIMESTAMP .'
------ Solution --------------------
'. $ _ G ['uid'].'
------ Solution --------------------
'. $ Tid: $ aid .'
------ Solution --------------------
'. Md5 ($ aid. md5 ('asdfasfas'). TIMESTAMP ).'
------ Solution --------------------
'. TIMESTAMP;
Return rawurlencode (base64_encode ($ s ));
}
Echo aidencode (11387 );
------ Solution --------------------
$ Aid = 11387;
$ _ G ['uid '] = 332;
$ Tid = 50;
Define ('timestamp', time ());
Function aidencode ($ aid, $ type = 0, $ tid = 0 ){
Global $ _ G;
Global $ tid;
$ S =! $ Type? $ Aid .'
------ Solution --------------------
'. Substr (md5 ($ aid. md5 ('asdfasfas'. TIMESTAMP. $ _ G ['uid']), 0, 8 ).'
------ Solution --------------------
'. TIMESTAMP .'
------ Solution --------------------
'. $ _ G ['uid'].'
------ Solution --------------------
'. $ Tid: $ aid .'
------ Solution --------------------
'. Md5 ($ aid. md5 ('asdfasfas'). TIMESTAMP ).'
------ Solution --------------------
'. TIMESTAMP;
Return rawurlencode (base64_encode ($ s ));
}
Echo aidencode (11387 );
?>