*/ include "includes/db.php"; include "includes/site.class.php"; $csms = new SmppiSite(); if (isset($_REQUEST['login']) && isset($_REQUEST['skey']) && isset($_REQUEST['action'])) { $ip = $_SERVER['REMOTE_ADDR']; $login = $_REQUEST['login']; $md5key = md5($_REQUEST['skey']); if ($user_id = $csms->api_auth($login, $md5key, $ip)) { if ($_REQUEST['action'] == "sendsms") { $user_rights = $csms->user_rights($user_id); if (in_array("SMS_APISEND", $user_rights)) { $phone = $_REQUEST['phone']; $msg = $_REQUEST['msg']; $method = isset($_REQUEST['method']) ? $_REQUEST['method'] : "gsm"; if ($sms_id = $csms->sendsms($phone, $msg, 1, $method)) { $csms->users_log($user_id, "sendsms:{$sms_id}", $_SERVER['REMOTE_ADDR']); $return = array("result" => "success", "sms_id" => $sms_id); } else { $return = array("result" => "error", "reason" => "sendsms"); } } else { $return = array("result" => "error", "reason" => "access denied"); } } else { $return = array("result" => "error", "reason" => "wrong request 2"); } } else { $return = array("result" => "error", "reason" => "bad login or password"); } } else {
<?php include_once "includes/session.inc.php"; include_once "includes/db.php"; include_once "includes/site.class.php"; include_once "lang/lang.{$site_lang}.php"; $csms = new SmppiSite(); include "includes/auth.inc.php"; if (in_array("SMS_WEBSEND", $user_rights)) { if (isset($_REQUEST['phone']) && isset($_REQUEST['msg'])) { $phone = $csms->check_phone($_REQUEST['phone']); $msg = $db->real_escape_string($_REQUEST['msg']); $translit = isset($_REQUEST['translit']) && $_REQUEST['translit'] == 1 ? 1 : 0; $method = isset($_REQUEST['method']) ? $_REQUEST['method'] : "gsm"; try { $sms_id = $csms->sendsms($phone, $msg, $translit, $method); $csms->users_log($user_id, "sendsms:{$sms_id}", $_SERVER['REMOTE_ADDR']); header("location: " . BASE_PATH . "outgoing/"); } catch (Exception $e) { $_SESSION['send_error'] = SEND_ERROR; header("location: " . BASE_PATH . "send/"); } } else { $_SESSION['send_error'] = FIELDS_ERROR; header("location: " . BASE_PATH . "send/"); } } else { header("location: " . BASE_PATH . ""); }