I am trying to write a script to prevent brute-force login attempts in a website I m building. The logic goes something like this: User sends login information. Check if username and password is ...
Okay i 最后是我的问题。 问题实际上不是在法典中,问题在于我讲的话语的国家安全局的价值。 电话自动把我行道的人排在DNS的现场。 现在,我给我的服务提供者的每日生活津贴,然后做罚款。 现在我收到普什文电文。 一俟送交。
I Hope it helps others.
第一,确保你重新使用:
- The application is compiled with debug/release provision
- your keychain has the devlopment/production push notification certificate
then use the following code (been tested both dev & production)
<?php
// Comment these lines in production mode
ini_set( display_errors , on );
error_reporting(E_ALL);
// Apns config
// true - use apns in production mode
// false - use apns in dev mode
define("PRODUCTION_MODE",false);
$serverId = 1;
$serverName = my-server-domain.com ;
if(PRODUCTION_MODE) {
$apnsHost = gateway.sandbox.push.apple.com ;
} else {
$apnsHost = gateway.push.apple.com ;
}
$apnsPort = 2195;
if(PRODUCTION_MODE) {
// Use a development push certificate
$apnsCert = $_SERVER[ DOCUMENT_ROOT ]. /apns/apns-dominos-development.pem ;
} else {
// Use a production push certificate
$apnsCert = $_SERVER[ DOCUMENT_ROOT ]. /apns/apns-dominos-production.pem ;
}
// --- Sending push notification ---
// Insert your device token here
$device_token = "<dc6127d8 dc6127d8 dc6127d8 dc6127d8 dc6127d8 dc6127d8 dc6127d8 dc6127d8>"; // Some Device Token
// Notification content
$payload = array();
//Basic message
$payload[ aps ] = array(
alert => testing 1,2,3.. ,
badge => 1,
sound => default ,
);
$payload[ server ] = array(
serverId => $serverId,
name => $serverName
);
// Add some custom data to notification
$payload[ data ] = array(
foo => "bar"
);
$payload = json_encode($payload);
$streamContext = stream_context_create();
stream_context_set_option($streamContext, ssl , local_cert , $apnsCert);
stream_context_set_option($streamContext, ssl , passphrase , "");
$apns = stream_socket_client( ssl:// . $apnsHost . : . $apnsPort, $error, $errorString, 2, STREAM_CLIENT_CONNECT, $streamContext);
$deviceToken = str_replace(" ","",substr($device_token,1,-1));
echo $deviceToken;
$apnsMessage = chr(0) . chr(0) . chr(32) . pack( H* , str_replace( , , $deviceToken)) . chr(0) . chr(mb_strlen($payload)) . $payload;
fwrite($apns, $apnsMessage);
//socket_close($apns);
fclose($apns);
?>
Implement the feedback service on server side and also check on server side that within how much duration all the device token are send to APNS. From feedback service atleast u will come to know that how much devices had received ur notification. If all the device token are send one by one to the APNs and the APNs does nt send any list through feedback service then u cannot handle the duration to receive notification on devices.
使用城市AirShip。 我认为,它是一种最佳的服务器边解决办法,因为它也包括了对Anden(C2DM)和Blakberry的Push-a类通知。
寻找这些档案与查阅档案之间的差别。 解决你的问题。 我的守则如下:
<?php
$message = Hello ; // $_GET or $_POST
$badge = 3; // int
$sound = default ; // string - sound name
$development = true; // boolean
$payload = array();
$payload[ aps ] = array( alert => $message, badge => intval($badge), sound => $sound);
$payload = json_encode($payload);
$apns_url = NULL; // Set Later
$apns_cert = NULL; // Set Later
$apns_port = 2195;
if($development)
{
$apns_url = gateway.sandbox.push.apple.com ;
$apns_cert = /path/apns.pem ; // relative address to an App Specific Certificate file
}
else
{
$apns_url = gateway.push.apple.com ;
$apns_cert = /path/cert-prod.pem ;
}
$stream_context = stream_context_create();
stream_context_set_option($stream_context, ssl , local_cert ,$apns_cert);
$apns = stream_socket_client( ssl:// .$apns_url. : .$apns_port,$error,$error_string,2,STREAM_CLIENT _CONNECT,$stream_context);
// You will need to put your device tokens into the $device_tokens array yourself
$device_tokens = array(); // tokens!!!
foreach($device_tokens as $device_token)
{
$apns_message = chr(0).chr(0).chr(32).pack( H* ,str_replace( , ,$device_token)).chr(0).chr(strlen($payload)).$payload;
fwrite($apns, $apns_message);
}
@socket_close($apns);
@fclose($apns);
?>
<?php $con=mysql_connect("localhost","mts","mts"); if(!con) { die( unable to connect . mysql_error()); } mysql_select_db("mts",$con); /* date_default_timezone_set ("Asia/Calcutta"); $date = ...
I found this script online that creates a thumbnail out of a image but the thumbnail image is created with poor quality how can I improve the quality of the image. And is there a better way to create ...
如何确认来自正确来源的数字。
Most sites need some way to show the dates on the site in the users preferred timezone. Below are two lists that I found and then one method using the built in PHP DateTime class in PHP 5. I need ...
I wonder there is a way to post a message to a facebook business page with cURL? thanks
I want to create text as a watermark for an image. the water mark should have the following properties front: Impact color: white opacity: 31% Font style: regular, bold Bevel and Emboss size: 30 ...
How does php cast boolean variables? I was trying to save a boolean value to an array: $result["Users"]["is_login"] = true; but when I use debug the is_login value is blank. and when I do ...
- winforms
- combobox
- fogbugz
- java
- date
- internationalization
- asp.net
- iis
- url-rewriting
- urlrewriter
- c#
- enums
- ocaml
- haxe
- algorithm
- string
- viewstate
- .net
- c++
- c
- symbol-table
- mysql
- database
- postgresql
- licensing
- migration
- vb.net
- vb6
- declaration
- vb6-migration
- python
- psycopg2
- backup
- vmware
- virtualization
- gnu-screen
- authentication
- desktop
- excel
- xll
- cultureinfo
- regioninfo
- oracle
- client
- session
- download
- html
- virtual
- constructor
- scenarios
- perl
- full-text-search
- javascript
- ajax
- testing
- oop
- inheritance
- vim
- encapsulation
- information-hiding