aboutsummaryrefslogtreecommitdiffstats
path: root/mod/dfrn_poll.php
diff options
context:
space:
mode:
authorMike Macgirvin <mike@macgirvin.com>2010-08-16 22:05:04 -0700
committerMike Macgirvin <mike@macgirvin.com>2010-08-16 22:05:04 -0700
commit4d34ec85cf61101291acf32e1b9e7fe5a6ab7a45 (patch)
treeff1827f4c5728b20e0bb9d086922f0550424f79e /mod/dfrn_poll.php
parentfacca43e2de1c3c30a34f38bbe7025b7216db13f (diff)
downloadvolse-hubzilla-4d34ec85cf61101291acf32e1b9e7fe5a6ab7a45.tar.gz
volse-hubzilla-4d34ec85cf61101291acf32e1b9e7fe5a6ab7a45.tar.bz2
volse-hubzilla-4d34ec85cf61101291acf32e1b9e7fe5a6ab7a45.zip
misc little fixes
Diffstat (limited to 'mod/dfrn_poll.php')
-rw-r--r--mod/dfrn_poll.php22
1 files changed, 12 insertions, 10 deletions
diff --git a/mod/dfrn_poll.php b/mod/dfrn_poll.php
index a4023d1c0..d0b915acf 100644
--- a/mod/dfrn_poll.php
+++ b/mod/dfrn_poll.php
@@ -167,20 +167,22 @@ function dfrn_poll_content(&$a) {
$r = q("SELECT * FROM `contact` WHERE `issued-id` = '%s' AND `blocked` = 0 AND `pending` = 0 LIMIT 1",
dbesc($_GET['dfrn_id']));
- if((! count($r)) || (! strlen($r[0]['prvkey'])))
- $status = 1;
+ if((count($r)) && (strlen($r[0]['prvkey']))) {
- $challenge = '';
+ $challenge = '';
- openssl_private_encrypt($hash,$challenge,$r[0]['prvkey']);
- $challenge = bin2hex($challenge);
+ openssl_private_encrypt($hash,$challenge,$r[0]['prvkey']);
+ $challenge = bin2hex($challenge);
- $encrypted_id = '';
- $id_str = $_GET['dfrn_id'] . '.' . mt_rand(1000,9999);
-
- openssl_private_encrypt($id_str,$encrypted_id,$r[0]['prvkey']);
- $encrypted_id = bin2hex($encrypted_id);
+ $encrypted_id = '';
+ $id_str = $_GET['dfrn_id'] . '.' . mt_rand(1000,9999);
+ openssl_private_encrypt($id_str,$encrypted_id,$r[0]['prvkey']);
+ $encrypted_id = bin2hex($encrypted_id);
+ }
+ else {
+ $status = 1; // key not found
+ }
echo '<?xml version="1.0" encoding="UTF-8"?><dfrn_poll><status>' .$status . '</status><dfrn_id>' . $encrypted_id . '</dfrn_id>'
. '<challenge>' . $challenge . '</challenge></dfrn_poll>' . "\r\n" ;