Guest User

Untitled

a guest
Jul 27th, 2018
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.00 KB | None | 0 0
  1. 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]
  2. <?php
  3.  
  4. $username = "root";
  5. $password = "";
  6. $hostname = "localhost";
  7.  
  8. //connection to the database
  9. $dbhandle = mysql_connect($hostname, $username, $password)
  10. or die("Unable to connect to MySQL");
  11. //echo "Connected to MySQL<br>";
  12.  
  13. //select a database to work with
  14. $selected = mysql_select_db("akshay",$dbhandle)
  15. or die("Could not select examples");
  16.  
  17. echo ($_POST['msg']);
  18.  
  19. class MCrypt
  20. {
  21. private $iv = 'fedcba9876543210'; #Same as in JAVA
  22. private $key = '0123456789abcdef'; #Same as in JAVA
  23.  
  24.  
  25. function __construct()
  26. {
  27. }
  28.  
  29. protected function hex2bin($hexdata) {
  30. $bindata = '';
  31.  
  32. for ($i = 0; $i < strlen($hexdata); $i += 2) {
  33. $bindata .= chr(hexdec(substr($hexdata, $i, 2)));
  34. }
  35.  
  36. return $bindata;
  37. }
  38.  
  39. function decrypt($code) {
  40. //$key = $this->hex2bin($key);
  41. $code = $this->hex2bin($code);
  42. $iv = $this->iv;
  43.  
  44. $td = mcrypt_module_open('rijndael-128', '', 'cbc', $iv);
  45.  
  46. mcrypt_generic_init($td, $this->key, $iv);
  47. $decrypted = mdecrypt_generic($td, $code);
  48.  
  49. mcrypt_generic_deinit($td);
  50. mcrypt_module_close($td);
  51.  
  52. return utf8_encode(trim($decrypted));
  53. }
  54. }
  55. echo ($_POST['msg']);
  56. $mcrypt = new MCrypt();
  57. $decrypted = $mcrypt->decrypt($_POST['msg']);
  58. echo($decrypted);
  59.  
  60. //execute the SQL query and return records
  61. $sql="INSERT INTO chat(msg,dec)VALUES('$_POST['msg']','$decrypted')";
  62.  
  63.  
  64.  
  65. if (!mysql_query($sql,$dbhandle))
  66. {
  67. die('Error: ' . mysql_error());
  68. }
  69.  
  70. mysql_close($dbhandle);
  71.  
  72. ?>
  73.  
  74. <?php
  75.  
  76. $username = "root";
  77. $password = "";
  78. $hostname = "localhost";
  79.  
  80. //connection to the database
  81. $dbhandle = mysql_connect($hostname, $username, $password)
  82. or die("Unable to connect to MySQL");
  83. //echo "Connected to MySQL<br>";
  84.  
  85. //select a database to work with
  86. $selected = mysql_select_db("akshay",$dbhandle)
  87. or die("Could not select examples");
  88.  
  89. echo ($_POST['msg']);
  90.  
  91. class MCrypt
  92. {
  93. private $iv = 'fedcba9876543210'; #Same as in JAVA
  94. private $key = '0123456789abcdef'; #Same as in JAVA
  95.  
  96.  
  97. function __construct()
  98. {
  99. }
  100.  
  101. protected function hex2bin($hexdata) {
  102. $bindata = '';
  103.  
  104. for ($i = 0; $i < strlen($hexdata); $i += 2) {
  105. $bindata .= chr(hexdec(substr($hexdata, $i, 2)));
  106. }
  107.  
  108. return $bindata;
  109. }
  110.  
  111. function decrypt($code) {
  112. //$key = $this->hex2bin($key);
  113. $code = $this->hex2bin($code);
  114. $iv = $this->iv;
  115.  
  116. $td = mcrypt_module_open('rijndael-128', '', 'cbc', $iv);
  117.  
  118. mcrypt_generic_init($td, $this->key, $iv);
  119. $decrypted = mdecrypt_generic($td, $code);
  120.  
  121. mcrypt_generic_deinit($td);
  122. mcrypt_module_close($td);
  123.  
  124. return utf8_encode(trim($decrypted));
  125. }
  126. }
  127. echo ($_POST['msg']);
  128. $mcrypt = new MCrypt();
  129. $decrypted = $mcrypt->decrypt($_POST['msg']);
  130. echo($decrypted);
  131.  
  132. //execute the SQL query and return records
  133. $sql="INSERT INTO chat(msg,dec)VALUES('$_POST['msg']','$decrypted')";
  134.  
  135.  
  136.  
  137. if (!mysql_query($sql,$dbhandle))
  138. {
  139. die('Error: ' . mysql_error());
  140. }
  141.  
  142. mysql_close($dbhandle);
  143.  
  144. ?>
  145.  
  146. <?php
  147.  
  148. $username = "root";
  149. $password = "";
  150. $hostname = "localhost";
  151.  
  152. //connection to the database
  153. $dbhandle = mysql_connect($hostname, $username, $password)
  154. or die("Unable to connect to MySQL");
  155. //echo "Connected to MySQL<br>";
  156.  
  157. //select a database to work with
  158. $selected = mysql_select_db("akshay",$dbhandle)
  159. or die("Could not select examples");
  160.  
  161. echo ($_POST['msg']);
  162.  
  163. class MCrypt
  164. {
  165. private $iv = 'fedcba9876543210'; #Same as in JAVA
  166. private $key = '0123456789abcdef'; #Same as in JAVA
  167.  
  168.  
  169. function __construct()
  170. {
  171. }
  172.  
  173. protected function hex2bin($hexdata) {
  174. $bindata = '';
  175.  
  176. for ($i = 0; $i < strlen($hexdata); $i += 2) {
  177. $bindata .= chr(hexdec(substr($hexdata, $i, 2)));
  178. }
  179.  
  180. return $bindata;
  181. }
  182.  
  183. function decrypt($code) {
  184. //$key = $this->hex2bin($key);
  185. $code = $this->hex2bin($code);
  186. $iv = $this->iv;
  187.  
  188. $td = mcrypt_module_open('rijndael-128', '', 'cbc', $iv);
  189.  
  190. mcrypt_generic_init($td, $this->key, $iv);
  191. $decrypted = mdecrypt_generic($td, $code);
  192.  
  193. mcrypt_generic_deinit($td);
  194. mcrypt_module_close($td);
  195.  
  196. return utf8_encode(trim($decrypted));
  197. }
  198. }
  199. echo ($_POST['msg']);
  200. $mcrypt = new MCrypt();
  201. $decrypted = $mcrypt->decrypt($_POST['msg']);
  202. echo($decrypted);
  203.  
  204. //execute the SQL query and return records
  205. $sql="INSERT INTO chat(msg,dec)VALUES('$_POST['msg']','$decrypted')";
  206.  
  207.  
  208.  
  209. if (!mysql_query($sql,$dbhandle))
  210. {
  211. die('Error: ' . mysql_error());
  212. }
  213.  
  214. mysql_close($dbhandle);
  215.  
  216. ?>
  217.  
  218. $sql="INSERT INTO chat(msg,dec)VALUES('$_POST['msg']','$decrypted')";
  219.  
  220. $sql="INSERT INTO chat(msg,dec)VALUES('" . mysql_escape_string($_POST['msg']) . "','$decrypted')";
  221.  
  222. $sql="INSERT INTO chat(msg,dec)VALUES('$_POST['msg']','$decrypted')";
  223.  
  224. $sql="INSERT INTO chat(msg,dec)VALUES('".$_POST['msg']."','$decrypted')";
  225.  
  226. $sql="INSERT INTO chat(msg,dec)VALUES('$_POST['msg']','$decrypted')";
  227.  
  228. $sql = "INSERT INTO chat (msg, dec) VALUES ('{$_POST['msg']}', '{$decrypted}')";
  229.  
  230. $sql="INSERT INTO chat(msg,dec)VALUES('$_POST['msg']','$decrypted')";
  231.  
  232. $sql="INSERT INTO chat(msg,dec)VALUES('".$_POST['msg']."','$decrypted')";
Add Comment
Please, Sign In to add comment