Skip to content

Instantly share code, notes, and snippets.

View chihebnabil's full-sized avatar

Nabil CHIHEB chihebnabil

View GitHub Profile
-- phpMyAdmin SQL Dump
-- version 3.4.11.1deb2+deb7u4
-- http://www.phpmyadmin.net
--
-- Client: localhost
-- Généré le: Mer 24 Août 2016 à 12:24
-- Version du serveur: 5.5.49
-- Version de PHP: 5.4.45-0+deb7u3
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
@chihebnabil
chihebnabil / default.ctp
Created August 24, 2016 11:44
Chat Application cakephp Layout
<!DOCTYPE html>
<html>
<head>
<?php echo $this->Html->charset(); ?>
<title>
<?php echo $this->fetch('title'); ?>
</title>
<!-- Material Design fonts -->
<link rel="stylesheet" type="text/css" href="//fonts.googleapis.com/css?family=Roboto:300,400,500,700">
<link rel="stylesheet" type="text/css" href="//fonts.googleapis.com/icon?family=Material+Icons">
@chihebnabil
chihebnabil / chat.ctp
Created August 24, 2016 12:03
Chat layout
<!DOCTYPE html>
<html>
<head>
<?php echo $this->Html->charset(); ?>
<title>
<?php echo $this->fetch('title'); ?>
</title>
<!-- Material Design fonts -->
<link rel="stylesheet" type="text/css" href="//fonts.googleapis.com/css?family=Roboto:300,400,500,700">
<link rel="stylesheet" type="text/css" href="//fonts.googleapis.com/icon?family=Material+Icons">
{
"name": "realtime",
"version": "1.0.0",
"description": "",
"main": "server.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
@chihebnabil
chihebnabil / server.js
Created August 25, 2016 12:46
this is not the finale server.js
var http = require('http');
var fs = require('fs');
var ent = require('ent')
var mysql = require('mysql');
var server = http.createServer(function(req, res) {
fs.readFile('./index.php', 'utf-8', function(error, content) {
res.writeHead(200, {"Content-Type": "text/html"});
@chihebnabil
chihebnabil / index.html
Last active August 26, 2016 13:56
upload file with php , Html markup
<!-- The data encoding type, enctype, MUST be specified as below -->
<form enctype="multipart/form-data" action="upload.php" method="POST">
<!-- MAX_FILE_SIZE must precede the file input field -->
<input type="hidden" name="MAX_FILE_SIZE" value="30000" />
<!-- Name of input element determines name in $_FILES array -->
Send this file: <input name="userfile" type="file" />
<input type="submit" value="Send File" />
</form>
?php
// In PHP versions earlier than 4.1.0, $HTTP_POST_FILES should be used instead
// of $_FILES.
$uploaddir = '/var/www/uploads/';
$uploadfile = $uploaddir . basename($_FILES['userfile']['name']);
echo '<pre>';
if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {
echo "File is valid, and was successfully uploaded.\n";
<?php
// In PHP versions earlier than 4.1.0, $HTTP_POST_FILES should be used instead
// of $_FILES.
$uploaddir = '/uploads/';
$uploadfile = $uploaddir . basename($_FILES['userfile']['name']);
echo '<pre>';
if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {
echo "File is valid, and was successfully uploaded.\n";
@chihebnabil
chihebnabil / data.json
Last active August 27, 2016 13:47
Let's build a mobile application with Ionic Framework #2
[
{
"Book":{
"id":"51",
"title":"Le Journal D\u2019une Femme De Chambre 01",
"preview":"\/mp3\/Octave_Mirbeau_-_Le_Journal_d_une_femme_de_chambre_Chap01.mp3",
"image":"\/sounds\/cover\/1\/51.webp",
"top":false,
"category_id":"16",
$(function () {
$('#my_form').on('submit', function (e) {
// prevent browser from submitting the form
e.preventDefault();
var $form = $(this);
$.ajax({
url: $form.attr('action'),
type: $form.attr('method'),