Welcome to HBH! If you had an account on hellboundhacker.org you will need to reset your password using the Lost Password system before you will be able to login.

Communicating With HBH - PHP Code Bank


Communicating With HBH
This code provides a PHP file that allows the user to easily and effectively communicate with HBH. Example applications would be for Timed Challenges, Real 2, Real 13, etc.
                <?php
/*
@author:  DopeBoiMag1k

PHP file designed to abstract the usage of cURL.  

Example usage:
<?php
include(''''hbh.php'''');

hbhInit(''''username'''', ''''password'''');
$page = requestPage(''''http://www.hellboundhackers.org/challenges/timed/timed2/index.php'''');
$string = isolateString($page, '''' and your string is: '''', ''''<br /><br />'''');

$answer = functionToFindAnswer($string);

addPostParam(''ans'', ''''''. $answer);
addPostParam(''''submit'''', ''''Check'''');

echo requestPage(''''http://www.hellboundhackers.org/challenges/timed/timed2/index.php?check'''');
?>
*/

$post_params = array();
$user = '''''''';
$pass = '''''''';
$cookie = '''''''';

function hbhInit($username, $password){
	global $user, $pass;
	
	$user = $username;
	$pass = $password;
}

function loginHBH(){
	global $user, $pass;
	
	$url = ''''http://www.hellboundhackers.org/index.php'''';
	$cookie = '''''''';
	
	$ch = curl_init();

	curl_setopt($ch, CURLOPT_POSTFIELDS, ''''user_name=''''.$user.''''&user_pass=''''.$pass.''''&login=Login'''');
	curl_setopt($ch, CURLOPT_URL, $url);
	curl_setopt($ch, CURLOPT_HEADER, true);
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
	
	$response = curl_exec($ch);
	
	$start = strpos($response, ''''PHPSESSID'''', 0);
	$end = strpos($response, '''';'''', $start);
	
	$cookie = substr($response, $start, $end - $start + 1);
	
	$start = strpos($response, ''''fusion_user'''', 0);
	$end = strpos($response, '''';'''', $start);
	
	$cookie = $cookie . '''''''' . substr($response, $start, $end - $start + 1);
	curl_close($ch);
	
	return $cookie;
}

function addPostParam($name, $value){
	global $post_params;
	
	$index = count($post_params);
	$post_params[$index] = $name . ''''='''' . $value;
}

function encodePostParams(){
	global $post_params;
	
	$post = '''''''';
	for($i = 0; $i < count($post_params); $i++){
		if($i == 0){
			$post = $post_params[$i];
		}else{
			$post = $post . ''''&'''' . $post_params[$i];
		}
	}
	
	return $post;
}

function requestPage($url){
	global $cookie;
	
	$ch = curl_init();
	
	if($cookie == ''''''''){
		$cookie = loginHBH();
	}
	
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
	curl_setopt($ch, CURLOPT_POSTFIELDS, encodePostParams());
	curl_setopt($ch, CURLOPT_COOKIE, $cookie);
	curl_setopt($ch, CURLOPT_URL, $url);
	
	$response = curl_exec($ch);
	return $response;
}

function isolateString($html, $stringBefore, $stringAfter){
	$start = strpos($html, $stringBefore, 0) + strlen($stringBefore);
	$end = strpos($html, $stringAfter, $start);
	
	return substr($html, $start, $end - $start);
}

?>
            
Comments
Sorry but there are no comments to display