{"id":199,"date":"2021-11-12T00:58:40","date_gmt":"2021-11-11T16:58:40","guid":{"rendered":"https:\/\/www.langsasec.cn\/?p=199"},"modified":"2022-11-14T18:11:46","modified_gmt":"2022-11-14T10:11:46","slug":"phploginsignsystem","status":"publish","type":"post","link":"https:\/\/blog.langsasec.cn\/index.php\/2021\/11\/12\/phploginsignsystem\/","title":{"rendered":"\u767b\u9646\u6ce8\u518c\u7cfb\u7edf"},"content":{"rendered":"<h2><span class=\"ez-toc-section\" id=\"%e4%bb%a3%e7%a0%81%e5%85%b1%e5%9b%9b%e4%b8%aa%e6%96%87%e4%bb%b6\"><\/span>\u4ee3\u7801\u5171\u56db\u4e2a\u6587\u4ef6<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p><strong>1.loginsign.html<\/strong><\/p>\n<pre class=\"prettyprint linenums\" ><code>&lt;html&gt;\n&lt;head&gt;\n&lt;meta charset=&quot;utf-8&quot;&gt;\n&lt;title&gt;\u767b\u9646\u6ce8\u518c\u7cfb\u7edf&lt;\/title&gt;\n&lt;\/head&gt;\n&lt;h1&gt;\u6b22\u8fce\u6765\u5230\u767b\u9646\u6ce8\u518c\u7cfb\u7edf&lt;\/h1&gt;\n&lt;h2&gt;welcome to login and sign system&lt;\/h2&gt;\n&lt;form action=&quot;loginsign.php&quot; method=&quot;POST&quot;&gt;\n  \u5e10\u53f7  &lt;input type=&quot;text&quot; name=&#039;username&#039;\/&gt;&lt;br \/&gt;&lt;br \/&gt;\n  \u5bc6\u7801  &lt;input type=&quot;password&quot; name=&#039;password&#039;\/&gt; &lt;br \/&gt;&lt;br \/&gt;\n  \u767b\u9646&lt;input type=&quot;submit&quot; value=&quot;login&quot;\/&gt;\n&lt;\/form&gt;\n&lt;form action=&quot;sign.html&quot;&gt;\n \u6ce8\u518c&lt;input type=&quot;submit&quot; value=&quot;sign&quot;\/&gt;\n&lt;\/form&gt;\n&lt;\/html&gt;<\/code><\/pre>\n<p><strong>2.sign.html<\/strong><\/p>\n<pre class=\"prettyprint linenums\" ><code>&lt;html&gt;\n&lt;head&gt;\n&lt;meta charset=&quot;utf-8&quot;&gt;\n&lt;title&gt;\u6ce8\u518c\u7cfb\u7edf&lt;\/title&gt;\n&lt;\/head&gt;\n&lt;h1&gt;\u6b22\u8fce\u65b0\u7528\u6237&lt;\/h1&gt;\n&lt;form action=&quot;sign.php&quot; method=&quot;POST&quot;&gt;\n  \u8bf7\u8f93\u5165\u4f60\u7684\u5e10\u53f7  &lt;input type=&quot;text&quot; name=&#039;username&#039;\/&gt;&lt;br \/&gt;&lt;br \/&gt;\n  \u8bf7\u8f93\u5165\u4f60\u7684\u5bc6\u7801  &lt;input type=&quot;password&quot; name=&#039;password&#039;\/&gt; &lt;br \/&gt;&lt;br \/&gt;\n  \u786e\u8ba4\u6ce8\u518c&lt;input type=&quot;submit&quot; name= &#039;sign&#039; value=&quot;sign&quot;\/&gt;\n&lt;\/form&gt;\n&lt;form action=&quot;loginsign.html&quot;&gt;\n    &lt;input type=&quot;submit&quot;  value=&quot;\u8fd4\u56de\u767b\u9646&quot;\/&gt;\n&lt;\/form&gt;\n&lt;\/html&gt;<\/code><\/pre>\n<p><strong>3.loginsign.php<\/strong><\/p>\n<pre class=\"prettyprint linenums\" ><code>&lt;meta charset=&quot;utf-8&quot;&gt;\n&lt;?php\n$username = $_POST[&#039;username&#039;];\/\/\u83b7\u53d6\u4f20\u53c2\n$password = $_POST[&#039;password&#039;];\n$con = mysqli_connect(&#039;localhost&#039;,&#039;phpwebtest&#039;,&#039;phpwebtest&#039;,&#039;phpwebtest&#039;);\nmysqli_select_db($con,&#039;phpwebtest&#039;);\/\/\u8fde\u63a5\u6570\u636e\u5e93\n$sql=&quot;select*from users where username =&#039;$username&#039; and passwd =&#039;$password&#039;&quot;;\/\/\u6267\u884csql\u8bed\u53e5\n$result=mysqli_query($con,$sql);\/\/\u5f97\u5230\u67e5\u8be2\u7ed3\u679c object\nif ($username== NULL or $password == NULL) {\n    echo &#039;\u5e10\u53f7\u6216\u5bc6\u7801\u4e3a\u7a7a\uff0c\u8bf7\u91cd\u65b0\u767b\u9646&#039;;\n }\nelseif(mysqli_fetch_array($result)[&#039;username&#039;]==$username){\n    echo &#039;\u767b\u9646\u6210\u529f&#039;;\n}\nelse{\n    echo &#039;\u8be5\u5e10\u6237\u4e0d\u5b58\u5728,\u8bf7\u8fd4\u56de\u6ce8\u518c\u5b8c\u6210\u540e\u518d\u767b\u9646&#039;;\n}\n\/\/\u8f6c\u6362\u4e3a\u6570\u7ec4\uff0c\u5224\u65ad\u8f93\u5165\u7684\u6b63\u786e\u4e0e\u5426\n?&gt;<\/code><\/pre>\n<p><strong>4.sign.php<\/strong><\/p>\n<pre class=\"prettyprint linenums\" ><code>&lt;?php\n$sign = $_POST[&#039;sign&#039;];\n$username = $_POST[&#039;username&#039;];\/\/\u83b7\u53d6\u4f20\u53c2\n$password = $_POST[&#039;password&#039;];\nif (($username or $password) != NULL) {\n$con = mysqli_connect(&#039;localhost&#039;,&#039;phpwebtest&#039;,&#039;phpwebtest&#039;,&#039;phpwebtest&#039;);\nmysqli_select_db($con,&#039;phpwebtest&#039;);\/\/\u8fde\u63a5\u6570\u636e\u5e93\n$sql=&quot;insert into users value(&#039;$username&#039;,&#039;$password&#039;)&quot;;\/\/\u6267\u884csql\u8bed\u53e5\n$result=mysqli_query($con,$sql);\/\/\u5f97\u5230\u7ed3\u679c object\necho &#039;\u6ce8\u518c\u6210\u529f\uff0c\u8bf7\u8fd4\u56de\u767b\u9646&#039;;\n}else {\n    echo &#039;\u8bf7\u8f93\u5165\u6b63\u786e\u7684\u5bc6\u7801\u5b8c\u6210\u6ce8\u518c!&#039;;\n}\n?&gt;<\/code><\/pre>\n<h2><span class=\"ez-toc-section\" id=\"%e5%8a%9f%e8%83%bd%e5%b1%95%e7%a4%ba\"><\/span>\u529f\u80fd\u5c55\u793a<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p><strong>1.\u968f\u4fbf\u8f93\u5165\u8d26\u53f7\u5bc6\u7801<\/strong><\/p>\n<p><img decoding=\"async\" src=\"https:\/\/blog.langsasec.cn\/wp-content\/uploads\/2021\/11\/image-5-1024x594.png\" alt=\"img\" title=\"\u767b\u9646\u6ce8\u518c\u7cfb\u7edf\u63d2\u56fe\" \/><\/p>\n<p>\u8df3\u8f6c\u65b0\u9875\u9762\u8fd4\u56de\u5982\u4e0b\uff1a<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/blog.langsasec.cn\/wp-content\/uploads\/2021\/11\/image-6.png\" alt=\"img\" title=\"\u767b\u9646\u6ce8\u518c\u7cfb\u7edf\u63d2\u56fe1\" \/><\/p>\n<p><strong>2.\u4e0d\u8f93\u5165\u6216\u586b\u5199\u4e0d\u5b8c\u6574\u767b\u9646<\/strong><\/p>\n<p><img decoding=\"async\" src=\"https:\/\/blog.langsasec.cn\/wp-content\/uploads\/2021\/11\/image-7-1024x391.png\" alt=\"img\" title=\"\u767b\u9646\u6ce8\u518c\u7cfb\u7edf\u63d2\u56fe2\" \/><\/p>\n<p><img decoding=\"async\" src=\"https:\/\/blog.langsasec.cn\/wp-content\/uploads\/2021\/11\/image-8-1024x428.png\" alt=\"img\" title=\"\u767b\u9646\u6ce8\u518c\u7cfb\u7edf\u63d2\u56fe3\" \/><\/p>\n<p>\u8df3\u8f6c\u65b0\u9875\u9762\u8fd4\u56de\u5982\u4e0b\uff1a<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/blog.langsasec.cn\/wp-content\/uploads\/2021\/11\/image-9-1024x348.png\" alt=\"img\" title=\"\u767b\u9646\u6ce8\u518c\u7cfb\u7edf\u63d2\u56fe4\" \/><\/p>\n<p><strong>3.\u6ce8\u518c<\/strong><\/p>\n<p><img decoding=\"async\" src=\"https:\/\/blog.langsasec.cn\/wp-content\/uploads\/2021\/11\/image-10-1024x435.png\" alt=\"img\" title=\"\u767b\u9646\u6ce8\u518c\u7cfb\u7edf\u63d2\u56fe5\" \/><\/p>\n<p><img decoding=\"async\" src=\"https:\/\/blog.langsasec.cn\/wp-content\/uploads\/2021\/11\/image-11-1024x499.png\" alt=\"img\" title=\"\u767b\u9646\u6ce8\u518c\u7cfb\u7edf\u63d2\u56fe6\" \/><\/p>\n<p>\u7559\u7a7a\u586b\u5199\u6ce8\u518c\u4f1a\u8fd4\u56de<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/blog.langsasec.cn\/wp-content\/uploads\/2021\/11\/image-12-1024x372.png\" alt=\"img\" title=\"\u767b\u9646\u6ce8\u518c\u7cfb\u7edf\u63d2\u56fe7\" \/><\/p>\n<p>\u8f93\u5165\u6b63\u786e\u6ce8\u518c\uff1a<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/blog.langsasec.cn\/wp-content\/uploads\/2021\/11\/image-13-1024x352.png\" alt=\"img\" title=\"\u767b\u9646\u6ce8\u518c\u7cfb\u7edf\u63d2\u56fe8\" \/><\/p>\n<p><img decoding=\"async\" src=\"https:\/\/blog.langsasec.cn\/wp-content\/uploads\/2021\/11\/image-14-1024x296.png\" alt=\"img\" title=\"\u767b\u9646\u6ce8\u518c\u7cfb\u7edf\u63d2\u56fe9\" \/><\/p>\n<p>\u70b9\u51fb\u8fd4\u56de\u767b\u9646<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/blog.langsasec.cn\/wp-content\/uploads\/2021\/11\/image-15-1024x434.png\" alt=\"img\" title=\"\u767b\u9646\u6ce8\u518c\u7cfb\u7edf\u63d2\u56fe10\" \/><\/p>\n<p><strong>4.\u767b\u9646<\/strong><\/p>\n<p><img decoding=\"async\" src=\"https:\/\/blog.langsasec.cn\/wp-content\/uploads\/2021\/11\/image-16-1024x488.png\" alt=\"img\" title=\"\u767b\u9646\u6ce8\u518c\u7cfb\u7edf\u63d2\u56fe11\" \/><\/p>\n<p>\u63d0\u793a\u767b\u9646\u6210\u529f<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4ee3\u7801\u5171\u56db\u4e2a\u6587\u4ef6 1.loginsign.html &lt;html&gt; &lt;head&gt; &lt; [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[22],"tags":[],"class_list":["post-199","post","type-post","status-publish","format-standard","hentry","category-webpt-studynote"],"_links":{"self":[{"href":"https:\/\/blog.langsasec.cn\/index.php\/wp-json\/wp\/v2\/posts\/199","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.langsasec.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.langsasec.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.langsasec.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.langsasec.cn\/index.php\/wp-json\/wp\/v2\/comments?post=199"}],"version-history":[{"count":4,"href":"https:\/\/blog.langsasec.cn\/index.php\/wp-json\/wp\/v2\/posts\/199\/revisions"}],"predecessor-version":[{"id":1054,"href":"https:\/\/blog.langsasec.cn\/index.php\/wp-json\/wp\/v2\/posts\/199\/revisions\/1054"}],"wp:attachment":[{"href":"https:\/\/blog.langsasec.cn\/index.php\/wp-json\/wp\/v2\/media?parent=199"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.langsasec.cn\/index.php\/wp-json\/wp\/v2\/categories?post=199"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.langsasec.cn\/index.php\/wp-json\/wp\/v2\/tags?post=199"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}