Jump to content

 

osama moqbal

Member Since 10 Jun 2018
Offline Last Active Jan 21 2019 07:49 AM
-----

#309822 How To Include Sql Query Using Php In Cs-Cart Page And Display In Data In A...

Posted by osama moqbal on 07 December 2018 - 07:40 PM

I create new PHP page to retrieve data from a database, but I want to include the PHP query code in the cs-cart page.  and does my code not secure for a hacker to the database.

 

here is my code {

<html>
<meta name="viewport" content="width=device-width">
<style>
#customers {
  font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
  border-collapse: collapse;
  width: 100%;
}
 
#customers td, #customers th {
  border: 1px solid #ddd;
  padding: 8px;
}
 
#customers tr:nth-child(even){background-color: #f2f2f2;}
 
#customers tr:hover {background-color: #ddd;}
 
#customers th {
  padding-top: 12px;
  padding-bottom: 12px;
  text-align: left;
  background-color: #4CAF50;
  color: white;
}
input[type=submit] {
  width: 250px;
  background-color: #4CAF50;
  color: white;
  padding: 14px 20px;
  margin: 8px 0;
  border: none;
  border-radius: 4px;
   margin-left: 20px;
  cursor: pointer;
}
input[type=text] {
  width: 200px%;
  padding: 12px 20px;
  margin: 8px 0;
  display: inline-block;
  border: 1px solid #ccc;
  border-radius: 4px;
  box-sizing: border-box;
}
</style>
<body>
<table id="customers">
<tr>
<th>firstname</th>
<th>lastname</th>
</tr>
<?php
 
if ($_SERVER["REQUEST_METHOD"] == "POST"){
 
$id =$_POST["id"];
$conn = new mysqli($localhost, "username", "pass", "sdb_name");
$id = $_POST["id"];
 
$sql = "SELECT `firstname` , `lastname` FROM `cscart_users` WHERE user_id = $id";
 
$result= mysqli_query($conn , $sql);
if ($result->num_rows > 0)  {
while ($row= mysqli_fetch_array($result)){
 
echo  "</td><td>". $row["firstname"] ."</td><td>". $row["lastname"] ."</td></tr>";
    }
}
}
 
?>
 
     <form method="post" action="file.php">
      please enter user_id:<input type="text" name="id">
     <input type="submit" name="submit" value="submit">
     </form>
   
 
</table>
 
}



#306149 Mobile Apps Developement For My Cs-Cart Site

Posted by osama moqbal on 04 September 2018 - 06:17 AM

does any one know if twigmo dead or no . 




#304325 How Make Google Recaptcha In Newsletter Subscriber

Posted by osama moqbal on 23 July 2018 - 12:18 PM

reCaptcha is just and addon which overrides core files. So mentioned solution should work

i use unitheme , and there is newsletter is these directory >  design/themes/THEME/templates/addons/newsletters/blocks/static_templates/subscribe.tpl  

and thank you ecomes lab for help