Skip to content

Instantly share code, notes, and snippets.

View KOUISAmine's full-sized avatar

Amine KOUIS KOUISAmine

View GitHub Profile
@KOUISAmine
KOUISAmine / index.html
Created February 8, 2017 00:09
Simple-upload-en-drag-and-drop-avec-mysqli
<!DOCTYPE html>
<html lang = "en">
<head>
<link rel = "stylesheet" type = "text/css" href = "css/bootstrap.css"/>
<link rel = "stylesheet" type = "text/css" href = "css/style.css"/>
<meta charset = "UTF-8" name= "viewport" content = "width=device-width, initial-scale=1" />
</head>
<body>
<nav class = "navbar navbar-default" style="background-color: #337ab7;">
<div class = "container-fluid">
@KOUISAmine
KOUISAmine / result.php
Created February 8, 2017 00:32
Simple upload en drag and drop avec MySQLi
<!DOCTYPE html>
<html lang = "en">
<head>
<link rel = "stylesheet" type = "text/css" href = "css/bootstrap.css"/>
<link rel = "stylesheet" type = "text/css" href = "css/style.css"/>
<meta charset = "UTF-8" name= "viewport" content = "width=device-width, initial-scale=1" />
</head>
<body>
<nav class = "navbar navbar-default">
<div class = "container-fluid">
@KOUISAmine
KOUISAmine / image_upload.php
Created February 8, 2017 00:34
Simple upload en drag and drop avec MySQLi
<?php
$conn = new mysqli('localhost', 'root', '', 'image');
if(ISSET($_POST['save'])){
if($_FILES['image']['name'] == ""){
echo '<script>alert("Veuillez selectionner une image")</script>';
echo '<script>window.location = "index.php"</script>';
}else{
$image = addslashes(file_get_contents($_FILES['image']['tmp_name']));
$image_name = addslashes($_FILES['image']['name']);
$image_size = getimagesize($_FILES['image']['tmp_name']);
@KOUISAmine
KOUISAmine / image.sql
Created February 8, 2017 00:39
Simple upload en drag and drop avec MySQLi
--
-- Database: `image`
--
CREATE TABLE `photo` (
`photo_id` int(11) NOT NULL,
`photo_name` varchar(100) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
@KOUISAmine
KOUISAmine / index.html
Created February 8, 2017 12:38
Comment créer une liste déroulante dépendante d'une autre liste déroulante avec jQuery/PHP/MYSQL
<!DOCTYPE html>
<?php
$conn = new mysqli('localhost', 'root', '', 'db_voiture') or die(mysqli_error());
?>
<html lang = "eng">
<head>
<meta charset = "UTF-8" />
<link rel = "stylesheet" type = "text/css" href = "css/bootstrap.css" />
</head>
<body>
@KOUISAmine
KOUISAmine / connexion.sql
Created February 10, 2017 19:29
Créer un formulaire de connexion en Php avec MySQLi / jQuery
CREATE TABLE IF NOT EXISTS user (
user_id int(11) NOT NULL AUTO_INCREMENT,
username varchar(50) NOT NULL,
password varchar(50) NOT NULL,
PRIMARY KEY (user_id)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
@KOUISAmine
KOUISAmine / connect.php
Last active February 10, 2017 19:40
Créer un formulaire de connexion en Php avec MySQLi / jQuery
<?php
$conn = new mysqli('localhost', 'root', '', 'connexion');
if($conn->connect_error){
die("Erreur: Impossible de se connecter à la base de données: ". $conn->connect_error);
}
?>
<!DOCTYPE html>
<?php
require 'connect.php';
?>
<html lang = "eng">
<head>
<meta charset = "UTF-8" />
</head>
<body style="background-color: #DCDCDC">
<center><h2>Création d'un formulaire de connexion en Php avec MySQLi / jQuery</h2></center>
<style>
#content{
background-color: #1E90FF;
width:340px;
height:110px;
margin: 50px auto;
padding:11px;
border-radius:2px;
-webkit-box-shadow:0px 0px 30px 3px #000;
}
$(document).ready(function(){
$error = $('<center><label style = "color:#ff0000;">Nom d\'utilisateur ou mot de passe incorrect</label></center>');
$error2 = $('<center><label style = "color:#ff0000;">Utilisateur n\' existe pas!</label></center>');
$success = $('<center><label style = "color:#00ff00;">Connexion réussie!</label></center>');
$loading = $('<center><img src = "loading.gif" height = "5px" width = "100%"/></center>');
$('#login').on('click', function(){
$error.remove();
$error2.remove();
$username = $('#username').val();
$password = $('#password').val();