<?php
/*********************/
/* */
/* Amir Ghazizadeh */
/* */
/*********************/
if ( defined( "ROOT_ACCESS" ) )
{
header( "HTTP/1.0 404 Not Found" );
exit( "" );
}
if ( isset( $_POST['config_form'] ) )
{
require_once( FUNC_PATH."sms/errors.php" );
require_once( FUNC_PATH."nusoap/nusoap.php" );
$client = new soapclient_nu( SMS_WSDL_URL, "wsdl" );
$result = $client->call( "accountInfo", array( "username" => stripslashes( $_POST['sms_user'] ), "password" => stripslashes( $_POST['sms_pass'] ) ) );
if ( !is_array( $result ) || !isset( $result['status'] ) )
{
$message = "متاسفانه امکان اتصال به سرور وجود ندارد.<br>\r\n\t\tلطفا مجددا سعی نمایید.";
}
else if ( $result['status'] == SMS_NO_ERROR )
{
$update = "UPDATE `config` SET `sms_username`='".$_POST['sms_user']."' , `sms_password`='{$_POST['sms_pass']}'";
zsql_query( $update );
zsql_query( "TRUNCATE `sms_number`" );
$sms_numbers = $result['sms_numbers'];
$sms_numbers = implode( "'),('", $sms_numbers );
zsql_query( "INSERT INTO `sms_number` (`sms_number`) VALUES ('".$sms_numbers."')" );
$message = "تغییرات با موفقیت ثبت شد";
}
else if ( $result['status'] == SMS_ERROR_AUTHENTICATION_FAILED )
{
$message = "اطلاعات وارد شده صحیح نمی باشد.";
}
include_once( FUNC_PATH."messages.php" );
message( $message, "", 2, false );
}
$config = zsql_fetch_assoc( zsql_query( "SELECT * FROM `config`" ) );
echo "<table width=\"745\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\">\r\n\t <tr>\r\n\t <td align=\"center\" valign=\"top\">\r\n\t <table border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\" class=\"form_table\">\r\n\t\t\t<tr>\r\n\t\t\t <td id=\"header\">\r\n\t\t\t <table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\r\n\t\t\t <tr>\r\n\t\t\t <td width=\"9\"><img src=\"images/box_right.jpg\" width=\"9\" height=\"25\" /></td>\r\n\t\t\t <td align=\"center\"><span class=\"form_title\"> تنظیمات سیستم</span></td>\r\n\t\t\t <td width=\"9\"><img src=\"images/box_left.jpg\" width=\"9\" height=\"25\" /></td>\r\n\t\t\t </tr>\r\n\t\t\t </table>\r\n\t\t\t </td>\r\n\t\t\t</tr>\r\n\t <tr class=\"row1\">\r\n\t <td>\r\n\t\t\t<div style=\"font-size:11px;padding:5px\" align=\"center\">\r\n\t\t\t<b>";
echo $message;
echo "</b>\r\n\t\t\t</div>\r\n\t\t\t<form action=\"?";
echo makezp( array( "zpe" => "config/index" ) );
echo "\" method=\"POST\">\r\n\t\t\t\t<table class=\"message\" border=\"0\" style=\"border-collapse: collapse\">\r\n\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t<td class=\"title\">نام کاربری MihanSMSCenter: </td>\r\n\t\t\t\t\t\t<td class=\"field\">\r\n\t\t\t\t\t\t <input type=\"text\" name=\"sms_user\" value=\"";
echo $config['sms_username'];
echo "\" >\r\n\t\t\t\t\t\t</td>\r\n\t\t\t\t\t</tr>\r\n\t\t\t\t\t\r\n\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t<td class=\"title\">کلمه عبور MihanSMSCenter: </td>\r\n\t\t\t\t\t\t<td class=\"field\">\r\n\t\t\t\t\t\t <input type=\"text\" name=\"sms_pass\" value=\"";
echo $config['sms_password'];
echo "\" >\r\n\t\t\t\t\t\t</td>\r\n\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t<td class=\"submit\" align=\"center\" colspan=\"4\" style=\"padding:10\">\r\n\t\t\t\t\t\t\t<input class=\"button\" id=\"message_btn\" type=\"submit\" value=\"ثبت تنظیمات\" name=\"config_form\">\r\n\t\t\t\t\t\t</td>\r\n\t\t\t\t\t</tr>\r\n\t\t\t\t</table>\r\n\t\t\t</form>\r\n\t\t</td>\r\n</tr>\r\n</table>\r\n</td>\r\n </tr>\r\n</table>";
?>