A place where criminals and hackers hang out..
 
HomeHome  FAQFAQ  SearchSearch  RegisterRegister  MemberlistMemberlist  UsergroupsUsergroups  Log inLog in  

Share | 
 

 ::PHP:: - Basic search process

View previous topic View next topic Go down 
AuthorMessage
JaVS_v2.5
Admin
avatar

Number of posts : 155
Age : 26
Localisation : vision homes seremban 2
Registration date : 2007-06-26

PostSubject: ::PHP:: - Basic search process   Thu Sep 16, 2010 11:11 pm

Code:

   //==========================================
   //   SEARCH PROCESS
   //==========================================
   $command = $_GET['confirm'];
   if($command == '1')
   {
   include ("connection.php");
   $idCustomer = $_POST['idCustomer'];
   $name = $_POST['username'];
   $address = $_POST['address'];
   $phone = $_POST['phone'];

//check
$idCheck = strlen($idCustomer);
$nameCheck = strlen($name);
$addressCheck = strlen($address);
$phoneCheck = strlen($phone);

//globalvar
$condition1 = "";
$condition2 = "";
$condition3 = "";
$condition4 = "";
$AND1 = ""; $AND2 = ""; $AND3 = "";


//condition
if($idCheck > 0){$condition1 = "ID LIKE '$idCustomer'";};
if($idCheck < 0){$condition1 = "";};

if($nameCheck > 0){$condition2 = "L1 LIKE '%$name%'";};
if($nameCheck < 0){$condition2 = "";};

if($addressCheck > 0){$condition3 = "address LIKE '%$address%'";};
if($addressCheck < 0){$condition3 = "";};

if($phoneCheck > 0){$condition4 = "phone LIKE '$phone'";};
if($phoneCheck < 0){$condition4 = "";};

//and
if($idCheck > 0 & $nameCheck > 0){$AND1 = "AND";};

if($idCheck > 0 & $nameCheck > 0 & $addressCheck > 0){$AND2 = "AND";};
if($nameCheck > 0 & $addressCheck > 0){$AND2 = "AND";};
if($idCheck > 0 & $addressCheck > 0){$AND2 = "AND";};

if($idCheck > 0 & $nameCheck > 0 & $addressCheck > 0 & $phoneCheck > 0){$AND3 = "AND";};
if($nameCheck > 0 & $addressCheck > 0 & $phoneCheck > 0){$AND3 = "AND";};
if($idCheck > 0 & $addressCheck > 0 & $phoneCheck > 0){$AND3 = "AND";};
if($nameCheck > 0 & $phoneCheck > 0){$AND3 = "AND";};
if($idCheck > 0 & $phoneCheck > 0){$AND3 = "AND";};
if($addressCheck > 0 & $phoneCheck > 0){$AND3 = "AND";};

$sql = "SELECT * FROM login WHERE $condition1 $AND1 $condition2 $AND2 $condition3 $AND3 $condition4";
$result=mysql_query($sql) or die("NO RESULTS FOUND.");

   echo "<div align='center'><font size='2'><b><br>Result of Customer Information<br/></b></font>";
   echo "<br><table border='1'><tr>
   <td bgcolor='yellow'><font size='1'><b>Customer ID</font></td>
   <td bgcolor='yellow'><font size='1'><b>Username</font></td>
   <td bgcolor='yellow'><font size='1'><b>Address</font></td>
   <td bgcolor='yellow'><font size='1'><b>Phone</font></td>
   <td bgcolor='yellow'><font size='1'><b>Delete</font></td>
   <td bgcolor='yellow'><font size='1'><b>Update</font></td>
   </tr></b></div>";

   while($row=mysql_fetch_array($result))
   {
      $idCustomer=$row[0];
      $name=$row[1];
      $address=$row[4];
      $phone=$row[5];
      
      echo "<tr>
      <td><font size='1'>$idCustomer</font></td>
      <td><font size='1'>$name</font></td>
      <td><font size='1'>$address</font></td>
      <td><font size='1'>$phone</font></td>
      <td><a href='admin.php?menu=searchcustomer&confirm&userid=$idCustomer'><font size='1'>DEL</font></a></td>
      <td><a href='admin.php?menu=updatecustomer&confirm=1&update&userid=$idCustomer'><font size='1'>UPDATE</font></a></td>
      </tr>";   
   }
   echo "</table>";};
   
      //==========================================
      //   SEARCH CUSTOMER : DELETE CUSTOMER
      //==========================================
      $userid = $_GET['userid'];
      include("connection.php");
      if($userid)
      {
      include("connection.php");
      $userid=$_GET['userid'];
      
      $sql_delete="DELETE FROM login WHERE ID='$userid'";
            
      $result=mysql_query($sql_delete) or die("Error in sql due to ".mysql_error());
   
      if ($result)
         echo "<p align='center'><font color='red'>Succesfully delete <b>Customer ID $userid.</b></font></p> ";
      else
         echo "Error in deleting Customer Information.";}
      
      echo "</table>";
   
   }
project web programming madafaka

_________________
666 is the number of the BEAST :: dA :: quote; "dreaming of tits are just fucking awesome..."LOL..
Back to top Go down
View user profile http://p33phole.your-board.com
 
::PHP:: - Basic search process
View previous topic View next topic Back to top 
Page 1 of 1
 Similar topics
-
» What are the basic requirements for using Selenium IDE?
» Need a Search Bar next to logo
» How to pass the multiple input data with or condition to search them?
» how to test search suggestions(ajax) in google?
» Search engines not working

Permissions in this forum:You cannot reply to topics in this forum
P33PHOLE HACKING NETWORK :: Codes & Bugs archive-
Jump to: