This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Country_model extends CI_Model { | |
public function __construct() | |
{ | |
parent::__construct(); | |
} | |
public function total_rows() | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
include "vendor/autoload.php"; | |
$mail = new PHPMailer; | |
//$mail->SMTPDebug = 3; // Enable verbose debug output | |
$mail->isSMTP(); // Set mailer to use SMTP | |
$mail->Host = 'smtp.gmail.com'; // Specify main and backup SMTP servers | |
$mail->SMTPAuth = true; // Enable SMTP authentication | |
$mail->Username = '[email protected]'; // SMTP username |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// FTP server details | |
$ftpHost = 'ftp.host.com'; | |
$ftpUsername = 'tutsplanet'; | |
$ftpPassword = 'xxxxxxxx'; | |
// open an FTP connection | |
$connId = ftp_connect($ftpHost) or die("Couldn't connect to $ftpHost"); | |
// login to FTP |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// FTP server details | |
$ftpHost = 'ftp.host.com'; | |
$ftpUsername = 'tutsplanet'; | |
$ftpPassword = 'xxxxxxxxxx'; | |
// open an FTP connection | |
$connId = ftp_connect($ftpHost) or die("Couldn't connect to $ftpHost"); | |
// login to FTP |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// FTP server details | |
$ftpHost = 'ftp.host.com'; | |
$ftpUsername = 'tutsplanet'; | |
$ftpPassword = 'xxxxxxx'; | |
// open an FTP connection | |
$connId = ftp_connect($ftpHost) or die("Couldn't connect to $ftpHost"); | |
// login to FTP |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// FTP server details | |
$ftpHost = 'ftp.host.com'; | |
$ftpUsername = 'tutsplanet'; | |
$ftpPassword = 'xxxxxxxx'; | |
// open an FTP connection | |
$connId = ftp_connect($ftpHost) or die("Couldn't connect to $ftpHost"); | |
// login to FTP |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//Empty All | |
if($action=='emptyall') { | |
$_SESSION['products'] =array(); | |
header("Location:shopping-cart.php"); | |
} | |
//Empty one by one | |
if($action=='empty') { | |
$sku = $_GET['sku']; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//Add to cart | |
if($action=='addcart' && $_SERVER['REQUEST_METHOD']=='POST') { | |
//Finding the product by code | |
$query = "SELECT * FROM products WHERE sku=:sku"; | |
$stmt = $conn->prepare($query); | |
$stmt->bindParam('sku', $_POST['sku']); | |
$stmt->execute(); | |
$product = $stmt->fetch(); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="row"> | |
<div class="container" style="width:600px;"> | |
<?php foreach($products as $product):?> | |
<div class="col-md-4"> | |
<div class="thumbnail"> <img src="<?php print $product['image']?>" alt="Lights"> | |
<div class="caption"> | |
<p style="text-align:center;"><?php print $product['name']?></p> | |
<p style="text-align:center;color:#04B745;"><b>$<?php print $product['price']?></b></p> | |
<form method="post" action="shopping-cart.php?action=addcart"> | |
<p style="text-align:center;color:#04B745;"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
try { | |
$conn = new PDO("mysql:host=localhost;dbname=tutsplanet", 'root', ''); | |
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); | |
$password = password_hash($_POST['password'], PASSWORD_BCRYPT); //hashing password | |
$query = "INSERT INTO `customers` (`username`, `firstname`,`lastname`, `email`, `password`, `gender`) | |
VALUES (:username, :firstname,:lastname, :email, :password, :gender)"; | |
$stmt = $conn->prepare($query); |