[php]代码库
<?php
include('header.php');
require_once('config.php');
if (isset($_GET["act"])) {
$currentpage = $_GET["act"];
} elseif (isset($_POST["act"])) {
$currentpage = $_POST["act"];
} else {
$currentpage = "home";
}
switch ($currentpage) {
case "home":
showPageHome();
break;
case "encrypt":
showPageEncrypt();
break;
case "decrypt":
showPagedecrypt();
break;
case "add":
showPageAdd();
break;
default:
showPageHome();
break;
}
?>
<?php
function showPageHome() {
require_once('config.php');
$query = "SELECT COUNT(id) FROM md5";
$result = mysql_query($query) or die("Query failed: " . mysql_error());
$row = mysql_fetch_array($result);
$no = $row['COUNT(id)'];
?>
<tr>
<td align="left" valign="top" background="images/back_right_1.jpg" style="background-position:top right; background-repeat:no-repeat "><table width="714" border="0" cellpadding="0" cellspacing="0" background="images/back_left.jpg" style="background-repeat:no-repeat; background-position:top left ">
<tr align="left" valign="top">
<td width="405"><table width="405" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="left" valign="top"><div style="padding-left:27px; padding-top:0px">
<table width="366" border="0" cellpadding="0" cellspacing="0" background="images/rep_line_1.jpg">
<tr>
<td height="59" align="left" valign="top" background="images/top_back.jpg"><div style="padding-left:32px; padding-top:12px">
<table height="27" border="0" cellpadding="0" cellspacing="0">
<tr>
<td><span class="style1">MD5 Encryption </span></td>
</tr>
</table>
</div></td>
</tr>
<tr>
<td align="left" valign="top" background="images/bottom_2.jpg" style="background-repeat:no-repeat; background-position:bottom left "><div style="padding-left:32px; padding-top:2px; padding-bottom:23px">
<table width="315" border="0" cellspacing="0" cellpadding="0">
<tr align="left" valign="top">
<td width="127"><table width="105" border="0" cellspacing="0" cellpadding="0">
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="get">
<tr>
<td height="17" align="left" valign="bottom"><span class="style7">Letter & number:</span></td>
</tr>
<tr>
<td align="left" valign="bottom"><span class="style8">
<input type="text" name="encrypt" style="width:100px; height:19px; font-family:tahoma; font-size:10px " size="32" maxlength="32">
</span></td>
</tr>
<tr>
<td height="26" align="left" valign="bottom"><input type="hidden" name="act" value="encrypt"><input type="submit" value="Encrypt"></td>
</tr>
</form>
</table></td>
<td><div style="padding-left:0px; padding-top:9px; line-height:11px"><span class="style10"><strong>Direction:</strong><br>
Paste the letter & number into the box and click
encrypt</span></div>
</td>
</tr>
</table>
</div></td>
</tr>
</table>
</div></td>
</tr>
<tr>
<td align="left" valign="top"><div style="padding-left:27px; padding-top:0px">
<table width="366" border="0" cellpadding="0" cellspacing="0" background="images/rep_line_1.jpg">
<tr>
<td height="59" align="left" valign="top" background="images/top_back.jpg"><div style="padding-left:32px; padding-top:12px">
<table height="27" border="0" cellpadding="0" cellspacing="0">
<tr>
<td><span class="style1">MD5 Decryption </span></td>
</tr>
</table>
</div></td>
</tr>
<tr>
<td align="left" valign="top" background="images/bottom_2.jpg" style="background-repeat:no-repeat; background-position:bottom left "><div style="padding-left:32px; padding-top:2px; padding-bottom:23px">
<table width="315" border="0" cellspacing="0" cellpadding="0">
<tr align="left" valign="top">
<td width="127"><table width="105" border="0" cellspacing="0" cellpadding="0">
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="get">
<tr>
<td height="17" align="left" valign="bottom"><span class="style7">MD5:</span></td>
</tr>
<tr>
<td align="left" valign="bottom"><span class="style8">
<input type="text" name="decrypt" style="width:100px; height:19px; font-family:tahoma; font-size:10px " size="32" maxlength="32">
</span></td>
</tr>
<tr>
<td height="26" align="left" valign="bottom"><input type="hidden" name="act" value="decrypt"><input type="submit" value="Decrypt"></td>
</tr>
</form>
</table></td>
<td><div style="padding-left:0px; padding-top:9px; line-height:11px"><span class="style10"><strong>Direction:</strong><br>
Paste the md5 into the box and click
decrypt</span></div>
</td>
</tr>
</table>
</div></td>
</tr>
</table>
</div></td>
</tr>
<tr>
<td align="center" valign="top"><span class="style10">Total
number of <?php echo "<strong>".number_format($no)."</strong>"; ?> combinations</span></td>
</tr>
</table></td>
<?php
}
function showPageEncrypt() {
require_once('config.php');
$query = "SELECT COUNT(id) FROM md5";
$result = mysql_query($query) or die("Query failed: " . mysql_error());
$row = mysql_fetch_array($result);
$no = $row['COUNT(id)'];
$encrypt = $_GET['encrypt'];
$encrypted = md5($encrypt);
$encrypt_query = "SELECT * FROM `md5` WHERE md5='$encrypted'";
$encrypt_result = mysql_query($encrypt_query) or die("Query failed: " . mysql_error());
$encrypt_row = mysql_fetch_array($encrypt_result);
if (!$encrypt_row) {
mysql_query("INSERT INTO `md5` VALUES ('', '$encrypt', '$encrypted')") or die (mysql_error());
}
?>
<script language=Javascript>
<!--
var copytoclip=1
function HighlightAll(theField) {
var tempval=eval("document."+theField)
tempval.focus()
tempval.select()
if (document.all&©toclip==1){
therange=tempval.createTextRange()
therange.execCommand("Copy")
window.status="Contents highlighted and copied to clipboard!"
setTimeout("window.status=''",2400);
}
}
-->
</script>
<tr>
<td align="left" valign="top" background="images/back_right_1.jpg" style="background-position:top right; background-repeat:no-repeat "><table width="714" border="0" cellpadding="0" cellspacing="0" background="images/back_left.jpg" style="background-repeat:no-repeat; background-position:top left ">
<tr align="left" valign="top">
<td width="405"><table width="405" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="left" valign="top"><div style="padding-left:27px; padding-top:0px">
<table width="366" border="0" cellpadding="0" cellspacing="0" background="images/rep_line_1.jpg">
<tr>
<td height="59" align="left" valign="top" background="images/top_back.jpg"><div style="padding-left:32px; padding-top:12px">
<table height="27" border="0" cellpadding="0" cellspacing="0">
<tr>
<td><span class="style1">MD5 Encryption </span></td>
</tr>
</table>
</div></td>
</tr>
<tr>
<td align="left" valign="top" background="images/bottom_2.jpg" style="background-repeat:no-repeat; background-position:bottom left "><div style="padding-left:32px; padding-top:2px; padding-bottom:23px">
<table width="315" border="0" cellspacing="0" cellpadding="0">
<tr align="left" valign="top">
<td width="127"><table width="105" border="0" cellspacing="0" cellpadding="0">
<tr>
<?php
if (!$encrypt) {
echo "<span class='style33'>Please fill up the blank.</span>";
} else {
?>
<td height="17" align="left" valign="bottom"><span class="style7">MD5 encrypted:</span></td>
</tr>
<tr>
<td align="left" valign="bottom"><span class="style8"">
<form name=form1>
<textarea name=select cols=12 rows="1"><?php echo "$encrypted"; ?></textarea>
<A class=high href="javascript:HighlightAll('form1.select')"><input type="submit" name="copy" value="Select"></A>
</form>
</span>
</td>
</tr>
<?php
}
?>
<tr>
<td height="26" align="left" valign="bottom"></td>
</tr>
</table></td>
<td><div style="padding-left:0px; padding-top:9px; line-height:11px"><span class="style10"><strong>Direction:</strong><br>
Click select button to highlight the encrypted result, then copy it to your clipboard (Ctrl+C)
</span></div>
</td>
</tr>
</table>
</div></td>
</tr>
</table>
</div></td>
</tr>
<tr>
<td align="center" valign="top"><span class="style10">Total
number of <?php echo "<strong>".number_format($no)."</strong>"; ?> combinations md5</span><br> <?php echo $ads2; ?></td>
</tr>
</table></td>
<?php
}
function showPageDecrypt() {
require_once('config.php');
$query = "SELECT COUNT(id) FROM md5";
$result = mysql_query($query) or die("Query failed: " . mysql_error());
$row = mysql_fetch_array($result);
$no = $row['COUNT(id)'];
$decrypt = $_GET['decrypt'];
$decrypt_query = "SELECT * FROM `md5` WHERE md5='$decrypt'";
$decrypt_result = mysql_query($decrypt_query) or die("Query failed: " . mysql_error());
$decrypt_row = mysql_fetch_array($decrypt_result);
$decrypted = $decrypt_row['combination'];
?>
<script language=Javascript>
<!--
var copytoclip=1
function HighlightAll(theField) {
var tempval=eval("document."+theField)
tempval.focus()
tempval.select()
if (document.all&©toclip==1){
therange=tempval.createTextRange()
therange.execCommand("Copy")
window.status="Contents highlighted and copied to clipboard!"
setTimeout("window.status=''",2400);
}
}
-->
</script>
<tr>
<td align="left" valign="top" background="images/back_right_1.jpg" style="background-position:top right; background-repeat:no-repeat "><table width="714" border="0" cellpadding="0" cellspacing="0" background="images/back_left.jpg" style="background-repeat:no-repeat; background-position:top left ">
<tr align="left" valign="top">
<td width="405"><table width="405" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="left" valign="top"><div style="padding-left:27px; padding-top:0px">
<table width="366" border="0" cellpadding="0" cellspacing="0" background="images/rep_line_1.jpg">
<tr>
<td height="59" align="left" valign="top" background="images/top_back.jpg"><div style="padding-left:32px; padding-top:12px">
<table height="27" border="0" cellpadding="0" cellspacing="0">
<tr>
<td><span class="style1">MD5 Decryption </span></td>
</tr>
</table>
</div></td>
</tr>
<tr>
<td align="left" valign="top" background="images/bottom_2.jpg" style="background-repeat:no-repeat; background-position:bottom left "><div style="padding-left:32px; padding-top:2px; padding-bottom:23px">
<table width="315" border="0" cellspacing="0" cellpadding="0">
<tr align="left" valign="top">
<td width="127"><table width="105" border="0" cellspacing="0" cellpadding="0">
<tr>
<?php
if (!$decrypt) {
echo "<span class='style33'>Please fill up the blank.</span>";
} elseif (strlen($decrypt) != 32) {
echo "<span class='style33'>Invalid md5</span>";
} elseif (!$decrypt_row) {
echo "<span class='style33'>Sorry, we couldn't decrypt this md5.</span>";
} else {
?>
<td height="17" align="left" valign="bottom"><span class="style7">MD5 decrypted:</span></td>
</tr>
<tr>
<td align="left" valign="bottom"><span class="style8"">
<form name=form1>
<textarea name=select cols=12 rows="1"><?php echo $decrypted; ?></textarea>
<A class=high href="javascript:HighlightAll('form1.select')"><input type="submit" name="copy" value="Select"></A>
</form>
</span>
</td>
</tr>
<?php
}
?>
<tr>
<td height="26" align="left" valign="bottom"></td>
</tr>
</table></td>
<td><div style="padding-left:0px; padding-top:9px; line-height:11px"><span class="style10"><strong>Direction:</strong><br>
Click select button to highlight the decrypted result, then copy it to your clipboard (Ctrl+C)
</span></div>
</td>
</tr>
</table>
</div></td>
</tr>
</table>
</div></td>
</tr>
<tr>
<td align="center" valign="top"><span class="style10">Total
number of <?php echo "<strong>".number_format($no)."</strong>"; ?> combinations md5</span><br> <?php echo $ads2; ?></td>
</tr>
</table></td>
<?php
}
?>
<td width="309" height="100%" background="images/rep_1.jpg" style="background-repeat:repeat-y; background-position:top left "><table width="309" height="100%" border="0" cellpadding="0" cellspacing="0" background="images/bot_pic_1.jpg" style="background-position:bottom left; background-repeat:no-repeat ">
<tr>
<td height="100%" align="left" valign="top" background="images/top_pic_1.jpg" style="background-repeat:no-repeat; background-position:top left "><div style="padding-left:14px; padding-top:12px">
<table height="27" border="0" cellpadding="0" cellspacing="0">
<tr>
<td><span class="style1">Welcome to MD5
Encryption & Decryption !</span></td>
</tr>
</table>
</div>
<div style="padding-left:14px; padding-top:10px"><span class="style10"><strong>Having
problem encrypting?<br>
</strong>This service will help you to encrypt<br>
your letter and number with md5 function.<br>
<br>
<strong>Having
problem decrypting?<br>
</strong>You are on the right place !<br>
This service will try to decrypt md5 for you !<br>
</span></div>
<div style="padding-left:15px; padding-top:15px">
<table width="158" border="0" cellspacing="0" cellpadding="0">
<tr align="left" valign="middle">
<td width="10" height="15"><a href="#"><img src="images/point_4.jpg" width="5" height="5" border="0"></a></td>
<td height="15"><span class="style14">MD5
encryption</span></td>
</tr>
<tr align="left" valign="middle">
<td width="10" height="15"><a href="#"><img src="images/point_4.jpg" width="5" height="5" border="0"></a></td>
<td height="15"><span class="style14">MD5
decryption</span></td>
</tr>
<tr align="left" valign="middle">
<td width="10" height="15"><a href="#"><img src="images/point_4.jpg" width="5" height="5" border="0"></a></td>
<td height="15"><span class="style14">Fast
and easy !</span></td>
</tr>
<tr align="left" valign="middle">
<td width="10" height="15"><a href="#"><img src="images/point_4.jpg" width="5" height="5" border="0"></a></td>
<td height="15"><span class="style14">Just
one click !</span></td>
</tr>
</table>
</div>
<div style="padding-left:13px; padding-top:16px; padding-bottom:15px">
<table width="240" height="18" border="0" cellpadding="0" cellspacing="0">
<tr align="left" valign="top">
<td width="100%" background="images/division_1.jpg" style="background-repeat:no-repeat; background-position:top right "><span class="style10"><strong>I
need your help !<br>
</strong>As we know there's billions of
different combination,<br>
me alone could not support the whole service, so
if you<br>
are free you could do some contribution by
adding different combinations to my database.<br>
Please refer to <?php echo $url; ?>add.php?no=<font color="#FF0000">x</font><br>
Replace the <font color="#FF0000">x</font> with the random lenght.</span></td>
</tr>
</table>
</div></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
<?php
include('footer.php');
?>
[代码运行效果截图]
[源代码打包下载]
初级程序员
by: 朽木可雕也 发表于:2017-08-19 19:57:11 顶(0) | 踩(0) 回复
你好,这个代码 可否直接线上运行呢?
回复评论