Просмотр файла MyLounge/myred/clients.php

Размер файла: 24.03Kb
<?php
include("include/vars.php");
require("include/functions.php");
$lang=setlanguage();
require("language/$lang");
$menu=setmenu();

if (!$do) {
	$do="login";
	}

if ($do=='pass') {
$main.="<table cellspacing=\"1\" cellpadding=\"3\" border=\"0\" width=\"500\" align=\"center\">
<tr>
<td>$text_128</td>
</tr>
  </table>
<form action=\"clients.php\" method=\"post\">
<table cellspacing=\"1\" cellpadding=\"3\" border=\"0\" width=\"500\" align=\"center\">
<td>$text_133</td>
<td><input type=\"text\" name=\"userid\" maxlength=\"100\"></td>
</tr>
<tr>
<td colspan=\"2\" align=\"center\">
<input type=\"hidden\" name=\"do\" value=\"sendpasswd\">
<input type=\"submit\" name=\"submit\" value=\"$text_77\">
<input type=\"reset\" value=\"reset\"></td>
</tr>
</table>
</form>";

$template = new MyredTemplate("template/template.html");
$template->assign("TITLE", $pagetitle);
$template->assign("MENU", $menu);
$template->assign("MAIN", $main);
$template->myred_print() or die($template->error);
exit;
}

if ($do=='sendpasswd') {
 	if (!$userid) {
		errormsg($text_129);
		exit;
	}
	$passwd_result=mysql_query("SELECT * FROM $advertiser_table WHERE userid='$userid'");
 	if (mysql_num_rows($passwd_result) < 1) {
		errormsg($text_130);
		exit;
	}
	$passwd_array=mysql_fetch_array($passwd_result);
	$cname=$passwd_array[realname];
	$mail = $passwd_array[email];
	$passwd = $passwd_array[password];
	$ip = getenv("REMOTE_ADDR");
	$subject = "$cname$text_131";
	$message="$text_132$passwd";
	mail($mail,$subject,$message,"From: $adminmail\nReply-To: $adminmail"); 

$main="<table cellspacing=\"1\" cellpadding=\"3\" border=\"0\" width=\"500\" align=\"center\">
<tr>
<td>
<p>$text_134</p>
</td>
</tr>
</table>";

$template = new MyredTemplate("template/template.html");
$template->assign("TITLE", $pagetitle);
$template->assign("MENU", $menu);
$template->assign("MAIN", $main);
$template->myred_print() or die($template->error);
exit;
}

if ($do == 'signup') {

$main="<table cellspacing=\"1\" cellpadding=\"3\" border=\"0\" width=\"400\" align=\"center\">
<tr>
<td>$text_135</td>
</tr>
</table>
<form action=\"clients.php\" method=\"post\">
<table cellspacing=\"1\" cellpadding=\"3\" border=\"0\" width=\"400\" align=\"center\">
<tr>
<td>* $text_136</td>
<td><input type=\"text\" name=\"cname\" maxlength=\"55\"></td>
</tr>
<tr>
<td>$text_27</td>
<td><input type=\"text\" name=\"mail\" maxlength=\"50\"></td>
</tr>
<tr>
<td colspan=\"2\">$text_28</td>
</tr>
<tr>
<td>* $text_137</td>
<td><input type=\"text\" name=\"street\" maxlength=\"150\"></td>
</tr>
<tr>
<td>* $text_138</td>
<td><input type=\"text\" name=\"zip\" maxlength=\"15\"></td>
</tr>
<tr>
<td>* $text_139</td>
<td><input type=\"text\" name=\"town\" maxlength=\"50\"></td>
</tr>
<tr>
<td>* $text_140</td>
<td><input type=\"text\" name=\"country\" maxlength=\"50\"></td>
</tr>
<tr>
<td colspan=\"2\"><input type=\"checkbox\" name=\"terms\" style=\"border:none\">$text_141</td>
</tr>
<tr>
<td colspan=\"2\" align=\"center\">
<input type=\"hidden\" name=\"do\" value=\"do_signup\">
<input type=\"submit\" name=\"sent\" value=\"$text_1\">
<input type=\"reset\" value=\"reset\">
</td>
</tr>
</table>
</form>";

$template = new MyredTemplate("template/template.html");
$template->assign("TITLE", $pagetitle);
$template->assign("MENU", $menu);
$template->assign("MAIN", $main);
$template->myred_print() or die($template->error);
exit;
}

if ($do == 'do_signup') {
	if (!$cname) {
		$login_error="$text_142<br>";
	}
	if (!$mail || verify_email($mail)!=1) {
		$login_error.="$text_41<br>";
	}
	if (!$street) {
		$login_error.="$text_143<br>";
	}
	if (!$zip) {
		$login_error.="$text_144<br>";
	}
	if (!$town) {
		$login_error.="$text_145<br>";
	}
	if (!$country) {
		$login_error.="$text_146<br>";
	}
	if ($terms != "on") {
		$login_error.="$text_147<br>";
	}
// Do a check wether the emailaddress has been used before
	$checkmail=mysql_query("SELECT * FROM $advertiser_table WHERE email='$mail'");
	if(mysql_num_rows($checkmail) > 0) {
		$login_error.="$text_148<br>";
	}
	if (!$login_error) {
	$password = randomstring(6);
	$date = time();
	$ip = getenv("REMOTE_ADDR");
	mysql_query("INSERT INTO $advertiser_table(password, realname, email, address, zipcode, town, country, regdate, ip) VALUES ('$password', '$cname', '$mail', '$street', '$zip', '$town', '$country', '$date', '$ip')"); 
// Get the userID
	$userid=mysql_fetch_array(mysql_query("SELECT * FROM $advertiser_table WHERE email='$mail'"));
	$userid=$userid[userid];
// Send the mail
	$subject = "$text_45 $cname!";
	$message = "$text_149 $userid
$text_60 $password

$text_150";
	mail($mail,$subject,$message,"From: $adminmail\nReply-To: $adminmail"); 
// Send a second mail to the webmaster
	$subject1 = "An adclient has registered at your website!";
	$message1 = "An adclient has registered at your website!

Here is the data we got from him:

UserID: $userid
Company name: $cname
Email: $mail
Street: $street
Zip-Code: $zip
Town: $town
Country: $country
Registrants IP: $ip
";
	mail($adminmail,$subject1,$message1,"From: $adminmail\nReply-To: $adminmail"); 

$main="<table cellspacing=\"1\" cellpadding=\"3\" border=\"0\" width=\"400\" align=\"center\">
<tr>
<td>
<p>$text_153</p>
<p>$text_154 <b>$userid</b><br>
<p>$text_155</p>
<p>$text_46</p>
</td>
</tr>
</table>";

$template = new MyredTemplate("template/template.html");
$template->assign("TITLE", $pagetitle);
$template->assign("MENU", $menu);
$template->assign("MAIN", $main);
$template->myred_print() or die($template->error);
exit;
	}
	else {
		errormsg($login_error);	
		exit;
	}
}

if ($do=='do_login') {
	if($userid=="") {
		errormsg($text_156);
		exit;
		}
	if($passwd=="") {
		errormsg($text_157);
		exit;
		}
	$login_query = mysql_query("SELECT * FROM $advertiser_table WHERE userid='$userid'");
		$num_rows = mysql_num_rows($login_query);
    		if ($num_rows < 1) {
		errormsg($text_158);
		exit;
		}
	$result_query=mysql_fetch_array($login_query);
	if ($result_query[password] != $passwd) {
		errormsg($text_159);
		exit;
	}
session_start();
session_register("userid_login");
session_register("password_login");
session_register("cname_login");
session_register("email_login");
$userid_login=$userid;
$password_login=$passwd;
$cname_login=$result_query[realname];
$email_login=$result_query[email];
	$do="main";
}

if ($do == 'change') {
	session_start();
	checksession();
	$showclient=mysql_query("SELECT * FROM $advertiser_table WHERE userid='$userid_login'");
	if (mysql_num_rows($showclient) < 1) {
		errormsg("Unknown error.");
		exit;
	}
	$client_array=mysql_fetch_array($showclient);
	$cname = $client_array[realname];
	$address = $client_array[address];
	$mail = $client_array[email];
	$password = $client_array[password];
	$zipcode = $client_array[zipcode];
	$town = $client_array[town];
	$country = $client_array[country];

$main="<table cellspacing=\"1\" cellpadding=\"3\" border=\"0\" width=\"400\" align=\"center\">
<tr>
<td>$text_160</td>
</tr>
</table>
<form action=\"clients.php?do=do_change\" method=\"post\">
<table cellspacing=\"1\" cellpadding=\"3\" border=\"0\" width=\"400\" align=\"center\">
<tr>
<td>* $text_136</td>
<td><input type=\"text\" name=\"cname\" maxlength=\"55\" value=\"$cname\"></td>
</tr>
<tr>
<td>* $text_54</td>
<td><input type=\"text\" name=\"mail\" maxlength=\"50\" value=\"$mail\"></td>
</tr>
<tr>
<td colspan=\"2\">$text_161</td>
</tr>
<tr>
<td colspan=\"2\"><td>&nbsp;</td>
</tr>
<tr>
<td colspan=\"2\">$text_72</td>
</tr>
<tr>
<td>$text_73</td>
<td><input type=\"password\" name=\"passwd1\" maxlength=\"25\"></td>
</tr>
<tr>
<td>$text_74</td>
<td><input type=\"password\" name=\"passwd2\" maxlength=\"25\"></td>
</tr>
<tr>
<td colspan=\"2\"><td>&nbsp;</td>
</tr>
<tr>
<td>* $text_137</td>
<td><input type=\"text\" name=\"street\" maxlength=\"150\" value=\"$address\"></td>
</tr>
<tr>
<td>* $text_138</td>
<td><input type=\"text\" name=\"zip\" maxlength=\"15\" value=\"$zipcode\"></td>
</tr>
<tr>
<td>* $text_139</td>
<td><input type=\"text\" name=\"town\" maxlength=\"50\" value=\"$town\"></td>
</tr>
<tr>
<td>* $text_140</td>
<td><input type=\"text\" name=\"country\" maxlength=\"50\" value=\"$country\"></td>
</tr>
<tr>
<td colspan=\"2\" align=\"center\">
<input type=\"submit\" name=\"sent\" value=\"$text_75\">
<input type=\"reset\" value=\"reset\">
</td>
</tr>
<tr>
<td colspan=\"2\"><td>&nbsp;</td>
</tr>
</table>
<table cellspacing=\"1\" cellpadding=\"3\" border=\"0\" align=\"center\">
<tr>
<td>
<p><b><a href=\"clients.php?do=main\">$text_162</a></b></p>
</td>
</tr>
</table>
</form>";

$template = new MyredTemplate("template/template.html");
$template->assign("TITLE", $pagetitle);
$template->assign("MENU", $menu);
$template->assign("MAIN", $main);
$template->myred_print() or die($template->error);
exit;
}
if ($do=='do_change') {
	session_start();
	checksession();
	if (!$cname) {
		$change_error="$text_142<br>";
	}
	if (!$mail || verify_email($mail)!=1) {
		$change_error.="$text_41<br>";
	}
	if ($passwd1 != $passwd2) {
		$change_error.="$text_63<br>";
	}
	if (!$street) {
		$change_error="$text_143<br>";
	}
	if (!$zip) {
		$change_error="$text_144<br>";
	}
	if (!$town) {
		$change_error="$text_145<br>";
	}
	if (!$country) {
		$change_error="$text_146<br>";
	}
	if ($change_error) {
		errormsg($change_error);	
		exit;
	}	
	if ($passwd1!="") {
		$password_login=$passwd1;
	}
	$cname_login=$cname;
	$email_login=$mail;
	mysql_query("UPDATE $advertiser_table SET realname='$cname_login',password='$password_login',email='$email_login',address='$street',zipcode='$zip',town='$town',country='$country' WHERE userid='$userid_login'") or die (mysql_error());
	$client_result=$text_65;
	$do="main";
}

if ($do=='ordernew') {
	session_start();
	checksession();

$main="<form action=\"clients.php?do=orderprev\" method=\"post\">
<table cellspacing=\"1\" cellpadding=\"3\" border=\"0\" width=\"400\" align=\"center\">
<tr>
<td colspan=\"2\">
<p>$text_163<br></p>
</td>
</tr>
<tr>
<td><br>$text_136</td>
<td>
<br><b>$cname_login</b></td>
</tr>
<tr>
<td colspan=\"2\">&nbsp;</td>
</tr>
<tr>
<td>$text_164 (<a href=\"javascript:openwindow('help.php?do=link');\">$text_13</a>):</td>
<td><input type=\"text\" name=\"link\" maxlength=\"200\" value=\"http://\"></td>
</tr>
<tr>
<td>$text_165 (<a href=\"javascript:openwindow('help.php?do=linktext');\">$text_13</a>):</td>
<td><input type=\"text\" name=\"linktext\" maxlength=\"270\"></td>
</tr>
<tr>
<td>$text_166 (<a href=\"javascript:openwindow('help.php?do=addittext');\">$text_13</a>):</td>
<td><input type=\"text\" name=\"addittext\" maxlength=\"270\"></td>
</tr>
<tr>
<td>$text_167 (<a href=\"javascript:openwindow('help.php?do=adtype');\">$text_13</a>):</td>
<td>
<input type=\"text\" name=\"hitsviews\" maxlength=\"10\">
<select name=\"ad_type\">
<option value=\"hits\">hits</option>
<option value=\"views\">views</option>
</select>
</td>
</tr>
</table>
<table cellspacing=\"1\" cellpadding=\"3\" border=\"0\" align=\"center\">
<tr>
<td>
<input type=\"submit\" name=\"submit\" value=\"$text_168\">
<input type=\"reset\" value=\"reset\">
</td>
</tr>
<tr>
<td colspan=\"2\"><td>&nbsp;</td>
</tr>
<tr>
<td colspan=\"2\" align=\"center\">
<b><a href=\"clients.php?do=main\">$text_162</a></b>
</td>
</tr>
</table>
</form>";

$template = new MyredTemplate("template/template.html");
$template->assign("TITLE", $pagetitle);
$template->assign("MENU", $menu);
$template->assign("MAIN", $main);
$template->myred_print() or die($template->error);
exit;
}

if ($do=='orderprev') {
	session_start();
	checksession();
	if ($link=="http://" || $link=="") {
		$preview_error="$text_169<br>";
	}
	if (!$linktext) {
		$preview_error.="$text_170<br>";
	}
	if (!$addittext) {
		$preview_error.="$text_171<br>";
	}
	if (!$hitsviews) {
		$preview_error.="$text_172<br>";
	}
	if ($preview_error) {
		errormsg($preview_error);
		exit;
	}

$main="<table cellspacing=\"1\" cellpadding=\"3\" border=\"0\" align=\"center\">
<tr>
<td>
<p>$text_173</p>
</td>
</tr>
</table>
<table cellspacing=\"1\" cellpadding=\"3\" border=\"1\" width=\"100%\" align=\"center\">
<tr>
<td><font size=\"2\"><div align=\"center\"><a href=\"$link\" target=\"_blank\"><b>$linktext</b></a> $addittext</td>
</tr>
</table>
<form action=\"clients.php?do=do_order\" method=\"post\">
<table cellspacing=\"1\" cellpadding=\"3\" border=\"0\" width=\"400\" align=\"center\">
<tr>
<td><p>$text_174 <b>$ad_type</b>: $hitsviews</p></td>
</tr>
<tr>
<td><p>$text_175</p></td>
</tr>
<tr>
<td><p>$text_176
<textarea cols=\"40\" rows=\"5\" name=\"addinfo\">
</textarea>
</p></td>
</tr>
<tr>
<td><input type=\"checkbox\" name=\"adrules\" style=\"border:none\">$text_141</td>
</tr>
</table>
<table cellspacing=\"1\" cellpadding=\"3\" border=\"0\" align=\"center\">
<tr>
<td>
<input type=\"hidden\" name=\"link\" value=\"$link\">
<input type=\"hidden\" name=\"linktext\" value=\"$linktext\">
<input type=\"hidden\" name=\"addittext\" value=\"$addittext\">
<input type=\"hidden\" name=\"hitsviews\" value=\"$hitsviews\">
<input type=\"hidden\" name=\"ad_type\" value=\"$ad_type\">
<input type=\"hidden\" name=\"do\" value=\"do_order\">
<input type=\"submit\" name=\"submit\" value=\"$text_177\">
</td>
</tr>
</table>
</form>
<form action=\"clients.php?do=orderprev\" method=\"post\">
<table cellspacing=\"1\" cellpadding=\"3\" border=\"0\" width=\"400\" align=\"center\">
<tr>
<td colspan=\"2\">
<p>$text_178</p>
</td>
</tr>
<tr>
<td><br>$text_136</td>
<td>
<br><b>$cname_login</b></td>
</tr>
<tr>
<td colspan=\"2\">&nbsp;</td>
</tr>
<tr>
<td>$text_164 (<a href=\"javascript:openwindow('help.php?do=link');\">$text_13</a>):</td>
<td><input type=\"text\" name=\"link\" maxlength=\"200\" value=\"$link\"></td>
</tr>
<tr>
<td>$text_165 (<a href=\"javascript:openwindow('help.php?do=linktext');\">$text_13</a>):</td>
<td><input type=\"text\" name=\"linktext\" maxlength=\"270\" value=\"$linktext\"></td>
</tr>
<tr>
<td>$text_166 (<a href=\"javascript:openwindow('help.php?do=addittext');\">$text_13</a>):</td>
<td><input type=\"text\" name=\"addittext\" maxlength=\"270\" value=\"$addittext\"></td>
</tr>
<tr>
<td>$text_167 (<a href=\"javascript:openwindow('help.php?do=adtype');\">$text_13</a>):</td>
<td>
<input type=\"text\" name=\"hitsviews\" maxlength=\"10\" value=\"$hitsviews\">
<select name=\"ad_type\">
<option value=\"hits\">hits</option>
<option value=\"views\">views</option>
<option value=\"$ad_type\" selected>$ad_type</option>
</select>
</td>
</tr>
</table>
<table cellspacing=\"1\" cellpadding=\"3\" border=\"0\" align=\"center\">
<tr>
<td>
<input type=\"submit\" name=\"submit\" value=\"$text_168\">
<input type=\"reset\" value=\"reset\">
</td>
</tr>
<tr>
<td colspan=\"2\"><td>&nbsp;</td>
</tr>
<tr>
<td colspan=\"2\" align=\"center\">
<b><a href=\"clients.php?do=main\">$text_162</a></b>
</td>
</tr>
</table>
</form>";

$template = new MyredTemplate("template/template.html");
$template->assign("TITLE", $pagetitle);
$template->assign("MENU", $menu);
$template->assign("MAIN", $main);
$template->myred_print() or die($template->error);
exit;
}

if ($do=='do_order') {
	session_start();
	checksession();
	if($adrules=="") {
	errormsg($text_147);
	exit;
	}
// We don't need to check a lot(the website-admin has to review the order anyway.)
	if ($ad_type=="views") {
		mysql_query("INSERT INTO $adverts_table (userid, adlink, linktext, adtext, maxviews) VALUES ('$userid_login','$link','$linktext','$addittext','$hitsviews')");
	}
	if ($ad_type=="hits") {
		mysql_query("INSERT INTO $adverts_table (userid, adlink, linktext, adtext, maxhits) VALUES ('$userid_login','$link','$linktext','$addittext','$hitsviews')");
	}
// Mail to client and admin
// Send the mail to client
	$subject = $text_179;
	$message = "$text_180
$text_164: $link
$text_165: $linktext
$text_166: $addittext
$text_167: $hitsviews $text_174 $ad_type

$text_181";
	mail($email_login,$subject,$message,"From: $adminmail\nReply-To: $adminmail"); 
// Send a second mail to the webmaster
	$subject1 = "$cname_login has ordered an advert.";
	$message1 = "$cname_login has ordered an advert.

$cname_login UserID: $userid_login
Link: $link
Linktext: $linktext
Additional text: $addittext
Number: $hitsviews maximum $ad_type

$addinfo";
	mail($adminmail,$subject1,$message1,"From: $adminmail\nReply-To: $adminmail"); 
	$client_result=$text_183;
	$do="main";
}

if ($do == 'adstats') {
	session_start();
	checksession();

$main="<table cellspacing=\"1\" cellpadding=\"3\" border=\"0\" width=\"500\" align=\"center\">
<tr>
<td>&nbsp;</td>
</tr>
<tr>
<td>";
	$listresult=mysql_query("SELECT * FROM $adverts_table WHERE active='$active' AND userid='$userid_login' ORDER BY adid");
	$countadvert=mysql_num_rows($listresult);
	if ($countadvert < 1) {
		$main.="$text_184<br>";
	} else {
		while($rowadvert=mysql_fetch_array($listresult)) {
			$adid=$rowadvert[adid];
			$main.="ID: $adid ($rowadvert[linktext]...) <a href=\"clients.php?do=adstats2&adid=$adid\">$text_7</a><br>";
		}
	}

$main.="</td>
</tr>
<tr>
<td>&nbsp;</td>
</tr>
<tr>
<td align=\"center\">
<p><b><a href=\"clients.php?do=main\">$text_162</a></b></p>
</td>
</tr>
</table>";

$template = new MyredTemplate("template/template.html");
$template->assign("TITLE", $pagetitle);
$template->assign("MENU", $menu);
$template->assign("MAIN", $main);
$template->myred_print() or die($template->error);
exit;
}

if ($do=='adstats2') {
	session_start();
	checksession();
	$adstats_query=mysql_query("SELECT * FROM $adverts_table WHERE adid='$adid' AND userid='$userid_login'");
	if (mysql_num_rows($adstats_query) < 1) {
		errormsg($text_184);
		exit;
	}
	$ad_array=mysql_fetch_array($adstats_query);
	$adid = $ad_array[adid];
	$userid = $ad_array[userid];
	$adlink = $ad_array[adlink];
	$linktext = $ad_array[linktext];
	$adtext = $ad_array[adtext];
	$maxviews = $ad_array[maxviews];
	$views = $ad_array[views];
	$maxhits = $ad_array[maxhits];
	$hits = $ad_array[hits];
	$active = $ad_array[active];
	$startdate = $ad_array[startdate];
	$startdate = date($dateformat, $startdate);
	$lastdate = $ad_array[lastdate];
	$lastdate = date($dateformat, $lastdate);

$main="<table cellspacing=\"1\" cellpadding=\"3\" border=\"1\" width=\"100%\" align=\"center\">
<tr>
<td><font size=\"2\"><div align=\"center\"><a href=\"$adlink\" target=\"_blank\"><b>$linktext</b></a> $adtext</td>
</tr>
</table>
<table cellspacing=\"1\" cellpadding=\"3\" border=\"0\" width=\"400\" align=\"center\">
<tr>
<td>&nbsp;</td>
</tr>
<tr>
<td><b>$text_185 $adid - $text_136 $cname_login</a></b> - $text_152 $userid_login</td>
</tr>
<tr>
<td><a href=\"clients.php?do=adstats3&adid=$adid\">$text_186</a> <a href=\"clients.php?do=adstats4&adid=$adid\">$text_187</a></td>
</tr>
<tr>
<td><b>$text_188</b> $views</td>
</tr>
<tr>
<td><b>$text_189</b> $maxviews $text_190</td>
</tr>
<tr>
<td><b>$text_191</b> $hits</td>
</tr>
<tr>
<td><b>$text_192</b> $maxhits $text_190</td>
</tr>
<tr>
<td><b>$text_193</b> $active</td>
</tr>
<tr>
<td><b>$text_194</b> $startdate</td>
</tr>
<tr>
<td><b>$text_195</b> $lastdate</td>
</tr>
<tr>
<td>&nbsp;</td>
</tr>
<tr>
<td align=\"center\">
<p><b><a href=\"clients.php?do=main\">$text_162</a></b></p>
</td>
</tr>
</table>";

$template = new MyredTemplate("template/template.html");
$template->assign("TITLE", $pagetitle);
$template->assign("MENU", $menu);
$template->assign("MAIN", $main);
$template->myred_print() or die($template->error);
exit;
}

if ($do=='adstats3') {
	session_start();
	checksession();
	$adstats_query=mysql_query("SELECT * FROM $adverts_table WHERE adid='$adid' AND userid='$userid_login'");
	if (mysql_num_rows($adstats_query) < 1) {
		errormsg($text_184);
	exit;
	}
	$adstats_query2=mysql_query("SELECT * FROM $adclicks_table WHERE adid='$adid'"); 
	if (mysql_num_rows($adstats_query2)<1) {
		errormsg($text_196);
		exit;
	}

$main="<table cellspacing=\"1\" cellpadding=\"3\" border=\"0\" width=\"350\" align=\"center\">
<tr>
<td align=\"center\"><b>$text_197 $adid</b></td>
</tr>
</table>";

$main.=detailstats($adid, $adclicks_table);

$main.="<table cellspacing=\"1\" cellpadding=\"3\" border=\"0\" width=\"350\" align=\"center\">
<tr>
<td align=\"center\">
<p><b><a href=\"clients.php?do=main\">$text_162</a></b></p>
</td>
</tr>
</table>";

$template = new MyredTemplate("template/template.html");
$template->assign("TITLE", $pagetitle);
$template->assign("MENU", $menu);
$template->assign("MAIN", $main);
$template->myred_print() or die($template->error);
exit;
}

if ($do=='adstats4') {
	session_start();
	checksession();
	$adstats_query=mysql_query("SELECT * FROM $adverts_table WHERE adid='$adid' AND userid='$userid_login'");
	if (mysql_num_rows($adstats_query) < 1) {
		errormsg($text_184);
	exit;
	}
	$adstats_query2=mysql_query("SELECT * FROM $adviews_table WHERE adid='$adid'"); 
	if (mysql_num_rows($adstats_query2)<1) {
		errormsg($text_198);
		exit;
	}

$main="<table cellspacing=\"1\" cellpadding=\"3\" border=\"0\" width=\"350\" align=\"center\">
<tr>
<td align=\"center\"><b>$text_199 $adid</b></td>
</tr>
</table>";

$main.=detailstats($adid, $adviews_table);

$main.="<table cellspacing=\"1\" cellpadding=\"3\" border=\"0\" width=\"350\" align=\"center\">
<tr>
<td align=\"center\">
<p><b><a href=\"clients.php?do=main\">$text_162</a></b></p>
</td>
</tr>
</table>";

$template = new MyredTemplate("template/template.html");
$template->assign("TITLE", $pagetitle);
$template->assign("MENU", $menu);
$template->assign("MAIN", $main);
$template->myred_print() or die($template->error);
exit;
}

if ($do=='logout') {
	session_start();
	checksession();
	session_destroy();

$main="<table cellspacing=\"1\" cellpadding=\"3\" border=\"0\" width=\"600\" align=\"center\">
<tr>
<td>$text_200<br><br>$text_46</td>
</tr>
</table>";

$template = new MyredTemplate("template/template.html");
$template->assign("TITLE", $pagetitle);
$template->assign("MENU", $menu);
$template->assign("MAIN", $main);
$template->myred_print() or die($template->error);
exit;
}

if ($do=='main') {
	session_start();
	checksession();

$main="<table cellspacing=\"1\" cellpadding=\"3\" border=\"0\" width=\"600\" align=\"center\">
<tr>
<td><b>$client_result</b></td>
</tr>
<tr>
<td>$text_201 <b>$cname_login</b></td>
</tr>
<tr>
<td>$text_202</td>
</tr>
<tr>
<td><a href=\"clients.php?do=ordernew\">$text_203</a> | <a href=\"clients.php?do=adstats&active=yes\">$text_204</a> | <a href=\"clients.php?do=adstats&active=no\">$text_205</a> | <a href=\"clients.php?do=change\">$text_206</a> | <a href=\"clients.php?do=logout\">$text_207</a><br><br><a href=\"javascript:openwindow('adrules.php');\">$text_208</a></td>
</tr>
</table>";

$template = new MyredTemplate("template/template.html");
$template->assign("TITLE", $pagetitle);
$template->assign("MENU", $menu);
$template->assign("MAIN", $main);
$template->myred_print() or die($template->error);
exit;
}

if ($do=='login') {

$main="<table cellspacing=\"1\" cellpadding=\"3\" border=\"0\" width=\"500\" align=\"center\">
<tr>
<td>$text_209</td>
</tr>
</table>
<form action=\"clients.php\" method=\"post\">
<table cellspacing=\"1\" cellpadding=\"3\" border=\"0\" width=\"500\" align=\"center\">
<tr>
<td>$text_152</td>
<td><input type=\"text\" name=\"userid\" maxlength=\"100\"></td>
</tr>
<tr>
<td>$text_60</td>
<td><input type=\"password\" name=\"passwd\"></td>
</tr>
<tr>
<td colspan=\"2\" align=\"center\">
<input type=\"hidden\" name=\"do\" value=\"do_login\">
<input type=\"submit\" name=\"submit\" value=\"$text_88\">
<input type=\"reset\" value=\"reset\">
</td>
</tr>
<tr>
<td colspan=\"2\" align=\"center\"><a href=\"clients.php?do=pass\">$text_61</a></td>
</tr>
</table>
</form>";

$template = new MyredTemplate("template/template.html");
$template->assign("TITLE", $pagetitle);
$template->assign("MENU", $menu);
$template->assign("MAIN", $main);
$template->myred_print() or die($template->error);
exit;
}

?>