P33PHOLE HACKING NETWORK
Would you like to react to this message? Create an account in a few clicks or log in to continue.


A place where criminals and hackers hang out..
 
HomeHome  SearchSearch  Latest imagesLatest images  RegisterRegister  Log inLog in  

 

 ::PHP:: - Basic search process

Go down 
AuthorMessage
JaVS_v2.5
Admin
JaVS_v2.5


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

::PHP:: - Basic search process Empty
PostSubject: ::PHP:: - Basic search process   ::PHP:: - Basic search process EmptyThu 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
Back to top Go down
https://p33phole.forumotion.com
 
::PHP:: - Basic search process
Back to top 
Page 1 of 1

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