pasteBin.php ➔ pasteLog()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 23
Code Lines 18

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 18
nc 1
nop 2
dl 0
loc 23
rs 9.0856
c 0
b 0
f 0
1
<?php
2
function pasteLog($pasteText, $pasteName)
3
{
4
    $api_dev_key = 'b76a9a39acaa8d9b2cec417a0f3a822a'; // Dramiel bot devs account
5
    $api_paste_code = $pasteText; // your paste text
6
    $api_paste_private = '0'; // 0=public 1=unlisted 2=private
0 ignored issues
show
Unused Code Comprehensibility introduced by
42% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
7
    $api_paste_name = $pasteName; // name or title of your paste
8
    $api_paste_expire_date = '10M';
9
    $api_paste_format = 'php';
10
    $api_user_key = ''; // if an invalid api_user_key or no key is used, the paste will be create as a guest
11
    $api_paste_name = urlencode($api_paste_name);
12
    $api_paste_code = urlencode($api_paste_code);
13
14
15
    $url = 'http://pastebin.com/api/api_post.php';
16
    $ch = curl_init($url);
17
18
    curl_setopt($ch, CURLOPT_POST, true);
19
    curl_setopt($ch, CURLOPT_POSTFIELDS, 'api_option=paste&api_user_key=' . $api_user_key . '&api_paste_private=' . $api_paste_private . '&api_paste_name=' . $api_paste_name . '&api_paste_expire_date=' . $api_paste_expire_date . '&api_paste_format=' . $api_paste_format . '&api_dev_key=' . $api_dev_key . '&api_paste_code=' . $api_paste_code . '');
20
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
21
    curl_setopt($ch, CURLOPT_VERBOSE, 0);
22
    curl_setopt($ch, CURLOPT_NOBODY, 0);
23
    return curl_exec($ch);
24
}