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 (!empty($_SERVER['HTTP_CLIENT_IP'])) | |
//check ip from share internet | |
{ | |
$ip=$_SERVER['HTTP_CLIENT_IP']; | |
} | |
elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) | |
//to check ip is pass from proxy | |
{ |
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
$.extend({ | |
countUnique : function(array) { | |
var result = []; | |
$.each(array, function(i,v) { | |
if($.inArray(v, result) == -1) { | |
result.push(v); | |
} | |
}); | |
return result.length; | |
} |
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 | |
//on pageload | |
session_start(); | |
$idletime=60;//after 60 seconds the user gets logged out | |
if (time()-$_SESSION['timestamp']>$idletime){ | |
session_destroy(); | |
session_unset(); | |
}else{ |
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
// Get distinct values from an array | |
$.extend({ | |
distinct : function(anArray) { | |
var result = []; | |
$.each(anArray, function(i,v){ | |
if ($.inArray(v, result) == -1) result.push(v); | |
}); | |
return result; | |
} |
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 array_has_dupes($array) { | |
return count($array) !== count(array_unique($array)); | |
} |
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
var fullList = []; | |
$(".list-wrapper").each(function() { | |
var tempStr = ""; | |
tempStr = '"' + $(this).find(".company-list-name a").text() + '"'; | |
tempStr += ',"' + $(this).find(".profile-update").text() + '"'; | |
tempStr += ',"' + $(this).find(".company-focus").text() + '"'; | |
fullList.push(tempStr); | |
}); | |
var output = fullList.join('\n'); | |
var uri = 'data:application/csv;charset=UTF-8,' + encodeURIComponent(output); |
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 | |
//define('UPLOADFILES', dirname(dirname(__FILE__)) . '/sixpoints'); | |
function recursiveDelete($path) { | |
// if (strpos($path, UPLOADFILES) === false) { | |
// exit('Trying to remove from wrong path to uploadfiles!'); | |
// } | |
if (is_file($path)) { | |
return unlink($path); | |
} elseif ( is_dir($path) ){ |
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 | |
function getExtension($str) { | |
$i = strrpos($str,"."); | |
if (!$i) { return ""; } | |
$l = strlen($str) - $i; | |
$ext = substr($str,$i+1,$l); | |
return $ext; | |
} |
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
<script type="text/javascript"> | |
$(document).ready(function() { | |
$('.dragger').mousedown(function (event) { | |
$(this) | |
.data('down', true) | |
.data('x', event.clientX) | |
.data('scrollLeft', this.scrollLeft) | |
.addClass("dragging"); | |
return false; |
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
UPDATE users SET password = floor(rand() * 9999999999) WHERE role=4 |