| Server IP : 10.200.247.200 / Your IP : 216.73.217.19 Web Server : Apache System : Linux synergy-usa-sites 6.8.0-138-generic #138-Ubuntu SMP PREEMPT_DYNAMIC Fri Jul 31 22:41:49 UTC 2026 x86_64 User : jeremy ( 1001) PHP Version : 8.4.25 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /var/www/usa_sites/newusafunding.com/inc/ |
Upload File : |
<?
// Prevent SQL Injection:
$_POST=array_map('makeSafe',$_POST);
$_GET=array_map('makeSafe',$_GET);
function db_connect() {
echo "host: " . dbhost . "<br />";
echo "user: ".dbuser."<br>";
echo "pass: ".dbpass."<br>";
echo "name: ".dbname."<br>";
// Connect to the database
if(!$link = mysqli_connect(dbhost, dbuser, dbpass)) {
$error = "Unable to connect to the database<br>" . mysqli_error($link);
echo "error = $error<br>";
return false;
}
// Select the database
if(!$db_sel = mysqli_select_db($link, dbname)) {
$error = "Unable to select the database<br>" . mysql_error($link);
echo $error;
return false;
}
return $link;
}
function getPage($url,$method,$post,$referer,$cookie_jar,$proxy){
$ch = curl_init();
//echo "url = $url<br>";
if($proxy){
//curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, 1);
curl_setopt($ch, CURLOPT_PROXY, $proxy);
//echo "proxy = $proxy";
curl_setopt($ch, CURLOPT_PROXYUSERPWD, "Trollio:31003");
}
//curl_setopt ($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_jar);
curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_jar);
curl_setopt($ch, CURLOPT_REFERER, $referer);
curl_setopt($ch, CURLOPT_URL, $url);
//curl_setopt($ch, CURLOPT_VERBOSE, 1);
if($method == "post"){
//echo "$post<br><br>";
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
}
curl_setopt($ch, CURLOPT_USERAGENT, $HTTP_USER_AGENT);
//curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
ob_start(); // prevent any output
$data = curl_exec ($ch); // execute the curl command
ob_end_clean(); // stop preventing output
//echo "post = $post<br>";
//echo $data;
curl_close ($ch);
return $data;
}
function makeInsertString( $id, $field, $table, $list, $needSafe = true, $insert = false )
{
$retVal = "";
if( $id == 0 || $id == "" || $insert == true)
{
$tempVal = "";
$retVal = "INSERT INTO {$table} (";
$first = true;
foreach( $list as $key=>$val )
{
if( $first )
{
$first = false;
} else
{
$retVal .= ", ";
$tempVal .= ", ";
}
$retVal .= $key;
if( $needSafe )
$tempVal .= safeString( $val );
else
$tempVal .= "'$val'";
}
$retVal .= ") VALUES ({$tempVal});";
}
else
{
$retVal = "UPDATE {$table} SET ";
$first = true;
foreach( $list as $key=>$val )
{
if( $first )
{
$first = false;
} else
{
$retVal .= ", ";
}
if( $needSafe )
$ss = safeString( $val );
else
$ss = "'$val'";
$retVal .= "{$key} = {$ss}";
}
$retVal .= " WHERE {$field} = {$id};";
}
return $retVal;
}
function safeString( $inVal )
{
if( !isset( $inVal ) || $inVal == null || strlen( $inVal ) == 0 )
{
return "null";
} else
{
return "'".makeSafe( $inVal )."'";
}
}
function makeSafe( $inVal )
{
return str_replace( "'", "\'", $inVal );
}
function makeSelectString($table, $list, $needSafe = true){
$first = true;
foreach( $list as $key=>$val )
{
if( !$first ) {
$values .= " AND ";
} else{
$first = false;
}
if( $needSafe )
$tempVal .= safeString( $val );
else
$tempVal .= "'$val'";
$values .= "(`$key` = '$tempVal')";
}
$select = "SELECT * FROM `$table` WHERE $values";
return $select;
}
function makeExistsString($table, $list, $needSafe = true){
$first = true;
foreach( $list as $key=>$val )
{
if( !$first ) {
$values .= " AND ";
} else{
$first = false;
}
if( $needSafe )
$tempVal .= safeString( $val );
else
$tempVal .= "'$val'";
$values .= "(`$key` = '$tempVal')";
}
$select = "SELECT COUNT(*) FROM `$table` WHERE $values";
return $select;
}
?>