PHP 搜索账户

标签 php html mysql database

我想进行基于管理员的帐户搜索,但我不知道应该采用什么布局。

我的想法:创建一个带有搜索栏的索引页面,输入帐户名,生成一个带有用户名的“幽灵”.php 页面。例如:domain.com/user.php

在该 user.php 中,它将回显 $user 的数据。

听起来怎么样?我现在做了什么

<body>
   <script>
      var button = document.getElementById("btnSearch");

      button.onclick = function () {
          var text = document.getElementById("textBoxEl").value;
          window.open("http://monkey=" + text + "&red");
      }
   </script>
   <div class="test">
   <h1 id="title-1">Search an account<em><span></span> </h1>
   <center>
      <?php
         if(isset($_POST['number'])){
             header('Location: http://localhost/ucpba/public_Html/ucp/users/'.$_POST['number']);
             exit;
         }
         ?>
      <form>
         <input type="text" id="number" name="number" />
         <input type="submit" onclick="window.location = window.location  + number.value; return false;"/>
      </form>
   </center>
   <?php }
      else header('location: index.php'); //if user isn't loged in it will redirect him on login.php
      ?>
   <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> 
   <script type="text/javascript" src="js/jquery.matchHeight-min.js"></script> 
   <script src="js/wow.min.js"></script> 
   <script src="js/animsition.min.js"></script> 
   <script src="http://cdnjs.cloudflare.com/ajax/libs/jquery-easing/1.3/jquery.easing.min.js"></script> 
   <script src="js/jquery.parallax-scroll.js"></script> 
   <script src="js/owl.carousel.min.js"></script> 
   <script src="js/jquery.cbpQTRotator.min.js"></script> 
   <script>
      $(document).ready(function() {
        $("#owl-partners").owlCarousel({
            autoPlay: 4000, 
            stopOnHover : true,
            pagination : false,
            items : 5,
            itemsDesktop : [1199,4],
            itemsDesktopSmall : [959,3]     
        });     
      });
   </script> 
   <script>
      $( function() {
      $( '#cbp-qtrotator' ).cbpQTRotator();                 
      });
   </script> 
   <script src="js/functions.js"></script> 
   <script src="js/particle.js"></script> 
   <script type="text/javascript">
      var _gaq = _gaq || [];
      _gaq.push(['_setAccount', 'XX-XXXXXXXX-X']);
      _gaq.push(['_trackPageview']);
      (function() {
        var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
        ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
        var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
      })();
      <?php } ?>
   </script>
</body>
</html>

但我不知道下一步如何继续创建用户页面。

最佳答案

您有很多事情需要考虑(学习)。 但首先,

1-您需要使用 $_GET 方法获取 url 参数。

2-使用switch函数来识别变量。

3- 在开关内,单独的情况(帐户名称,号码)

4- 查询数据库以按帐户名或号码获取用户信息。

最后显示在页面中。

要更改 url,大多数情况下您需要使用 .htaccess 配置。

一些有用的入门教程:

网址重写:https://www.addedbytes.com/blog/url-rewriting-for-beginners

GET/POST 方法:https://www.formget.com/php-post-get/

搜索:https://owlcation.com/stem/Simple-search-PHP-MySQL

关于PHP 搜索账户,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49225473/

相关文章:

php - 将 PHP 进程作为守护进程运行,同时从后台安全地终止它

php - 这是一次将多个文本字段添加到 mysql 中的正确方法吗?

html - div 宽度和高度与屏幕宽度成正比

php - 在 PHP 或 MySQL 中按日期(月年)排序

mysql - 我在 Rails 2.2.2 应用程序中保存数组时遇到问题

php - 使用 PHP 显示服务器上存在的图像

php - Nginx:将子域重写为其中的文件夹和文件

html - 为什么不将 float 列到 div 的开头?

jquery - 单击按钮时加载包含内容的 div

php - 在 mysqli 连接中使用 mysql_* 函数