<?php

function random_string($length) {
$key = '';
$keys = array_merge(range(0,9),range('a','z'),range('A','Z'));
for ($i = 0;$i <$length;$i++) {
$key .= $keys[array_rand($keys)];
}
return $key;
}
function check_number($number) {
if (!is_numeric($number)) {return false;}
$teststring = (string)$number;
$stringlength = strlen($teststring);
if ($stringlength == 0) {return false;}
for ($i = 0;$i <$stringlength;$i++) {
$testchar = ord($teststring{$i});
if (($testchar<48) ||($testchar>57)) {
return false;
}
}
return true;
}
function checkreferrer ($userid) {
global $fonttype,$fontcolour;
$query = "select * from members where userid='".$userid."'";
$result = mysql_query ($query);
$numrows = mysql_num_rows($result);
if ($numrows>0) {
echo "<font size=3 face='$fonttype' color='$fontcolour'><p><b><center>Error! You can't refer yourself. Please click your browsers back button.</p><b></center></font>";
mysql_query("INSERT INTO transactions VALUES ('id','".$userid."','Tried To Refer Themselves','".time()."','')");
include '/footer.php';
exit;
}
}
function optimize_database() {
mysql_select_db("$MySqlDatabase");
$rs2 = mysql_query('show tables');
while($arr2=mysql_fetch_array($rs2)){
$rs3 = mysql_query("analyze table `$arr2[0]`");echo mysql_error();
$arr3=mysql_fetch_array($rs3);
$rs4 = mysql_query("optimize table `$arr2[0]`");echo mysql_error();
$arr4=mysql_fetch_array($rs4);
}
}
function goback() {
echo("<br>
		     <form style=\"margin:2px\" action=\"mailer.php\" method=\"POST\">
		     <input type=\"hidden\" name=\"credits\" value=\"".$_POST['credits']."\">
		     <input type=\"hidden\" name=\"subject\" value=\"".$_POST['subject']."\">
		     <input type=\"hidden\" name=\"message\" value=\"".$_POST['message']."\">
		     <input type=\"hidden\" name=\"url\" value=\"".$_POST['url']."\">
		     <input type=\"submit\" value=\"Go Back\">
		     </form>");
}
function docform () {
;echo '<script language="JavaScript">
// submit form func
function submitform() {

// if box coord submit else rectangle coord alert
// Do not edit javascript below this line. you can edit the alert message

if (document.xcoords.x.value ';echo $aler;;echo ') {
document.xcoords.submit();

} else {
alert("Click number in square identical to number in rectangle to submit.");
}
}
// image x value
function xcoord(event) {
image = event.offsetX?(event.offsetX):event.pageX-document.getElementById("coord").offsetLeft;
document.xcoords.x.value = image;
}
</script>
';
}
function monthy_cron () {
$today = date('Y-m-d',strtotime('now'));
$onemonthago = date('d');
$onemonthagoc = date('Y-m-d',strtotime('-1 months'));
$sql = mysql_query('SELECT * FROM monthlyads');
while($offer = mysql_fetch_array($sql)) {
$sql2 = mysql_query("SELECT * FROM members WHERE memtype='".$offer['memtype']."'");
while($each = mysql_fetch_array($sql2)) {
$userid=$each['userid'];
$lastlogin=$each['lastlogin'];
$contact_email=$each['contact_email'];
$name=$each['name'];
$memtype=$each['memtype'];
if (substr($each['confirmed'],8,2) == $onemonthago) {
if(($lastlogin<=$onemonthagoc OR $lastlogin='') AND ($memtype == 'PRO'OR $memtype == 'JV Member')) {
mysql_query("INSERT INTO transactions VALUES ('id', '".$userid."','Monthly: Ads Skipped','".time()."','lastlogin: $lastlogin')");
mysql_query("INSERT INTO account_ledger VALUES ('id', '".$userid."','Monthly Ads Skipped (NO Login In Last 30 Days)','".time()."','lastlogin: $lastlogin')");
sendoutmail ($contact_email,$name,'You just lost your monthly bonus ads','Hello '.$name.',<br><br>You just lost your monthly bonus ad package because you have not logged into your account within the last 30 days.<br><br>The last time you logged in was: '.$lastlogin.'<br><br>Login: '.$domain.'<br><br>'.$sitename." Admin
".$adminemail."<br><br>$adminname<br>$adminaddress<br><br>");
}else {
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--;
}
}
sendoutmail ($contact_email,$name,'Your monthly bonus ads have been added','Hello '.$name.',<br><br>Your monthly bonus ad package has just been added to your account.<br><br>Login to your account and get them setup.<br><br>'.$domain.'<br><br>'.$sitename.' Admin<br>'.$adminemail."<br><br>$adminname<br>$adminaddress<br><br>");
mysql_query("INSERT INTO account_ledger VALUES ('id','".$userid."','$memtype Monthly Bonus Ad Package','".time()."','')");
mysql_query("INSERT INTO transactions VALUES ('id', '".$userid."','Monthly: $memtype  Bonus Ad Package','".time()."','added')");
}
}
}
}
}
function remove_expiredads () {
$sql = mysql_query('SELECT * FROM banners WHERE status=1 AND shown>=max');
while($each = mysql_fetch_array($sql)) {
mysql_query("DELETE FROM banners_viewed WHERE id='".$each['id']."'");
mysql_query("INSERT INTO campain_ledger VALUES ('id','".$each['userid']."','468x60 Banner Campaign Completed','".$each['name']."', '".$each['url']."', '".$each['shown']."', '".$each['clicks']."', '".time()."')");
}
mysql_query('DELETE FROM banners WHERE status=1 AND shown>=max');
$sql = mysql_query('SELECT * FROM buttons WHERE status=1 AND shown>=max');
while($each = mysql_fetch_array($sql)) {
mysql_query("DELETE FROM buttons_viewed WHERE id='".$each['id']."'");
mysql_query("INSERT INTO campain_ledger VALUES ('id','".$each['userid']."','125x125 Banner Campaign Completed','".$each['name']."', '".$each['url']."', '".$each['shown']."', '".$each['clicks']."', '".time()."')");
}
mysql_query('DELETE FROM buttons WHERE status=1 AND shown>=max');
$sql = mysql_query('SELECT * FROM texts WHERE approved=1 AND sent>=paid');
while($each = mysql_fetch_array($sql)) {
mysql_query("DELETE FROM texts_viewed WHERE id='".$each['id']."'");
mysql_query("INSERT INTO campain_ledger VALUES ('id','".$each['userid']."','Text Link Ad Campaign Completed','".$each['subject']."', '".$each['url']."', '".$each['views']."', '".$each['sent']."', '".time()."')");
}
mysql_query('DELETE FROM texts WHERE approved=1 AND sent>=paid AND ptc=0');
}
function getjoindate($userid) {
$uid=mysql_query ("select userid, joindate from members where userid='".$userid."'");
$uidresult=mysql_fetch_array($uid);
$user=$uidresult['joindate'];
return $user;
}
function checkregistration($new_contact,$new_contact_ip) {
global $fonttype,$fontcolour;
$query = 'select * from bandomain_settings';
$result = mysql_query( $query )
or die( 'Connection error. Check database settings!');
$array = mysql_fetch_array($result);
$mode = $array['type'];
if( $mode == 'allow')
{
$query2 = 'select * from allowdomains';
$result2 = mysql_query( $query2 )
or die( 'Connection error. Check database settings!(2)');
$array2 = mysql_fetch_array($result2);
}
else if( $mode == 'reject')
{
$query2 = 'select * from rejected_domains';
$result2 = mysql_query( $query2 )
or die( 'Connection error. Check database settings!(2)');
$array2 = mysql_fetch_array($result2);
}
$rows = mysql_num_rows( $result2 );
$contact = $array2['domain'];
$passed = 0;
if( $rows != 0)
{
if( $mode == 'reject')
{
$contact = split('@',$new_contact);
if( $contact[1] == $array2['domain'] )
{
echo( "<center>This site doesn't allow email addresses from &quot;$contact[1]&quot; (1)</center><br><br>");
include '/footer.php';
exit;
}
while( $line = mysql_fetch_array( $result2 ) )
{
$contact = split('@',$new_contact);
if( $contact[1] == $line['domain'] )
{
echo( "<center>This site doesn't allow email addresses from &quot;$contact[1]&quot; (2)</center><br><br>");
include '/footer.php';
exit;
}
}
}
else if( $mode == 'allow')
{
$contact = split('@',$new_contact);
if( $contact[1] == $array2['domain'] )
{
$ignore = 1;
}
else
{
echo( "<center>This site doesn't allow email addresses from &quot;$contact[1]&quot; (3)</center><br><br>");
echo( $passed);
include '/footer.php';
exit;
}
if( $ignore != 1 )
{
while( $line = mysql_fetch_array( $result2 ) )
{
if( $contact[1] == $line['domain'] )
{
}
else
{
echo( "<center>This site doesn't allow email addresses from &quot;$contact[1]&quot; (4)</center><br><br>");
echo( $passed);
include '/footer.php';
exit;
}
}
}
}
}
$member_deletes_sql = "select * from member_deletes where reinstate_date>'".date('Y-m-d')."' AND email='".$new_contact."';";
$member_deletes_result = mysql_query ($member_deletes_sql);
$member_deletes_email_rows = mysql_num_rows($member_deletes_result);
$member_deletes_sql = "select * from member_deletes where reinstate_date>'".date('Y-m-d')."' AND ip='".$new_contact_ip."';";
$member_deletes_result = mysql_query ($member_deletes_sql);
$member_deletes_ip_rows = mysql_num_rows($member_deletes_result);
if ($member_deletes_email_rows >0 ||$member_deletes_ip_rows >0) {
mysql_query("UPDATE member_deletes SET ip='".$new_contact_ip."' WHERE email='".$new_contact."'");
if ($member_deletes_email_rows >0) {
mysql_query("UPDATE member_deletes SET email_resignup_attempts=email_resignup_attempts+1, email_last_attempted='".date('Y-m-d')."' WHERE email='".$new_contact."'");
}
if ($member_deletes_ip_rows >0) {
mysql_query("UPDATE member_deletes SET ip_resignup_attempts=ip_resignup_attempts+1, ip_last_attempted='".date('Y-m-d')."' WHERE ip='".$new_contact_ip."'");
}
echo "<font size=3 face='$fonttype' color='$fontcolour'><p><b><center>You are prevented from signing up because you have been recently deleted as a member.</p><b></center></font>";
include '/footer.php';
exit;
}
}
function requestpayout ($userid) {
global $sitename,$adminemail,$admintablebgcolor,$contrastcolour,$fonttype,$fontcolour,$minimumpayout,$commission,$payzaemail,$paypal_email,$memtype;
echo '<p><center>';
function formatDate($val) {
$arr = explode('-',$val);
return date('M d Y',mktime(0,0,0,$arr[1],$arr[2],$arr[0]));
}
$commission = number_format($commission,2);
$totalowed = $commission;
$totalowed = number_format($totalowed,2);
$minimumpayout = $minimumpayout;
if ($_POST['action'] == 'cashout')
{
$cashoutamount = $_POST['cashoutamount'];
if ($cashoutamount <$minimumpayout)
{
echo "<p align=\"center\"><font face=\"Tahoma\" size=\"2\">Sorry, you cannot withdraw less than the minimum payout, which is \$".$minimumpayout ."<br><a href=\"requestcashout.php\">Click here</a> to go back.</font></p>";
include '/footer.php';
exit;
}
if ($cashoutamount >$totalowed)
{
echo "<p align=\"center\"><font face=\"Tahoma\" size=\"2\">You do not have \$".$cashoutamount ." in earnings to withdraw.<br><a href=\"requestcashout.php\">Click here</a> to go back.</font></p>";
include '/footer.php';
exit;
}
if ($payzaemail == '')
{
$payzaemail = 'Not Entered';
}
if ($paypal_email == '')
{
$paypal_email = 'Not Entered';
}
$q = "insert into cashoutrequests (userid,payza,paypal,amountrequested,regularowed,daterequested) values (\"$userid\",\"$alertpayemail\",\"$paypal_email\",\"$cashoutamount\",\"$commission\",NOW())";
$r = mysql_query($q);
$to = $adminemail;
$subject = $sitename ." Cash Out Request for UserID $userid";
$body = "UserID: $userid<br>Payza: $payzaemail<br>Paypal: $paypal_email<br>Requested Withdrawal: $cashoutamount<br>Total Regular Commissions Owed: $commission";
sendoutmail ($to,$adminname,$subject,wordwrap(stripslashes($body)));
echo "<p align=\"center\"><font face=\"Tahoma\" size=\"2\">Your cash out request for \$".$cashoutamount ." was submitted to the admin. <br><a href=\"requestcashout.php\">Click here</a> to go back.</font></p>";
include '/footer.php';
exit;
}
extract($GLOBALS);
if($pay_with[paypal]) {
$displayemailalert ='PayPal';
}if($pay_with[payza] &&$pay_with[paypal]) {
$displayemailalert .='/Payza';
}if($pay_with[payza] &&$pay_with[paypal]=='') {
$displayemailalert .='Payza';
}
;echo '<p><font size=6>Cash Out Your Earnings!</font><br>
<font size=3><b>Please</b> Make Sure You Have Your<BR>';echo $displayemailalert;;echo ' Email Added To Your Profile.<BR>
 </font>
<p>Minimum Payout: ';echo $minimumpayout ;echo '<br>
Total Commissions Owed: $ ';echo number_format($commission,2);;echo '<br>
<form method="post" action="requestcashout.php">
Withdraw Earnings: $<input type="text" name="cashoutamount"><br>
<input type="hidden" name="action" value="cashout"><br>
<input type="submit" value="Submit">
</form>
</p>

';
}
function pendingrequest ($userid) {
global $sitename,$adminemail,$admintablebgcolor,$contrastcolour,$fonttype,$fontcolour,$minimumpayoutsuperjv,$minimumpayoutjv,$minimumpayoutpro,$commission,$alertpayemail,$paypal_email;
;echo '<table align="center" border="0" width="100%">
<tr>
<td valign="top" align="center"> ';
echo '<p><center>';
echo '<H2>Your Pending Cash Out Requests</H2>';
$query = "select * from cashoutrequests where userid='$userid'";
$result = mysql_query ($query);
$numrows = @ mysql_num_rows($result);
if ($numrows <1) {
echo '<p><center>You Have No Requests Pending.</p></center>';
}
if ($show != '')
{
echo $show;
}
if ($numrows >0)
{
;echo '<table width=90% border=1 bordercolor=#000000 cellpadding=2 cellspacing=0 bgcolor="';echo $admintablebgcolor ;echo '">
<tr>

<td bgcolor="';echo $contrastcolour;;echo '"><center><font size=2 face="';echo $fonttype;;echo '" color="';echo $fontcolour;;echo '">Amount Requested</font></center></td>
<td bgcolor="';echo $contrastcolour;;echo '"><center><font size=2 face="';echo $fonttype;;echo '" color="';echo $fontcolour;;echo '">Date Requested</font></center></td>
<td bgcolor="';echo $contrastcolour;;echo '"><center><font size=2 face="';echo $fonttype;;echo '" color="';echo $fontcolour;;echo '">Regular Commissions Owing</font></center></td>

</tr>
';
while ($line = mysql_fetch_array($result)) {
$requestid = $line['id'];
$userid = $line['userid'];
$amountrequested = $line['amountrequested'];
$regularowed = $line['regularowed'];
$daterequested = $line['daterequested'];
if (($daterequested == '') or ($daterequested == 0))
{
$daterequested = 'N/A';
}
if (($daterequested != '') and ($daterequested != 0))
{
$daterequested = formatDate($daterequested);
}
;echo '<tr>
<td bgcolor="#FFFFFF"><center><font size=2 face="';echo $fonttype;;echo '" color="';echo $fontcolour;;echo '">$';echo $amountrequested ;echo '</font></center></td>
<td bgcolor="#FFFFFF"><center><font size=2 face="';echo $fonttype;;echo '" color="';echo $fontcolour;;echo '">';echo $daterequested ;echo '</font></center></td>
<td bgcolor="#FFFFFF"><center><font size=2 face="';echo $fonttype;;echo '" color="';echo $fontcolour;;echo '">$';echo $regularowed ;echo '</font></center></td>


</tr>
';
echo '</table></center>';
}
}
echo '</td></tr></table></center>';
}
function paidrequest ($userid) {
global $sitename,$adminemail,$admintablebgcolor,$contrastcolour,$fonttype,$fontcolour,$minimumpayoutsuperjv,$minimumpayoutjv,$minimumpayoutpro,$commission,$alertpayemail,$paypal_email;
;echo '<br>
<table align="center" border="0" width="100%">
<tr>
<td valign="top" align="center"> ';
echo '<p><center>';
echo '<H2>Your Paid Cash Out Requests</H2>';
$query = "select * from regularpayouts where userid='$userid'";
$result = mysql_query ($query);
$numrows = @ mysql_num_rows($result);
if ($numrows <1) {
echo '<p><center>You Have No Paid Requests.</p></center>';
}
if ($show != '')
{
echo $show;
}
if ($numrows >0)
{
$TotQuery = "SELECT SUM(paid) as total_paid FROM regularpayouts WHERE userid='$userid'";
$Row = mysql_fetch_array(mysql_query($TotQuery));
$paidtotal = $Row['total_paid'];
;echo 'You have been paid a total of $';echo $paidtotal;;echo '<table width=90% border=1 bordercolor=#000000 cellpadding=2 cellspacing=0 bgcolor="';echo $admintablebgcolor ;echo '">
<tr>

<td bgcolor="';echo $contrastcolour;;echo '"><center><font size=2 face="';echo $fonttype;;echo '" color="';echo $fontcolour;;echo '">Amount Paid</font></center></td>
<td bgcolor="';echo $contrastcolour;;echo '"><center><font size=2 face="';echo $fonttype;;echo '" color="';echo $fontcolour;;echo '">Date Paid</font></center></td>


</tr>
';
while ($line = mysql_fetch_array($result)) {
$requestid = $line['id'];
$userid = $line['userid'];
$paid = $line['paid'];
$datepaid = $line['datepaid'];
if (($datepaid == '') or ($datepaid == 0))
{
$datepaid = 'N/A';
}
if (($datepaid != '') and ($datepaid != 0))
{
$datepaid = formatDate($datepaid);
}
;echo '<tr>
<td bgcolor="#FFFFFF"><center><font size=2 face="';echo $fonttype;;echo '" color="';echo $fontcolour;;echo '">$';echo $paid ;echo '</font></center></td>
<td bgcolor="#FFFFFF"><center><font size=2 face="';echo $fonttype;;echo '" color="';echo $fontcolour;;echo '">';echo $datepaid ;echo '</font></center></td>


</tr>
';
}
echo '</table>';
}
echo '</center></td></tr></table></center>';
}
function otopaymentbutton($type,$otonum,$userid,$paymentprice,$pinterval)  {
global $domain,$sitename,$paypal,$payza,$pinterval;
;echo '<table align=center border=0><tr>
';if ($paypal<>'') {;echo '<td valign=top>
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
';if($pinterval=='Monthly'OR $pinterval=='Yearly') {;echo '<input type="hidden" name="cmd" value="_xclick-subscriptions">
';}else {;echo '<input type="hidden" name="cmd" value="_xclick">
';};echo '<input type="hidden" name="business" value="';echo $paypal;;echo '">
<input type="hidden" name="item_name" value="';echo $sitename;;echo ' ';echo $type;;echo '">
<input type="hidden" name="amount" value="';echo $paymentprice;;echo '">
<input type="hidden" name="page_style" value="PayPal">
<input type="hidden" name="no_shipping" value="1">
<input type="hidden" name="return" value="';echo $domain;;echo '/thanks.php">
<input type="hidden" name="cancel_return" value="';echo $domain;;echo '/">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="lc" value="US">
';if($pinterval=='Monthly') {;echo '<input type="hidden" name="a3" value="';echo $paymentprice;;echo '">
<input type="hidden" name="p3" value="1">
<input type="hidden" name="t3" value="M">
<input type="hidden" name="src" value="1">
<input type="hidden" name="sra" value="1">
';}elseif($pinterval=='Yearly') {;echo '<input type="hidden" name="a3" value="';echo $paymentprice;;echo '">
<input type="hidden" name="p3" value="1">
<input type="hidden" name="t3" value="Y">
<input type="hidden" name="src" value="1">
<input type="hidden" name="sra" value="1">
';};echo '<input type="hidden" name="bn" value="PP-BuyNowBF">
<input type="hidden" name="on0" value="User ID">
<input type="hidden" name="os0" value="';echo $userid;;echo '">
';if($type=='OTO 1'OR $type=='OTO 2'OR $type=='OTO 3') {
$type='oto';
}elseif($type=='OFFER 1'OR $type=='OFFER 2'OR $type=='OFFER 3') {
$type='offer';
};echo '<input type="hidden" name="on1" value="';echo $type;;echo '">
<input type="hidden" name="os1" value="';echo $otonum;;echo '">
<input type="hidden" name="notify_url" value="';echo $domain;;echo '/paypal_ipn.php">
<input type="image" src="/images/PayPal_BuyNow.jpg" border="0" name="submit" alt="Make payments with PayPal - it\'s fast, free and secure!">
</form>
</td>
';}if ($payza<>'') {;echo '<td width=30>&nbsp;</td>
<td valign=top>
<form method="post" action="https://secure.payza.com/checkout" > 
';if($pinterval=='Monthly'OR $pinterval=='Yearly') {;echo '<input type="hidden" name="ap_purchasetype" value="subscription"/> 
';}else {;echo '<input type="hidden" name="ap_purchasetype" value="item"/> 
';};echo '  <input type="hidden" name="ap_merchant" value="';echo $payza;;echo '"/> 
  <input type="hidden" name="ap_currency" value="USD"/> 
  <input type="hidden" name="ap_returnurl" value="';echo $domain;;echo '/thanks.php"/>  
  <input type="hidden" name="ap_itemname" value="';echo $sitename;;echo ' ';echo $type;;echo '"/> 
  <input type="hidden" name="ap_quantity" value="1"/> 
  <input type="hidden" name="ap_amount" value="';echo $paymentprice;;echo '"/> 
  <input type="hidden" name="apc_1" value="';echo $userid;;echo '"> 
';if($type=='OTO 1'OR $type=='OTO 2'OR $type=='OTO 3') {
$type='oto';
}elseif($type=='OFFER 1'OR $type=='OFFER 2'OR $type=='OFFER 3') {
$type='offer';
};echo '  <input type="hidden" name="apc_2" value="';echo $otonum;;echo '"> 
  <input type="hidden" name="apc_3" value="';echo $type;;echo '"> 
';if($pinterval=='Monthly') {;echo '  <input type="hidden" name="ap_timeunit" value="month"/> 
  <input type="hidden" name="ap_periodlength" value="1"/> 
  <input type="hidden" name="ap_periodcount" value="0"/> 
';}elseif($pinterval=='Yearly') {;echo '  <input type="hidden" name="ap_timeunit" value="year"/> 
  <input type="hidden" name="ap_periodlength" value="1"/> 
  <input type="hidden" name="ap_periodcount" value="0"/>
';};echo '  <input type="hidden" name="ap_alerturl" value="';echo $domain;;echo '/payza_ipn.php"/>  
  <input name="ap_image" src="/images/Payza_BuyNow.jpg" type="image" />
  </form>
</td>
';};echo ' 
</tr></table>
';
}
function displayoto($type) {
$query = "SELECT * FROM pages where name='".$type."'";
$result = mysql_query ($query) or die ('Query failed 1');
while ($line = mysql_fetch_array($result)) {
$otohtmlcode = $line['htmlcode'];
echo str_replace('%oto_cost%',$oto['price'],
str_replace('%oto_interval%',$oto['pinterval'],
str_replace('%oto_points%',$oto['points'],
str_replace('%oto_banner_num%',$oto['banner_num'],
str_replace('%oto_banner_views%',$oto['banner_views'],
str_replace('%oto_button_num%',$oto['button_num'],
str_replace('%oto_button_views%',$oto['button_views'],
str_replace('%oto_text_num%',$oto['text_num'],
str_replace('%oto_text_views%',$oto['text_views'],
stripslashes($otohtmlcode))))))))));
}
}
function question ($type) {
if($type=='cronjobs') {
;echo '<span class="dropt" title=""><img src="../images/question.png"><span style="width: 425px;">
<img src="../images/cron.gif">
<br/><br/></span></span>
';
}
}
function add_delivered (){
mysql_query('update lifetimeadstats set delivered=delivered+1');
}
function adminsolo_sent ($counter) {
mysql_query("update lifetimeadstats set delivered=delivered+'".$counter."', admin_sent=admin_sent+'".$counter."'");
}
function listmailer_sent ($counter) {
mysql_query("update lifetimeadstats set delivered=delivered+'".$counter."', listmail_sent=listmail_sent+'".$counter."'");
}
function creditmail_sent ($counter) {
mysql_query("update lifetimeadstats set delivered=delivered+'".$counter."', creditmail_sent=creditmail_sent+'".$counter."'");
}
function refmail_sent ($counter) {
mysql_query("update lifetimeadstats set delivered=delivered+'".$counter."', refmail_sent=refmail_sent+'".$counter."'");
}
function textads_sent ($counter) {
mysql_query("update lifetimeadstats set delivered=delivered+'".$counter."', textlink_sent=textlink_sent+'".$counter."'");
}
function umemtype($r) {
$uid=mysql_query ("select userid, memtype from members where userid='".$r."'");
$uidresult=mysql_fetch_array($uid);
$user=$uidresult['memtype'];
return $user;
}
function getuname($r) {
$uid=mysql_query ("select name, userid from members where userid='".$r."'");
$uidresult=mysql_fetch_array($uid);
$user=$uidresult['name'];
return $user;
}
//function textquerymailer($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 5";
//$textsresult = mysql_query ($texts) or die ('Query failed 2');
//return $textsresult;
//}
function adearn($type,$userid,$memtype,$adid) {
global $userid,$protextearn,$jvtextearn,$superjvtextearn,$probannerearn,$jvbannerearn,$superjvbannerearn,$probuttonearn,$jvbuttonearn,$superjvbuttonearn,
$prolistmailearn,$jvlistmailearn,$superjvlistmailearn,$procmailearn,$jvcmailearn,$superjvcmailearn;
if($type==5) {
if ($memtype == 'PRO') {
$credits=$protextearn;
}elseif($memtype=='JV Member')  {
$credits=$jvtextearn;
}elseif ($memtype == 'SUPER JV') {
$credits=$superjvtextearn;
}
}
if($type==7) {
if ($memtype == 'PRO') {
$credits=$probannerearn;
}elseif($memtype=='JV Member')  {
$credits=$jvbannerearn;
}elseif ($memtype == 'SUPER JV') {
$credits=$superjvbannerearn;
}
}
if($type==8) {
if ($memtype == 'PRO') {
$credits=$probuttonearn;
}elseif($memtype=='JV Member')  {
$credits=$jvbuttonearn;
}elseif ($memtype == 'SUPER JV') {
$credits=$superjvbuttonearn;
}
}
if($type==20) {
if ($memtype == 'PRO') {
$credits=$prolistmailearn;
}elseif($memtype=='JV Member')  {
$credits=$jvlistmailearn;
}elseif ($memtype == 'SUPER JV') {
$credits=$superjvlistmailearn;
}
}
if($type==21) {
$getamountcredits = mysql_query("Select credits from adminemails where id='$adid' limit 1");
$credits = mysql_result($getamountcredits,0,'credits');
}
if($type==22) {
if ($memtype == 'PRO') {
$credits=$procmailearn;
}elseif($memtype=='JV Member')  {
$credits=$jvcmailearn;
}elseif ($memtype == 'SUPER JV') {
$credits=$superjvcmailearn;
}
}
return $credits;
}
function fetchuid($r) {
$uid=mysql_query ("select id, userid from members where userid='".$r."'");
$uidresult=mysql_fetch_array($uid);
$user=$uidresult['id'];
return $user;
}
function tbcolor2($i) {
if ($i%2) {
$bg='B8F500';
}else {
$bg='F5B800';
}
return $bg;
}
function mailfooter ($userid) {
global $domain,$sitename,$adminname,$adminaddress,$adminemail;
$getmemdata = mysql_query("select id, name, lastname, contact_email, userid, pword, ip from members where userid='".$userid."'") or die(mysql_error());
$id = mysql_result($getmemdata,0,'id');
$name = mysql_result($getmemdata,0,'name');
$lastname = mysql_result($getmemdata,0,'lastname');
$userid = mysql_result($getmemdata,0,'userid');
$pword = mysql_result($getmemdata,0,'pword');
$contact_email = mysql_result($getmemdata,0,'contact_email');
$ip = mysql_result($getmemdata,0,'ip');
//$textsresult = textquerymailer($userid);
//$text_row_count = mysql_num_rows($textsresult);
//if($text_row_count) {
$memtype = umemtype($userid);
$textearn=adearn(5,$userid,$memtype,'');
//$message .= "<span style=\"background-color: #FFFF00;\"><b>Click Text Links Below To Earn ".$textearn.' Credits Each!</b></span><br><br>';
$i=0;
//$message .= "<table bgcolor=#FFFFFF style=\"border: 0px solid rgb(0, 0, 0);\">";
//while($textinfo = mysql_fetch_array($textsresult)) {
$bg=tbcolor2($i);
$i=$i+1;
//$message .= '<tr><td bgcolor='.$bg.' align=center><b>'.$textinfo['subject']."</b></td></tr><tr><td><a href=\"".$domain.'/earn.php?t=5&u='.$id.'&adid='.$textinfo['id'].'&num='.$textinfo['num']."\">Click Here To Visit This Site And Earn Credits</a></td></tr>";
//if($message != '') $message = ''.$message.'<br>';
//$counter=$counter+1;
//}
//textads_sent ($counter);
//$message .= '</table>';
//}
//$message .='====================================================================<br>';
$message .='Here is the information you submitted when you joined.<br><br>';
$message .="First name: $name<br>";
$message .="Last name: $lastname<br>";
$message .="Username: $userid<br>";
$message .="Email Address: $contact_email<br>";
$message .="IP Number: $ip<br><br>";
$message .="Important: $sitename, nor any of it's agents,
representatives or employees,<br>are
responsible for the content or claims made by any of our advertisers.<br><br>";
$message .='It is your responsibilty to review each<br>offer and do your own due diligence.<br>';
$message .="$adminname<br>";
$message .="Admin, $sitename<br><br>";
$message .='This is a commercial email from:<br>';
$message .="$sitename<br>";
$message .="$adminaddress";
$message .="<br><br>====================================================================
<br>You are receiving this as you are a member of $sitename. You can opt out of<br>
receiving emails only by deleting your account, <a href=\"$domain/delete.php?userid=".$userid.'&code='.md5($pword)."\"><b>click here</b></a> to delete your account.<br>
====================================================================<br><br>
$sitename<br>
$adminaddress";
return $message;
}
function sendoutmail ($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';
require_once '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 testemailsetting ($testcontact,$testname,$testsubject,$testmessage) {
global $adminemail,$sitename,$adminname,$smtp_host,$smtp_username,$smtp_password,$smtp_port,$smtp_secure,$smtp_enabled;
if($smtp_enabled == 1 ||$smtp_enabled == 2 ||$smtp_enabled == 3 ||$smtp_enabled == 4) {
require_once 'inc/PHPMailer/class.phpmailer.php';
$mail = new PHPMailer;
if($smtp_secure==1) {
$sslsecure='ssl';
}else $sslsecure='tls';
if($smtp_enabled == 1) {
$mail->IsSMTP();
$testsubject='SMTP Test Subject';
$testmessage='SMTP Test Body';
}elseif($smtp_enabled == 2) {
$mail->IsMail();
$testsubject='Mail () Test Subject';
$testmessage='Mail () Test Body';
}elseif($smtp_enabled == 3) {
$mail->IsSendmail();
$testsubject='Sendmail Test Subject';
$testmessage='Sendmail Test Body';
}elseif($smtp_enabled == 4) {
$mail->IsQmail();
$testsubject='QMail Test Subject';
$testmessage='Qmail Test Body';
}
$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($testcontact,$testname);
$mail->AddReplyTo($adminemail,$adminname);
$mail->WordWrap = 50;
$mail->IsHTML(true);
$subject='Test';
$message='Test Body';
$mail->Subject = $testsubject;
$mail->Body    = $testmessage;
$mail->AltBody = $testmessage;
$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) {
$testsubject='Default Mail Test Subject';
$testmessage='Default Test Body';
$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($testcontact,$testsubject,$testmessage,$headers,"-f $adminemail")
or print 'Failed to send email.';
}
}
function truncat($text,$numb) {
if (strlen($text) >$numb) {
$text = substr($text,0,$numb);
$text = substr($text,0,strrpos($text,' '));
$etc = ' ...';
$text = $text.$etc;
}
return $text;
}
function expandable () {
;echo '<script type="text/javascript" src="../jscripts/txt.js"></script>
<!-- flooble Expandable Content header start -->
<script language="javascript">
// Expandable content script from flooble.com.
// For more information please visit:
//   http://www.flooble.com/scripts/expand.php
// Copyright 2002 Animus Pactum Consulting Inc.
//----------------------------------------------
var ie4 = false; if(document.all) { 
ie4 = true;
 }
function getObject(id) { 
if (ie4) { 
return document.all[id];
 } else { 
return document.getElementById(id);
 } 
}
function toggle(link, divId) { 
var lText = link.innerHTML; 
var d = getObject(divId);
 if (lText == \'Show\') { 
link.innerHTML = \'Hide\'; 
d.style.display = \'block\'; 
}
 else { 
link.innerHTML = \'Show\'; 
d.style.display = \'none\'; 
} 
}




function showadminlinks(str)
{
if (str=="")
  {
  document.getElementById("displayadminlinks").innerHTML="";
  return;
  }
if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
    document.getElementById("displayadminlinks").innerHTML=xmlhttp.responseText;
    }
  }
xmlhttp.open("GET","ad_refresh.php?adtype="+str,true);
xmlhttp.send();
}






function showtextlinks(str)
{
if (str=="")
  {
  document.getElementById("displaytextlinks").innerHTML="";
  return;
  }
if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
    document.getElementById("displaytextlinks").innerHTML=xmlhttp.responseText;
    }
  }
xmlhttp.open("GET","ad_refresh.php?adtype="+str,true);
xmlhttp.send();
}



function showbannerlinks(str)
{
if (str=="")
  {
  document.getElementById("displaybannerlinks").innerHTML="";
  return;
  }
if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
    document.getElementById("displaybannerlinks").innerHTML=xmlhttp.responseText;
    }
  }
xmlhttp.open("GET","ad_refresh.php?adtype="+str,true);
xmlhttp.send();
}


function showbuttonlinks(str)
{
if (str=="")
  {
  document.getElementById("displaybuttonlinks").innerHTML="";
  return;
  }
if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
    document.getElementById("displaybuttonlinks").innerHTML=xmlhttp.responseText;
    }
  }
xmlhttp.open("GET","ad_refresh.php?adtype="+str,true);
xmlhttp.send();
}


function showmcredit(str)
{
if (str=="")
  {
  document.getElementById("displaymcredit").innerHTML="";
  return;
  }
if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
    document.getElementById("displaymcredit").innerHTML=xmlhttp.responseText;
    }
  }
xmlhttp.open("GET","ad_refresh.php?adtype="+str,true);
xmlhttp.send();
}

</script>
<!-- flooble Expandable Content header end   -->

';
}
function chartclose($type) {
$closechart="<script language=\"javascript\">toggle(getObject('".$type."_link'), '$type');</script>";
return $closechart;
}
function openchart($type) {
$chart="<div id=\"$type\" style=\"padding: 0px;\">";
$chart .="<div style=\"width: 609px; height: 100%; padding: 4px; overflow:auto; border-style: solid; border-size: 1px; border-color: #000000; background: #ffffff;\">";
return $chart;
}
function compareclose() {
$closechart="<script language=\"javascript\">toggle(getObject('compare_link'), 'compare');</script>";
return $closechart;
}
function opencompare() {
$chart="<div id=\"compare\" style=\"padding: 0px;\">";
return $chart;
}
function tbcolor($i) {
if ($i%2) {
$bg='E5ECFF';
}else {
$bg='A8BFFF';
}
return $bg;
}
function deletead() {
;echo '<script>
function deletebanner(url,name,id){
var conBox = confirm("Are you sure you want to delete this banner? " + name);
if(conBox){
location.href="';echo $_SERVER['PHP_SELF'];;echo '?id="+ id + "&url="+ url + "&action=deletebanner";
}else{
return;
}
}
</script>

<script>
function deletebuttons(url,name,id){
var conBox = confirm("Are you sure you want to delete this button banner? " + name);
if(conBox){
location.href="';echo $_SERVER['PHP_SELF'];;echo '?id="+ id + "&url="+ url + "&action=deletebutton";
}else{
return;
}
}
</script>

<script>
function deletetlinks(tlinksurl,name,id){
var conBox = confirm("Are you sure you want to delete this text link? " + name);
if(conBox){
location.href="';echo $_SERVER['PHP_SELF'];;echo '?id="+ id + "&tlinksurl="+ tlinksurl + "&action=deletetlink";
}else{
return;
}
}
</script>


<script>
function deleteAlert(adminurl,id){
var conBox = confirm("Are you sure you want to delete: " + adminurl);
if(conBox){
location.href="';echo $_SERVER['PHP_SELF'];;echo '?id="+ id + "&adminurl="+ adminurl + "&action=deletesite";
}else{
return;
}
}
</script>

';
}
function validate() {
;echo '<script type="text/javascript">

function AuthorizeValidation(myform) {

if(myform.terms.checked == true) {myform.validation.disabled = false }

if(myform.terms.checked == false) {myform.validation.disabled = true }

}
</script>  
';
}
function checkbox() {
;echo '<script language="JavaScript">
 function Inverse(form)
   {
    len = form.elements.length;
    var i=0;
    for( i=0; i<len; i++)
    {
     if (form.elements[i].type==\'checkbox\' )
     {
      form.elements[i].checked = !form.elements[i].checked;
     }
    }
	return false;
   }		
</script>
';
}
function validationadmin () {
;echo '<table align="center" bgcolor="#FFFFFF" style="width: 600px; margin-left: auto; margin-right: auto; border: 1px solid rgb(0, 0, 0);" align="center" cellpadding="5" cellspacing="1">
<tr>
<td><img src="../images/manwithsign.png"></td>

<td>
<div align=left>
';
if ($_POST['new_fullname'] &&$_POST['new_lastname']) {
echo "<img src=\"../images/greenbullet.png\"> <font size=3 face='verdana' color='#000000'><b>Full Name: ".$_POST['new_fullname'].' '.$_POST['new_lastname'].'</b></font><br />';
}
if ($_POST['new_contact']) {
echo "<img src=\"../images/greenbullet.png\"> <font size=3 face='verdana' color='#000000'><b>Contact Email: ".$_POST['new_contact'].'</b></font><br />';
}
if ($_POST['new_userid']) {
echo "<img src=\"../images/greenbullet.png\"> <font size=3 face='verdana' color='#000000'><b>Username: ".$_POST['new_userid'].'</b></font><br />';
}
if ($_POST['new_password']) {
echo "<img src=\"../images/greenbullet.png\"> <font size=3 face='verdana' color='#000000'><b>Password: ".$_POST['new_password'].'</b></font><br />';
}
if ($_POST['paypal_email']) {
echo "<img src=\"../images/greenbullet.png\"> <font size=3 face='verdana' color='#000000'><b>Paypal: ".$_POST['paypal_email'].'</b></font><br />';
}
if ($_POST['payza_email']) {
echo "<img src=\"../images/greenbullet.png\"> <font size=3 face='verdana' color='#000000'><b>Payza: ".$_POST['payza_email'].'</b></font><br />';
}
if ($_POST['terms']) {
echo "<img src=\"../images/greenbullet.png\"> <font size=3 face='verdana' color='#000000'><b>You Agreed To Terms...</b></font><br />";
}
;echo '</div>
</td></tr>
<tr><td colspan=2>
<br><br><br>
<table align=center width=550><tr><td>
<font size=2 face="verdana" color="#2E2E2E"><b>Send the information along to the member if necessary.</b><br><br><br>
</td></tr>
</table>
</td></tr>
</table>
';
}
function validationmessage () {
global $adminemail;
;echo '<table align="center" bgcolor="#FFFFFF" style="width: 800px; margin-left: auto; margin-right: auto; border: 1px solid rgb(0, 0, 0);" align="center" cellpadding="5" cellspacing="1">
<tr>
<td><img src="images/manwithsign.png"></td>

<td>
<div align=left>
';
if ($_POST['new_fullname'] &&$_POST['new_lastname']) {
echo "<img src=\"images/greenbullet.png\"> <font size=3 face='verdana' color='#000000'><b>Full Name: ".$_POST['new_fullname'].' '.$_POST['new_lastname'].'</b></font><br />';
}
if ($_POST['new_contact']) {
echo "<img src=\"images/greenbullet.png\"> <font size=3 face='verdana' color='#000000'><b>Contact Email: ".$_POST['new_contact'].'</b></font><br />';
}
if ($_POST['new_userid']) {
echo "<img src=\"images/greenbullet.png\"> <font size=3 face='verdana' color='#000000'><b>Username: ".$_POST['new_userid'].'</b></font><br />';
}
if ($_POST['new_password']) {
echo "<img src=\"images/greenbullet.png\"> <font size=3 face='verdana' color='#000000'><b>Password: ".$_POST['new_password'].'</b></font><br />';
}
if ($_POST['paypal_email']) {
echo "<img src=\"images/greenbullet.png\"> <font size=3 face='verdana' color='#000000'><b>Paypal: ".$_POST['paypal_email'].'</b></font><br />';
}
if ($_POST['payza_email']) {
echo "<img src=\"images/greenbullet.png\"> <font size=3 face='verdana' color='#000000'><b>Payza: ".$_POST['payza_email'].'</b></font><br />';
}
if ($_POST['terms']) {
echo "<img src=\"images/greenbullet.png\"> <font size=3 face='verdana' color='#000000'><b>You Agreed To Terms...</b></font><br />";
}
;echo '</div>
</td></tr>
<tr><td colspan=2>
<br><br><br>
<table align=center width=550><tr><td>
<font size=2 face="verdana" color="#2E2E2E"><b>
		Please whitelist ';echo $adminemail;;echo ' to ensure that you can verify your account. Check your bulk/spam folder if you don\'t see it in your inbox. If you haven\'t received the verification email within an hour, contact us.<br /><br />
		ALL Unverified (even paid) accounts will be deleted after 24 hours.<br /><br />
		You will not be able to access your account until you verify your email.  </b>
		
		<br><br><br>
</td></tr>
</table>
</td></tr>
</table>
';
}
function checknewuser() {
;echo '<script type="text/javascript" src="../jscripts/jquery.js"></script>
<script type="text/javascript">
$(document).ready(function() {
    $(\'#feedback\').load(\'../inc/check.php\').show();

    $(\'#usercheck\').keyup(function() {
      $.post(\'../inc/check.php\', { userid: myform.new_userid.value  },
         function(result)  {
             $(\'#feedback\').html(result).show();
           } );
     
    } );

} );
</script>
';
}
function checknewemail() {
;echo '<script type="text/javascript" src="../jscripts/jquery.js"></script>
<script type="text/javascript">
$(document).ready(function() {
    $(\'#feedback2\').load(\'../inc/check2.php\').show();

    $(\'#usercheck2\').keyup(function() {
      $.post(\'../inc/check2.php\', { contact_email: myform.new_contact.value  },
         function(result)  {
             $(\'#feedback2\').html(result).show();
           } );
     
    } );

} );
</script>
';
}
function check() {
;echo '<script type="text/javascript" src="jscripts/jquery.js"></script>
<script type="text/javascript">
$(document).ready(function() {
    $(\'#feedback\').load(\'inc/check.php\').show();

    $(\'#usercheck\').keyup(function() {
      $.post(\'inc/check.php\', { userid: myform.new_userid.value  },
         function(result)  {
             $(\'#feedback\').html(result).show();
           } );
     
    } );

} );
</script>
';
}
function check2() {
;echo '<script type="text/javascript" src="jscripts/jquery.js"></script>
<script type="text/javascript">
$(document).ready(function() {
    $(\'#feedback2\').load(\'inc/check2.php\').show();

    $(\'#usercheck2\').keyup(function() {
      $.post(\'inc/check2.php\', { contact_email: myform.new_contact.value  },
         function(result)  {
             $(\'#feedback2\').html(result).show();
           } );
     
    } );

} );
</script>
';
}
function preview() {
;echo '<script language="javascript" type="text/javascript">
function checkKeyPress(message, MaxLen, e)
{
   if (window.event)
   {
      if (window.event.keyCode == 8)
      {
         return true;
      }
   }
   else if (e)
   {
      if (e.keyCode == 8)
      {
         return true;
      }
   }
  return (message.value.length <= MaxLen);
}
</script>

<script language="JavaScript">
 function Inverse(form)
   {
    len = form.elements.length;
    var i=0;
    for( i=0; i<len; i++)
    {
     if (form.elements[i].type==\'checkbox\' )
     {
      form.elements[i].checked = !form.elements[i].checked;
     }
    }
	return false;
   }		
</script>
<!-- tinyMCE -->
		<script language="javascript" type="text/javascript" src="../jscripts/tiny_mce/tiny_mce.js"></script>
		<script language="javascript" type="text/javascript">
		tinyMCE.init({
			mode : "textareas",
			theme : "advanced",
		plugins : "autolink,lists,pagebreak,style,layer,table,save,advhr,advimage,advlink,preview,contextmenu,paste,nonbreaking,wordcount,advlist",


                        theme_advanced_buttons1 : "bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,styleselect,formatselect,fontselect,fontsizeselect",
		theme_advanced_buttons2 : "copy,paste,pastetext,pasteword,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor",
		theme_advanced_toolbar_location : "top",
		theme_advanced_toolbar_align : "left",
		
			extended_valid_elements : "a[href|target|name],font[face|size|color|style],span[class|align|style],form[action|method],select[name],input[type|name|value|src|alt|border],option[value]"
		});
		</script>
		<!-- /tinyMCE -->
<SCRIPT LANGUAGE="JavaScript">
	                    function previewad(htmlcode)
	                    {
	                    var win
	                    win = window.open("", "win", "height=700,width=700,toolbar=no,directories=no,menubar=no,scrollbars=yes,resizable=yes,dependent=yes\'");
	                    win.document.clear();
						win.document.write(htmlcode);
	                    win.focus();
	                    win.document.close();
	                    }
	                    </SCRIPT>

';
}
function colorpick () {
;echo '<script type="text/javascript" src="../jscripts/jscolor/jscolor.js"></script>
';
}
function checkforworddoc ($message) {
$badstring='<!--[if gte mso 9]>';
if (substr($message,0,19) == $badstring) 
{
echo "<div align=center><font color=BLACK><b>You are not allowed to post directly from word document,<br>please use the paste from word button in the html editor.</b><br><a href=\"\">Go Back</a></font></div>";
exit;
}
};
?>