资源分享
我们一直在努力

百家姓暗号html源码

PHP版本

<?php
// 定义百家姓与字符的映射数组
$obja = [
    "赵" => "0", "钱" => "1", "孙" => "2", "李" => "3", "周" => "4", "吴" => "5", "郑" => "6", "王" => "7", "冯" => "8", "陈" => "9",
    "褚" => "a", "卫" => "b", "蒋" => "c", "沈" => "d", "韩" => "e", "杨" => "f", "朱" => "g", "秦" => "h", "尤" => "i", "许" => "j",
    "何" => "k", "吕" => "l", "施" => "m", "张" => "n", "孔" => "o", "曹" => "p", "严" => "q", "华" => "r", "金" => "s", "魏" => "t",
    "陶" => "u", "姜" => "v", "戚" => "w", "谢" => "x", "邹" => "y", "喻" => "z", "福" => "A", "水" => "B", "窦" => "C", "章" => "D",
    "云" => "E", "苏" => "F", "潘" => "G", "葛" => "H", "奚" => "I", "范" => "J", "彭" => "K", "郎" => "L", "鲁" => "M", "韦" => "N",
    "昌" => "O", "马" => "P", "苗" => "Q", "凤" => "R", "花" => "S", "方" => "T", "俞" => "U", "任" => "V", "袁" => "W", "柳" => "X",
    "唐" => "Y", "罗" => "Z", "薛" => ".", "伍" => "-", "余" => "_", "米" => "+", "贝" => "=", "姚" => "/", "孟" => "?", "顾" => "#",
    "尹" => "%", "江" => "&", "钟" => "*"
];

// 定义函数将明文转换为乱码
function convertToCode($input, $obja) {
    $t = 'magnet:?xt=urn:btih:';
    $input = trim($input);
    $result = '';
    for ($i = 0; $i < mb_strlen($input); $i++) {
        $char = mb_substr($input, $i, 1);
        if (array_key_exists($char, $obja)) {
            $result .= $obja[$char];
        }
    }
    return $t . $result;
}

// 定义函数将乱码转换为明文
function convertToPlain($input, $obja) {
    $input = trim($input);
    $input = str_replace('magnet:?xt=urn:btih:', '', $input);
    $result = '';
    $keys = array_keys($obja);
    $values = array_values($obja);
    for ($i = 0; $i < strlen($input); $i++) {
        $char = $input[$i];
        $index = array_search($char, $values);
        if ($index!== false) {
            $result .= $keys[$index];
        }
    }
    return $result;
}

// 处理表单提交
if ($_SERVER["REQUEST_METHOD"] == "POST") {
    if (isset($_POST['convertToCode'])) {
        $plainText = $_POST['plainText'];
        $code = convertToCode($plainText, $obja);
    } elseif (isset($_POST['convertToPlain'])) {
        $code = $_POST['code'];
        $plainText = convertToPlain($code, $obja);
    }
}
?>

<!DOCTYPE html>
<!-- saved from url=(0030)https://www.wuzuowei.net/anhao.html -->
<html lang="en">

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>赵钱孙李百家姓接头暗号</title>
    <!-- 作者:刘学 http://www.sexy0769.com -->

    <style type="text/css">
        body {
            overFlow-x: hidden;
            background-color: #eee;
            -moz-user-select: none;
            /*火狐*/
            -webkit-user-select: none;
            /*webkit浏览器*/
            -ms-user-select: none;
            /*IE10*/
            -khtml-user-select: none;
            /*早期浏览器*/
            user-select: none;
            min-width: 18em;
            width: expression_r(document.body.clientWidth < 19 ? "18em" : "auto");
        }

        /* hr ---------------------------------------------- */
        hr {
            width: 80%;
            margin: 0 auto;
            border: 0;
            height: 4px;
            background-image: linear-gradient(to right, rgba(0, 0, 0, 0),
                    rgba(0, 0, 0, 0.75), rgba(0, 0, 0, 0));
        }

        /* input ---------------------------------------------- */
        input {
            outline-style: none;
            border: 1px solid #ccc;
            border-radius: 3px;
            padding: 18px 18px;
            font: 16px/100% Arial, Helvetica, sans-serif;
            width: 100%;
        }

        /* button ---------------------------------------------- */
        .button {
            display: inline-block;
            zoom: 1;
            /* zoom and *display = ie7 hack for display:inline-block */
            *display: inline;
            vertical-align: baseline;
            margin: 0 2px;
            outline: none;
            cursor: pointer;
            text-align: center;
            text-decoration: none;
            font: 16px/100% Arial, Helvetica, sans-serif;
            padding: .5em 2em .55em;
            text-shadow: 0 1px 1px rgba(0, 0, 0, .3);
            -webkit-border-radius: .5em;
            -moz-border-radius: .5em;
            border-radius: .5em;
            -webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, .2);
            -moz-box-shadow: 0 1px 2px rgba(0, 0, 0, .2);
            box-shadow: 0 1px 2px rgba(0, 0, 0, .2);
        }

        .button:hover {
            text-decoration: none;
        }

        .button:active {
            position: relative;
            top: 1px;
        }
    </style>
</head>

<body>
    <div style="width:90%">
        <br>
        <h1 style="text-align: center;">赵钱孙李百家姓接头暗号</h1>
        <h4>危险驾驶区</h4>
        <form method="post" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>">
            <input type="text" id="c" name="code" value="<?php if (isset($code)) echo $code; ?>"> <br>
            <button type="submit" id="d" class="button" name="convertToPlain"><<<<<转换成明文</button>

            <br> <br>
            <hr>
            <br>
            <h4>安全驾驶区</h4>
            <input type="text" id="a" name="plainText" value="<?php if (isset($plainText)) echo $plainText; ?>"> <br>
            <button type="submit" id="b" class="button" name="convertToCode">转换成乱码>>>>></button>
            <br><br><br><hr><br>
            <a href="https://coolx.zabc.net/" class="button">返回主页</a><br><br><br>
        </form>
    </div>
</body>

</html>

 

html版本

<!DOCTYPE html>
<!-- saved from url=(0030)https://www.wuzuowei.net/anhao.html -->
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>赵钱孙李百家姓接头暗号</title>
<!-- 作者:刘学 http://www.sexy0769.com -->

<style type="text/css">
body {
	overFlow-x: hidden;
	background-color: #eee;
	-moz-user-select: none; /*火狐*/
	-webkit-user-select: none; /*webkit浏览器*/
	-ms-user-select: none; /*IE10*/
	-khtml-user-select: none; /*早期浏览器*/
	user-select: none;
	min-width: 18em;
	width: expression_r(document.body.clientWidth < 19 ?"18em" : "auto");
}

/* hr ---------------------------------------------- */
hr {
	width: 80%;
	margin: 0 auto;
	border: 0;
	height: 4px;
	background-image: linear-gradient(to right, rgba(0, 0, 0, 0),
		rgba(0, 0, 0, 0.75), rgba(0, 0, 0, 0) );
}
/* input ---------------------------------------------- */
input {
	outline-style: none;
	border: 1px solid #ccc;
	border-radius: 3px;
	padding: 18px 18px;
	font: 16px/100% Arial, Helvetica, sans-serif;
	width: 100%;
}
/* button ---------------------------------------------- */
.button {
	display: inline-block;
	zoom: 1; /* zoom and *display = ie7 hack for display:inline-block */
	*display: inline;
	vertical-align: baseline;
	margin: 0 2px;
	outline: none;
	cursor: pointer;
	text-align: center;
	text-decoration: none;
	font: 16px/100% Arial, Helvetica, sans-serif;
	padding: .5em 2em .55em;
	text-shadow: 0 1px 1px rgba(0, 0, 0, .3);
	-webkit-border-radius: .5em;
	-moz-border-radius: .5em;
	border-radius: .5em;
	-webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, .2);
	-moz-box-shadow: 0 1px 2px rgba(0, 0, 0, .2);
	box-shadow: 0 1px 2px rgba(0, 0, 0, .2);
}

.button:hover {
	text-decoration: none;
}

.button:active {
	position: relative;
	top: 1px;
}
</style>
</head>
<body>
	<div style="width:90%">
		 <br> 
		<h1 style="text-align: center;">赵钱孙李百家姓接头暗号</h1>
		<h4>危险驾驶区</h4>
		<input type="text" id="c"> <br>
		<button type="button" id="d" class="button">转换成乱码>>>>></button>

		<br> <br>
		<hr>
		<br> 
		<h4>安全驾驶区</h4>
		<input type="text" id="a"> <br>
		<button type="button" id="b" class="button"><<<<<转换成明文</button>
		<br><br><br><hr><br>
		<a href="https://coolx.zabc.net/" class="button">返回主页</a><br><br><br>
	</div>

	<script>
    var t='magnet:?xt=urn:btih:';
    var obja={
        "赵":"0", "钱":"1", "孙":"2", "李":"3", "周":"4", "吴":"5", "郑":"6", "王":"7", "冯":"8", "陈":"9",
        "褚":"a", "卫":"b", "蒋":"c", "沈":"d", "韩":"e", "杨":"f", "朱":"g", "秦":"h", "尤":"i", "许":"j",
        "何":"k", "吕":"l", "施":"m", "张":"n", "孔":"o", "曹":"p", "严":"q", "华":"r", "金":"s", "魏":"t",
        "陶":"u", "姜":"v", "戚":"w", "谢":"x", "邹":"y", "喻":"z", "福":"A", "水":"B", "窦":"C", "章":"D",
        "云":"E", "苏":"F", "潘":"G", "葛":"H", "奚":"I", "范":"J", "彭":"K", "郎":"L", "鲁":"M", "韦":"N",
        "昌":"O", "马":"P", "苗":"Q", "凤":"R", "花":"S", "方":"T", "俞":"U", "任":"V", "袁":"W", "柳":"X",
        "唐":"Y", "罗":"Z", "薛":".", "伍":"-", "余":"_", "米":"+", "贝":"=", "姚":"/", "孟":"?", "顾":"#",
        "尹":"%", "江":"&", "钟":"*"
    };

    var b = document.getElementById("b");
    b.addEventListener("click", function() {
        var str = document.getElementById("a").value;
        str=str.replace(/^\s\s*/, '').replace(/\s\s*$/, '');
        var strc = str.split("");
        var c  = '';
        for(var i=0;i<strc.length;i++){
            var o=cy(obja,strc[i]);
            c +=o;
        }
        c=t+c;
        document.getElementById('c').value=c;
    });

    var d = document.getElementById("d");
    d.addEventListener("click", function() {
        var str = document.getElementById("c").value;
        str=str.replace(/^\s\s*/, '').replace(/\s\s*$/, '');
        var v=str.replace(/magnet:\?xt=urn:btih:/,"");
        var strc = v.split("");
        var a  = '';
        for(var i=0;i<strc.length;i++){
            a +=ay(obja,strc[i]);
        }
        document.getElementById('a').value=a;
    });

    function cy(array,val){
        for( var key in array ){
            if(key==val){
                return array[key];
            }
        }
        return '';
    }
    function ay(array,val){
        for( var key in array ){
            if(array[key]==val){
                return key;
            }
        }
        return '';
    }
</script>
</body>
</html>
赞(0)
未经允许不得转载:Cool享博客 » 百家姓暗号html源码
分享到

登录

找回密码

注册