Файл: billing/billing.php
Строк: 1395
<?php
session_start( );
require_once( "./_rootconfig.php" );
if ( !$do )
{
$do = "orders";
}
if ( $_GET['do'] == "logout" && !isset( $_POST['pass'] ) )
{
userlogout( );
header( "Location: billing.php" );
exit( );
}
mconnect( );
validateuser( );
if ( isset( $_POST['pass'] ) )
{
$res = userlogon( $_POST['login'], $_POST['pass'] );
if ( $res == "0" || $res == "-1" )
{
$error = "Не правильно введён логин или пароль.";
}
}
if ( !isset( $_SESSION['userLogin'] ) )
{
head( );
echo "tt<table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td><font size="5"><b><font size="3">Биллинг панель</font></b></font><hr size="1"></td></tr></table>rntt";
if ( $error )
{
print "<font color=red>Ошибка: {$error}</font><BR><BR>";
}
echo " <BR>rn <form method=post>rn <table>rn t <tr> rn t <td> rn <div align="right">Логин:</div>rn t </td>rn t <td> rn <input type=text name=login>rn t </tr>rn t <tr> rn t <td> rn <div align="right">Пароль:</div>rn t </td>rn t <td> rn <input type=password name=pass>rn t </td>rn t </tr>rn t <tr> rn t <td";
echo " height="27"> </td>rn t <td height="27"> rn <div align="right"> rn <input type=submit value=Войти name="submit">rn </div>rn t </td>rn t </tr>rn </table>rn </form>rn ";
foot( );
mclose( );
exit( );
}
if ( $do == "profile" )
{
if ( $sub == "edit" )
{
if ( !mysql_query( "UPDATE users_profile SET icq = '".$_POST['icq']."', name = '".$_POST['name']."', otchestvo = '".$_POST['otchestvo']."', phone = '".$_POST['phone']."', country = '".$_POST['country']."', city = '".$_POST['city']."', post = '".$_POST['post']."', street = '".$_POST['street']."', pasport_seriya = '".$_POST['seriya']."', pasport_by = '".$_POST['by']."', ripn = '".$_POST['ripn']."', ripe = '".$_POST['ripe']."', uanic = '".$_POST['uanic']."', surname = '".$_POST['surname']."',pasport_date = '".$_POST['date']."',birthday = '".$_POST['birthday']."' WHERE uid = '".$_SESSION['userId']."'" ) )
{
exit( mysql_error( ) );
}
if ( $_POST['passwd'] )
{
if ( !mysql_query( "UPDATE users SET password = '".crypt( $_POST['passwd'] )."' WHERE id = '".$_SESSION['userId']."'" ) )
{
exit( mysql_error( ) );
}
}
if ( $_POST['email'] || $_POST['news'] )
{
if ( $_POST['news'] )
{
$newstomysql = "1";
}
else
{
$newstomysql = "0";
}
if ( !mysql_query( "UPDATE users SET email = '".$_POST['email']."', news='{$newstomysql}' WHERE id = '".$_SESSION['userId']."'" ) )
{
exit( mysql_error( ) );
}
}
if ( $fromreg )
{
header( "Location: billing.php?do=pay&id={$bill_id}" );
}
else
{
$error = "Профайл успешно изменен.";
}
}
head( );
if ( $error )
{
print "{$error}<BR><BR>";
}
if ( $fromreg )
{
print "<table border=0 ><tr><td><b>Заказ успешно оформлен.<BR>Заполните профайл, необходимый для регистрации Вашего домена.</tr></td></table><BR>";
}
if ( !( $query = mysql_query( "select * from users_profile where uid = '".$_SESSION['userId']."'" ) ) )
{
exit( mysql_error( ) );
}
$object = mysql_fetch_object( $query );
if ( !( $s = mysql_query( "select * from users where id = '".$_SESSION['userId']."'" ) ) )
{
exit( mysql_error( ) );
}
$t = mysql_fetch_object( $s );
if ( $t->news )
{
$newscheckbox = "checked";
}
else
{
$newscheckbox = "";
}
echo "rn <table border=0><form method=post>rn <tr><td colspan=2 align=center bgcolor={$font_head}><B>Профайл пользователя [{$t->login}]</b></td></tr>rn <tr><td colspan=2 align=center><br>Поля, отмеченные знаком *, обязательны для заполнения.<br>rn(Для регистрации домена в зоне .ru заполнять все поля)<br><br></td></tr>rn <input type=hidden name=do value={$do}>rn <input type=hidden name=sub value=edit>rn <input type=hidden name=fromreg value={$fromreg}>rn <input type=hidden name=bill_id value={$bill_id}>rnrnrn <tr><td>*Фамилия</td><td><input type=text name=surname value="".$object->surname."" size=40></td></tr>rn <tr><td>*Имя</td><td><input type=text name=name value="".$object->name."" size=40></td></tr>rn <tr><td>*Отчество</td><td><input type=text name=otchestvo value="".$object->otchestvo."" size=40></td></tr>rnrn <tr><td><BR>*Страна</td><td><BR><input type=text name=country value="".$object->country."" size=40></td></tr>rn <tr><td>*Индекс</td><td><input type=text name=post value="".$object->post."" size=40></td></tr>rn <tr><td>*Город</td><td><input type=text name=city value="".$object->city."" size=40></td></tr>rn <tr><td>*Адрес</td><td><input type=text name=street value="".$object->street."" size=40></td></tr>rn <tr><td>*Телефон</td><td><input type=text name=phone value="".$object->phone."" size=40></td></tr>rn <tr><td>*E-mail</td><td><input type=text name=email value="".$t->email."" size=40></td></tr>rn <tr><td>*Icq</td><td><input type=text name=icq value="".$object->icq."" size=40></td></tr>rnrn <tr><td><BR>Паспорт</td><td><BR><input type=text name=seriya value="".$object->pasport_seriya."" size=40></td></tr>rn <tr><td>Кем выдан</td><td><input type=text name=by value='".$object->pasport_by."' size=40></td></tr>rn <tr><td>Дата выдачи</td><td><input type=text name=date value="".$object->pasport_date."" size=40></td></tr>rn <tr><td>Дата рождения</td><td><input type=text name=birthday value="".$object->birthday."" size=40></td></tr>rnrnrnrn <tr><td><BR>Пароль (изменить)</td><td><BR><input type=text name=passwd size=40></td></tr>rnrn <tr><td><BR>Подписка на новости:</td><td><BR><input type=checkbox {$newscheckbox} name=news size=40> да</td></tr>rnrn <tr><td colspan=2 align=center><BR><input type=Submit value=Сохранить></td></tr></table><BR></form>rn ";
foot( );
}
if ( $do == "orders" )
{
head( );
if ( $sub == "delete" && $id )
{
if ( !@mysql_query( @"delete from orders where id='{$id}' and uid='".@$_SESSION['userId']."'" ) )
{
exit( mysql_error( ) );
}
if ( !@mysql_query( @"delete from orders_domains where host_id='{$id}' and uid='".@$_SESSION['userId']."'" ) )
{
exit( mysql_error( ) );
}
if ( !@mysql_query( @"delete from bills where host_id='{$id}' and uid='".@$_SESSION['userId']."'" ) )
{
exit( mysql_error( ) );
}
print "Заказ и все счета, относящиеся к нему, успешно удалены.<BR><BR>";
}
getfont( );
if ( !( $r = @mysql_query( @"select * from bills where status = '0' and uid='".@$_SESSION['userId']."'" ) ) )
{
exit( mysql_error( ) );
}
if ( 0 < mysql_num_rows( $r ) )
{
print "<font color=red>У Вас не оплачено счетов: ".mysql_num_rows( $r ).". Перейдите в раздел <A href=?do=bills>Счета</a> для их оплаты.</font><BR><BR>";
}
echo "t<table cellpadding=3>rnt<tr><td colspan=8 align=center>Чтобы заказать дополнительные услуги или переход на более высокий тарифный план свяжитесь с администрацией<br><br></td></tr>rnt<tr><td colspan=8 align=center bgcolor=";
echo $font_head;
echo "><B>Заказы</b></td></tr>rnt<tr bgcolor=";
echo $font_head;
echo " align=center><Td>Дата</td><td>Домен</td><td>Тариф</td><td>Конец</td><td>Осталось дней</td><td>Доп. услуги</td><td></td></tr>rnt";
if ( !( $r = @mysql_query( @"select *,TO_DAYS(todate)-TO_DAYS(NOW()) as leftdays from orders where uid='".@$_SESSION['userId']."' order by id desc" ) ) )
{
exit( mysql_error( ) );
}
$cnt = 0;
getfont( );
while ( $rr = mysql_fetch_object( $r ) )
{
getfont( );
$t = mysql_query( "select * from tarifs where id = '{$rr->tarif}'" );
$t = mysql_fetch_object( $t );
if ( !( $b = mysql_query( "select * from bills where host_id = '{$rr->id}' and uid='".$_SESSION['userId']."'" ) ) )
{
exit( mysql_error( ) );
}
$bills = mysql_num_rows( $b );
$b = mysql_fetch_object( $b );
if ( !( $bp = mysql_query( "select * from bills where host_id = '{$rr->id}' and uid='".$_SESSION['userId']."' and !(status='0')" ) ) )
{
exit( mysql_error( ) );
}
$billspayed = mysql_num_rows( $bp );
$billsNonPayed = $bills - $billspayed;
if ( $rr->leftdays == "" )
{
$rr->leftdays = "-";
}
else if ( $rr->leftdays <= 10 && $rr->startdate != "0000-00-00" )
{
$rr->leftdays = "<font color=red>".$rr->leftdays."</font>";
}
if ( $rr->leftdays != "-" )
{
$leftDays = "<img src=./_rootimages/hosting.gif border=0 alt='Хостинг' title='Хостинг'> ".$rr->leftdays;
}
else
{
$leftDays = "-";
}
if ( $rr->startdate != "0000-00-00" )
{
$todate = "<img src=./_rootimages/hosting.gif border=0 alt='Хостинг' title='Хостинг'> ".mydate( $rr->todate );
}
else
{
$todate = "-";
}
if ( $rr->domain_reg )
{
if ( !( $d = @mysql_query( @"select *,TO_DAYS(todate)-TO_DAYS(NOW()) as leftdays from orders_domains where host_id='{$rr->id}' and uid='".@$_SESSION['userId']."'" ) ) )
{
exit( mysql_error( ) );
}
$d = mysql_fetch_object( $d );
if ( $d->leftdays == "" )
{
$d->leftdays = "-";
}
else if ( $d->leftdays <= 30 && $d->startdate != "0000-00-00" )
{
$d->leftdays = "<font color=red>".$d->leftdays."</font>";
}
if ( $d->leftdays != "-" )
{
$leftDays .= " <img src=./_rootimages/domain.gif border=0 alt='Домен' title='Домен'> ".$d->leftdays;
}
if ( $d->startdate != "0000-00-00" )
{
$todate .= "<BR><img src=./_rootimages/domain.gif border=0 alt='Домен' title='Домен'> ".mydate( $d->todate );
}
}
if ( !( 0 < $billspayed ) || $billsNonPayed == 0 )
{
$renew = "<a href=?do=renew&host_id={$rr->id}><img src=./_rootimages/renew.gif border=0 alt='Продлить заказ' title='Продлить заказ'></a>";
}
else
{
$renew = "";
}
$orderAddons = split( ":x:", $rr->addons );
$lastaddon = "";
$orderAddonsTxt = "";
$v = each( @$orderAddons )[1];
$k = each( @$orderAddons )[0];
while ( @each( @$orderAddons ) )
{
if ( $v )
{
$oneAddon = getaddonbyid( $v );
if ( $lastaddon )
{
$orderAddonsTxt .= ", ";
}
$orderAddonsTxt .= "{$oneAddon->textid}";
$lastaddon = $oneAddon->textid;
}
}
print "rntt<tr bgcolor={$font_row} height=30>rntt<td align=center>".mydate( $rr->orderdate )."</td>rntt<td><B>{$rr->domain}</b><BR>[".$_newregmin[$rr->domain_reg]."]</td>rntt<td align=center>{$t->name}</td>rntt<td align=center>{$todate}</td>rntt<td align=center nowrap>{$leftDays}</td>rntt<td>{$orderAddonsTxt}</font></td>rntt<td align=center valign=middle><A href=?do=bills¶m=host_id&search={$rr->id}><img src=./_rootimages/bills.gif border=0 alt='Счета: {$bills}' title='Счета: {$bills}'></a>{$renew}{$delete}</td>rntt</tr>rntt";
++$cnt;
}
echo "t<tr bgcolor=";
echo $font_head;
echo "><Td colspan=8>Всего заказов: ";
echo $cnt;
echo "</td></tr>rnt</table>rnt";
foot( );
}
if ( $do == "domains" )
{
head( );
if ( $sub == "delete" && $id )
{
if ( !@mysql_query( @"delete from orders_domains where id='{$id}' and uid='".@$_SESSION['userId']."'" ) )
{
exit( mysql_error( ) );
}
if ( !@mysql_query( @"delete from bills where domain_id='{$id}' and uid='".@$_SESSION['userId']."'" ) )
{
exit( mysql_error( ) );
}
print "Домен и все счета, относящиеся к нему, успешно удалены.<BR><BR>";
}
getfont( );
if ( !( $r = @mysql_query( @"select * from bills where status = '0' and uid='".@$_SESSION['userId']."'" ) ) )
{
exit( mysql_error( ) );
}
if ( 0 < mysql_num_rows( $r ) )
{
print "<font color=red>У Вас не оплачено счетов: ".mysql_num_rows( $r ).". Перейдите в раздел <A href=?do=bills>Счета</a> для их оплаты.</font><BR><BR>";
}
echo " <table cellpadding=3>rn <tr><td colspan=6 align=center bgcolor=";
echo $font_head;
echo "><B>Домены</b></td></tr>rn <tr bgcolor=";
echo $font_head;
echo " align=center><Td>Дата</td><td>Домен</td><td>Конец</td><td>Осталось дней</td><td></td></tr>rn ";
if ( !( $r = @mysql_query( @"select *,TO_DAYS(todate)-TO_DAYS(NOW()) as leftdays from orders_domains where uid='".@$_SESSION['userId']."' order by id desc" ) ) )
{
exit( mysql_error( ) );
}
$cnt = 0;
getfont( );
while ( $rr = mysql_fetch_object( $r ) )
{
getfont( );
if ( !( $b = mysql_query( "select * from bills where domain_id = '{$rr->id}' and uid='".$_SESSION['userId']."'" ) ) )
{
exit( mysql_error( ) );
}
$bills = mysql_num_rows( $b );
$b = mysql_fetch_object( $b );
if ( !( $bp = mysql_query( "select * from bills where domain_id = '{$rr->id}' and uid='".$_SESSION['userId']."' and !(status='0')" ) ) )
{
exit( mysql_error( ) );
}
$billspayed = mysql_num_rows( $bp );
$billsNonPayed = $bills - $billspayed;
if ( $rr->leftdays == "" )
{
$rr->leftdays = "-";
}
else if ( $rr->leftdays <= 30 && $rr->startdate != "0000-00-00" )
{
$rr->leftdays = "<font color=red>".$rr->leftdays."</font>";
}
if ( $rr->startdate != "0000-00-00" )
{
$todate = mydate( $rr->todate );
}
else
{
$todate = "-";
}
$leftDays = $rr->leftdays;
if ( !( 0 < $billspayed ) || $billsNonPayed == 0 )
{
$renew = "<a href=?do=renewdomain&domain_id={$rr->id}><img src=./_rootimages/renew.gif border=0 alt='Продлить заказ' title='Продлить домен'></a>";
}
else
{
$renew = "";
}
print "rn <tr bgcolor={$font_row} height=30>rntttt <td align=center>".mydate( $rr->orderdate )."</td>rn <td><B>{$rr->domain}</b></td>rn <td align=center>{$todate}</td>rn <td align=center>{$leftDays}</td>rn <td align=center valign=middle><A href=?do=bills¶m=domain_id&search={$rr->id}><img src=./_rootimages/bills.gif border=0 alt='Счета: {$bills}' title='Счета: {$bills}'></a>{$renew}{$delete}</td>rn </tr>rn ";
++$cnt;
}
echo " <tr bgcolor=";
echo $font_head;
echo "><Td colspan=6>Всего доменов: ";
echo $cnt;
echo "</td></tr>rn </table>rn ";
foot( );
}
if ( $do == "bills" )
{
head( );
if ( $search )
{
$addon = "and {$param} LIKE '%{$search}%'";
}
getfont( );
echo " <table cellpadding=3>rn <tr><td colspan=8 align=center bgcolor=";
echo $font_head;
echo "><B>Счета</b></td></tr>rn <tr bgcolor=";
echo $font_head;
echo " align=center><td>Дата</td><td>№ счета</td><td>Тариф</td><td>Домен</td><td>Стоимость</td><td>Сумма</td><td>Статус</td><td></td></tr>rn ";
if ( !( $r = @mysql_query( @"select * from bills where uid='".@$_SESSION['userId'].@"' {$addon} order by id desc" ) ) )
{
exit( mysql_error( ) );
}
$cnt = 0;
getfont( );
while ( $rr = mysql_fetch_object( $r ) )
{
$tarifTxt = "";
$domainTxt = "";
$cost = "";
$t = @mysql_query( @"select t1.*, t2.name from orders as t1, tarifs as t2 where t1.id='{$rr->host_id}' and t1.uid='".@$_SESSION['userId']."' and t1.tarif=t2.id" );
if ( 0 < mysql_num_rows( $t ) )
{
$t = mysql_fetch_object( $t );
$cost = "<img src=./_rootimages/hosting.gif border=0 alt='Хостинг' title='Хостинг'> {$rr->money_host}$";
$newreg = "";
$domain_srok = "";
$tarifTxt = $t->name."<BR>[".$rr->host_srok." мес]";
if ( $t->domain_reg )
{
if ( $rr->renew )
{
if ( $rr->domain_id )
{
$newreg = $_renewmin[1];
$domain_srok = " [{$rr->domain_srok} мес]";
}
else
{
$newreg = $_renewmin[0];
}
}
else
{
$newreg = $_newregmin[1];
$domain_srok = " [{$rr->domain_srok} мес]";
}
}
else
{
if ( $rr->renew )
{
$newreg = "";
}
else
{
$newreg = $_newregmin[0];
}
}
if ( $newreg )
{
$newreg = "[".$newreg."]";
}
$domainTxt = "<B>".$t->domain."</b><BR>".$newreg.$domain_srok;
}
if ( !( $d = @mysql_query( @"select * from orders_domains domains where id='{$rr->domain_id}'" ) ) )
{
exit( mysql_error( ) );
}
if ( 0 < mysql_num_rows( $d ) )
{
$d = mysql_fetch_object( $d );
$cost = $cost." <img src=./_rootimages/domain.gif border=0 alt='Домен' title='Домен'> {$rr->money_domain}$";
if ( !$rr->host_id )
{
$domainTxt = "<B>".$d->domain."</b><BR>";
if ( $rr->renew )
{
$domainTxt .= "[продление] ";
}
else
{
$domainTxt .= "[новый] ";
}
$domainTxt .= "[{$rr->domain_srok} мес]";
}
}
if ( $rr->money_addons )
{
$cost = $cost." <img src=./_rootimages/addons.gif border=0 alt='Дополнительные услуги' title='Дополнительные услуги'> {$rr->money_addons}$";
}
if ( !( $u = @mysql_query( @"select * from users where id='{$rr->uid}'" ) ) )
{
exit( mysql_error( ) );
}
$u = mysql_fetch_object( $u );
if ( $rr->status != 0 )
{
$statusAddOn = " ".mydate( $rr->payed );
$make = "";
}
else
{
$statusAddOn = "";
$make = "<a href=?do=pay&id={$rr->id}><img src=./_rootimages/pay.gif border=0 alt='Оплатить счет' title='Оплатить счет'></a>";
}
getfont( );
echo "tt<tr bgcolor="";
echo $font_row;
echo "" height=30>rntt<td align=center>";
echo mydate( $rr->created );
echo "</td>rntt<td align=center><B>";
echo sprintf( "%04d", $rr->id );
echo "</b></td>rntt<td>";
echo $tarifTxt;
echo "</td>rntt<td>";
echo $domainTxt;
echo "</td>rntt<td align=center>";
echo $cost;
echo "</td>rntt<td align=center><B>";
echo $rr->money_host + $rr->money_domain + $rr->money_addons;
echo "$</b></td>rntt<td align=center><img src=./_rootimages/payed_";
echo $rr->status;
echo "_small.gif border=0 alt="";
echo $_statusBill[$rr->status].$statusAddOn;
echo "" title="";
echo $_statusBill[$rr->status].$statusAddOn;
echo ""></td>rntt<td>";
echo $make;
echo "</td>rntt</tr>rntt";
++$cnt;
}
echo "t<tr bgcolor=";
echo $font_head;
echo "><Td colspan=8>Всего счетов: ";
echo $cnt;
echo "</td></tr>rnt</table>rnt";
foot( );
}
if ( $do == "pay" && $id )
{
if ( !( $r = @mysql_query( @"select * from bills where id='{$id}' and uid='".@$_SESSION['userId']."'" ) ) )
{
exit( mysql_error( ) );
}
if ( 0 < mysql_num_rows( $r ) )
{
head( );
$r = mysql_fetch_object( $r );
$sid = sprintf( "%04d", $r->id );
if ( $fromreg )
{
print "Заказ успешно оформлен.<BR>";
}
print "<font color=red>Вам необходимо оплатить счёт.</font><BR><BR>";
print "При оплате с телефона или при обычном переводе укажите в комментариях номер вашего счёта № {$sid}<BR><BR>";
print "<B>Оплата счета № {$sid}</b><BR><BR>Чтобы оплатить онлайн вам надо зайти в биллинг с браузера IE<br><br>Онлайн оплата следующими способами:<BR><BR><Table border=0 cellpadding=0 cellspacing=0><tr bgcolor=#CCCCCC><td colspan=5 height=1></td></tr>";
$manager_email = getsetting( "manager_email" );
$company_name = getsetting( "company_name" );
$payment_url = getsetting( "payment_url" );
$nopayment_url = getsetting( "nopayment_url" );
$wmz = getsetting( "wmz" );
$wmr = getsetting( "wmr" );
$wme = getsetting( "wme" );
if ( $wmz )
{
$money = $r->money_host + $r->money_domain + $r->money_addons;
echo " <tr>rn <td valign=top><BR><A href="http://www.webmoney.ru/" target=_blank><img src="./_rootimages/logo_wm.gif" width="88" height="31" border=0></a></td>rn <td width=10> </td>rntttttt<td width=1 bgcolor=#CCCCCC></td>rntttttt<td width=10> </td>rn <td><BR>rn rn <B>:: We";
echo "bMoney</b><BR><BR>rn rn <B>Кошельки:</B><BR>rn WMZ - ";
echo $wmz;
echo "<BR>rn ";
if ( $wmr )
{
print "WMR - {$wmr}<BR>";
}
echo " ";
if ( $wme )
{
print "WME - {$wme}<BR>";
}
echo " <BR>rnrn <form method="POST" action="https://merchant.webmoney.ru/lmi/payment.asp">rn <input type=hidden name=LMI_PAYMENT_DESC value="";
echo $company_name;
echo ": счет № ";
echo $sid;
echo "">rn <input type=hidden name=LMI_PAYEE_PURSE value="";
echo $wmz;
echo "">rn <input type=hidden name=LMI_PAYMENT_AMOUNT value="";
echo $money;
echo "">rn <input type=hidden name=LMI_RESULT_URL value="http://";
echo $server_host;
echo "/online_wm.php">rntttttt<input type=hidden name=LMI_SUCCESS_URL value="";
echo $payment_url;
echo "">rntttttt<input type=hidden name=LMI_FAIL_URL value="";
echo $nopayment_url;
echo "">rntttttt<input type=hidden name=BILL_ID value="";
echo $sid;
echo "">rn <input type=submit value="Оплатить ";
echo $money;
echo " WMZ">rn </form>rnrnttt";
if ( $wmr )
{
echo "ttt";
$money_rur = $money * getsetting( "kurs_rur" );
echo "rn <form method="POST" action="https://merchant.webmoney.ru/lmi/payment.asp">rn <input type=hidden name=LMI_PAYMENT_DESC value="";
echo $company_name;
echo ": счет № ";
echo $sid;
echo "">rn <input type=hidden name=LMI_PAYEE_PURSE value="";
echo $wmr;
echo "">rn <input type=hidden name=LMI_PAYMENT_AMOUNT value="";
echo $money_rur;
echo "">rn <input type=hidden name=LMI_RESULT_URL value="http://";
echo $server_host;
echo "/online_wm.php">rntttttt<input type=hidden name=LMI_SUCCESS_URL value="";
echo $payment_url;
echo "">rntttttt<input type=hidden name=LMI_FAIL_URL value="";
echo $nopayment_url;
echo "">rntttttt<input type=hidden name=BILL_ID value="";
echo $sid;
echo "">rn <input type=submit value="Оплатить ";
echo $money_rur;
echo " WMR">rn </form>rnrnttt";
}
echo " rn </td></tr>rn <tr bgcolor=#CCCCCC><td colspan=5 height=1></td></tr>rn ";
}
$yandex = getsetting( "yandex" );
if ( $yandex )
{
$money = ( $r->money_host + $r->money_domain + $r->money_addons ) * getsetting( "kurs_rur" );
echo "tttttt<tr>rntttttt<td valign=top><BR><A href="http://money.yandex.ru/" target=_blank><img src="./_rootimages/logo_yandex.gif" width="88" height="31" border=0></a> </td>rn <td width=10> </td>rntttttt<td width=1 bgcolor=#CCCCCC></td>rntttttt<td width=10> </td>rntttttt<td><BR>rnttttttrntttttt<B>:: Яndex.Деньги</B><BR><BR>rnttttttrntttttt<B>Кошелек:</b> ";
echo $yandex;
echo "<BR><BR>rnttttttrn <form method="POST" action="http://money.yandex.ru/select-wallet.xml">rn <input type="hidden" name="TargetCurrency" value="643">rn <input type="hidden" name="currency" value="643">rn <input type=hidden name="wbp_Version" value="2">rn <input type="hidden" name="wbp_MessageT";
echo "ype" value="DirectPaymentIntoAccountRequest">rn <input type="hidden" name="wbp_ShopAddress" value="";
echo $manager_email;
echo "">rn <input type="hidden" name="wbp_accountid" value="";
echo $yandex;
echo "">rn <input type="hidden" name="wbp_currencyamount" value="643;";
echo $money;
echo "">rn <input type="hidden" name="wbp_ShopErrorInfo" value="Платеж не совершен">rn <input type="hidden" name="wbp_shortdescription" value="Требование прямого платежа на счет">rn <input type="hidden" name="wbp_template_1" value="";
echo $company_name;
echo ": счет № ";
echo $sid;
echo "">rn <input type=submit value="Оплатить ";
echo $money;
echo " руб.">rn </form>rn rn </td></tr>rn <tr bgcolor=#CCCCCC><td colspan=5 height=1></td></tr>rn ";
}
$egold = getsetting( "egold" );
if ( $egold )
{
$money = $r->money_host + $r->money_domain + $r->money_addons;
echo "tttttt<tr>rntttttt<td valign=top><BR><A href="http://www.e-gold.com/" target=_blank><img src="./_rootimages/logo_egold.gif" width="88" height="31" border=0></a> </td>rn <td width=10> </td>rntttttt<td width=1 bgcolor=#CCCCCC></td>rntttttt<td width=10> </td>rntttttt<td><BR>rnttttttrntttttt<B>:: E-Gold</b><BR><BR>rnttttttrntttttt<B>Аккаунт:</B> ";
echo $egold;
echo "<BR><BR>rnttttttrn <form action="https://www.e-gold.com/sci_asp/payments.asp" method="POST">rn <input type="hidden" name="PAYEE_ACCOUNT" value="";
echo $egold;
echo "">rn <input type="hidden" name="PAYEE_NAME" value="";
echo $company_name;
echo "">rn <input type="hidden" name="PAYMENT_AMOUNT" value="";
echo $money;
echo "">rn <input type="hidden" name="PAYMENT_UNITS" value="1">rn <input type="hidden" name="PAYMENT_METAL_ID" value="1">rn <input type="hidden" name="PAYMENT_ID" value="";
echo $sid;
echo "">rn <input type="hidden" name="STATUS_URL" value="http://";
echo $server_host;
echo "/online_egold.php">rn <input type="hidden" name="PAYMENT_URL" value="";
echo $payment_url;
echo "">rn <input type="hidden" name="NOPAYMENT_URL" value="";
echo $nopayment_url;
echo "">rn <input type="hidden" name="SUGGESTED_MEMO" value="";
echo $company_name;
echo ": bill # ";
echo $sid;
echo "">rn <input type="hidden" name="BAGGAGE_FIELDS" value="">rn <input type="submit" name="PAYMENT_METHOD" value="Оплатить ";
echo $money;
echo "$">rn </form>rn rn </td></tr>rn <tr bgcolor=#CCCCCC><td colspan=5 height=1></td></tr>rn ";
}
$rupayschet = getsetting( "rupayschet" );
$rupay = getsetting( "rupay" );
if ( $rupayschet )
{
$money = $r->money_host + $r->money_domain + $r->money_addons;
echo "tttttt<tr>rntttttt<td valign=top><BR><A href="http://www.rupay.com/" target=_blank><img src="./_rootimages/logo_rupay.gif" width="88" height="31" border=0></a> </td>rn <td width=10> </td>rntttttt<td width=1 bgcolor=#CCCCCC></td>rntttttt<td width=10> </td>rntttttt<td><BR>rnttttttrntttttt<B>:: RuPay</b><BR><BR>rnttttttrntttttt<B>Счет:</B> ";
echo $rupayschet;
echo "<BR><BR>rnttttttrntttttt";
if ( $rupay )
{
echo " <form action="http://www.rupay.ru/rupay/pay/index.php" name="pay" method="POST">rn <input type="hidden" name="pay_id" value="";
echo $rupay;
echo "">rn <input type="hidden" name="sum_pol" value="";
echo $money;
echo "">rn <input type="hidden" name="sum_val" value="USD">rn <input type="hidden" name="name_service" value="";
echo $company_name;
echo ": счет № ";
echo $sid;
echo "">rn <input type="hidden" name="order_id" value="";
echo $sid;
echo "">rn <input type="hidden" name="success_url" value="";
echo $payment_url;
echo "">rntttttt<input type="hidden" name="fail_url" value="";
echo $nopayment_url;
echo "">rn <input type="submit" name="button" value="Оплатить ";
echo $money;
echo "$">rn </form>rn ";
}
echo "<BR>rn rn <B>Способы оплаты через данную платежную систему:</B><BR><BR>rn <LI>В России</LI>rn <UL>Сбербанк РФ (кроме Москвы)</UL>rn <UL>WebMoney рубли</UL>rn <UL>WebMoney WMZ</UL>rn <UL>Рапида</UL>rn <UL>Банковский платеж</UL>rn ";
echo " <UL>Наличными по системе Контакт</UL>rn <UL>Картой Webmoney WMZ, paymer, Telepat</UL>rn <UL>Наличными в Москве</UL>rn <UL>Наличными в Санкт-Петербурге</UL>rn <BR>rn <LI>В Украине</LI>rn <UL>Наличными в Киеве</UL>rn <UL>Приват 24 (грн.";
echo ")</UL>rn <UL>Наличными в Приватбанке</UL>rn <UL>Банковский перевод</UL>rn <UL>Интернет.Деньги</UL>rn <UL>WebMoney WMZ</UL>rn <UL>WebMoney WMU</UL>rn <BR>rn <LI>За границей</LI>rn <UL>Fethard</UL>rn <UL>Междунар";
echo "одный банковский перевод (wire transfer) в USD</UL>rn <UL>Международный банковский перевод (wire transfer) в EURO</UL>rn <UL>E-GOLD</UL>rn <UL>WebMoney WMZ или ВМ-картой или paymer</UL>rn <UL>Capitalcollect</UL>rn <UL>RUpay</UL>rn <UL>Анелик</UL>rn <UL>";
echo "Western Union</UL>rn <UL>Наличными в странах мира</UL><BR>rn rn rn </td></tr>rn <tr bgcolor=#CCCCCC><td colspan=5 height=1></td></tr>rn ";
}
print "</table><BR><BR>";
foot( );
}
}
if ( $do == "renew" )
{
if ( $sub == "renew" )
{
if ( !$hostMonths )
{
$error = "Не указан срок продления.";
if ( !( $order = @mysql_query( @"select * from orders where id='{$host_id}' and uid='".@$_SESSION['userId']."'" ) ) )
{
exit( mysql_error( ) );
}
}
else if ( mysql_num_rows( $order ) == 0 )
{
$error = "Утерян идентификатор.";
}
else
{
$order = mysql_fetch_object( $order );
$orderAddons = split( ":x:", $order->addons );
$addonsCost = 0;
$addonsToSave = "";
$addonsToSaveText = "";
$v = each( @$orderAddons )[1];
$k = each( @$orderAddons )[0];
while ( @each( @$orderAddons ) )
{
if ( $v )
{
$oneAddon = getaddonbyid( $v );
if ( 0 < $oneAddon->cost_monthly )
{
if ( $addonsToSaveText )
{
$addonsToSaveText = $addonsToSaveText.", ".$oneAddon->textid;
}
else
{
$addonsToSaveText = $oneAddon->textid;
}
$addonsToSave = $addonsToSave.":x:{$oneAddon->id}";
$addonsCost += $oneAddon->cost_monthly * $hostMonths;
}
}
}
if ( !$addonsToSaveText )
{
$addonsToSaveText = $_yes[0];
}
if ( !@mysql_query( @"update orders set addons='{$addonsToSave}' where id='{$host_id}'" ) )
{
exit( mysql_rror( ) );
}
if ( !( $tarif = @mysql_query( @"select * from tarifs where id='{$order->tarif}'" ) ) )
{
exit( mysql_error( ) );
}
$tarif = mysql_fetch_object( $tarif );
$hostCost = $tarif->cost * $hostMonths;
if ( !( $tsroki = @mysql_query( @"select discount from tarifs_sroki where tarif_id='{$order->tarif}' and months='{$hostMonths}'" ) ) )
{
exit( mysql_error( ) );
}
$tsroki = mysql_fetch_object( $tsroki );
$srokDiscount = $tsroki->discount;
$orderDiscount = $order->discount;
$host = $hostCost - $hostCost / 100 * ( $srokDiscount + $orderDiscount );
if ( $orderDiscount == "100" )
{
$host = 0;
}
$domainCost = 0;
$domain_renew = 0;
if ( $order->domain_reg && $domainMonths )
{
$domain_renew = 1;
$order_domain = getdomainbydomain( $order->domain );
$zone = getzonebydomain( $order->domain );
$domainCost = $zone->renew_if_host * ( $domainMonths / 12 );
$domainDiscount = $order_domain->discount;
$domainCost = $domainCost - $domainCost / 100 * $domainDiscount;
if ( $domainDiscount == "100" )
{
$domainCost = 0;
}
if ( !( $tfreedomains = @mysql_query( @"select * from tarifs_freedomains where tarif_id='{$order->tarif}' and zone='{$zone->zone}' and hostmonths='{$hostMonths}'" ) ) )
{
exit( mysql_error( ) );
}
if ( 0 < mysql_num_rows( $tfreedomains ) )
{
$domainFree = 1;
}
else
{
$domainFree = 0;
}
if ( $domainFree )
{
$domainCost = 0;
}
}
else
{
$domainMonths = 0;
}
if ( $order->domain_reg )
{
$newreg = $_renew[$domain_renew];
}
else
{
$newreg = "-";
}
if ( !@mysql_query( @"insert into bills (uid,host_id,domain_id,host_srok,domain_srok,money_host,money_domain,money_addons,created,renew) values('".@$_SESSION['userId'].@"','{$order->id}','{$order_domain->id}','{$hostMonths}','{$domainMonths}','{$host}','{$domainCost}','{$addonsCost}',NOW(),'1')" ) )
{
exit( mysql_error( ) );
}
$bill_id = mysql_insert_id( );
$sid = sprintf( "%04d", $bill_id );
$template = gettpl( "email_touser_".$tarif->vid."_renew" );
$company_name = getsetting( "company_name" );
$company_url = getsetting( "company_url" );
$billing_url = getsetting( "billing_url" );
$support_url = getsetting( "support_url" );
$manager_email = getsetting( "manager_email" );
$template = str_replace( "{company_name}", $company_name, $template );
$template = str_replace( "{company_url}", $company_url, $template );
$template = str_replace( "{billing_url}", $billing_url, $template );
$template = str_replace( "{support_url}", $support_url, $template );
$template = str_replace( "{tarif}", $tarif->name, $template );
$template = str_replace( "{srok}", $hostMonths, $template );
$template = str_replace( "{domain}", $order->domain, $template );
$template = str_replace( "{addons}", $addonsToSaveText, $template );
$template = str_replace( "{newreg}", $newreg, $template );
$template = str_replace( "{login}", $_SESSION['userLogin'], $template );
$template = str_replace( "{password}", "******", $template );
$template = str_replace( "{schet}", $sid, $template );
$template = str_replace( "{hostcost}", $host, $template );
$template = str_replace( "{domaincost}", $domainCost, $template );
$template = str_replace( "{addonscost}", $addonsCost, $template );
$template = str_replace( "{cost}", $host + $domainCost + $addonsCost, $template );
$template = str_replace( "{userid}", $_SESSION['userId'], $template );
adduserlog( $_SESSION['userId'], "renew", "{$tarif->name}, {$hostMonths} мес., {$order->domain} [{$newreg} (".$domainMonths / 12." г.)]" );
sendmail( $_SESSION['userEmail'], $manager_email, "Продление заказа [".$tarif->vid."]", $template );
sendmail( $manager_email, $_SESSION['userEmail'], "Duplicate: Продление заказа [".$tarif->vid."]", $template );
header( "Location: billing.php?do=pay&fromreg=1&id={$bill_id}" );
mclose( );
exit( );
}
}
if ( !( $r = @mysql_query( @"select * from orders where id='{$host_id}'" ) ) )
{
exit( mysql_error( ) );
}
if ( mysql_num_rows( $r ) == 0 )
{
$error = "Утерян идентификатор.";
}
head( );
print "<B>Продление заказа</b><BR><BR>";
if ( $error )
{
print "Ошибка: {$error}<BR><BR>";
}
if ( 0 < mysql_num_rows( $r ) )
{
$r = mysql_fetch_object( $r );
$tarif = gettarifbyid( $r->tarif );
if ( !( $tarif_sroki = @mysql_query( @"select * from tarifs_sroki where tarif_id='{$tarif->id}' order by months" ) ) )
{
exit( mysql_error( ) );
}
echo "tt<form method=post>rntt<input type=hidden name=do value=";
echo $do;
echo ">rntt<input type=hidden name=sub value=renew>rntt<input type=hidden name=host_id value=";
echo $host_id;
echo ">rnrntt<table border=0>rntt<tr><td align=right>Домен: </td><td><input type=text name=domain value="";
echo $r->domain;
echo "" readonly></td></tr>rntt";
if ( $r->domain_reg )
{
if ( !( $minsrok = @mysql_query( "select t1.minsrok_renew from zones as t1, orders_domains as t2, orders as t3 where t1.id=t2.zone_id and t2.domain=t3.domain" ) ) )
{
exit( mysql_error( ) );
}
$minsrok = mysql_fetch_object( $minsrok );
$minsrok = $minsrok->minsrok_renew;
echo "ttt<tr><td align=right>На срок:<BR><BR></td><Td>";
echo "<s";
echo "elect name=domainMonths><option value=0>не продлевать<option value=";
echo $minsrok;
echo ">";
echo $minsrok / 12;
echo " год";
if ( 1 < $minsrok / 12 )
{
print "а";
}
echo "ttt</select><BR><BR></td></tr>rnttt";
}
echo "tt<tr><td align=right>Тарифный план: </td><td><input type=radio name=tarif_id value=";
echo $tarif->id;
echo " checked>";
echo $tarif->name;
echo " (";
echo $tarif->cost;
echo " $/мес)</td></tr>rntt<tr><td align=right>На срок: </td><td>";
echo "<s";
echo "elect name=hostMonths><option>rntt";
while ( !( 0 < mysql_num_rows( $tarif_sroki ) ) || !( $srok = mysql_fetch_object( $tarif_sroki ) ) )
{
if ( $srok->months == $hostMonths )
{
$selected = "selected";
}
else
{
$selected = "";
}
print "<option value={$srok->months} {$selected}>{$srok->months} мес (скидка {$srok->discount}%)";
}
echo "tt</select></td></tr>rntt<tr><td align=right valign=top>Доп. услуги: </td><td>rntt";
$orderAddons = split( ":x:", $r->addons );
$v = each( @$orderAddons )[1];
$k = each( @$orderAddons )[0];
while ( @each( @$orderAddons ) )
{
if ( $v )
{
$oneAddon = getaddonbyid( $v );
if ( 0 < $oneAddon->cost_monthly )
{
if ( $lastaddon )
{
$orderAddonsTxt .= "<BR>";
}
$orderAddonsTxt .= "{$oneAddon->name} ({$oneAddon->cost_monthly} $/мес)";
$lastaddon = $oneAddon->textid;
}
}
}
if ( !$orderAddonsTxt )
{
$orderAddonsTxt = $_yes[0];
}
print $orderAddonsTxt;
echo "tt</td></tr>rntt<tr><td colspan=2 align=center><BR><input type=submit value=Продлить></td></tr>rntt</table>rntt";
}
foot( );
}
if ( $do == "renewdomain" )
{
if ( $sub == "renew" )
{
if ( !( $r = @mysql_query( @"select * from orders_domains where id='{$domain_id}'" ) ) )
{
exit( mysql_error( ) );
}
if ( 0 < mysql_num_rows( $r ) )
{
$r = mysql_fetch_object( $r );
$zone = getzonebydomain( $r->domain );
$domainCost = $zone->renew_if_not_host * ( $domainMonths / 12 );
$domainDiscount = $r->discount;
$domainCost = $domainCost - $domainCost / 100 * $domainDiscount;
if ( !@mysql_query( @"insert into bills (uid,domain_id,domain_srok,money_domain,created,renew) values('".@$_SESSION['userId'].@"','{$domain_id}','{$domainMonths}','{$domainCost}',NOW(),'1')" ) )
{
exit( mysql_error( ) );
}
$bill_id = mysql_insert_id( );
$sid = sprintf( "%04d", $bill_id );
$template = gettpl( "email_touser_domain_renew" );
$company_name = getsetting( "company_name" );
$company_url = getsetting( "company_url" );
$billing_url = getsetting( "billing_url" );
$support_url = getsetting( "support_url" );
$manager_email = getsetting( "manager_email" );
$template = str_replace( "{company_name}", $company_name, $template );
$template = str_replace( "{company_url}", $company_url, $template );
$template = str_replace( "{billing_url}", $billing_url, $template );
$template = str_replace( "{support_url}", $support_url, $template );
$template = str_replace( "{domain}", $r->domain, $template );
$template = str_replace( "{srok}", $domainMonths / 12, $template );
$template = str_replace( "{login}", $_SESSION['userLogin'], $template );
$template = str_replace( "{password}", "******", $template );
$template = str_replace( "{schet}", $sid, $template );
$template = str_replace( "{domaincost}", $domainCost, $template );
$template = str_replace( "{cost}", $domainCost, $template );
$template = str_replace( "{userid}", $_SESSION['userId'], $template );
adduserlog( $_SESSION['userId'], "renewdomain", "{$r->domain}, ".$domainMonths / 12." г." );
sendmail( $_SESSION['userEmail'], $manager_email, "Продление заказа [domain]", $template );
sendmail( $manager_email, $_SESSION['userEmail'], "Duplicate: Продление заказа [domain]", $template );
header( "Location: billing.php?do=pay&fromreg=1&id={$bill_id}" );
mclose( );
exit( );
}
}
if ( !( $r = @mysql_query( @"select * from orders_domains where id='{$domain_id}'" ) ) )
{
exit( mysql_error( ) );
}
if ( mysql_num_rows( $r ) == 0 )
{
$error = "Утерян идентификатор.";
}
head( );
print "<B>Продление домена</b><BR><BR>";
if ( $error )
{
print "Ошибка: {$error}<BR><BR>";
}
if ( 0 < mysql_num_rows( $r ) )
{
$r = mysql_fetch_object( $r );
echo "tt<form method=post>rntt<input type=hidden name=do value=";
echo $do;
echo ">rntt<input type=hidden name=sub value=renew>rntt<input type=hidden name=domain_id value=";
echo $domain_id;
echo ">rntt<table border=0>rntt<tr><td align=right>Домен: </td><td><input type=text name=domain value="";
echo $r->domain;
echo "" readonly></td></tr>rntt";
if ( !( $minsrok = @mysql_query( @"select t1.minsrok_renew from zones as t1, orders_domains as t2 where t1.id=t2.zone_id and t2.id='{$domain_id}'" ) ) )
{
exit( mysql_error( ) );
}
$minsrok = mysql_fetch_object( $minsrok );
$minsrok = $minsrok->minsrok_renew;
echo "tt<tr><td align=right>На срок:</td><Td>";
echo "<s";
echo "elect name=domainMonths><option value=";
echo $minsrok;
echo ">";
echo $minsrok / 12;
echo " год";
if ( 1 < $minsrok / 12 )
{
print "а";
}
echo "</select></td></tr>rntt<tr><td colspan=2 align=center><BR><input type=submit value=Продлить></td></tr>rntt</table>rntt";
}
foot( );
}
mclose( );
?>