Файл: billing/_rootbill/_catalog.inc.php
Строк: 137
<?
_head('utf-8',$_lang[CatTitle]);
if (!$sub) { $sub = "list"; }
if ($sub == 'delete' and $id) {
@mysql_query("delete from catalog where id='$id' and uid='".$_SESSION["userId"]."'") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
print $_lang[CatSiteDeleteSuccess]."<BR><BR>";
$sub='list';
}
if ($sub == 'add2' or $sub == 'edit2') {
if ($sub == 'add2') {$sub2='add';}
if ($sub == 'edit2') {$sub2='edit';}
if (!$title) {$error = $_lang[CatErrorSite];}
else if (!$url) {$error = $_lang[CatErrorDomain];}
else if (preg_match("///ui",$url) or preg_match("/:/ui",$url)) {$error = $_lang[CatErrorDomainSymbol];}
else if (!$opisanie) {$error = $_lang[CatErrorOpisanie];}
else {
$siteip=gethostbyname($url);
if ($siteip == $url and GetSetting("catalog_ip")) {$error = $_lang[CatErrorIP];}
else if (!IsIPInIPs($siteip,GetSetting("catalog_ip"))) {$error = $_lang[CatSiteIP]." [$siteip] ".$_lang[CatIPDenied]."."; }
else {
if ($sub == 'add2') {
@mysql_query("insert into catalog (uid,title,url,opisanie) values('".$_SESSION["userId"]."','$title','$url','$opisanie')") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
print $_lang[CatNewSiteSuccess]."<br><br>";
$sub2='list';
}
else if ($sub == 'edit2') {
if ($id) {
@mysql_query("update catalog set title='$title',url='$url',opisanie='$opisanie' where id='$id' and uid='".$_SESSION["userId"]."'") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
print $_lang[CatSiteEditSuccess]."<br><br>";
$sub2='list';
}
else {
print $_lang[ErrorBadId]."<br><br>";
$sub2='list';
}
}
}
}
$sub=$sub2;
}
if ($sub == 'add' or $sub == 'edit') {
if ($error) { print "<font color=red>".$_lang[Error].": $error</font><br><br>"; }
$button=$_lang[Add];
$text = $_lang[CatAdding];
if ($sub == 'edit') {
$r=@mysql_query("select * from catalog where id='$id' and uid='".$_SESSION["userId"]."'") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
$r=mysql_fetch_object($r);
$title=$r->title;
$url=$r->url;
$opisanie=$r->opisanie;
$button=$_lang[Change];
$text=$_lang[CatEditing];
}
?>
<form method=post>
<input type=hidden name=do value=<?=$do?>>
<input type=hidden name=sub value=<?=$sub?>2>
<input type=hidden name=id value=<?=$id?>>
<table class='rpTable'>
<tr><td colspan=2 align=center bgcolor=#EAEAEA><B><?=$text?> <?=$_lang[CatSaita]?></b></td></tr>
<tr><td><?=$_lang[CatSiteName]?>:</td><td><input class=input type=text size=53 name=title maxlength=75 value="<?=$title?>"></td></tr>
<tr><td><?=$_lang[CatSiteDomain]?> (<?=$_lang[CatWithoutHttp]?>):</td><td><input class=input type=text size=53 name=url maxlength=100 value="<?=$url?>"></td></tr>
<tr><td><?=$_lang[CatSiteOpisanie]?>:</td><td><input class=input type=text size=53 name=opisanie maxlength=250 value="<?=$opisanie?>"></td></tr>
<tr><Td colspan=2 align=center><BR><input class=button type=submit value="<?=$button?>"></td></tr>
</table>
</form>
<?
}
if ($sub == "list") {
$r=@mysql_query("select * from catalog where uid='".$_SESSION["userId"]."'") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
?>
<table class='rpTable' cellpadding=3 width=95% align=center border=1>
<tr><th colspan=3 align=center><B><?=$_lang[CatYourSites]?></b></th></tr>
<tr><th align=center><?=$_lang[CatSiteName]?></th><th align=center><?=$_lang[CatSiteDomain]?></th><th align=center><?=$_lang[Option]?></th></tr>
<?
$cnt=0;
while ($rr = @mysql_fetch_object($r)) {
getfont();
print "
<tr bgcolor=$font_row>
<td>$rr->title</td>
<td>$rr->url</td>
<Td align=center><A class=rootlink href=?do=$do&sub=edit&id=$rr->id><img src=./_rootimages/edit.gif alt='".$_lang[CatChange]."' border=0></a><A class=rootlink href=?do=$do&sub=delete&id=$rr->id onclick="javascript: return confirm('".$_lang[CatDeleteAlert]."');"><img src=./_rootimages/del.gif alt='".$_lang[CatDelete]."' border=0></a></td>
</tr>
";
$cnt++;
}
?>
<tr><th colspan=3><?=$_lang[CatTotalSites]?>: <?=$cnt?></th></tr>
<tr><th align=right colspan=3><A class=rootlink href=?do=<?=$do?>&sub=add><?=$_lang[CatAddSite]?></a></th></tr>
</table>
<?
}
_foot('utf-8');
?>