<?php

if (file_exists('install.php')) {
print "<a href='install.php'>Click here to populate the database</a><br>";
print 'You must delete the install.php to continue script operation';
exit;
}
function querymember($userid) {
$sql=mysql_query("SELECT * FROM members WHERE userid = '$userid'");
$info = mysql_fetch_array($sql);
return $info;
}
function queryexitopt() {
$options = mysql_query ("select * from exited_options where id='1'");
$array = mysql_fetch_array($options);
return $array;
}
function commission_adjust ($userid) {
global $userrecord;
$commission=0;
$query = "select * from cashoutrequests where userid='$userid'";
$result = mysql_query ($query);
$numrows = @ mysql_num_rows($result);
if ($numrows <1) {
$commission=$userrecord['commission'];
return $commission;
}else {
while ($line = mysql_fetch_array($result)) {
$amountrequested = $line['amountrequested'];
$commission2=$userrecord['commission'];
$commission=$commission2-$amountrequested;
return $commission;
}
}
}
function amountrequested ($userid) {
$getamountrequested = mysql_query("Select amountrequested from cashoutrequests where userid='$userid' limit 1");
@$amountrequested = mysql_result($getamountrequested,0,'amountrequested');
return $amountrequested;
}
function add_clickstats (){
mysql_query('update totalclickstats set daily=daily+1, weekly=weekly+1, monthly=monthly+1, yearly=yearly+1, lifetime=lifetime+1');
}
function signupads ($memtype,$userid) {
$sql = mysql_query("SELECT * FROM signup_ads WHERE memtype='$memtype'");
$offer = mysql_fetch_array($sql);
mysql_query("INSERT INTO account_ledger VALUES ('id','".$userid."','$memtype Upgrade/Signup Bonus Ads','".time()."','')");
mysql_query("INSERT INTO transactions VALUES ('id','".$userid."','Signup: $memtype Upgrade/Signup Bonus Ads','".time()."','')");
if($offer['points']) mysql_query('UPDATE members SET points=points+'.$offer['points']." WHERE userid='".$userid."'");
if($offer['banner_num'] AND $offer['banner_views']) {
$count = $offer['banner_num'];
while($count >0) {
mysql_query("INSERT INTO `banners` (`userid`,`max` )VALUES ('".$userid."','".$offer['banner_views']."')");
$count--;
}
}if($offer['button_num'] AND $offer['button_views']) {
$count = $offer['button_num'];
while($count >0) {
mysql_query("INSERT INTO `buttons` (`userid`,`max`)VALUES ('".$userid."','".$offer['button_views']."')");
$count--;
}
}if($offer['text_num'] AND $offer['text_views']) {
$count = $offer['text_num'];
while($count >0) {
mysql_query("insert into texts (userid,paid) values('$userid','".$offer['text_views']."')");
$count--;
}
}if($offer['upgrade']=='1') {
if($memtype == 'PRO'OR $memtype == 'JV Member') {
upgrade (1,0,$userid);
}
}if($offer['upgrade']=='2') {
upgrade (2,0,$userid);
}
}
function sendoutmailcom ($contact_email,$name,$subject,$message) {
global $domain,$adminemail,$sitename,$adminname,$smtp_host,$smtp_username,$smtp_password,$smtp_port,$smtp_secure,$smtp_enabled;
set_time_limit(0);
ignore_user_abort(true);
if($smtp_enabled == 1 ||$smtp_enabled == 2 ||$smtp_enabled == 3 ||$smtp_enabled == 4) {
require_once dirname('index.php').'/PHPMailer/class.phpmailer.php';
$mail = new PHPMailer;
if($smtp_secure==1) {
$sslsecure='ssl';
}else $sslsecure='tls';
if($smtp_enabled == 1) {
$mail->IsSMTP();
}elseif($smtp_enabled == 2) {
$mail->IsMail();
}elseif($smtp_enabled == 3) {
$mail->IsSendmail();
}elseif($smtp_enabled == 4) {
$mail->IsQmail();
}
$mail->Host = $smtp_host;
$mail->Port = $smtp_port;
$mail->SMTPAuth = true;
$mail->Username = $smtp_username;
$mail->Password = $smtp_password;
$mail->SMTPSecure = $sslsecure;
$mail->From = $adminemail;
$mail->FromName = $sitename;
$mail->AddAddress($contact_email,$name);
$mail->AddReplyTo($adminemail,$adminname);
$mail->WordWrap = 50;
$mail->IsHTML(true);
$mail->Subject = $subject;
$mail->Body    = $message;
$mail->AltBody = $message;
$now = date('ymdHis').rand(1000,9999);
$mail->Priority = 3;
$mail->Sender=$adminemail;
if(!$mail->Send()) {
echo 'Message could not be sent.';
echo 'Mailer Error: '.$mail->ErrorInfo;
exit;
}
$mail->ClearAddresses();
$mail->ClearAttachments();
}elseif($smtp_enabled == 5) {
$now = date('ymdHis').rand(1000,9999);
$headers = "From: $sitename <$adminemail>
";
$headers .= "Return-Path: $sitename <$adminemail>
";
$headers .= "Reply-To: $adminemail
";
$headers .= "MIME-Version: 1.0
";
$headers .= "Content-type: text/html; charset=iso-8859-1
";
@mail($contact_email,$subject,$message,$headers,"-f $adminemail")
or print 'Failed to send email.';
}
}
function add_commission ($userid,$amount,$referid,$item) {
global $domain,$adminname,$adminemail,$sitename;
if($referid AND $amount!=0) {
$toadd = number_format($amount ,2);
mysql_query("UPDATE members SET commission=commission+'".$toadd."' WHERE userid='".$referid."'");
$sql = mysql_query("SELECT * FROM members WHERE userid='$referid'");
if(@mysql_num_rows($sql)) {
$user = mysql_fetch_array($sql);
mysql_query("INSERT INTO transactions VALUES ('id','$referid','Buyer Commissions for $item','".time()."','$$toadd')");
mysql_query("INSERT INTO account_ledger VALUES ('id', '$referid','Buyer Commissions for $item','".time()."','$$toadd')");
$sql = mysql_query("SELECT * FROM monthly_income WHERE time='".strtotime(date('Y-m-01'))."'");
if(@mysql_num_rows($sql)) mysql_query("UPDATE monthly_income SET commission=commission+'$toadd' WHERE time='".strtotime(date('Y-m-01'))."'");
else mysql_query("INSERT INTO monthly_income SET commission='$toadd', time='".strtotime(date('Y-m-01'))."'");
$sql = mysql_query("SELECT * FROM commission_stats WHERE userid='".$referid."'");
if(@mysql_num_rows($sql)) mysql_query("UPDATE commission_stats SET commission=commission+'$toadd' WHERE userid='".$referid."'");
else mysql_query("INSERT INTO commission_stats SET commission='$toadd', userid='".$referid."'");
sendoutmailcom ($user['contact_email'],$user['name'],'Purchase Commission at '.$sitename,'Congratulations '.$user['name']."! You just earned a Purchase Commission for a $item purchase from an active member!<br><br>"
."We awarded you with a \$".number_format($toadd,2).' commission.<br><br> '
."Keep referring active members and you'll keep getting purchase commissions every time they make a purchase!<br><br>"
.'To your success,<br><br>'
.$adminname.'<br><br>'
.$adminemail.'<br><br>'
.'You are receiving this as you are a member of '.$sitename.'<br>'
.'You can opt out of receiving emails only by deleting your account.  Click the link below to delete your account.<br><br>'
.$domain.'/delete.php?userid='.$info['userid'].'&code='.md5($info['pword']).'<br><br>'
.$sitename.'<br>'
.$domain.'/index.php');
}
}
}
function add_income ($amount) {
$toadd = number_format($amount ,2);
$sql = mysql_query("SELECT * FROM monthly_income WHERE time='".strtotime(date('Y-m-01'))."'");
if(@mysql_num_rows($sql)) mysql_query("UPDATE monthly_income SET income=income+$toadd WHERE time='".strtotime(date('Y-m-01'))."'");
else mysql_query("INSERT INTO monthly_income SET income=$toadd, time='".strtotime(date('Y-m-01'))."'");
}
function add_click_commission ($amount) {
$toadd = number_format($amount ,2);
$sql = mysql_query("SELECT * FROM monthly_income WHERE time='".strtotime(date('Y-m-01'))."'");
if(@mysql_num_rows($sql)) mysql_query("UPDATE monthly_income SET commission=commission+'$toadd' WHERE time='".strtotime(date('Y-m-01'))."'");
else mysql_query("INSERT INTO monthly_income SET commission='$toadd', time='".strtotime(date('Y-m-01'))."'");
}
function add_sale ($paid) {
$salestoadd = number_format($paid ,2);
mysql_query("update lifetimeadstats set sales=sales+$salestoadd");
}
function queryprosignupads () {
$query = mysql_query("SELECT * FROM signup_ads WHERE memtype='PRO'");
return $query;
}
function queryjvsignupads () {
$query = mysql_query("SELECT * FROM signup_ads WHERE memtype='JV Member'");
return $query;
}
function querysuperjvsignupads () {
$query = mysql_query("SELECT * FROM signup_ads WHERE memtype='SUPER JV'");
return $query;
}
function queryproads () {
$query = mysql_query("SELECT * FROM monthlyads WHERE memtype='PRO'");
return $query;
}
function queryjvads () {
$query = mysql_query("SELECT * FROM monthlyads WHERE memtype='JV Member'");
return $query;
}
function querysuperjvads () {
$query = mysql_query("SELECT * FROM monthlyads WHERE memtype='SUPER JV'");
return $query;
}
function paymentprice($bamemtype) {
if($bamemtype=='JV Member') {
$getprice='jvprice';
}elseif($bamemtype=='SUPER JV') {
$getprice='superjvprice';
}
$getsignupdata = mysql_query("Select name, setting from settings where name='".$getprice."' limit 1");
$paymentprice = mysql_result($getsignupdata,0,'setting');
print $paymentprice;
}
function paymentinterval($bamemtype) {
if($bamemtype=='JV Member') {
$getinterval='jvinterval';
}elseif($bamemtype=='SUPER JV') {
$getinterval='superjvinterval';
}
$getintervaldata = mysql_query("Select name, setting from settings where name='".$getinterval."' limit 1");
$interval = mysql_result($getintervaldata,0,'setting');
print $interval;
}
function changepayment_email($type,$name,$lastname,$email,$oldemail) {
global $domain,$sitename,$adminemail;
$message = 'Dear '.$name.' '.$lastname.',<br><br>'
.'Your '.$type.' email address at '.$sitename.' has just been changed to '.$oldemail.'.<br><br>'
.'If you performed this action please disregard this notice.<br>'
.'If you did not performed this action please contact us right away.<br><br>'
.$domain.'<br><br>'
.'Thank you...<br>'
.$sitename.' Admin<br><br>'
.''.$adminemail.'<br><br>';
sendoutmail ($email,$name,$sitename.' Payment Change Verification',wordwrap(stripslashes($message)));
}
function navquery() {
$navquery = "SELECT * FROM navigation where status='ON' AND `owner` = 0 ORDER BY seq";
$navresult = mysql_query ($navquery) or die ('Query failed 1');
return $navresult;
}
function childsql($navlink) {
$navquery2 = 'SELECT * FROM navigation WHERE `owner` = '.$navlink.' LIMIT 1';
$navresult2 = mysql_query ($navquery2);
return $navresult2;
}
function childsql2($navlink) {
$navquery3 = 'SELECT * FROM navigation WHERE `owner` = '.$navlink.' ORDER BY seq ASC';
$navresult3 = mysql_query ($navquery3);
return $navresult3;
}
function updatememberview($userid,$earn) {
mysql_query("UPDATE members SET points=points+$earn, bonus_viewed=1 WHERE userid='".$userid."'");
}
function spredirect($url) {
;echo '<script type="text/javascript">
setTimeout("document.forms.ATP.submit()",5000);
</script>
';
}
function addisplay($sponsoradcredittimer,$redirecturl) {
;echo '<center><b>Please take the next <span id="plzwait">';echo $sponsoradcredittimer ;echo ' seconds </span>&nbsp;to view our Sponsor Ad.</b>
<script type="text/javascript">
counter = ';echo $sponsoradcredittimer ;echo ';
function countdown() {
	if ((0 <= 100) || (0 > 0)) {
		counter--;
		if(counter > 0) {
			document.getElementById("plzwait").innerHTML = \'<b>\'+counter+\'<\/b> seconds\';
			setTimeout(\'countdown()\',1000);
		}
		if(counter < 1)
		{
		window.location="';echo $redirecturl ;echo '";
		}
	}
}
countdown();
</script>
';
}
function payment_ipn_log($type,$payment_status,$payment_amount,$payment_currency,$txn_id,$receiver_email,$payer_email,$userid,$item,$paymentnumber)
{
$payment_time=date('Y-m-d H:i:s');
mysql_query("INSERT INTO payment_ipn_log(type,payment_status,payment_amount,payment_currency,txn_id,receiver_email,payer_email,userid,payment_time, item, payment_num) 
    VALUES('".$type."','".$payment_status."',".$payment_amount.",'".$payment_currency."','".$txn_id."','".$receiver_email."','".$payer_email."','".$userid."','".$payment_time."', '".$item."', '".$paymentnumber."')");
}
function sponsoradtimer($timer) {
;echo '<script type="text/javascript">
counter = ';echo $timer ;echo ';
function countdown() {
	if ((0 <= 100) || (0 > 0)) {
		counter--;
		if(counter > 0) {
			document.getElementById("plzwait").innerHTML = \'<b>\'+counter+\'<\/b> seconds\';
			setTimeout(\'countdown()\',1000);
		}
	}
}
countdown();
</script>
';
}
function countdowntime($type,$credits,$credittimer) {
extract($GLOBALS);
$condition=condition($type);
;echo '<form name="xcoords" style="display: inline;" action="';echo 'earn.php?pageid=3&t='.$type.'&adid='.$adid.'&uid='.$userid.'&url='.urlencode($url);;echo '" method="post">
<input type="hidden" name="x">
</form>
<!--center><b>Please take the next <span id="plzwait">';echo $credittimer;;echo ' seconds </span>&nbsp;to view our members website and earn ';if($condition=='commissions') {echo "$";};echo '';echo $credits;;echo ' ';echo $condition;;echo '.</b-->



<span id="plzwait">Please take the next ';echo $credittimer;;echo ' seconds to view our members website and earn ';if($condition=='commissions') {echo "$";};echo '';echo $earn;;echo ' ';echo $condition;;echo '</span>
	<script type="text/javascript">
	counter = ';echo $adcredittimer;;echo ';
	function countdown() {
		if ((0 <= 100) || (0 > 0)) {
			counter--;
			if(counter > 0) {
				document.getElementById("plzwait").innerHTML = \'<center><b>Please take the next \'+counter+\' seconds to view our members website and earn ';if($condition=='commissions') {echo "$";};echo '';echo $earn;;echo ' ';echo $condition;;echo '</b></center>\';
				setTimeout(\'countdown()\',1000);
				
			} else if(counter==0) {
			document.getElementById("plzwait").innerHTML = \'<center><div id="coord" onclick="submitform(xcoord(event))" class="cd"></div></center>\';
                        
						
			}
		}
	}
	countdown();
	</script>
';
}
function adcount($adcount) {
return $adcount;
}
function adtype($type,$uid,$adid,$num) {
if($type==5) {
$text = "SELECT * FROM texts WHERE approved=1 AND paid>sent AND subject!='' AND userid!='$uid' AND num='$num' AND id='$adid' AND id not in(select id from texts_viewed WHERE userid='$uid')";
$textresult = mysql_query($text);
return $textresult;
}
if($type==7) {
$text = "SELECT * FROM banners WHERE status=1 AND max>shown AND userid!='$uid' AND num='$num' AND id='$adid' AND id not in(select id from banners_viewed WHERE userid='$uid')";
$textresult = mysql_query($text);
return $textresult;
}
if($type==8) {
$text = "SELECT * FROM buttons WHERE status=1 AND max>shown AND userid!='$uid' AND num='$num' AND id='$adid' AND id not in(select id from buttons_viewed WHERE userid='$uid')";
$textresult = mysql_query($text);
return $textresult;
}
if($type==20) {
$text = "SELECT * FROM listmailer WHERE id='$adid' AND num='$num' AND id not in(select id from listmailer_viewed WHERE userid='$uid')";
$textresult = mysql_query($text);
return $textresult;
}
if($type==21) {
$text = "SELECT * FROM adminemails WHERE id='$adid' AND num='$num' AND id not in(select id from adminemails_viewed WHERE userid='$uid')";
$textresult = mysql_query($text);
return $textresult;
}
if($type==22) {
$text = "SELECT * FROM membermail WHERE id='$adid' AND num='$num' AND id not in(select id from membermail_viewed WHERE userid='$uid')";
$textresult = mysql_query($text);
return $textresult;
}
}
function adtype2($type,$adid) {
if($type==5) {
$text = "SELECT * FROM texts WHERE approved=1 AND paid>sent AND subject!='' AND id='$adid'";
$textresult = mysql_query($text);
return $textresult;
}
if($type==7) {
$text = "SELECT * FROM banners WHERE status=1 AND max>shown AND id='$adid'";
$textresult = mysql_query($text);
return $textresult;
}
if($type==8) {
$text = "SELECT * FROM buttons WHERE status=1 AND max>shown AND id='$adid'";
$textresult = mysql_query($text);
return $textresult;
}
if($type==20) {
$text = "SELECT * FROM listmailer WHERE id='$adid'";
$textresult = mysql_query($text);
return $textresult;
}
if($type==21) {
$text = "SELECT * FROM adminemails WHERE id='$adid'";
$textresult = mysql_query($text);
return $textresult;
}
if($type==22) {
$text = "SELECT * FROM membermail WHERE id='$adid'";
$textresult = mysql_query($text);
return $textresult;
}
}
function uid($r) {
$uid=mysql_query ("select id, userid from members where id='".$r."'");
$uidresult=mysql_fetch_array($uid);
$user=$uidresult['userid'];
return $user;
}
function textquery($userid) {
$texts = "SELECT * FROM texts WHERE approved=1 AND userid!='".$userid."' AND paid>sent AND subject!='' AND id not in(select id from texts_viewed WHERE userid='$userid') ORDER BY RAND() LIMIT 10";
$textsresult = mysql_query ($texts) or die ('Query failed 2');
return $textsresult;
}
function textrows($userid) {
$textextract = mysql_query("SELECT count(*) FROM texts WHERE approved=1 AND paid>sent AND userid!='".$userid."' AND subject!='' AND id not in(select id from texts_viewed WHERE userid='$userid')");
$textnumrows = mysql_num_rows($textextract);
return $textnumrows;
}
function bannerquery($userid) {
$banners = "SELECT id, bannerurl, url, max, clicks, status, userid, num FROM banners WHERE max>clicks && status=1 AND userid!='".$userid."' AND id not in(select id from banners_viewed WHERE userid='$userid') order by rand() LIMIT 5";
$bannersresult = mysql_query ($banners) or die ('Query failed 3');
return $bannersresult;
}
function bannerrows($userid) {
$bannerextract = mysql_query("SELECT count(*) FROM banners WHERE max>shown AND userid!='".$userid."' AND status=1 AND id not in(select id from banners_viewed WHERE userid='$userid')");
$bannernumrows = mysql_num_rows($bannerextract);
return $bannernumrows;
}
function buttonquery($userid) {
$banners = "SELECT id, bannerurl, url, max, clicks, status, userid, num FROM buttons WHERE max>clicks && status=1 AND userid!='".$userid."' AND id not in(select id from buttons_viewed WHERE userid='$userid') order by rand() LIMIT 9";
$bannersresult = mysql_query ($banners) or die ('Query failed 4');
return $bannersresult;
}
function buttonrows($userid) {
$buttonextract = mysql_query("SELECT count(*) FROM buttons WHERE max>shown AND userid!='".$userid."' AND status=1 AND id not in(select id from buttons_viewed WHERE userid='$userid')");
$buttonnumrows = mysql_num_rows($buttonextract);
return $buttonnumrows;
}
function adminrows($userid) {
$adminextract = mysql_query("SELECT count(*) FROM adminemails WHERE id not in(select id from adminemails_viewed WHERE userid='$userid')");
$adminnumrows = mysql_num_rows($adminextract);
return $adminnumrows;
}
function adminsoloquery($userid,$memtype) {
$solos2 = "SELECT * FROM adminsolos WHERE (userid = '".$userid."' OR memtype = '$memtype' OR userid = '' AND memtype= '') AND id not in(select id from adminemails_viewed WHERE userid='".$userid."') ORDER BY datesent DESC LIMIT 5";
$soloresult2 = mysql_query ($solos2) or die ('Query failed 5');
return $soloresult2;
}
function mcreditquery($userid) {
$mcredit2 = "SELECT * FROM membermail_process WHERE userid='".$userid."' AND time>'".(time()-7*24*60*60)."' AND id NOT IN (select id from membermail_viewed WHERE userid='".$userid."') ORDER BY time DESC LIMIT 5";
$mcreditresult2 = mysql_query ($mcredit2) or die ('Query failed 6');
return $mcreditresult2;
}
function mcreditprocess($id) {
$mcreditprocess = "SELECT id, userid, subject, message, url, num FROM membermail WHERE id='".$id."' LIMIT 5";
$mcreditprocessresult2 = mysql_query ($mcreditprocess) or die ('Query failed 7');
return $mcreditprocessresult2;
}
function updatenosessiont($adid) {
mysql_query('update lifetimeadstats set textlink_clicks=textlink_clicks+1');
}
function updatenosessionb($table,$adid) {
if($table=='banners') {
$tabletype='banner_clicks';
}else {
$tabletype='button_clicks';
}
mysql_query("update lifetimeadstats set $tabletype=$tabletype+1");
mysql_query("Update $table set clicks=clicks+1,show_clicks=show_clicks+1 where id=$adid limit 1");
}
function updatenosessions($table,$id) {
mysql_query('update lifetimeadstats set solo_clicks=solo_clicks+1');
mysql_query("Update $table set clicks=clicks+1 where id=$id limit 1");
}
function updatebannerstats($adid) {
mysql_query("UPDATE banners SET shown=shown+1, show_views=show_views+1 WHERE id='".$adid."'");
mysql_query('update lifetimeadstats set delivered=delivered+1, banner_sent=banner_sent+1');
}
function updatebuttonstats($adid) {
mysql_query("UPDATE buttons SET shown=shown+1, show_views=show_views+1 WHERE id='".$adid."'");
mysql_query('update lifetimeadstats set delivered=delivered+1, button_sent=button_sent+1');
}
function updatetextadstats($adid) {
mysql_query("UPDATE texts SET shown=shown+1 WHERE id='".$adid."'");
mysql_query('update lifetimeadstats set delivered=delivered+1, textlink_sent=textlink_sent+1');
}
function updateptcadstats($adid) {
mysql_query("UPDATE texts SET shown=shown+1 WHERE id='".$adid."'");
mysql_query('update lifetimeadstats set delivered=delivered+1, ptc_sent=ptc_sent+1');
}
function updatestats($type,$earn,$adid,$userid) {
global $userrecord;
assignpoints($userrecord['referid'],$earn);
if($type==5) {
mysql_query("UPDATE members SET points=points+$earn WHERE userid='".$userid."'");
mysql_query("UPDATE texts SET sent=sent +1 where id='".$adid."' LIMIT 1");
mysql_query("INSERT INTO texts_viewed SET id='".$adid."', userid='".$userid."'");
mysql_query('update lifetimeadstats set textlink_clicks=textlink_clicks+1');
add_adclick('text');
add_clickstats ();
}
if($type==7) {
mysql_query("UPDATE members SET points=points+$earn WHERE userid='".$userid."'");
mysql_query("UPDATE banners SET clicks=clicks+1, show_clicks=show_clicks+1 where id='".$adid."' LIMIT 1");
mysql_query("INSERT INTO banners_viewed SET id='".$adid."', userid='".$userid."'");
mysql_query('update lifetimeadstats set banner_clicks=banner_clicks+1');
add_adclick('banner');
add_clickstats ();
}
if($type==8) {
mysql_query("UPDATE members SET points=points+$earn WHERE userid='".$userid."'");
mysql_query("UPDATE buttons SET clicks=clicks+1, show_clicks=show_clicks+1 where id='".$adid."' LIMIT 1");
mysql_query("INSERT INTO buttons_viewed SET id='".$adid."', userid='".$userid."'");
mysql_query('update lifetimeadstats set button_clicks=button_clicks+1');
add_adclick('button');
add_clickstats ();
}
if($type==20) {
mysql_query("UPDATE members SET points=points+$earn WHERE userid='".$userid."'");
mysql_query("UPDATE listmailer SET clicks=clicks+1 where id='".$adid."' LIMIT 1");
mysql_query("INSERT INTO listmailer_viewed SET id='".$adid."', userid='".$userid."'");
mysql_query('update lifetimeadstats set listmail_clicks=listmail_clicks+1');
add_clickstats ();
}
if($type==21) {
mysql_query("UPDATE members SET points=points+$earn WHERE userid='".$userid."'");
mysql_query("UPDATE adminemails SET clicks=clicks+1 where id='".$adid."' LIMIT 1");
mysql_query("INSERT INTO adminemails_viewed SET id='".$adid."', userid='".$userid."'");
mysql_query('update lifetimeadstats set admin_clicks=admin_clicks+1');
add_clickstats ();
}
if($type==22) {
mysql_query("UPDATE members SET points=points+$earn WHERE userid='".$userid."'");
mysql_query("UPDATE membermail SET clicks=clicks+1 where id='".$adid."' LIMIT 1");
mysql_query("INSERT INTO membermail_viewed SET id='".$adid."', userid='".$userid."'");
mysql_query('update lifetimeadstats set creditmail_clicks=creditmail_clicks+1');
add_clickstats ();
}
}
function condition($type) {
if($type==3 ||$type==4 ||$type==6) {
$str='commissions';
}else $str='credits';
return $str;
}
function bannerearn($userid,$memtype) {
global $userid,$memtype,$probannerearn,$jvbannerearn,$superjvbannerearn;
if ($memtype == 'PRO') {
$bannercredits=$probannerearn;
}elseif($memtype=='JV Member')  {
$bannercredits=$jvbannerearn;
}elseif ($memtype == 'SUPER JV') {
$bannercredits=$superjvbannerearn;
}
return $bannercredits;
}
function buttonearn($userid,$memtype) {
global $userid,$memtype,$probuttonearn,$jvbuttonearn,$superjvbuttonearn;
if ($memtype == 'PRO') {
$buttoncredits=$probuttonearn;
}elseif($memtype=='JV Member')  {
$buttoncredits=$jvbuttonearn;
}elseif ($memtype == 'SUPER JV') {
$buttoncredits=$superjvbuttonearn;
}
return $buttoncredits;
}
function mcreditearn($userid,$memtype) {
global $userid,$memtype,$procmailearn,$jvcmailearn,$superjvcmailearn;
if ($memtype == 'PRO') {
$mcredits=$procmailearn;
}elseif($memtype=='JV Member')  {
$mcredits=$jvcmailearn;
}elseif ($memtype == 'SUPER JV') {
$mcredits=$superjvcmailearn;
}
return $mcredits;
}
function poscols () {
$cols='<tr>';
return $cols;
}
function poscols2 () {
$cols2='</tr>';
return $cols2;
}
function doscols () {
$cols3="<td style=\"visibility: hidden\">&nbsp;</td>";
return $cols3;
}
function buttoncheck($bannerurl){
$width=125;
$height=125;
list($width,$height)=@getimagesize($bannerurl);
if($width!='125'OR $height!='125') {
return false;
}else return true;
}
function bannercheck($bannerurl){
$width=468;
$height=60;
list($width,$height)=@getimagesize($bannerurl);
if($width!='468'OR $height!='60') {
return false;
}else return true;
}
function adcheck() {
;echo '<center>
Your link is being tested to see if it breaks frames.<br>
Please wait <span id="plzwait">10 seconds</span>
<script type="text/javascript">
counter = 10;
function countdown() {
	if ((0 <= 100) || (0 > 0)) {
		counter--;
		if(counter > 0) {
			document.getElementById("plzwait").innerHTML = \'<b>\'+counter+\'<\/b> seconds\';
			setTimeout(\'countdown()\',1000);
		}
	}
}
countdown();
</script>
<br>
';
}
function banned_sites($url) {
$sql = mysql_query('SELECT * FROM banned_sites WHERE 1');
while($each = mysql_fetch_array($sql)) {
if(strpos(strtolower($url),strtolower(trim($each['url']))) !== false) {
echo "<p align=center>That url is banned. Click <a href=\"\">here</a> to go back</p>";
exit;
}
}
return 0;
}
function checkbanner($url) {
if (strpos($url,'https://') !== false) {
return 4;
}
if (strpos($url,'http://') === false) {
return 3;
}
if (strpos($url,'\"') !== false ||strpos($url,'\'') !== false ||$url == 'http://') {
return 3;
}
}
function check468($bannerurl) {
$width=468;
$height=60;
list($width,$height)=@getimagesize($bannerurl);
if($width!='468'OR $height!='60') {
;echo '<p align=center><font color=BLACK size=4><b>ERROR: Correct Banner Size Not Entered</font></p>
<p align=center><font color=BLUE size=4><b>Banner Size Required: 468w x 60h</b></font></p>
<p align=center><font color=RED size=4><b>Your banner was ';echo $width;;echo 'w x ';echo $height;;echo 'h</b></font></p>
<p align=center><b><a href="">Go back</a></b></p>
 ';
exit;
}
}
function check125($bannerurl) {
$width=125;
$height=125;
list($width,$height)=@getimagesize($bannerurl);
if($width!='125'OR $height!='125') {
;echo '<p align=center><font color=BLACK size=4><b>ERROR: Correct Banner Size Not Entered</font></p>
<p align=center><font color=BLUE size=4><b>Banner Size Required: 125w x 125h</b></font></p>
<p align=center><font color=RED size=4><b>Your banner was ';echo $width;;echo 'w x ';echo $height;;echo 'h</b></font></p>
<p align=center><b><a href="">Go back</a></b></p>
 ';
exit;
}
}
function checksubject($subject) {
if (preg_match('/[\^£$*()}{@><>|_¬]/',$subject,$match))
{
echo "<div align=center><font color=BLACK><b>You are not allowed to post special characters in the subject, please remove:<br /><em><font color=red>$match[0]</font></em></b><br><a href=\"\">Go Back</a></font></div>";
exit;
}
}
function authorizeurl($adbody) {
$not_check_email = true;
$tld_list = array(
'ac','ad','ae','aero','af','ag','ai','al',
'am','an','ao','aq','ar','arpa','arts','as',
'at','au','aw','az','ba','bb','bd','be',
'bf','bg','bh','bi','biz','bj','bm','bn',
'bo','br','bs','bt','bv','bw','by','bz',
'ca','cc','cd','cf','cg','ch','ci','ck',
'cl','cm','cn','co','com','coop','cr','cu',
'cv','cx','cy','cz','de','dj','dk','dm',
'do','dz','ec','edu','ee','eg','eh','er',
'es','et','fi','firm','fj','fk','fm','fo',
'fr','fx','ga','gd','ge','gf','gg','gh',
'gi','gl','gm','gn','gov','gp','gq','gr',
'gs','gt','gu','gw','gy','hk','hm','hn',
'hr','ht','hu','id','ie','il','im','in',
'info','int','io','iq','ir','is','it','je',
'jm','jo','jp','ke','kg','kh','ki','km',
'kn','kp','kr','kw','ky','kz','la','lb',
'lc','li','lk','lr','ls','lt','lu','lv',
'ly','ma','mc','md','mg','mh','mil','mk',
'ml','mm','mn','mo','mp','mq','mr','ms',
'mt','mu','museum','mv','mw','mx','my','mz',
'na','name','nato','nc','ne','net','nf','ng',
'ni','nl','no','np','nom','np','nr','nu',
'nz','om','org','pa','pe','pf','pg','ph',
'pk','pl','pn','pr','pro','pt','pw','py',
'qa','re','rec','ro','ru','rw','sa','sb',
'sc','sd','se','sg','sh','shop','si','sj',
'sk','sl','sm','sn','so','sr','st','su',
'sv','sy','sz','tc','td','tf','tg','th',
'tj','tk','tm','tn','to','tp','tr','tt',
'tv','tw','tz','ua','ug','uk','um','us',
'uy','uz','va','vc','ve','vg','vi','vn',
'vu','web','wf','ws','ye','yt','yu','za',
'zm','zr','zw'
);
$disallowed_tld = implode('|',$tld_list);
if($not_check_email)
{
$adbody = preg_replace("#([a-z0-9\-_]+)@(((?:www.)?.[a-z0-9\-_]+)\.($disallowed_tld)(\.($disallowed_tld))?.)#i",'',$adbody);
}
if (preg_match("#(([a-z0-9\-_]+)@)?([a-z]{3,6}://)?(((?:www.)?.[a-z0-9\-_]+)\.($disallowed_tld)(\.($disallowed_tld))?.)#i",$adbody,$match)) {
echo "<div align=center><font color=BLACK><b>You are not allowed to post url links in your ad body, please remove:<br /><em><font color=red>$match[0]</font></em></b><br><a href=\"\">Go Back</a></font></div>";
exit;
}
}
function bannerapprove($adid,$user) {
mysql_query("UPDATE banners SET added=1, status=0 WHERE id='".$adid."' AND userid='$user'");
$str= "<p><center>Your 468x60 banner ad has been set up and placed in queue for approval.<br><a href=\"add_banners.php\">Click here</a> to go back.</p><BR><BR>";
return $str;
}
function listmailapprove($adid,$user) {
$sql = mysql_query("SELECT * FROM listmailer_temp WHERE userid='$user' AND id='$adid'");
if(@mysql_num_rows($sql)) {
$info = mysql_fetch_array($sql);
mysql_query("INSERT INTO listmailer SET `timestamp`='".time()."' , userid='".$user."', subject='".$info['subject']."', message='".$info['message']."', url='".$info['url']."'");
$newid = mysql_insert_id();
mysql_query("DELETE FROM listmailer_temp WHERE userid='$user' AND id='$adid'");
echo '<p><b><center>Your message has been approved and placed into queue.<br>It will be delivered within the hour.</center></b></p>';
}
}
function membermailapprove($adid,$user) {
$sql = mysql_query("SELECT * FROM membermail_temp WHERE userid='$user' AND id='$adid'");
if(@mysql_num_rows($sql)) {
$info = mysql_fetch_array($sql);
mysql_query("INSERT INTO membermail SET `timestamp`='".time()."' , userid='".$user."', subject='".$info['subject']."', message='".$info['message']."', url='".$info['url']."', sendto='".$info['sendto']."'");
$newid = mysql_insert_id();
mysql_query("UPDATE members SET points=points-'".$info['sendto']."', lastmailing='".date('Y-m-d H:i:s')."' WHERE userid='".$user."'");
mysql_query("DELETE FROM membermail_temp WHERE userid='$user' AND id='$adid'");
echo '<p><b><center>Your message has been approved and placed into queue.<br>It will be delivered within the hour.</center></b></p>';
echo "</table>";
}
}
function addexistingbanner($oldid,$adid) {
$query = 'select * from banners where id='.$adid.' LIMIT 1';
$result = mysql_query ($query) or die ('Query 1 failed');
$line = mysql_fetch_array($result);
$max = $line['max'];
$bannername = $line['name'];
$query = 'select * from banners where id='.$oldid.' LIMIT 1';
$result = mysql_query ($query) or die ('Query 1 failed');
$line = mysql_fetch_array($result);
$bannername = $line['name'];
$query1 = 'update banners set max=max+'.$max.' where id='.$oldid.' LIMIT 1';
$result2 = mysql_query ($query1) or die ('Query 2 failed');
$query2 = 'delete from banners where id='.$adid.' LIMIT 1';
$result2 = mysql_query ($query2) or die ('Query 3 failed');
$str="<p align=\"center\"><span style=\"background-color: #FFFF00\">".$max." credits have been added to your 468x60 banner $bannername.</span></p>";
return $str;
}
function buttonapprove($adid,$user) {
mysql_query("UPDATE buttons SET added=1, status=0 WHERE id='".$adid."' AND userid='$user'");
$str= "<p><center>Your 125x125 banner ad has been set up and placed in queue for approval.<br><a href=\"add_buttons.php\">Click here</a> to go back.</p><BR><BR>";
return $str;
}
function addexistingbutton($oldid,$adid) {
$query = 'select * from buttons where id='.$adid.' LIMIT 1';
$result = mysql_query ($query) or die ('Query 1 failed');
$line = mysql_fetch_array($result);
$max = $line['max'];
$bannername = $line['name'];
$query = 'select * from buttons where id='.$oldid.' LIMIT 1';
$result = mysql_query ($query) or die ('Query 1 failed');
$line = mysql_fetch_array($result);
$bannername = $line['name'];
$query1 = 'update buttons set max=max+'.$max.' where id='.$oldid.' LIMIT 1';
$result2 = mysql_query ($query1) or die ('Query 2 failed');
$query2 = 'delete from buttons where id='.$adid.' LIMIT 1';
$result2 = mysql_query ($query2) or die ('Query 3 failed');
$str="<p align=\"center\"><span style=\"background-color: #FFFF00\">".$max." credits have been added to your 125x125 banner $bannername.</span></p>";
return $str;
}
function framecheck($type,$adid,$targeturl) {
;echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
<html>
<head>
<title>Frame Breaker test</title>
<META HTTP-EQUIV="Refresh" Content="10; URL=ad_checked.php?pageid=';echo $type;;echo '&id=';echo $adid;;echo '">
</head>
  <frameset ROWS="60,*" BORDER=0 FRAMEBORDER=1 FRAMESPACING=0>
  <frame name="header" scrolling="no" noresize marginheight="1" marginwidth="1" target="main" src="ad_check.php?pageid=';echo $type;;echo '&id=';echo $adid;;echo '">
  <frame name="main" src="';echo $targeturl;;echo '">
  </frameset>
</html>		
';
}
function textlink ($userid,$spurl) {
global $userid,$id,$domain;
$str = "<div style=\"float: left; margin:5px; padding-top: 50px;\">";
$sql = mysql_query("SELECT * FROM texts WHERE approved=1 AND paid>sent AND subject!='' AND userid!='$userid' AND id not in(select id from texts_viewed WHERE userid='$userid') ORDER BY rand() LIMIT 2");
if(@mysql_num_rows($sql)) {
$info = mysql_fetch_array($sql);
$uid=fetchuid($userid);
$redirecturl="<a href=\"/earn.php?t=5&u=$uid&adid=".$info['id'].'&num='.$info['num']."\" target=\"_blank\">";
$subject = truncat($info['subject'],20);
$str .= "<span style=\"background-color: #FFFF00; margin:3px; font-weight: bold; color: #FF0000; font-size: 12px;\">";
$str .= "<font face=\"Tahoma\" size=\"2\">".$redirecturl."<u><font face=\"Tahoma\" size=\"2\">".$subject.'</font></u></a>';
$str .= '</font></span><br><br>';
textads_sent ('1');
updatetextadstats($info['id']);
}
$str .= "<a href=\"$spurl\" target=\"_blank\"><font color=\"#000000\">Visit This Website</a></div>";
$str .= "<div style=\"float: right; padding-top: 55px;\">";
if(@mysql_num_rows($sql) == 2) {
$info = mysql_fetch_array($sql);
$uid=fetchuid($userid);
$redirecturl="<a href=\"/earn.php?t=5&u=$uid&adid=".$info['id'].'&num='.$info['num']."\" target=\"_blank\">";
$subject = truncat($info['subject'],20);
$str .= "<span style=\"background-color: #FFFF00; margin:3px; font-weight: bold; color: #FF0000; font-size: 12px;\">";
$str .= "<font face=\"Tahoma\" size=\"2\">".$redirecturl."<u><font face=\"Tahoma\" size=\"2\">".$subject.'</font></u></a>';
$str .= '</font></span><br><br>';
textads_sent ('1');
updatetextadstats($info['id']);
}
$str .= "<a href=\"$spurl\" target=\"_blank\"><font color=\"#000000\">Visit This Website</a></div>";
return $str;
}
function sponsorlink($url) {
$str = "<div style=\"float: left; padding-top: 10px;\"><a href=\"".$url."\" target=\"NEW\">Visit Sponsor Site</a></div>";
$str .= "<div style=\"float: right; padding-top: 10px;\"><a href=\"".$url."\" target=\"NEW\">Visit Sponsor Site</a></div>";
return $str;
}
function bonusviewed($userid) {
$member = "select * from members where userid='".$userid."' and bonus_viewed=1 limit 1";
$memberresult = mysql_query($member);
$memberrows = mysql_num_rows($memberresult);
return $memberrows;
}
function sponsorclicks($sponsorid) {
mysql_query("UPDATE adminsites SET clicks=clicks+1 WHERE id='".$sponsorid."'");
mysql_query('update lifetimeadstats set delivered=delivered+1, adminsites=adminsites+1');
add_clickstats ();
}
function linkupdate($subject,$url,$adid) {
global $userid;
$query = "update texts set subject='$subject', added=1, approved=0, url='$url' where id=".$adid;
$result = mysql_query ($query) or die ('Query failed 8');
framecheck('textlink',$adid,$url);
}
function querylink($mtag,$userid,$rid) {
global $userid;
if($rid) $query = "SELECT * FROM texts where userid='".$userid."' and id='".$rid."' LIMIT 1";
else $query = "SELECT * FROM texts where added=0 and userid='".$userid."' ORDER BY id ASC limit 1";
$result = mysql_query ($query) or die ('Query failed 9');
return $result;
}
function textlinkapprove($adid,$user) {
$query = 'select * from texts where id='.$adid;
$result = mysql_query ($query) or die ('Query failed 10');
$line = mysql_fetch_array($result);
mysql_query("UPDATE texts SET added=1, approved=0 WHERE id='".$adid."' AND userid='$user'");
$str= "<p><center>Your text link ad has been set up and placed in queue for approval.<br><a href=\"add_links.php\">Click here</a> to go back.</p><BR><BR>";
return $str;
}
function memberspage ($name) {
$getpage = mysql_query("Select htmlcode from pages where name='$name'");
$showpage = mysql_result($getpage,0,'htmlcode');
return stripslashes($showpage);
}
function fetch_ip()	{
$strIP = $_SERVER['REMOTE_ADDR'];
if (isset($_SERVER['HTTP_CLIENT_IP'])) {
$strIP = $_SERVER['HTTP_CLIENT_IP'];
}else if (isset($_SERVER['HTTP_X_FORWARDED_FOR']) AND preg_match_all('#\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}#s',$_SERVER['HTTP_X_FORWARDED_FOR'],$matches)) {
foreach ($matches[0] AS $ip) {
if (!preg_match("#^(10|172\.16|192\.168)\.#",$ip)) {
$strIP = $ip;
break;
}
}
}else if (isset($_SERVER['HTTP_FROM'])) {
$strIP = $_SERVER['HTTP_FROM'];
}
return $strIP;
}
function deleteconfirm ($userid) {
extract($GLOBALS);
@extract($POST);
$remark = stripslashes($_POST['remarks']);
$ip = getenv(REMOTE_ADDR);
$options = mysql_query ("select * from exited_options where id='1'");
$array = mysql_fetch_array($options);
$scriptactive = $array['exit_active'];
$email = $array['exit_email'];
$logexit = $array['log_exit'];
if($scriptactive == 1)
{
if($remark == '') {$remark = 'No remark was given.';}
if($logexit == 1)
{
$userinfo=mysql_query ("select * from members where userid='".$_SESSION[uname]."'");
$userrecord=mysql_fetch_array($userinfo);
$id=$userrecord['id'];
$name=$userrecord['name'];
$contact_email=$userrecord['contact_email'];
$userid=$userrecord['userid'];
$ip=$userrecord['ip'];
$joindate=$userrecord['joindate'];
$memtype=$userrecord['memtype'];
$today = date('Y-m-d',strtotime('now'));
$query1 = "insert into exited (id, ip, name, username, memtype, contact_email, reason, joindate, deleted) values
					('$id', '$ip', '$name', '$userid', '$memtype', '$contact_email', '$remark', '$joindate', '$today')";
$result1 = mysql_query ($query1);
}
}
if ($banning==1) {
$member_sql = mysql_query("SELECT * FROM members WHERE userid = '".$_SESSION[uname]."'");
$member_info = mysql_fetch_array($member_sql);
$delete_email = $member_info['subscribed_email'];
if (empty($delete_email)) {$delete_email = $member_info['contact_email'];}
$delete_ip = fetch_ip();
$reinstate_date = date('Y-m-d',strtotime('+'.$ban_period.' days'));
$md_query = 'INSERT INTO member_deletes ';
$md_query .= '(email, ip, reinstate_date, deleted_by) ';
$md_query .= 'VALUES ';
$md_query .= "('".$delete_email."','".$delete_ip."','".$reinstate_date."','User')";
mysql_query($md_query);
}
delete_account($userid);
mysql_query("INSERT INTO transactions VALUES ('id','".$userid."','Member Deleted Account','".time()."','')");
$str= '<center><b>Successfully deleted from Database.</b></center>';
return $str;
}
function deletenowrequest ($userid) {
extract($GLOBALS);
$options = mysql_query ("select * from exited_options where id='1'");
$array = mysql_fetch_array($options);
$scriptactive = $array['exit_active'];
$email = $array['leave_email'];
$logexit = $array['log_exit'];
if($scriptactive == 1) {
if($email == 1 OR $logexit == 1) {
;echo '		
				
				<center>
				<br><br>
				<p align="center">Sorry to see you go!<br><br> Please let us know why you\'re leaving in the text box below,<br>we would appreciate your input so we can work on improving our website.</p>
				<p>Thank you for having been a part of our community!</p>

				<form method="post"><div class="form"><div class="formlist"></div>

					  <div class="formfield">
						<table width="331" border="0" align="center" cellpadding="0" cellspacing="0">
						  <tr>
							<td width="186"><div align="center">
							  <textarea rows="4" cols="40" name="remarks" value=""></textarea>
							</div></td>
						  </tr>
						</table>
					  </div>

					<div class="form"><div class="formlist">
						<div align="center">
						  <input name="Submit" value="Submit & Delete Account" type="submit">
						</div>
					</div>
				</form>
				</center>
				<!--* End of necessary part for the e-mail script -->
		
		
			';
}
else
{
;echo '				<!--* The original message -->
				<center>
				<br><br>
				Are you sure you want to cancel your ';echo $sitename;;echo ' account?<br>If you continue you will no longer have access to your account "';echo $userid;;echo '",<br> you will lose your downline, and will lose all commissions. 
				
				<br><br>
				
				<form method="post"><div class="form"><div class="formlist"></div>

					  <div class="formfield">
						<table width="331" border="0" align="center" cellpadding="0" cellspacing="0">
						  <tr>
							<td width="186"><div align="center">
							</div></td>
						  </tr>
						</table>
					  </div>

					<div class="form"><div class="formlist">
						<div align="center">
						  <input name="Submit" value="Submit & Delete Account" type="submit">
						</div>
					</div>
				</form>
				</center>
				<!--* End of the original message -->
				';
}
}
}
function uploaduserimage($userid,$image) {
$image=$_FILES['image']['name'];
$newname='';
if ($image){
$filename = stripslashes($_FILES['image']['name']);
$extension = getExtension($filename);
$extension = strtolower($extension);
if (($extension != 'jpg') &&($extension != 'png') &&($extension != 'gif')) 
{
echo '<font color=red>Unknown file extension!</font><br><br>';
$errors=1;
}
else
{
$newimagename="$_SESSION[uname].";
$image_name=$newimagename.$extension;
$newname='../img/'.$image_name;
copy($_FILES['image']['tmp_name'],$newname);
}
}
return $image_name;
}
function pauseaccount($st,$userid) {
if($st == 2) {
mysql_query("UPDATE members SET vacation=0, vacation_date = '".time()."' WHERE userid='$userid'");
$vacation = 0;
$vacation_date = time();
if($vacation_date >time()-24*60*60 ) {
$str='<p align=center>Your account is now active again!<br>You will start receiving emails again. In order to prevent abuse you will not be able to submit any solos for 24 hours.';
}
}
if($st == 1) {
mysql_query("UPDATE members SET vacation=1, vacation_date = '".time()."' WHERE userid='$userid'");
$vacation = 1;
$vacation_date = time();
$str='Your account is now active paused!';
}
return $str;
}
function vacationlimit($userid) {
extract($GLOBALS);
if($vacation_date >time()-24*60*60 ) {
;echo '  	        <center>
		<br><br>
		Your account is now active again!<p>You will start receiving emails again.<br>In order to prevent abuse you will not be able to submit a solo for 24 hours. 
		</center>
		';
include '../inc/footer.php';
exit;
}

}
function paymentprocess($type,$userid) {
if($type) {
echo "<p align=center><b>Thank you for purchasing $type advertising.<br><br>Your advertising has been added to your account. <br><a href=\"".$type."advertising.php\">Click Here to submit your ads.</a></p></b>";
}else echo '<p align=center><b>Your purchase has been cancelled.</p></b>';
}
function memberpage ($userid,$pid) {
global $memtype;
$query = "SELECT * FROM custompages where id='".$pid."'";
$result = mysql_query ($query)
or die ('Query failed 11');
while ($line = mysql_fetch_array($result)) {
$htmlcode = $line['htmlcode'];
$yourmemtype = $line['memtype'];
$name = $line['name'];
if($yourmemtype=='1') {
$yourmem = 'PRO';
}elseif($yourmemtype=='2') {
$yourmem = 'JV Member';
}elseif($yourmemtype=='3') {
$yourmem = 'SUPER JV';
}elseif($yourmemtype=='0') {
$yourmem = 'ALL';
}
if($memtype==$yourmem OR $yourmem=='ALL') {
echo "<H2 align=center>$name</H2>";
echo stripslashes($htmlcode);
}else {
echo "Only $yourmem Members Can Access This Page";
}
}
};
?>