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

Размер файла: 4.74Kb
<?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_83</td>
</tr>
</table>
<form action=\"delete.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>&nbsp;</td>
<td>
<input type=\"password\" name=\"passwd\">
</td>
</tr>
<tr>
<td colspan=\"2\" align=\"center\">
<input type=\"hidden\" name=\"do\" value=\"do_delete\">
<input type=\"submit\" name=\"submit\" value=\"$text_84\">
<input type=\"reset\" value=\"reset\">
</td>
</tr>
<tr>
<td colspan=\"2\" align=\"center\"><a href=\"delete.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=='do_delete') {
	if($dom=="") {
		errormsg($text_16);
		exit;
		}
	if($passwd=="") {
		errormsg($text_62);
		exit;
		}
	$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;
	}
	$delete_query = mysql_query("DELETE FROM $redir_table WHERE host='$new_dom' AND passwd='$passwd'") OR DIE ("Something's screwed up, send for help");

$main="<table cellspacing=\"1\" cellpadding=\"3\" border=\"0\" width=\"400\" align=\"center\">
<tr>
<td>
<p>$text_85</p>
<p>$text_86</p>
<p><b>http://www.$new_dom</b><br>
<p>$text_87</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;
}
?>