Skip to content

Instantly share code, notes, and snippets.

View KOUISAmine's full-sized avatar

Amine KOUIS KOUISAmine

View GitHub Profile
@KOUISAmine
KOUISAmine / JsonSchemaExample.json
Last active November 6, 2023 01:45
JsonSchemaExample
{
"type": "object",
"properties": {
"users": {
"type": "array",
"minItems": 20,
"maxItems": 20,
"uniqueItems": true,
"items": {
"type": "object",
<?php
function getCdnUrls($html)
{
$cdnUrl = "//cdn.mon-domain.com";
$baseUrl = "mon-domain.com";
$patterns = [
// Match sources that are from the www or mobile urls
// We check for the schema as well as protocol relative urls
'~(<(img|script|link)[^>]*)(src|href) *= *(["\'])(https?:)?//(' . preg_quote($baseUrl) . ')~',
<!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>
<?php
require_once 'connect.php';
$username = $_POST['username'];
$password = $_POST['password'];
$stmt = $conn->prepare("SELECT * FROM `user` WHERE username = '$username' && `password` = '$password'") or die(mysqli_error());
if($stmt->execute()){
$result = $stmt->get_result();
$num_rows = $result->num_rows;
}
if($num_rows > 0){
$(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();
<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;
}
<!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>
@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);
}
?>
@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 / 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>