PHP搜索帐户

时间:2018-03-11 21:48:30

标签: php html mysql database

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

我的想法:创建一个带搜索栏的索引页面,键入帐户名称,生成一个带有用户名称的“ghost”.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 个答案:

答案 0 :(得分:0)

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

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

2-使用开关功能识别变量。

3-在交换机内部,单独的情况(account_name,数字)

4-查询您的数据库,以通过account_name或数字获取用户的信息。

最后在页面中显示。

要更改网址,大多数情况下您需要使用.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