diff --git a/test.php b/test.php deleted file mode 100644 index 4bc62402..00000000 --- a/test.php +++ /dev/null @@ -1,64 +0,0 @@ - array("capture_peer_cert" => TRUE, "verify_peer" => FALSE,))); - $read = stream_socket_client($socket, $errno, $errstr, 10, STREAM_CLIENT_CONNECT, $get); - - if($read){ - $cert = stream_context_get_params($read); - $cert_public_key_obj = openssl_x509_parse($cert['options']['ssl']['peer_certificate']); - openssl_x509_export($cert['options']['ssl']['peer_certificate'], $export); - - // Success - process data - if($cert_public_key_obj){ - $expire = mysqli_real_escape_string($mysqli, date('Y-m-d', $cert_public_key_obj['validTo_time_t'])); - $issued_by = mysqli_real_escape_string($mysqli, strip_tags($cert_public_key_obj['issuer']['O'])); - $public_key = mysqli_real_escape_string($mysqli, $export); - - // Update the record (forcing certificate_created_at field to be updated to ensure we don't try and update the same record every day) - mysqli_query($mysqli, "UPDATE certificates SET certificate_issued_by = '$issued_by', certificate_expire = '$expire', certificate_public_key = '$public_key', certificate_updated_at = NOW() WHERE certificate_id = '$certificate_id' LIMIT 1"); - echo "Updated $certificate_domain"; - } - else{ - // Likely the SSL socket failed, log an error notification - mysqli_query($mysqli, "INSERT INTO notifications SET notification_type = 'Cron', notification = 'Nightly SSL update for $certificate_domain failed. Please check and manually update this record.', notification_timestamp = NOW(), company_id = $company_id"); - echo "Update $certificate_domain failed"; - } - } - else{ - // Likely the SSL socket failed, log an error notification - mysqli_query($mysqli, "INSERT INTO notifications SET notification_type = 'Cron', notification = 'Nightly SSL update for $certificate_domain failed. Please check and manually update this record.', notification_timestamp = NOW(), company_id = $company_id"); - echo "Update $certificate_domain failed"; - } - -} - -echo "Carried on!"; - -?> \ No newline at end of file