Skip to content

Instantly share code, notes, and snippets.

@sunlee-newyork
Created November 16, 2013 21:35
Show Gist options
  • Save sunlee-newyork/7505653 to your computer and use it in GitHub Desktop.
Save sunlee-newyork/7505653 to your computer and use it in GitHub Desktop.
Website NONAME / HEADER
<html>
<head>
<title>HEADER</title>
</head>
<body>
</body>
</html>
<?php
$salt = "Cant stop the signal";
$iv_size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_CBC);
$iv = mcrypt_create_iv($iv_size, MCRYPT_RAND);
$encoded_iv = base64_encode($iv);
define('HOST', "localhost");
define('USER', "root" );
define('PASS', "root" );
define('DB' , "idea_com" );
error_reporting(E_ERROR);
$connection = mysql_connect(HOST, USER, PASS);
if (!$connection) { die('<H3>=/= Server</H3>: ' . mysql_error()); }
mysql_select_db(DB) or die ("<H3>=/= Database</H3>");
array_walk_recursive($_GET , "mysql_real_escape_string");
array_walk_recursive($_POST, "mysql_real_escape_string");
$sql = "SELECT * FROM `encryption` WHERE `salt` = '$salt';";
$query = mysql_query($sql);
if (mysql_num_rows($query) === 0) {
$sql = "INSERT INTO `encryption` (`salt`,`iv`) VALUES ('$salt','$encoded_iv');";
$query = mysql_query($sql);
echo "New Salt/IV combination has been saved.";
}
/*
else {
while ($row = mysql_fetch_assoc($query)) {
echo "Header.php working!</br></br>";
echo "Salt: " .$row["salt"]. "</br>";
echo "IV: " .$row["iv" ]. "</br>";
}
}
*/
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment