Размер файла: 9.58Kb
<?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_76</td>
</tr>
</table>
<form action=\"member.php\" method=\"post\">
<table cellspacing=\"1\" cellpadding=\"3\" border=\"0\" width=\"500\" align=\"center\">
<td>$text_10</td>
<td><div align =\"right\">http://www.</div></td>
<td>
<input type=\"text\" name=\"dom\" maxlength=\"100\">.
<select name=\"ext\">";
// The difficult query :-)
$tld_query = mysql_query("SELECT * FROM $domain_table ORDER BY domain ASC");
while ($tlds = mysql_fetch_array($tld_query)) {
$main.="<option>$tlds[0]</option>";
}
$main.="</select>
</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 (!$dom) {
errormsg($text_16);
exit;
}
$new_dom="$dom.$ext";
$passwd_result=mysql_query("SELECT * FROM $redir_table WHERE host='$new_dom'");
if (mysql_num_rows($passwd_result) < 1) {
errormsg($text_78);
exit;
}
$passwd_array=mysql_fetch_array($passwd_result);
$host=$passwd_array[host];
$mail = $passwd_array[email];
$passwd = $passwd_array[passwd];
$ip = getenv("REMOTE_ADDR");
$subject = "$host$text_79";
$message = "$text_80
$text_48 $host
$text_49 $passwd
$text_81
";
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_82</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=='login') {
$main="<table cellspacing=\"1\" cellpadding=\"3\" border=\"0\" width=\"500\" align=\"center\">
<tr>
<td>$text_59</td>
</tr>
</table>
<form action=\"member.php\" method=\"post\">
<table cellspacing=\"1\" cellpadding=\"3\" border=\"0\" width=\"500\" align=\"center\">
<tr>
<td>$text_10</td>
<td><div align =\"right\">http://www.</div></td>
<td><input type=\"text\" name=\"dom\" maxlength=\"100\">.
<select name=\"ext\">";
// Again: the difficult query :-)
$tld_query = mysql_query("SELECT * FROM $domain_table ORDER BY domain ASC");
while ($tlds = mysql_fetch_array($tld_query)) {
$main.="<option>$tlds[0]</option>";
}
$main.="</select>
</td>
</tr>
<tr>
<td>$text_60</td>
<td> </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=\"member.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;
}
if ($do=='change') {
if (!$firstname) {
$login_error="$text_39<br>";
}
if (!$name) {
$login_error.="$text_40<br>";
}
if (!$mail || verify_email($mail)!=1) {
$login_error.="$text_41<br>";
}
if (!$passwd) {
$login_error.="$text_62<br>";
}
if ($passwd1 != $passwd2) {
$login_error.="$text_63<br>";
}
if (!$title) {
$login_error.="$text_42<br>";
}
if($url=="http://" || $url=="") {
$login_error.="$text_43<br>";
}
if ($login_error) {
errormsg($login_error);
exit;
}
// Do a check if domain name matches password - to prevent manipulation of the html-code of the form.
$check_change=mysql_query("SELECT * FROM $redir_table WHERE host='$new_dom'") or die ("mysql_error");
$check_change2=mysql_fetch_array($check_change);
if ($check_change2[passwd] != $passwd) {
errormsg($text_64);
exit;
}
if ($passwd1!="") {
$passwd=$passwd1;
}
mysql_query("UPDATE $redir_table SET name='$name',vname='$firstname',passwd='$passwd',email='$mail',url='$url',title='$title',descr='$description',keyw='$keywords',robots='$robot',news='$newsletter',revisit='$revisit',cat='$cat' WHERE host='$new_dom'") or die ("mysql_error");
$do="do_login";
$change="$text_65";
}
if ($do=='do_login') {
if($dom=="" && !$new_dom) {
errormsg($text_16);
exit;
}
if($passwd=="") {
errormsg($text_62);
exit;
}
if(!$new_dom) {
$new_dom="$dom.$ext";
}
$login_query = mysql_query("SELECT * FROM $redir_table WHERE host='$new_dom'");
$num_rows = mysql_num_rows($login_query);
if ($num_rows < 1) {
errormsg($text_66);
exit;
}
$result_query=mysql_fetch_array($login_query);
if ($result_query[passwd] != $passwd) {
errormsg($text_67);
exit;
}
$name = $result_query[name];
$firstname = $result_query[vname];
$passwd = $result_query[passwd];
$mail = $result_query[email];
$title = $result_query[title];
$description = $result_query[descr];
$keywords = $result_query[keyw];
$url = $result_query[url];
$revisit = $result_query[revisit];
$counter = $result_query[counter];
$robot = $result_query[robots];
$news = $result_query[news];
$cat = $result_query[cat];
if($news=="on") {
$checkbox=" checked";
}
else {
$checkbox="";
}
$main="<form action=\"member.php\" method=\"post\">
<table cellspacing=\"1\" cellpadding=\"3\" border=\"0\" width=\"400\" align=\"center\">
<tr>
<td colspan=\"2\">
<p><b>$change</b></p>
<p>$text_45, $firstname!</p>
<p>$text_68 <b>$counter</b> $text_69</p>
<input type=\"hidden\" name=\"new_dom\" value=\"$new_dom \">
<p>$text_70<br></p>
</td>
</tr>
<tr>
<td><br>$text_10</td>
<td>
<br><b>http://www.$new_dom</b>
</td>
</tr>
<tr>
<td><br><br><b>$text_24</b></td>
<td> </td>
</tr>
<tr>
<td>$text_25</td>
<td><input type=\"text\" name=\"name\" value=\"$name\" maxlength=\"25\"></td>
</tr>
<tr>
<td>$text_26</td>
<td><input type=\"text\" name=\"firstname\" value=\"$firstname\" maxlength=\"25\"></td>
</tr>
<tr>
<td>$text_27</td>
<td><input type=\"text\" name=\"mail\" value=\"$mail\" maxlength=\"100\"></td>
</tr>
<tr>
<td colspan=\"2\">$text_71</td>
</tr>
<tr>
<td colspan=\"2\"> </td>
</tr>
<tr>
<td>* $text_60</td>
<td><input type=\"password\" name=\"passwd\" value=\"$passwd\" maxlength=\"25\"></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><br><br><b>$text_29</b></td>
<td> </td>
</tr>
<tr>
<td>$text_30 (<a href=\"javascript:openwindow('help.php?do=title');\">$text_13</a>):</td>
<td><input type=\"text\" name=\"title\" value=\"$title\" maxlength=\"100\"></td>
</tr>
<tr>
<td>$text_31 (<a href=\"javascript:openwindow('help.php?do=description');\">$text_13</a>):</td>
<td><input type=\"text\" name=\"description\" value=\"$description\" maxlength=\"270\"></td>
</tr>
<tr>
<td>$text_32 (<a href=\"javascript:openwindow('help.php?do=keywords');\">$text_13</a>):</td>
<td><input type=\"text\" name=\"keywords\" value=\"$keywords\" maxlength=\"270\"></td>
</tr>
<tr>
<td>$text_33 (<a href=\"javascript:openwindow('help.php?do=cat');\">$text_13</a>):</td>
<td>
<select name=\"cat\">";
// Surprise: The difficult query :-)
$cat_query = mysql_query("SELECT * FROM $category_table ORDER BY category ASC");
while ($cats = mysql_fetch_array($cat_query)) {
$main.="<option>$cats[0]</option>";
}
$main.="<option value=\"$cat \" selected>$cat</option>
</select>
</td>
</tr>
<tr>
<td>* $text_12 (<a href=\"javascript:openwindow('help.php?do=target');\">$text_13</a>):</td>
<td><input type=\"text\" name=\"url\" value=\"$url\" maxlength=\"100\"></td>
</tr>
<tr>
<td>$text_34 (<a href=\"javascript:openwindow('help.php?do=revisit');\">$text_13</a>):</td>
<td><input type=\"text\" name=\"revisit\" value=\"$revisit\"></td>
</tr>
<tr>
<td>$text_35 (<a href=\"javascript:openwindow('help.php?do=robots');\">$text_13</a>):</td>
<td><select name=\"robot\">
<option value=\"INDEX, FOLLOW\">INDEX, FOLLOW</option>
<option value=\"NOINDEX, FOLLOW\">NOINDEX, FOLLOW</option>
<option value=\"NOINDEX\">NOINDEX</option>
<option value=\"INDEX\">INDEX</option>
<option value=\"FOLLOW\">FOLLOW</option>
<option value=\"ALL\">ALL</option>
<option value=\"$robot\" selected>$robot</option>
</select></td>
<tr>
<tr>
<td colspan=\"2\"><input type=\"checkbox\" name=\"newsletter\" $checkbox style=\"border:none\">$text_36</td>
</tr>
<td colspan=\"2\" align=\"center\">
<input type=\"hidden\" name=\"do\" value=\"change\">
<input type=\"submit\" name=\"submit\" value=\"$text_75\">
<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;
}
?>