-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathdb_conf.php
86 lines (59 loc) · 1.91 KB
/
db_conf.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
<?php
//session_start();
$DB_host = "localhost";
$DB_user = "root";
$DB_pass = "";
$DB_name = "Otechnologie";
try {
$DB_con = new
PDO("mysql:host={$DB_host};dbname={$DB_name}",$DB_user,$DB_pass);
} catch(PDOException $e) {
echo $e->getMessage();
}
if (isset($_SESSION['user_session'])) {
$umail=$_SESSION['user_session'];
}
else{
$umail="";
}
$reponsee = $DB_con->query("SELECT * FROM users where user_email='$umail' LIMIT 1");
$donnes=$reponsee->fetch(PDO::FETCH_ASSOC);
$user=$donnes['user_id'];
$userpers=$donnes['personnalite'];
/********* nbre de commande par produit*******/
$reponse = $DB_con->query("SELECT pro_id,count(numcom) as star FROM commande group by(pro_id)");
while ($donnees = $reponse->fetch()){
$nbstar=$donnees['star'];
$nbpro=$donnees['pro_id'];
$DB_con->exec("UPDATE produit SET star='$nbstar' where id='$nbpro'");
}
/******* devise *************/
$res=$DB_con->query("SELECT * FROM formweb");
$rows = $res->fetch();
$devise="TND";
if(isset($_GET['d'])){
$devise=$_GET['d'];
$devise = strtoupper($devise);
}
if($devise=="TND"){
$dev="DT";
$pridev=1;
}elseif($devise=="USD"){
$dev='<i class="fa fa-usd"></i>';
$pridev=2.43847;
}elseif($devise=="EUR"){
$dev='<i class="fa fa-eur "></i>';
$pridev=2.573;
}
/******************** fin date produit *****************/
/*$reponse = $DB_con->query("SELECT * FROM produit");
$datenew=date("Y-m-d")." ".date("H:i:s");
while ($donnees = $reponse->fetch())
{
$npro=$donnees['id'];
if($donnees['datefinsolde']<$datenew and $donnees['datefinsolde']!="" and $donnees['prixsolde']!=0){
$prix=$donnees['prixsolde'];
$DB_con->exec("UPDATE produit SET prix='$prix',prixsolde='0',datefinsolde='',pourcentage='0' where id=$npro");
}
}*/
?>