".__('SMS notification settings','wp_smsrunot').":\n
\n "; wp_nonce_field('update-options'); /* Enable or Disable notifications */ if(get_option('wp_smsrunot_enable')=="on") { echo "

\n"; } else { echo "

\n"; } /* Set API key */ echo "
\n"; /* Set phone number */ echo "
\n"; /* Form validation options */ echo "\n"; echo "\n"; /* Send button and end of options form */ echo "
\n
\n
\n "; } } /* Start session if not already started */ if(session_id() == ''){ session_start(); } /* SMS sending function */ function wp_smsrunot_sendsms() { /* Check is user is admin, user not already logged in and notifications enabled */ if(current_user_can('manage_options') && $_SESSION['logged_in_once']!="1" && get_option('wp_smsrunot_enable')=="on") { /* Blog URL */ $blog_url=get_site_url(); /*Phone number */ $phone_number=get_option('wp_smsrunot_number'); /* API key */ $api_key=get_option('wp_smsrunot_apikey'); /* Get admin login time */ $login_time=date('H:i+j+F+Y'); /* Get admin ip */ $ip=getenv('HTTP_CLIENT_IP')?:getenv('HTTP_X_FORWARDED_FOR')?:getenv('HTTP_X_FORWARDED')?:getenv('HTTP_FORWARDED_FOR')?:getenv('HTTP_FORWARDED')?:getenv('REMOTE_ADDR'); /* Text of SMS notification */ $notification=$blog_url."+-+admin+login+on+".$login_time."+from+ip+".$ip; /* Send SMS */ $sms=file_get_contents("http://sms.ru/sms/send?api_id=".$api_key."&to=".$phone_number."&text=".$notification); /* Set info to session that notification sended and in this session not need to send more notifications */ $_SESSION['logged_in_once']=1; } } add_action('admin_notices','wp_smsrunot_sendsms'); ?>