javascript - jQuery $.post() Logging Me Out On Key Down -


i have dynamic drop down search bar searches through members of data base inside of form on webpage. in order view webpage must log in first. when built site on domain works fine. when transferred files on different domain , configed identical database works perfect, except dynamic search in form. if type name (sometime odd different name work) in search works fine, if type else seems stay on page should, logs me out , reload login form on top of else including form typing on. using jquery .post() make search dynamic. provide code below

index.php

  <script>         // jquery function used post search document on key         function searchuserq(){             var searchtxt = $("input[name='usersearch']").val();             console.log(searchtxt);             if (searchtxt != '') {                  $.post("includes/search.php", {searchval:searchtxt},                     function(output){                         $("#userresults").html(output);                     });             }         }     </script>     <h1 class="edituser">edit user</h1>   <form class="edituser" action="index.php" method="post">     <h1>search employee</h1>     <input type="text" name="usersearch" id="usersearch" placeholder="search employee first name" onkeyup="searchuserq();" />     <submit type="submit" />     <div id="userresults">      </div>  </form> 

search.php

<?php     // connect secure login     $cfgprogdir = '../phpsecurepages/';     include($cfgprogdir . "secure.php");     //these includes needed make php page run     // file connects database     include("connect.inc.php");      if(isset($_post['searchval'])){         // turn user searched varible         $searchq = $_post['searchval'];         // delete symbols security         $searchq = preg_replace("#[^0-9a-z]#i", "", $searchq);          $output      = "";         $link        = "";         $searcharray = array();         $searchindex = 0;          // search through these columns inside main database         $usersearchquery = mysql_query("select * dealeremployees              firstname   '%$searchq%'          ");          // count number of results         $usercount = mysql_num_rows($usersearchquery);         if($usercount == 0){             // $output = "there no search results";         }else{             while($row = mysql_fetch_array($usersearchquery)){                 // define dynamic varibles each loop iteration                 $id         = $row['id'];                 $firstname  = $row['firstname'];                 $lastname   = $row['lastname'];                 $address    = $row['address'];                 $phone      = $row['phone'];                 $email      = $row['email'];                 $password   = $row['password'];                 $permission = $row['permission'];                 $photo      = "images/" . $row['profilephoto'];                  $output .= "<li><div class='employeesearch' style=\"background: url('$photo'); width: 75px; height: 75px\"></div><h6>" . $firstname  . "</h6>" . " " .  "<h6>" . $lastname . "</h6><a href='#' class='employee' data-firstname='$firstname' data-lastname='$lastname' data-address='$address' data-phone='$phone' data-email='$email' data-password='$password' data-permission='$permission' data-id='$id'>select employee</a></li>";             }         }     }      echo $output; 

can try this?

> "select id, firstname, lastname, address, phone, email, password, > permission profilephone  dealeremployees  >             firstname = '".$searchq."' limit 1" 

maybe condition giving more 1 result.


Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -