- shell_exec: documentation ( source)
- usleep: documentation ( source)
<?php
# SET DATABASE VARIABLES
$ROOT="/var/www/picardo/";
$DB_USER ="masscom";
$DB_PASSWORD="p1x1e1";
$DB_TYPE="mysql";
$DB_HOST="127.0.0.1";
$DBASE="lipsvc";
# Modified by nathan@webr3.org
$port_open = shell_exec("netstat -tulpn | grep 3309"); // check if ssh tunnel is open
if(!$port_open) { // if not open
shell_exec("echo 'pixie1234' | sudo -S ssh -f -L 3309:127.0.0.1:3306 root@72.93.87.15 -p 8022 -N >> logfile"); // reopen ssh tunnel
usleep(500000); // apply half second grace period to allow connection to be established
}
$STYLESHEET=$ROOT."/styles/style.css";
//transaction variables may be set here
$apps= $_REQUEST[apps];
$acctid = $_REQUEST[acctid];
?>