icon Get the most out of Surmunity, read our tips here! Need an interesting blog to read? You've got to read the Surpass Blog! | Welcome! Please register to access all of our features.

» Surpass Web Hosting Forums » Discussions » PHP, MySQL » PHP parse error.

PHP, MySQL General PHP questions. Or go to our PHPsuexec Forum >>

Reply
 
LinkBack Thread Tools Search this Thread Rate Thread
Old October 29th, 2004, 4:33 AM   #1 (permalink)
Registered User
Fresh Surpasser
 
Joined in Oct 2004
28 posts
Gave thanks: 0
Thanked 0 times
PHP parse error.

I'm getting an error on this line of code but it looks fine to me.

unexpected T_VARIABLE on line 13

$size = mcrypt_get_iv_size('rijndael-256', 'ofb');

Anyone see what the problem is, I haven't done this sort of thing for a long time. Thanks.
cassius is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old October 29th, 2004, 8:24 AM   #2 (permalink)
Registered User
Seasoned Poster
 
potato's Avatar
 
Joined in Jun 2004
Lives in PK, NY
Hosted on pilot
85 posts
Gave thanks: 1
Thanked 3 times
show us the lines above and below that, usually T_VARIABLE means an unclosed conditional statement or missing semi-colon
potato is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old October 29th, 2004, 1:35 PM   #3 (permalink)
Registered User
Fresh Surpasser
 
Joined in Oct 2004
28 posts
Gave thanks: 0
Thanked 0 times
I am more or less using the code from the second example on this page. I'm just trying to get it to work -- elegance comes later.

http://us4.php.net/manual/en/functio...odule-open.php

Code:
<?php
$pacs = "texttexttext";
$pcsi = "lfact";
echo "this is a test for crypt <br>";
echo "we'll crypt texttexttext can you see it below<br><br>";

/* Open the cipher */
$dfact = mcrypt_module_open('rijndael-256', '', 'ofb', '');

 /* Create the IV and determine the keysize length, used MCRYPT_RAND
on Windows instead */

$size = mcrypt_get_iv_size('rijndael-256', 'ofb');
$iv = mcrypt_create_iv($size, MCRYPT_DEV_RANDOM);
$ks = mcrypt_enc_get_key_size($dfact);

   /* Create key */
   $key = substr(md5($pcsi),0,$ks);

   /* Intialize encryption */
   mcrypt_generic_init($dfact,$key,$iv);

   /* Encrypt data */
   $pfact = mcrypt_generic($dfact,'$pacs');

   /* Terminate encryption handler */
   mcrypt_generic_deinit($dfact);

echo "is this text crypt $pfact";

   /* Initialize encryption module for decryption */
   mcrypt_generic_init($dfact,$key,$iv);

   /* Decrypt encrypted string */
   $efact = mdecrypt_generic($dfact,$pfact);

   /* Terminate decryption handle and close module */
   mcrypt_generic_deinit($dfact);
   mcrypt_module_close($dfact);

   /* Show string */
   echo "is this text decrypt $efact <br><br>";

  echo "thanks either way";

?>
cassius is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old October 29th, 2004, 9:31 PM   #4 (permalink)
Registered User
Fresh Surpasser
 
Joined in Oct 2004
28 posts
Gave thanks: 0
Thanked 0 times
I rewrote the script and it works. Guess I cheated myself by not going through the motions of writing it myself. Thanks.
cassius is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On