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 | |
$conn = mysql_connect('yourserver','yourusername','yourpassword'); | |
echo "<html><head><META HTTP-EQUIV='Refresh' CONTENT='2; URL=".$_SERVER['PHP_SELF']."'><body>"; | |
echo "<table><th>ID</th><th>DATABASE</th><th>QUERY</th><th>EXECUTION TIME</th><th>STATE</th>"; | |
$res = mysql_query("show processlist"); | |
while($row = mysql_fetch_assoc($res)) | |
{ | |
if (stristr($row['State'],"Has sent all binlog to slave")) | |
{ | |
continue; |
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 | |
define('CLIENT_LONG_PASSWORD',1); /* new more secure passwords */ | |
define('CLIENT_FOUND_ROWS',2); /* Found instead of affected rows */ | |
define('CLIENT_LONG_FLAG',4); /* Get all column flags */ | |
define('CLIENT_CONNECT_WITH_DB',8); /* One can specify db on connect */ | |
define('CLIENT_NO_SCHEMA',16); /* Don't allow database.table.column */ | |
define('CLIENT_COMPRESS',32); /* Can use compression protocol */ | |
define('CLIENT_ODBC',64); /* Odbc client */ | |
define('CLIENT_LOCAL_FILES',128); /* Can use LOAD DATA LOCAL */ | |
define('CLIENT_IGNORE_SPACE',256); /* Ignore spaces before '(' */ |
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 | |
if (array_key_exists('user',$_REQUEST)) | |
{ | |
if (!is_dir($_REQUEST['repo'])) | |
{ | |
system("mkdir {$_REQUEST['repo']} && cd {$_REQUEST['repo']} && git init && git pull git://github.com/{$_REQUEST['user']}/{$_REQUEST['repo']}.git master"); | |
} | |
else | |
{ |
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 | |
$caseInsensitivePosts = array('your_desired_cleaned_lower_case_post_var'); | |
foreach($_GET as $k=>$v) | |
{ | |
$lower = strtolower($k); | |
foreach ($caseInsensitivePosts as $requestVal) | |
{ | |
if ($requestVal == $lower && $k !== $requestVal) | |
{ |
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
Edit cron tab to point to this file and run php script every one minute: | |
*/1 * * * * php /yourpath/phpFatals.php web01 | |
*/1 * * * * php /yourpath/phpFatals.php cron01 | |
*/1 * * * * php /yourpath/phpFatals.php etcetc | |
Edit the below variables: |
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
body { | |
font-family: helvetica; | |
} | |
li:nth-last-child(-n + 4) { | |
opacity: 0.6; | |
} | |
li:nth-last-child(-n + 3) { | |
opacity: 0.4; |
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 | |
//1. Create a file that contains your constants or paths of locations of files | |
//2. Update your database classes before they make a connection to look for this $contants['slave_on'] path. If file doesnt exist, only make a connection to your master server. Tweak the settings of the seconds_behind_master if 120 seconds is too much for your reporting of slave data. | |
//3. Create a monitoring script to ping this URL to see if the connection is "OK". Upon error it will unlink the file and recreate it once the slave's IO is back up | |
include('yourconstants.php'); | |
$conn = mysql_connect('server','username','password'); | |
$singleRow = mysql_query("SHOW SLAVE STATUS"); | |
$row = mysql_fetch_array($singleRow); |
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 | |
//It turns out, that it takes more memory and same amount of time to have all your includes in one file. I thought that all the file I/O would be less with one huge compiled include file. This class will combine all your includes into one file. | |
//it could be useful to try to see all your includes top down. But over all is not meant for production | |
//Ended up using spl_autoload_register which took all my production includes from 40MB to 10MB and increased speed by 1 to 3 seconds | |
/* | |
implementation |
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
;copy the top header columns. save as C:\import.csv and it will build the needed SQL to import | |
While 1 | |
$nMsg = GUIGetMsg() | |
Switch $nMsg | |
Case $cTooltipClick | |
$clipBoardContents = ClipGet() | |
$array1 = StringExplode($clipBoardContents, @TAB, 0) | |
$cols = "" | |
$tableDef = "DROP TABLE IF EXISTS `development`.`import_tmp`; " & @CRLF & @CRLF & "CREATE TABLE `development`.`import_tmp` (" |
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
function json_encode_non_buggy($array, $return=false) | |
{ | |
//fixes cases where json_decode will crap out. | |
foreach ($array as $k=>$v) | |
{ | |
$array[$k] = str_replace(array("\t",'"'),array(" ","""), utf8_encode($v)); | |
} | |
if($return) | |
{ |
OlderNewer