Topic: Submitting/Exporting User Profile Information

Just been checking out the submissions part of stopforumspam: (red what it's called in punbb)

Looking for ideas how to extract the profile username, registration_ip and email


You can automate submissions by making an HTTP POST to the following URL, with the following parameters:

http://www.stopforumspam.com/add.php
?username=USERNAME   $user['username']
&ip_addr=IPADDRESS       $user['registration_ip']
&email=EMAILADDRESS     $user['email']
&api_key=ZZZZZZZZZZZZZZZ

To verify, check the HTTP status code returned. a 200 will indicate a successful submission, whereas a 403 will indicate an unsuccessful attempt. A reason will be given (inside a paragraph tag) for unsuccessful attempts. Nothing will be returned for a successful submission.


Here's what I found about getting php to http post ...

<?php
function do_post_request($url, $data, $optional_headers = null)
{
  $params = array('http' => array(
              'method' => 'POST',
              'content' => $data
            ));
  if ($optional_headers !== null) {
    $params['http']['header'] = $optional_headers;
  }
  $ctx = stream_context_create($params);
  $fp = @fopen($url, 'rb', false, $ctx);
  if (!$fp) {
    throw new Exception("Problem with $url, $php_errormsg");
  }
  $response = @stream_get_contents($fp);
  if ($response === false) {
    throw new Exception("Problem reading data from $url, $php_errormsg");
  }
  return $response;
}

source: http://wezfurlong.org/blog/2006/nov/htt … thout-curl


or maybe something like this?

//extract data from the post 
extract($_POST);

//set POST variables 
$url = 'http://domain.com/get-post.php';
$fields = array( 
            'lname'=>urlencode($last_name),    
            'fname'=>urlencode($first_name),
            'title'=>urlencode($title),
            'company'=>urlencode($institution),
            'age'=>urlencode($age),
            'email'=>urlencode($email),
            'phone'=>urlencode($phone) 
        );

//url-ify the data for the POST 
foreach($fields as $key=>$value) { $fields_string .= $key.'='.$value.'&'; } 
rtrim($fields_string,'&');

//open connection 
$ch = curl_init();

//set the url, number of POST vars, POST data 
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_POST,count($fields));
curl_setopt($ch,CURLOPT_POSTFIELDS,$fields_string);

//execute post 
$result = curl_exec($ch);

//close connection 
curl_close($ch);

source: http://davidwalsh.name/execute-http-post-php-curl

2

Re: Submitting/Exporting User Profile Information

Or you could do the easy way :-)

$api_key = "your_key";

$url = "http://www.stopforumspam.com/add.php?username=".$user['username']."&ip_addr=".$user['registration_ip']."&email=".$user['email']."&api_key=".$api_key;

if(get_remote_file($url, 10)) {
    //hopefully, everything went ok...
} else {
    //something screwed up :))
}

Btw I haven't checked whether $user really contains data of user you want to ban so I hope you're sure about them. It would be quite bad if you would accidentally reported yourself instead big_smile

Eraversum - scifi browser-based online webgame

Re: Submitting/Exporting User Profile Information

big_smile looks a lot easier yes

I guess this will have to be checked somehow aswell

        // Is this users own profile
        $forum_page['own_profile'] = ($forum_user['id'] == $id) ? true : false;
    // Make sure we are allowed to send user info
    if ($forum_user['id'] != $id &&
        $forum_user['g_id'] != FORUM_ADMIN &&
        ($forum_user['g_moderator'] != '1' || $forum_user['g_mod_edit_users'] == '0' || $user['g_id'] == FORUM_ADMIN || $user['g_moderator'] == '1'))
        message($lang_common['No permission']);

wondering if I'd put a link to post http here (lines 1663...) profile.php

<?php ($hook = get_hook('pf_change_details_about_pre_user_private_info')) ? eval($hook) : null; ?>
<?php if (!empty($forum_page['user_private'])): ?>
            <div id="private-profile" class="ct-set data-set set<?php echo ++$forum_page['item_count'] ?>">
                <div class="ct-box data-box">
                    <h3 class="ct-legend hn"><span><?php echo $lang_profile['Private info'] ?></span></h3>
                    <ul class="data-list">
                        <?php echo implode("\n\t\t\t\t\t\t", $forum_page['user_private'])."\n" ?>
                    </ul>
                </div>
            </div>
<?php endif; ?>