This file contains hidden or 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
<div style="overflow:hidden; width:100%"> | |
<div style="float:left"> | |
... | |
</div> | |
</div> |
This file contains hidden or 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
// Parsing GET | |
// parse URL | |
var url_parts = url.parse(req.url); | |
// parse query | |
var raw = querystring.parse(url_parts.query); | |
// some juggling e.g. for data from jQuery ajax() calls. | |
var data = raw ? raw : {}; | |
data = raw.data ? JSON.parse(raw.data) : data; | |
This file contains hidden or 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 | |
if(basename(__FILE__) == basename($_SERVER['PHP_SELF'])) send_404(); | |
$dbHost = "localhost"; //Location Of Database usually its localhost | |
$dbUser = "xxxx"; //Database User Name | |
$dbPass = "xxxx"; //Database Password | |
$dbDatabase = "xxxx"; //Database Name | |
$db = mysql_connect("$dbHost", "$dbUser", "$dbPass") or die ("Error connecting to database."); | |
mysql_select_db("$dbDatabase", $db) or die ("Couldn't select the database."); | |
This file contains hidden or 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
$i = imagecreatefromjpeg("image.jpg"); | |
for ($x=0;$x<imagesx($i);$x++) { | |
for ($y=0;$y<imagesy($i);$y++) { | |
$rgb = imagecolorat($i,$x,$y); | |
$r = ($rgb >> 16) & 0xFF; | |
$g = ($rgb >> & 0xFF; | |
$b = $rgb & 0xFF; | |
$rTotal += $r; |
This file contains hidden or 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
/****************** | |
*@email - Email address to show gravatar for | |
*@size - size of gravatar | |
*@default - URL of default gravatar to use | |
*@rating - rating of Gravatar(G, PG, R, X) | |
*/ | |
function show_gravatar($email, $size, $default, $rating) | |
{ | |
echo '<img src="http://www.gravatar.com/avatar.php?gravatar_id='.md5($email). |
This file contains hidden or 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
function getRealIpAddr() | |
{ | |
if (!emptyempty($_SERVER['HTTP_CLIENT_IP'])) | |
{ | |
$ip=$_SERVER['HTTP_CLIENT_IP']; | |
} | |
elseif (!emptyempty($_SERVER['HTTP_X_FORWARDED_FOR'])) | |
//to check ip is pass from proxy | |
{ | |
$ip=$_SERVER['HTTP_X_FORWARDED_FOR']; |
This file contains hidden or 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
function encode_email($email='[email protected]', $linkText='Contact Us', $attrs ='class="emailencoder"' ) | |
{ | |
// remplazar aroba y puntos | |
$email = str_replace('@', '@', $email); | |
$email = str_replace('.', '.', $email); | |
$email = str_split($email, 5); | |
$linkText = str_replace('@', '@', $linkText); | |
$linkText = str_replace('.', '.', $linkText); | |
$linkText = str_split($linkText, 5); |
This file contains hidden or 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
function watermarkImage ($SourceFile, $WaterMarkText, $DestinationFile) { | |
list($width, $height) = getimagesize($SourceFile); | |
$image_p = imagecreatetruecolor($width, $height); | |
$image = imagecreatefromjpeg($SourceFile); | |
imagecopyresampled($image_p, $image, 0, 0, 0, 0, $width, $height, $width, $height); | |
$black = imagecolorallocate($image_p, 0, 0, 0); | |
$font = 'arial.ttf'; | |
$font_size = 10; | |
imagettftext($image_p, $font_size, 0, 10, 20, $black, $font, $WaterMarkText); | |
if ($DestinationFile<>'') { |
This file contains hidden or 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
// A few settings | |
$image = 'cricci.jpg'; | |
// Read image path, convert to base64 encoding | |
$imageData = base64_encode(file_get_contents($image)); | |
// Format the image SRC: data:{mime};base64,{data}; | |
$src = 'data: '.mime_content_type($image).';base64,'.$imageData; | |
// Echo out a sample image |
This file contains hidden or 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
<form action="" method="post"> | |
<label for="username">Create a Username: </label> | |
<input type="text" | |
name="username" | |
id="username" | |
placeholder="4 <> 10" | |
pattern="[A-Za-z]{4,10}" | |
autofocus | |
required> | |
<button type="submit">Go </button> |