Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in C:\wamp\www\enc\chatting.php on line 60 [closed]
- <?php
- $username = "root";
- $password = "";
- $hostname = "localhost";
- //connection to the database
- $dbhandle = mysql_connect($hostname, $username, $password)
- or die("Unable to connect to MySQL");
- //echo "Connected to MySQL<br>";
- //select a database to work with
- $selected = mysql_select_db("akshay",$dbhandle)
- or die("Could not select examples");
- echo ($_POST['msg']);
- class MCrypt
- {
- private $iv = 'fedcba9876543210'; #Same as in JAVA
- private $key = '0123456789abcdef'; #Same as in JAVA
- function __construct()
- {
- }
- protected function hex2bin($hexdata) {
- $bindata = '';
- for ($i = 0; $i < strlen($hexdata); $i += 2) {
- $bindata .= chr(hexdec(substr($hexdata, $i, 2)));
- }
- return $bindata;
- }
- function decrypt($code) {
- //$key = $this->hex2bin($key);
- $code = $this->hex2bin($code);
- $iv = $this->iv;
- $td = mcrypt_module_open('rijndael-128', '', 'cbc', $iv);
- mcrypt_generic_init($td, $this->key, $iv);
- $decrypted = mdecrypt_generic($td, $code);
- mcrypt_generic_deinit($td);
- mcrypt_module_close($td);
- return utf8_encode(trim($decrypted));
- }
- }
- echo ($_POST['msg']);
- $mcrypt = new MCrypt();
- $decrypted = $mcrypt->decrypt($_POST['msg']);
- echo($decrypted);
- //execute the SQL query and return records
- $sql="INSERT INTO chat(msg,dec)VALUES('$_POST['msg']','$decrypted')";
- if (!mysql_query($sql,$dbhandle))
- {
- die('Error: ' . mysql_error());
- }
- mysql_close($dbhandle);
- ?>
- <?php
- $username = "root";
- $password = "";
- $hostname = "localhost";
- //connection to the database
- $dbhandle = mysql_connect($hostname, $username, $password)
- or die("Unable to connect to MySQL");
- //echo "Connected to MySQL<br>";
- //select a database to work with
- $selected = mysql_select_db("akshay",$dbhandle)
- or die("Could not select examples");
- echo ($_POST['msg']);
- class MCrypt
- {
- private $iv = 'fedcba9876543210'; #Same as in JAVA
- private $key = '0123456789abcdef'; #Same as in JAVA
- function __construct()
- {
- }
- protected function hex2bin($hexdata) {
- $bindata = '';
- for ($i = 0; $i < strlen($hexdata); $i += 2) {
- $bindata .= chr(hexdec(substr($hexdata, $i, 2)));
- }
- return $bindata;
- }
- function decrypt($code) {
- //$key = $this->hex2bin($key);
- $code = $this->hex2bin($code);
- $iv = $this->iv;
- $td = mcrypt_module_open('rijndael-128', '', 'cbc', $iv);
- mcrypt_generic_init($td, $this->key, $iv);
- $decrypted = mdecrypt_generic($td, $code);
- mcrypt_generic_deinit($td);
- mcrypt_module_close($td);
- return utf8_encode(trim($decrypted));
- }
- }
- echo ($_POST['msg']);
- $mcrypt = new MCrypt();
- $decrypted = $mcrypt->decrypt($_POST['msg']);
- echo($decrypted);
- //execute the SQL query and return records
- $sql="INSERT INTO chat(msg,dec)VALUES('$_POST['msg']','$decrypted')";
- if (!mysql_query($sql,$dbhandle))
- {
- die('Error: ' . mysql_error());
- }
- mysql_close($dbhandle);
- ?>
- <?php
- $username = "root";
- $password = "";
- $hostname = "localhost";
- //connection to the database
- $dbhandle = mysql_connect($hostname, $username, $password)
- or die("Unable to connect to MySQL");
- //echo "Connected to MySQL<br>";
- //select a database to work with
- $selected = mysql_select_db("akshay",$dbhandle)
- or die("Could not select examples");
- echo ($_POST['msg']);
- class MCrypt
- {
- private $iv = 'fedcba9876543210'; #Same as in JAVA
- private $key = '0123456789abcdef'; #Same as in JAVA
- function __construct()
- {
- }
- protected function hex2bin($hexdata) {
- $bindata = '';
- for ($i = 0; $i < strlen($hexdata); $i += 2) {
- $bindata .= chr(hexdec(substr($hexdata, $i, 2)));
- }
- return $bindata;
- }
- function decrypt($code) {
- //$key = $this->hex2bin($key);
- $code = $this->hex2bin($code);
- $iv = $this->iv;
- $td = mcrypt_module_open('rijndael-128', '', 'cbc', $iv);
- mcrypt_generic_init($td, $this->key, $iv);
- $decrypted = mdecrypt_generic($td, $code);
- mcrypt_generic_deinit($td);
- mcrypt_module_close($td);
- return utf8_encode(trim($decrypted));
- }
- }
- echo ($_POST['msg']);
- $mcrypt = new MCrypt();
- $decrypted = $mcrypt->decrypt($_POST['msg']);
- echo($decrypted);
- //execute the SQL query and return records
- $sql="INSERT INTO chat(msg,dec)VALUES('$_POST['msg']','$decrypted')";
- if (!mysql_query($sql,$dbhandle))
- {
- die('Error: ' . mysql_error());
- }
- mysql_close($dbhandle);
- ?>
- $sql="INSERT INTO chat(msg,dec)VALUES('$_POST['msg']','$decrypted')";
- $sql="INSERT INTO chat(msg,dec)VALUES('" . mysql_escape_string($_POST['msg']) . "','$decrypted')";
- $sql="INSERT INTO chat(msg,dec)VALUES('$_POST['msg']','$decrypted')";
- $sql="INSERT INTO chat(msg,dec)VALUES('".$_POST['msg']."','$decrypted')";
- $sql="INSERT INTO chat(msg,dec)VALUES('$_POST['msg']','$decrypted')";
- $sql = "INSERT INTO chat (msg, dec) VALUES ('{$_POST['msg']}', '{$decrypted}')";
- $sql="INSERT INTO chat(msg,dec)VALUES('$_POST['msg']','$decrypted')";
- $sql="INSERT INTO chat(msg,dec)VALUES('".$_POST['msg']."','$decrypted')";
Add Comment
Please, Sign In to add comment