|
Menu |
|
|
Home |
| |
|
Discussions |
| |
|
Tools |
| |
|
Affiliates |
| |
|
Content |
| |
|
Info |
| | |
|
|
|
|
|
User Info |
|
Membership:
Latest: MichaelSnaRe
New Today: 0
New Yesterday: 0
Overall: 9144
People Online:
Visitors: 69
Members: 0
Total: 69
|
|
|
|
|
|
Full disclosure |
|
|
|
|
|
|
|
|
|
IT Security and Insecurity Portal |
|
|
Need help to update php code to work on PHP 5.3.x |
|
Posted: Sun Nov 11, 2012 2:33 am |
|
|
Rockman |
Beginner |
|
|
Joined: Oct 24, 2012 |
Posts: 3 |
|
|
|
|
|
|
|
I have some files there where coded in PHP/Ioncube a while back and now there are being installed on a new server with PHP 5.3.x and some will not load or are giving a php warning errors!
Most of the error are for the session, cookies data vars to be pass and then allow the users to login
If you can help and can work using skype or a live join meeting with voice and sharing screen to show and tell & test live
PM me with your skype contact
I will then buzz you via skype
Here is one of the older php session type file that I will need to update to work with php 5.x.x
File #1 members/index.php
Code: |
<?
session_start ();
if ($form == 'sent')
{
unset ($HTTP_SESSION_VARS);
session_destroy ();
}
global $sess_name;
global $sess_passwd;
global $host;
global $dns;
global $useragent;
global $sess_id;
global $sess_data;
global $sess_bonus;
$_SESSION['sess_data'];
session_register ('sess_name');
session_register ('sess_passwd');
session_register ('host');
session_register ('dns');
session_register ('useragent');
session_register ('sess_id');
session_register ('sess_bonus');
include '../vars.php';
include '../headfoot.php';
mysql_connect ($db_host, $db_user, $db_pwd);
mysql_select_db ($db_name);
$cfg = mysql_query ('select field, value from adminprops where field IN (\'tnlogn\', \'alfre\', \'almin\', \'almax\', \'mlmin\', \'mlmax\', \'clmin\', \'clmax\', \'alauto\', \'alman\')');
if (0 < mysql_num_rows ($cfg))
{
while ($row = mysql_fetch_object ($cfg))
{
${$row->field} = $row->value;
}
}
@mysql_free_result ($cfg);
$date = date ('Y-m-d');
$oldstat = time () - 86400 * 8;
$delstat = date ('Y-m-d', $oldstat);
$res = mysql_query ('' . 'delete from `7stat` where `date` < \'' . $delstat . '\'');
$res = mysql_query ('' . 'delete from `7statsite` where `date` < \'' . $delstat . '\'');
$usedns = TRUE;
$myhost = getip ();
$myuseragent = getuseragent ();
$mydns = gethostname ($myhost);
$myuseragent = md5 (trim ('' . $myuseragent));
$myhost = md5 ('' . $myhost);
$mydns = md5 ('' . $mydns);
if (session_is_registered ('securitycheck'))
{
$res = mysql_query ('' . 'select sessionidz from user where email=\'' . $sess_name . '\'');
if (0 < mysql_num_rows ($res))
{
$getoldsessionid = mysql_result ($res, 0, 'sessionidz');
}
if ($getoldsessionid != $sess_id)
{
echo '' . '<head><title>' . $title . '</title></head><body bgcolor="#ffffff"><center><br><span style="font-size:150%">' . $title . '<br>Current Session has Expired!</span><script language="JavaScript1.1" type="text/javascript">top.location="' . $self_url . '";</script></center></body></html>';
unset ($HTTP_SESSION_VARS);
session_destroy ();
exit ();
}
else
{
if (((($host != $myhost AND !$usedns) OR $dns != $mydns) OR $useragent != $myuseragent))
{
session_regenerate_id ();
session_unregister ('securitycheck');
}
}
}
else
{
global $myhost;
global $mydns;
global $myuseragent;
global $sessid;
$host = $myhost;
$dns = $mydns;
$useragent = $myuseragent;
$sess_id = $sessid;
$currentdata = array ();
$currentdata['host'] = $myhost;
$currentdata['dns'] = $mydns;
$currentdata['useragent'] = $myuseragent;
$currentdata['sess_id'] = $sessid;
session_register ('securitycheck', $currentdata);
}
$sessid = session_id ();
$noaccess = 'You are not authorized to view this page!';
if ((!isset ($HTTP_SESSION_VARS['sess_name']) OR !ereg ($self_name, $HTTP_REFERER)))
{
if ($tnlogn == 1)
{
$gentn = $sess_data['gentn'];
if (($_POST['tninput'] == $gentn AND isset ($_POST['tninput'])))
{
}
else
{
echo '' . '<html><title>' . $title . '</title><meta http-equiv="Refresh" content="2;URL=' . $self_url . 'login.php"><body bgcolor="#ffffff"><center><br><span style="font-size:150%">Turing number doesn\'t match, please try again!</span></center></body></html>';
unset ($HTTP_SESSION_VARS);
session_destroy ();
exit ();
}
}
$country = getcountryid (getip ());
if ($country != '')
{
$countrychk = mysql_result (mysql_query ('' . 'select ip_block from blocked_countries where ip_2chr=\'' . $country . '\''), 0);
if ($countrychk == 1)
{
echo '' . '<html><title>' . $title . '</title><meta http-equiv="Refresh" content="2;URL=' . $self_url . '"><body bgcolor="#ffffff"><center><br><span style="font-size:150%">Sorry, but your Country (' . $country . ') has been blocked!</span></center></body></html>';
unset ($HTTP_SESSION_VARS);
session_destroy ();
exit ();
}
}
if (($form == 'sent' AND ereg ($self_name, $HTTP_REFERER)))
{
if (((($email == '' OR $passwd == '') OR ereg ('%', $email)) OR ereg ('%', $passwd)))
{
echo '' . '<head><title>' . $title . '</title><meta http-equiv="Refresh" content="1;URL=' . $self_url . ('' . 'login.php"></head><body bgcolor="#ffffff"><center><br><span style="font-size:150%">' . $title . '<br><br>Error 6: ' . $noaccess . '</span></center></body></html>');
unset ($HTTP_SESSION_VARS);
session_destroy ();
exit ();
}
global $email;
global $passwd;
global $sessid;
$sess_name = $email;
$sess_passwd = $passwd;
$sess_id = $sessid;
$resupdatesession = mysql_query ('' . 'update user set sessionidz=\'' . $sessid . '\' where email=\'' . $sess_name . '\'');
if ($_POST['page'] == 'auto')
{
header ('Location: ../auto4credits.php?' . SID);
}
else
{
if ($_POST['page'] == 'manual')
{
header ('Location: ../manual4credits.php?' . SID);
}
else
{
header ('' . 'Location: ' . $PHP_SELF . '?' . SID);
}
}
exit ();
}
echo '' . '<head><title>' . $title . '</title><meta http-equiv="Refresh" content="1;URL=' . $self_url . '"></head><body bgcolor="#ffffff"><center><br><span style="font-size:150%">' . $title . '<br><br>Error 7: ' . $noaccess . '</span></center></body></html>';
unset ($HTTP_SESSION_VARS);
session_destroy ();
exit ();
}
else
{
$res = mysql_query ('' . 'select id, ref, passwd, ac, suspended from user where email=\'' . $sess_name . '\'');
if (mysql_num_rows ($res) != 0)
{
$row = mysql_fetch_object ($res);
$saved_usrid = $row->id;
$saved_ref = $row->ref;
$saved_passwd = $row->passwd;
$saved_ac = $row->ac;
$saved_suspended = $row->suspended;
mysql_free_result ($res);
if ($saved_suspended != 0)
{
secheader ();
echo '' . '<head><title>' . $title . '</title></head><body bgcolor="#ffffff"><center><br><span style="font-size:150%">Your Account was <font color="red">Suspended</font><br><br>You will need to contact Admin regarding this issue.</span></center></body></html>';
secfooter ();
unset ($HTTP_SESSION_VARS);
session_destroy ();
exit ();
}
if (($saved_passwd != $sess_passwd OR $saved_ac != 0))
{
echo '' . '<head><title>' . $title . '</title><meta http-equiv="Refresh" content="1;URL=' . $self_url . '"></head><body bgcolor="#ffffff"><center><br><span style="font-size:150%">' . $title . '<br><br>Error 8: ' . $noaccess . '</span></center></body></html>';
unset ($HTTP_SESSION_VARS);
session_destroy ();
exit ();
}
if ($sess_data['usrid'] != $saved_usrid)
{
$sess_data['usrid'] = $saved_usrid;
}
if ($sess_data['ref'] != $saved_ref)
{
$sess_data['ref'] = $saved_ref;
}
}
else
{
echo '' . '<head><title>' . $title . '</title><meta http-equiv="Refresh" content="1;URL=' . $self_url . '"></head><body bgcolor="#ffffff"><center><br><span style="font-size:150%">' . $title . '<br><br>Error 9: ' . $noaccess . '</span></center></body></html>';
unset ($HTTP_SESSION_VARS);
session_destroy ();
exit ();
}
}
secheader ();
include 'main.php';
bannerads ();
echo '<p class=\'ptitle\'>Member News Area<br><a href="javascript:OpenWin(\'../pop_help/mainarea_help.html\', \'help\', 380, 400);"><img src=\'../img/q.gif\' width=\'16\' height=\'16\' border=\'0\'></a></p>';
$lastsess_date = mysql_result (mysql_query ('' . 'select lastaccess_date from user where email=\'' . $sess_name . '\''), 0);
$acctype = mysql_result (mysql_query ('' . 'select acctype from user where email=\'' . $sess_name . '\''), 0);
if ((($alfre == '1' OR '1' < $acctype) AND $lastsess_date < $date))
{
$resins = mysql_query ('' . 'update user set lastaccess_date=\'' . $date . '\' where email=\'' . $sess_name . '\'');
$albonus = rand ($almin, $almax);
$mlbonus = rand ($mlmin, $mlmax);
$clmin = $clmin * 10000;
$clmax = $clmax * 10000;
$clbonus = rand ($clmin, $clmax);
$clbonus = floor ($clbonus);
$clbonus = $clbonus / 10000;
if (((0 < $albonus OR 0 < $mlbonus) OR 0 < $clbonus))
{
$resins = mysql_query ('' . 'update user set credits=credits+' . $albonus . ', mcredits=mcredits+' . $mlbonus . ', ecash=ecash+' . $clbonus . ' where email=\'' . $sess_name . '\'');
$surplus = $albonus + $mlbonus;
$surpres = mysql_query ('' . 'update adminprops set value=value-' . $surplus . ' where field=\'surplu\'');
echo '<br><b>You have Earned a Random Daily Login Bonus!</b><br>';
if (($alauto == 1 AND 0 < $albonus))
{
echo '' . '<font color=\'red\'><b>' . $albonus . '</b></font> Auto Credits';
}
if ((($alman == 1 AND $alauto == 1) AND 0 < $albonus))
{
echo ', ';
}
if ($alman == 1)
{
echo '' . '<font color=\'red\'><b>' . $mlbonus . '</b></font> Manual Credits';
}
if (((0 < $albonus OR 0 < $mlbonus) AND 0 < $clbonus))
{
echo ', ';
}
if ($clbonus != 0)
{
echo '' . '<font color=\'red\'><b>' . $clbonus . '</b></font> Earned Cash';
}
echo '<br>';
}
}
$res = mysql_query ('select content from html where type=\'news2\'');
$content = mysql_result ($res, 0, 'content');
echo '' . $content;
tads ();
secfooter ();
mysql_close;
?>
|
File #2 Headfoot.php
Code: |
<?
function uheader ()
{
global $ref;
$res = mysql_query ('select content from html where type=\'head1\'');
$hf = mysql_result ($res, 0, 'content');
$hf = str_replace ('?ref=', (empty ($ref) ? '' : '' . '?ref=' . $ref), $hf);
echo $hf;
}
function ufooter ()
{
global $ref;
global $ver;
$res = mysql_query ('select content from html where type=\'foot1\'');
$hf = mysql_result ($res, 0, 'content');
$hf = str_replace ('?ref=', (empty ($ref) ? '' : '' . '?ref=' . $ref), $hf);
$hf = str_replace ('[poweredby]', '' . '<center><font size=\'1\' face=\'verdana, arial\'>Powered by <a href=\'http://www.trafficdx.com\' target=\'_blank\'><font size=\'1\' face=\'verdana, arial\'>TrafficDX ' . $ver . '</font></a></font></center>', $hf);
echo $hf;
}
function secheader ()
{
global $ref;
$res = mysql_query ('select content from html where type=\'head2\'');
$hf = mysql_result ($res, 0, 'content');
$hf = str_replace ('?ref=', (empty ($ref) ? '' : '' . '?ref=' . $ref), $hf);
echo $hf;
}
function secfooter ()
{
global $ref;
global $ver;
$res = mysql_query ('select content from html where type=\'foot2\'');
$hf = mysql_result ($res, 0, 'content');
$hf = str_replace ('?ref=', (empty ($ref) ? '' : '' . '?ref=' . $ref), $hf);
$hf = str_replace ('[poweredby]', '' . '<center><font size=\'1\' face=\'verdana, arial\'>Powered By: <a href=\'http://www.trafficdx.com\' target=\'_blank\'><font size=\'1\' face=\'verdana, arial\'>TrafficDX ' . $ver . '</font></a></font><font size=\'1\' face=\'verdana, arial\'>Host By: <a href=\'http://www.buy4less-hosting.com\' target=\'_blank\'><font size=\'1\' face=\'verdana, arial\'>Buy4Less Hosting Co.</font></a></font></center>', $hf);
echo $hf;
}
function fads ()
{
global $self_url;
error_reporting (0);
$ads = mysql_query ('select * from adstext where state=\'Active\' and sponsor=\'1\' order by rand() limit 1');
if (0 < mysql_num_rows ($ads))
{
$row = mysql_fetch_object ($ads);
$adid = $row->id;
$adtitle = $row->title;
$adtext = $row->text;
$adamount = $row->amount;
$adtype = $row->type;
$adstart = $row->start;
$adshown = $row->timp;
$adclick = $row->tclick;
mysql_free_result ($ads);
echo '<center><a href=' . $self_url . ('' . 'adclick.php?tid=' . $adid . ' target=\'_blank\'><b><u>' . $adtitle . '</u></b><p align=\'left\'>' . $adtext . '</p></a></center>');
$res2 = mysql_query ('' . 'update adstext set timp=timp+1 where id=\'' . $adid . '\'');
if ($adamount == '-1')
{
return null;
}
switch ($adtype)
{
case 'c':
{
if ($adamount <= $adclick)
{
$res2 = mysql_query ('' . 'update adstext set state=\'Expire\' where id=\'' . $adid . '\'');
}
break;
}
case 'd':
{
$adend = strtotime ('' . '-' . $adamount . ' DAY');
$adend = date ('Y-m-d', $adend);
if ($adstart < $adend)
{
$res2 = mysql_query ('' . 'update adstext set state=\'Expire\' where id=\'' . $adid . '\'');
}
break;
}
default:
{
if ($adamount <= $adshown)
{
$res2 = mysql_query ('' . 'update adstext set state=\'Expire\' where id=\'' . $adid . '\'');
}
break;
}
}
return null;
}
echo '<center><a href=' . $self_url . 'contact.php><b><u>Why not become a Sponsor!</u></b><p align=\'left\'>Your text, html, or image ad could be posted right here to be viewed by all of our friends and visitors!</p>Click Here And Ask Us How</a></center>';
}
function mads ()
{
global $self_url;
error_reporting (0);
$ads = mysql_query ('select * from adstext where state=\'Active\' and sponsor=\'2\' order by rand() limit 1');
if (0 < mysql_num_rows ($ads))
{
$row = mysql_fetch_object ($ads);
$adid = $row->id;
$adtitle = $row->title;
$adtext = $row->text;
$adamount = $row->amount;
$adtype = $row->type;
$adstart = $row->start;
$adshown = $row->timp;
$adclick = $row->tclick;
mysql_free_result ($ads);
echo '<center><a href=' . $self_url . ('' . 'adclick.php?tid=' . $adid . ' target=\'_blank\'><span>' . $adtitle . '</span></a></center>');
$res2 = mysql_query ('' . 'update adstext set timp=timp+1 where id=\'' . $adid . '\'');
if ($adamount == '-1')
{
return null;
}
switch ($adtype)
{
case 'c':
{
if ($adamount <= $adclick)
{
$res2 = mysql_query ('' . 'update adstext set state=\'Expire\' where id=\'' . $adid . '\'');
}
break;
}
case 'd':
{
$adend = strtotime ('' . '-' . $adamount . ' DAY');
$adend = date ('Y-m-d', $adend);
if ($adstart < $adend)
{
$res2 = mysql_query ('' . 'update adstext set state=\'Expire\' where id=\'' . $adid . '\'');
}
break;
}
default:
{
if ($adamount <= $adshown)
{
$res2 = mysql_query ('' . 'update adstext set state=\'Expire\' where id=\'' . $adid . '\'');
}
break;
}
}
return null;
}
echo '<center><a href=' . $self_url . 'members/addban.php target=\'_top\'>Why not become a Surf Bar Sponsor?<br>Click Here to purchase your Mini Text Ads!</a></center>';
}
function tads ()
{
global $self_url;
global $show;
error_reporting (0);
$alwtad = mysql_result (mysql_query ('select value from adminprops where field=\'alwtad\''), 0);
if ($alwtad == '1')
{
if ($show == 1)
{
$ad = '<table class=\'tables\' width=\'100%\' border=\'0\' align=\'center\' cellpadding=\'5\' cellspacing=\'1\'><tr><td width=\'100%\' class=\'toptd\' align=\'center\' colspan=\'4\'>Check Our Members Text Ads</td></tr><tr>';
}
else
{
echo '<table class=\'tables\' width=\'100%\' border=\'0\' align=\'center\' cellpadding=\'5\' cellspacing=\'1\'><tr><td width=\'100%\' class=\'toptd\' align=\'center\' colspan=\'4\'>Check Our Members Text Ads</td></tr><tr>';
}
$ads = mysql_query ('select * from adstext where state=\'Active\' and sponsor=\'0\' order by rand() limit 4');
$adcount = mysql_num_rows ($ads);
if (0 < mysql_num_rows ($ads))
{
while ($row = mysql_fetch_object ($ads))
{
$adid = $row->id;
$adtitle = $row->title;
$adtext = $row->text;
$adamount = $row->amount;
$adtype = $row->type;
$adstart = $row->start;
$adshown = $row->timp;
$adclick = $row->tclick;
if ($show == 1)
{
$ad .= '<td class=\'midtd\' width=\'25%\' valign=\'top\'><a href=' . $self_url . ('' . 'adclick.php?tid=' . $adid . ' target=\'_blank\'><b><u>' . $adtitle . '</u></b><br>' . $adtext . '<br></a></td>');
}
else
{
echo '<td class=\'midtd\' width=\'25%\' valign=\'top\'><a href=' . $self_url . ('' . 'adclick.php?tid=' . $adid . ' target=\'_blank\'><b><u>' . $adtitle . '</u></b><br>' . $adtext . '<br></a></td>');
}
$res2 = mysql_query ('' . 'update adstext set timp=timp+1 where id=\'' . $adid . '\'');
if ($adamount == '-1')
{
continue;
}
else
{
switch ($adtype)
{
case 'c':
{
if ($adamount <= $adclick)
{
$res2 = mysql_query ('' . 'update adstext set state=\'Expire\' where id=\'' . $adid . '\'');
}
break;
}
case 'd':
{
$adend = strtotime ('' . '-' . $adamount . ' DAY');
$adend = date ('Y-m-d', $adend);
if ($adstart < $adend)
{
$res2 = mysql_query ('' . 'update adstext set state=\'Expire\' where id=\'' . $adid . '\'');
}
break;
}
default:
{
if ($adamount <= $adshown)
{
$res2 = mysql_query ('' . 'update adstext set state=\'Expire\' where id=\'' . $adid . '\'');
}
break;
}
}
continue;
}
}
mysql_free_result ($ads);
}
$i = $adcount;
while ($i < 4)
{
if ($show == 1)
{
$ad .= '<td class=\'midtd\' width=\'25%\' valign=\'top\'><a href=' . $self_url . 'signup.php><b><u>Text Ad Space Is Available!</u></b><br>Members can place their very own Text Ads here in rotation for everyone to see! Check the Member Area for more details.<br></a></td>';
}
else
{
echo '<td class=\'midtd\' width=\'25%\' valign=\'top\'><a href=' . $self_url . 'signup.php><b><u>Text Ad Space Is Available!</u></b><br>Members can place their very own Text Ads here in rotation for everyone to see! Check the Member Area for more details.<br></a></td>';
}
++$i;
}
if ($show == 1)
{
$ad .= '</tr></table>';
return $ad;
}
echo '</tr></table>';
}
}
function bannerads ()
{
global $self_url;
global $show;
error_reporting (0);
$alwbad = mysql_result (mysql_query ('select value from adminprops where field=\'alwbad\''), 0);
if ($alwbad == '1')
{
$ads = mysql_query ('select * from adsbanner where state=\'Active\' order by rand() limit 1');
if (0 < mysql_num_rows ($ads))
{
$row = mysql_fetch_object ($ads);
$adid = $row->id;
$adimg = $row->img;
$adalt = $row->alt;
$adsize = $row->size;
$adamount = $row->amount;
$adtype = $row->type;
$adstart = $row->start;
$adshown = $row->timp;
$adclick = $row->tclick;
mysql_free_result ($ads);
if ($show == 1)
{
return $ad = '<center><br><a href=' . $self_url . ('' . 'adclick.php?bid=' . $adid . ' target=\'_blank\'><img src=\'' . $adimg . '\' ' . $adsize . ' alt=\'' . $adalt . '\' border=\'1\'></a><br></center>');
}
echo '<center><br><a href=' . $self_url . ('' . 'adclick.php?bid=' . $adid . ' target=\'_blank\'><img src=\'' . $adimg . '\' ' . $adsize . ' alt=\'' . $adalt . '\' border=\'1\'></a><br></center>');
$res2 = mysql_query ('' . 'update adsbanner set timp=timp+1 where id=\'' . $adid . '\'');
if ($adamount == '-1')
{
return null;
}
switch ($adtype)
{
case 'c':
{
if ($adamount <= $adclick)
{
$res2 = mysql_query ('' . 'update adsbanner set state=\'Expire\' where id=\'' . $adid . '\'');
}
break;
}
case 'd':
{
$adend = strtotime ('' . '-' . $adamount . ' DAY');
$adend = date ('Y-m-d', $adend);
if ($adstart < $adend)
{
$res2 = mysql_query ('' . 'update adsbanner set state=\'Expire\' where id=\'' . $adid . '\'');
}
break;
}
default:
{
if ($adamount <= $adshown)
{
$res2 = mysql_query ('' . 'update adsbanner set state=\'Expire\' where id=\'' . $adid . '\'');
}
break;
}
}
}
}
}
function bannerads2 ()
{
global $self_url;
error_reporting (0);
$alwbad = mysql_result (mysql_query ('select value from adminprops where field=\'alwbar\''), 0);
if ($alwbad == '1')
{
$ads = mysql_query ('select * from adsbanner where state=\'Active\' order by rand() limit 1');
if (0 < mysql_num_rows ($ads))
{
$row = mysql_fetch_object ($ads);
$adid = $row->id;
$adimg = $row->img;
$adalt = $row->alt;
$adsize = $row->size;
$adamount = $row->amount;
$adtype = $row->type;
$adstart = $row->start;
$adshown = $row->timp;
$adclick = $row->tclick;
mysql_free_result ($ads);
echo '<center><a href=' . $self_url . ('' . 'adclick.php?bid=' . $adid . ' target=\'_blank\'><img src=\'' . $adimg . '\' ' . $adsize . ' alt=\'' . $adalt . '\' border=\'1\'></a></center>');
$res2 = mysql_query ('' . 'update adsbanner set timp=timp+1 where id=\'' . $adid . '\'');
if ($adamount == '-1')
{
return null;
}
switch ($adtype)
{
case 'c':
{
if ($adamount <= $adclick)
{
$res2 = mysql_query ('' . 'update adsbanner set state=\'Expire\' where id=\'' . $adid . '\'');
}
break;
}
case 'd':
{
$adend = strtotime ('' . '-' . $adamount . ' DAY');
$adend = date ('Y-m-d', $adend);
if ($adstart < $adend)
{
$res2 = mysql_query ('' . 'update adsbanner set state=\'Expire\' where id=\'' . $adid . '\'');
}
break;
}
default:
{
if ($adamount <= $adshown)
{
$res2 = mysql_query ('' . 'update adsbanner set state=\'Expire\' where id=\'' . $adid . '\'');
}
break;
}
}
}
}
}
function setupline ($mode)
{
error_reporting (0);
global $ref;
global $refid;
$chkalauto = mysql_result (mysql_query ('select value from adminprops where field=\'alauto\''), 0);
$chkalman = mysql_result (mysql_query ('select value from adminprops where field=\'alman\''), 0);
$inactset = mysql_result (mysql_query ('select value from adminprops where field=\'inact\''), 0);
$inactset = time () - 86400 * $inactset;
$inline = date ('Y-m-d', $inactset);
$memref = $ref;
$memreset = 1;
$i = 1;
while ($i < 11)
{
if (0 < $memref)
{
$memres = mysql_query ('' . 'select acctype, ref from user where id=\'' . $memref . '\' and ac=\'0\' and suspended=\'0\' and lastaccess_date>' . $inline);
if (0 < mysql_num_rows ($memres))
{
$memlev = mysql_result ($memres, 0, 'acctype');
$membonus = mysql_result (mysql_query ('' . 'select sgnupl' . $i . ' from acctype where id=\'' . $memlev . '\''), 0);
$membonusa = $membonus / 2;
$membonusm = $membonus / 2;
if (($chkalauto == 1 AND $chkalman == 0))
{
$membonusa = $membonus;
$membonusm = 0;
}
else
{
if (($chkalauto == 0 AND $chkalman == 1))
{
$membonusa = 0;
$membonusm = $membonus;
}
}
$res = mysql_query ('' . 'update user set credits=credits+' . $membonusa . ', mcredits=mcredits+' . $membonusm . ', refbonus=refbonus+' . $membonus . ', reset=reset+' . $memreset . ' where id=\'' . $memref . '\'');
$res = mysql_query ('' . 'insert into ref_levels (uid, reflev, refid, refac, refmc, refcash, refbonus) VALUES (\'' . $memref . '\',\'' . $i . '\',\'' . $refid . '\',\'0\',\'0\',\'0\',\'' . $membonus . '\')');
$res = mysql_query ('' . 'update adminprops set value=value-' . $membonus . ' where field=\'surplu\'');
$memref = mysql_result ($memres, 0, 'ref');
$memreset = 0;
}
else
{
break;
}
}
++$i;
}
}
function getupline ($mode)
{
error_reporting (0);
global $ref;
global $refid;
global $cost;
$chkalauto = mysql_result (mysql_query ('select value from adminprops where field=\'alauto\''), 0);
$chkalman = mysql_result (mysql_query ('select value from adminprops where field=\'alman\''), 0);
$inactset = mysql_result (mysql_query ('select value from adminprops where field=\'inact\''), 0);
$inactset = time () - 86400 * $inactset;
$inline = date ('Y-m-d', $inactset);
$res = mysql_query ('' . 'select * from ref_levels where refid=\'' . $refid . '\' order by reflev limit 10');
if (0 < mysql_num_rows ($res))
{
while ($row = mysql_fetch_object ($res))
{
$uid = $row->uid;
$reflev = $row->reflev;
$memres = mysql_query ('' . 'select acctype from user where id=\'' . $uid . '\' and ac=\'0\' and suspended=\'0\' and lastaccess_date>\'' . $inline . '\'');
if (0 < mysql_num_rows ($memres))
{
$memlev = mysql_result ($memres, 0, 'acctype');
$memcred = mysql_result (mysql_query ('' . 'select crl' . $reflev . ' from acctype where id=\'' . $memlev . '\''), 0);
$memcash = mysql_result (mysql_query ('' . 'select cshl' . $reflev . ' from acctype where id=\'' . $memlev . '\''), 0);
$memtype = mysql_result (mysql_query ('' . 'select ps_const from acctype where id=\'' . $memlev . '\''), 0);
if ($mode == 'auto')
{
$res = mysql_query ('' . 'update user set credits=credits+' . $memcred . ', refac=refac+' . $memcred . ' where id=\'' . $uid . '\'');
$res = mysql_query ('' . 'update ref_levels set refac=refac+' . $memcred . ' where uid=\'' . $uid . '\' and refid=\'' . $refid . '\'');
$res = mysql_query ('' . 'update adminprops set value=value-' . $memcred . ' where field=\'surplu\'');
continue;
}
else
{
if ($mode == 'man')
{
$res = mysql_query ('' . 'update user set mcredits=mcredits+' . $memcred . ', refmc=refmc+' . $memcred . ' where id=\'' . $uid . '\'');
$res = mysql_query ('' . 'update ref_levels set refmc=refmc+' . $memcred . ' where uid=\'' . $uid . '\' and refid=\'' . $refid . '\'');
$res = mysql_query ('' . 'update adminprops set value=value-' . $memcred . ' where field=\'surplu\'');
continue;
}
else
{
if ($mode == 'cash')
{
if ($memtype == 'percentage')
{
$refcash = $cost * $memcash / 100;
}
else
{
$refcash = $memcash;
}
$res = mysql_query ('' . 'update user set ecash=ecash+' . $refcash . ', refcash=refcash+' . $refcash . ' where id=\'' . $uid . '\'');
$res = mysql_query ('' . 'update ref_levels set refcash=refcash+' . $refcash . ' where uid=\'' . $uid . '\' and refid=\'' . $refid . '\'');
continue;
}
continue;
}
continue;
}
continue;
}
}
mysql_free_result ($res);
}
}
function getcountryid ($ip)
{
/*
$iplong = ip2long ($ip);
$query = 'ip=' . $iplong;
list ($cont, $err) = post ('trafficdx.com', '/Script_keyDX/checkip.php', $query);
if ($err)
{
echo '' . 'Failed connecting to ip lookup server (fsockopen() failed: ' . $cont . ')';
return null;
}
return $cont;
*/
return null;
}
function post ($host, $path, $query, $headers = '')
{
$cookie_headers = '';
$header = '';
$header .= '' . 'POST ' . $path . ' HTTP/1.0
';
$header .= 'Content-Type: application/x-www-form-urlencoded
';
$header .= (('' . 'Host: ' . $host . '
') . '
');
$header .= (('' . 'Referer: http://' . $host . $path . '
') . '
');
$header .= $headers;
$header .= 'Content-Length: ' . strlen ($query) . '
';
$header .= 'Connection: Close
';
$cont = '';
$fp = '';
$fp = fsockopen ($host, 80, $errno, $errstr, 30);
if (!$fp)
{
$err = 1;
$cont = $errstr;
}
else
{
fputs ($fp, $header . $query);
while (!feof ($fp))
{
$cont .= fgets ($fp, 1024);
}
fclose ($fp);
if (substr ($cont, 0, 4) != '200 ')
{
$err = floor (substr ($cont, 0, 3));
}
else
{
$err = 0;
}
$cookie_headers = '';
list ($hdr, $cont) = explode ('
', $cont, 2);
if (preg_match_all ('!Set-Cookie:\\s*([^= ]+)=([^; ]+);!i', $hdr, $matches, PREG_SET_ORDER))
{
foreach ($matches as $match)
{
$cookie_headers .= ($cookie_headers == '' ? 'Cookie:' : ';') . ('' . ' ' . $match[1] . '=' . $match[2]);
}
}
if ($cookie_headers != '')
{
$cookie_headers .= '
';
}
$cont = trim ($cont);
}
return array ($cont, $err, $cookie_headers);
}
function getip ()
{
if ((getenv ('HTTP_CLIENT_IP') AND strcasecmp (getenv ('HTTP_CLIENT_IP'), 'unknown')))
{
$ip = getenv ('HTTP_CLIENT_IP');
}
else
{
if ((getenv ('HTTP_X_FORWARDED_FOR') AND strcasecmp (getenv ('HTTP_X_FORWARDED_FOR'), 'unknown')))
{
$ip = getenv ('HTTP_X_FORWARDED_FOR');
}
else
{
if ((getenv ('REMOTE_ADDR') AND strcasecmp (getenv ('REMOTE_ADDR'), 'unknown')))
{
$ip = getenv ('REMOTE_ADDR');
}
else
{
if (((isset ($_SERVER['REMOTE_ADDR']) AND $_SERVER['REMOTE_ADDR']) AND strcasecmp ($_SERVER['REMOTE_ADDR'], 'unknown')))
{
$ip = $_SERVER['REMOTE_ADDR'];
}
else
{
$ip = 'unknown';
}
}
}
}
return $ip;
}
function getuseragent ()
{
if ((getenv ('HTTP_USER_AGENT') AND strcasecmp (getenv ('HTTP_USER_AGENT'), 'unknown')))
{
$agnt = getenv ('HTTP_USER_AGENT');
}
else
{
if ((getenv ('HTTP_USER_AGENT') AND strcasecmp (getenv ('HTTP_USER_AGENT'), 'unknown')))
{
$agnt = getenv ('HTTP_USER_AGENT');
}
else
{
if ((getenv ('HTTP_USER_AGENT') AND strcasecmp (getenv ('HTTP_USER_AGENT'), 'unknown')))
{
$agnt = getenv ('HTTP_USER_AGENT');
}
else
{
if (((isset ($_SERVER['HTTP_USER_AGENT']) AND $_SERVER['HTTP_USER_AGENT']) AND strcasecmp ($_SERVER['HTTP_USER_AGENT'], 'unknown')))
{
$agnt = $_SERVER['HTTP_USER_AGENT'];
}
else
{
$agnt = 'unknown';
}
}
}
}
return $agnt;
}
function gethostname ($myhost)
{
$host = @gethostbyaddr ($myhost);
$real_host = chop ($host);
if ($real_host)
{
$host_arr = explode ('.', $real_host);
$count = count ($host_arr);
if (1 < $count)
{
if (intval ($host_arr[$count - 1]) != 0)
{
$host = substr ($real_host, 0, strrpos ($real_host, '.')) . '.*';
}
else
{
$host = '*' . strstr ($real_host, '.');
}
}
else
{
$host = $real_host;
}
}
else
{
$host = '';
}
return $host;
}
global $ver;
global $domain_path;
global $script_path;
global $lang_main;
global $lang_user;
global $show;
$show = '';
$ver = 'v8.28';
$domain_path = $_SERVER['DOCUMENT_ROOT'];
$script_path = $_SERVER['SCRIPT_FILENAME'];
$script_path = str_replace ('//', '/', $script_path);
$script_path = str_replace ($_SERVER['SCRIPT_NAME'], '', $script_path);
?>
|
Thanks! |
|
|
|
|
|
www.waraxe.us Forum Index -> Php
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
All times are GMT
Page 1 of 1
|
|
|
Powered by phpBB © 2001-2008 phpBB Group
|
|
|
|
|
|