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 | |
function isValidMail($mail) { | |
if(!filter_var($mail, FILTER_VALIDATE_EMAIL)) | |
return FALSE; | |
if(!checkdnsrr("gmail.com", "MX")) // if we have no internet access on the server | |
return TRUE; | |
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
// found on http://stackoverflow.com/a/7469410/1579481 | |
#include <termios.h> | |
#include <stdio.h> | |
static struct termios old, newp; | |
/* Initialize new terminal i/o settings */ | |
void initTermios(int echo) | |
{ | |
tcgetattr(0, &old); /* grab old terminal i/o settings */ |
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 | |
function sendMail($to, $subject, $message, $from = 'From: [email protected]', $isHtml = true) { | |
$from .= "\r\n"; // we make sure we have an endline | |
if($isHtml) { | |
$from .= "MIME-Version: 1.0 \r\n"; | |
$from .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; | |
} | |
$from .= 'X-Mailer: PHP/'.phpversion()."\r\n"; | |
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 | |
function get_os() { | |
$browser = $_SERVER['HTTP_USER_AGENT']; | |
if (strpos($browser,"Windows") !== FALSE) { | |
return "Windows"; | |
}else if (strpos($browser,"Linux") !== FALSE) { | |
return "Linux"; | |
}else if (strpos($browser,"FreeBSD") !== FALSE) { | |
return "FreeBSD"; |
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 | |
function get_max_upl() { | |
$max_upload = (int)(ini_get('upload_max_filesize')); | |
$max_post = (int)(ini_get('post_max_size')); | |
$memory_limit = (int)(ini_get('memory_limit')); | |
return min($max_upload, $max_post, $memory_limit); | |
} |
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 | |
function deleteAll($directory, $empty = false) { | |
$t= time() - 60*60*24*4; | |
if(substr($directory,-1) == "/") { | |
$directory = substr($directory,0,-1); | |
} | |
if(!file_exists($directory) || !is_dir($directory)) { | |
return false; |
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 | |
/** | |
* Time elapes since a times | |
* @param int $time The past time | |
* @return string time elapssed | |
* credits: http://stackoverflow.com/a/2916189/1579481 | |
*/ | |
function tsince($time, $end_msg = 'ago') { | |
$time = abs(time() - $time); // to get the time since that moment |
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 | |
// Returns the real IP address of the user | |
function i2c_realip() | |
{ | |
// No IP found (will be overwritten by for | |
// if any IP is found behind a firewall) | |
$ip = FALSE; | |
// If HTTP_CLIENT_IP is set, then give it priority |
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
/******************************/ | |
/* 1. CSS Reset | |
/******************************/ | |
body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,form,fieldset,input,textarea,p,blockquote,th,td { | |
margin:0; | |
padding:0; | |
} | |
table { | |
border-collapse:collapse; | |
border-spacing:0; |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<link href="//netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/css/bootstrap-combined.min.css" rel="stylesheet"> | |
<script src="//netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/js/bootstrap.min.js"> | |
</script> | |
<title></title> | |
</head> | |
<body> |
OlderNewer