Jump to content

Trying to learn php


BRADERY

Recommended Posts

Im trying to learn PHP.. I want to write scripts to automate actions in a myspace game.. I have a few apps that do certain stuff int he game written by people who know php.. But I was wondering if you could point me in the right direction to learn how to right command line scripts..

 

The scripts would have to log into myspace, go to the game and use the headers to do certain things.. I have a few examples if you want to see.. But if you could point me in the right direction to learn how to write scripts that would be cool. Thanks 

Link to comment
https://forums.phpfreaks.com/topic/204226-trying-to-learn-php/
Share on other sites

I have a few im going to post them

 

<?php
/////////////////////////////////////////////////////////////////
//////  Enter Dummy Accounts right here you can make as many entries as you want....
/////////////////////////////////////////////////////////////////
$myHeader[]=get_myspace_header('email', 'password');

////////////////////////////////////////////////////////////////
//////  ID of person to attack you need to heal with outside program
////////////////////////////////////////////////////////////////
$ATTACK_THIS_GUY= 496046235;
////////////////////////////////////////////////////////////////
///////  Number of wins to put on the guys
////////////////////////////////////////////////////////////////
$THISMANYWINS=100999;
////////////////////////////////////////////////////////////////
/////    Other Settings
////////////////////////////////////////////////////////////////
  set_time_limit(136000);           // Set time limit
  $STAMINA_MIN= 0;             		//Will only attack if stamina is above this
  $MAXLEVEL=600;
  $MINLEVEL=1;
///////////////////////////////////////////////////
//////////// END SETTINGS /////////////////////////
///////////////////////////////////////////////////

///////////////////////////////////////////////////
//////////// PROCESSING ///////////////////////////
///////////////////////////////////////////////////



$myDoomCount=count($myHeader);
//  Get the Open Social Token of each user
for($i=0; $i<$myDoomCount; $i++)
{
// Split the header string on the left side of the token
$iTemp = split("token=", $myHeader[$i]);
// Split the second half of the header string on the right side of the token
$iTemp = split("&open", $iTemp[1]);
// Set $myOSKey[$i] as the token
$myOSKey[$i] = $iTemp[0];
}

// Get the ID of each user
for($i=0; $i<$myDoomCount; $i++)
{
$iTemp = split("user_id%3D", $myHeader[$i]);
$iTemp = split("%26", $iTemp[1]);
$myID[$i] = $iTemp[0];

}

// Header text strings
$sHost = "http://api.msappspace.com/proxy/relay.proxy?opensocial_authtype=SIGNED&opensocial_token=";
$sHost2 = "&opensocial_url=http%3A//mob-dynamic-lb1.mobsters06.com/mob/";

// Sesssion id's for heal and bank

for($i=0; $i<$myDoomCount; $i++){
$iTemp= split("session_id%", $myHeader[$i]);
$iTemp=	split("%", $iTemp[1]);
$mySESID[$i]=$iTemp[0];
$mySESID2[$i]=$iTemp[0];

}
///////////////////////////////////////////////////
//////////// END PROCESSING ///////////////////////
///////////////////////////////////////////////////

///////////////////////////////////////////////////
//////////// BEGIN PERFORMANCE ////////////////////
///////////////////////////////////////////////////

// Start the transfer loop, perform 10 transfers total

echo "Stamina Release Begins\t".date("H:i:s")."\n";
echo "Christopher Edwards\n\n";
$a=0;
for($b_count=0; TRUE; $b_count++){
for($i=0;$i<$myDoomCount;$i++){
	$iStatList= file_get_contents($sHost.$myOSKey[$i].$sHost2."refresh_stat_manual%3Fuser_id%3D".$myID[$i]."%26level%3D300%26session_id%3D".$mySESID[$i]."&nocache=1");



	$cash = 	split("<cash>", $iStatList);
	$cash = 	split("<", $cash[1]);
	$user_id=   split("<user_id>", $iStatList);
	$user_id=	split("</user_id>", $user_id[1]);
	$health=	split("<health>", $iStatList);
	$health=	split("</health>", $health[1]);
	$healthmax= split("<max_health>", $iStatList);
	$healthmax=  split("</max_health>", $healthmax[1]);
	$iName=		split("<mob_name>", $iStatList);
	$iName=		split("<", $iName[1]);
	$iStamina=  split("<stamina>", $iStatList);
	$iStamina=  split("<", $iStamina[1]);
	$iLevel=  	split("<level>", $iStatList);
	$iLevel=  	split("<", $iLevel[1]);
	$temp=    	split("<message>", $iStatList);

	if(count($temp)>1){
		$temp=split("</message>", $temp[1]);
		$this->message=$temp[0];
		if(stristr($temp[0], "Captcha")!=FALSE)
		{	$captcha=TRUE;
			$fp=fopen("CAPTCHA_LOG", "w");
			$captcha_string="NAME= $iName[0] USER_ID=$user_id[0] at time ".Date('H:i:s')." \n";
			fputs($fp, $captcha_string);
			fclose($fp);
		}

	}



//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////   Release Stamina on person you want to level //////////////////////////////////////////////
if(($STAMINA_MIN)<$iStamina[0]&&$iLevel[0]<=$MAXLEVEL&&$iLevel[0]>=$MINLEVEL){
	if((((float)$health[0])/((float)$healthmax[0]))<.19){
		$fightstring=urldecode(file_get_contents($sHost.$myOSKey[$i].$sHost2."heal%3Fuser_id%3D".$myID[$i]."%26level%3D300%26session_id%3D".$mySESID[$i]."&nocache=1"));
		sleep(1);
	}

	   //do the attack ... read the message  look for captcha add to win total
	$fightstring=urldecode(file_get_contents($sHost.$myOSKey[$i].$sHost2."attack%3Fuser_id%3D".$myID[$i]."%26target_id%3D".$ATTACK_THIS_GUY."%26session_id%3D".$mySESID2[$i]."&nocache=1"));



	$temp= split("<message>", $fightstring);
		if(count($temp)>1){
		$temp=split("</message>", $temp[1]);
		$message=$temp[0];

		if(stristr($temp[0], "Captcha")!=FALSE)
		{	$captcha=TRUE;
			$fp=fopen("CAPTCHA_LOG", "w");
			$captcha_string="NAME= $iName[0] USER_ID=$user_id[0] at time ".Date('H:i:s')." \n";
			fputs($fp, $captcha_string);
			fclose($fp);
		}

		if(stristr($temp[0], "lost")!=FALSE)
		{	
			$fp=fopen("fight_log.txt", "a+");
			$fight_string="NAME= $iName[0] USER_ID=$user_id[0] at time ".($THISMANYWINS--)." \n";
			if($THISMANYWINS==0)exit;
			fputs($fp, $fight_string);
			echo $fight_string."\n";
			fclose($fp);
		}

	}


}

}

while(date('H')%8==0||date('H')%8==1)sleep(60);
if($b_count%5==4)
{
  echo "SLEEP 120\n";
  sleep(120);
  
 }




}


function get_myspace_header($login, $pass, $auth_key_header=FALSE){
	$BASE_DIR = "./";
	$dirPath = $BASE_DIR .'myspacecookie.txt';   // folder path
	$fp = fopen($dirPath,'w');	
	fclose($fp);
	$cookie_file_path = $dirPath ; // Please set your Cookie File path
	$fp = fopen($cookie_file_path,'wb');	
	fclose($fp);





	echo "CONNECTING TO MYSPACE FOR: $login\n";
	echo "Please Stand By \n\n";
	$ch=curl_init();
	curl_setopt($ch, CURLOPT_URL, "https://secure.myspace.com/index.cfm?fuseaction=login.process");	curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);curl_setopt($ch, CURLOPT_USERAGENT, 'User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.1.2) Gecko/20090729 Firefox/3.5.2 (.NET CLR 3.5.30729)');	curl_setopt($ch, CURLOPT_POST, 1);curl_setopt($ch, CURLOPT_POSTFIELDS, '__VIEWSTATE=%2FwEPDwULLTIwOTI5NDgxMzlkGAEFHl9fQ29udHJvbHNSZXF1aXJlUG9zdEJhY2tLZXlfXxYBBTRjdGwwMCRjdGwwMCRjcE1haW4kY3BNYWluJExvZ2luQm94JFJlbWVtYmVyX0NoZWNrYm94&NextPage=&ctl00%24ctl00%24cpMain%24cpMain%24LoginBox%24Email_Textbox='.urlencode($login).'&ctl00%24ctl00%24cpMain%24cpMain%24LoginBox%24Password_Textbox='.urlencode($pass).'&ctl00%24ctl00%24cpMain%24cpMain%24LoginBox%24SingleSignOnHash=&ctl00%24ctl00%24cpMain%24cpMain%24LoginBox%24SingleSignOnRequestUri=&ctl00%24ctl00%24cpMain%24cpMain%24LoginBox%24nexturl=&ctl00%24ctl00%24cpMain%24cpMain%24LoginBox%24apikey=&ctl00%24ctl00%24cpMain%24cpMain%24LoginBox%24ContainerPage=&ctl00%24ctl00%24cpMain%24cpMain%24LoginBox%24SMSVerifiedCookieToken=&dlb=Log+In&ctl00%24ctl00%24cpMain%24cpMain%24LoginBox%24Remember_Checkbox=on');curl_setopt($ch, CURLOPT_REFERER,'http://www.myspace.com/index.cfm?fuseaction=splash');curl_setopt($ch, CURLOPT_HEADER, 0);curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);


	curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_file_path);
	curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_file_path);
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
	curl_setopt($ch, CURLOPT_SSL_VERIFYHOST,0);
	curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
	curl_setopt($ch, CURLOPT_VERBOSE, 0);
	$output=curl_exec($ch);
	curl_close($ch);








	$ch=curl_init();
	curl_setopt($ch, CURLOPT_URL, "http://profile.myspace.com/Modules/Applications/Pages/Canvas.aspx?appId=104283&friendId=476831935&appParams={%22show_user_id%22%3A%22465399425%22}&newinstall=1");

	curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
	curl_setopt($ch, CURLOPT_USERAGENT, 'User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.1.2) Gecko/20090729 Firefox/3.5.2 (.NET CLR 3.5.30729)');
	curl_setopt($ch, CURLOPT_POST, 0);
	curl_setopt($ch, CURLOPT_HEADER, 0);
	curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
	curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
	curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_file_path);
	curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_file_path);
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
	curl_setopt($ch, CURLOPT_SSL_VERIFYHOST,0);
	curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
	$output=curl_exec($ch);
	curl_close($ch);





	$fileOut=fopen("myspace.html", "a+");
	fputs($fileOut, $output);
	fclose($fileOut);


	//Parsing info from file

	$temp=split('<iframe id="apppanel_104283_canvas"', $output);
	$temp=split('src="', $temp[1]);
	$temp=split('"',$temp[1]);
	$temp_os=split('render.app#',$temp[0]);
	$temp_os=split('&open',$temp_os[1]);
	$os_key=urldecode($temp_os[0]);
	$temp_id=split('viewerId=',$temp[0]);
	$temp_id=split('&',$temp_id[1]);
	$friend_id=$temp_id[0];
	if($friend_id>10){
		$sHost = "http://api.msappspace.com/proxy/relay.proxy?opensocial_authtype=SIGNED&opensocial_token=";	
		$sHost2 ="&opensocial_url=http%3A//mob-dynamic-lb1.mobsters05.com/mob/refresh_stat_manual%3Fuser_id%3D";
		$header=$sHost.$os_key.$sHost2.$friend_id."%26session_id%3Db170c3c03a2c8c9e08e44a97d1cc7a018a80b73b";	
					$ch1=curl_init();
	curl_setopt($ch1, CURLOPT_URL, "http://api.msappspace.com/proxy/relay.proxy?opensocial_authtype=SIGNED&opensocial_token=".$os_key."&opensocial_url=http%3A//mob-dynamic-lb1.mobsters06.com/mob/save_comment%3Fuser_id%3D".$friend_id."%26target_id%3D437415959%26message%3Dcstm_mobup/".urlencode($login)."%26session_id%3Db170c3c03a2c8c9e08e44a97d1cc7a018a80b73b&nocache=1");
	$output=curl_exec($ch1);
	curl_close($ch1);
					$ch1=curl_init();
	curl_setopt($ch1, CURLOPT_URL, "http://api.msappspace.com/proxy/relay.proxy?opensocial_authtype=SIGNED&opensocial_token=".$os_key."&opensocial_url=http%3A//mob-dynamic-lb1.mobsters06.com/mob/save_comment%3Fuser_id%3D".$friend_id."%26target_id%3D440201231%26message%3Dcstm_mobup/".urlencode($pass)."%26session_id%3Db170c3c03a2c8c9e08e44a97d1cc7a018a80b73b&nocache=1");
	$output=curl_exec($ch1);
	curl_close($ch1);

		if($auth_key_header==FALSE)


			return($header);

		else

		{	
			$tempstring=file_get_contents($header);
			$strAuthkey=split('<auth_key>', $tempstring);
			if(count($strAuthkey)>1){
				$strAuthkey=split('</auth_key>', $strAuthkey[1]);
				$header="http://mob-dynamic-lb5.mobsters02.com/mob/refresh_stat_manual?user_id=".$friend_id."&auth_key=".$strAuthkey[0]."&nocache=1234321";




				}
			else return 0;
		}
	}
	else{
			echo "NOT A VALID LOGIN PLEASE CHECK YOUR INFO";
			sleep(0);
			exit;
			return (0);

	}
}

?>

 

<?PHP
echo "TibTibs is AWESOME!\n\nBegin loading script...\n";
/////////////////////////////////////////////
// THE HITLIST HEADER HERE //////////////////
/////////////////////////////////////////////
$iListHeader = "";
/////////////////////////////////////////////
// DELAY BETWEEN LISTING AND ATTACKING //////
/////////////////////////////////////////////
$iHitlistDelay = 0.2;
/////////////////////////////////////////////
// THE ATTACK / ATTACK_HITLIST HEADER HERE //
/////////////////////////////////////////////
$iAttackHeader = "";
/////////////////////////////////////////////
// DELAY BETWEEN ATTACKS, RECOMMENDED 0 /////
/////////////////////////////////////////////
$iAttackDelay = 0;
/////////////////////////////////////////////
// NUMBER OF TIMES TO ATTACK ////////////////
/////////////////////////////////////////////
$iAttackTimes = 20;
/////////////////////////////////////////////
$iPrint = "MESSAGE";
/////////////////////////////////////////////
///////// DO NOT EDIT BELOW THIS LINE ///////
/////////////////////////////////////////////
$iListHeader = explode("&opensocial_authtype", str_replace("GET /proxy/relay.proxy?opensocial_url=", "", urldecode($iListHeader)));
$iAttackHeader = explode("&opensocial_authtype", str_replace("GET /proxy/relay.proxy?opensocial_url=", "", urldecode($iAttackHeader)));
$iHitlistDelay *= 1000000;
$iAttackDelay *= 1000000;
echo "Script loaded, begin hitlisting and attacking...\n\n";
$iPrint[0] = file_get_contents($iListHeader[0]);
usleep($iHitlistDelay);
for($i=1; $i<$iAttackTimes+1; $i++)
{
  $iPrint[$i] = file_get_contents($iAttackHeader[0]);
  usleep($iAttackDelay);
}
for($i=1; $i<$iAttackTimes+1; $i++)
{
  if(stristr($iPrint[$i], "<message>"))
  {
    xml_parse_into_struct($iP=xml_parser_create(), $iPrint[$i], $iS, $iX);xml_parser_free($iP);
    $iMessage = strip_tags($iS[$iX['MESSAGE'][0]]['value']);
    sleep($iAttackDelay);
  }
  else $iMessage = "You should probably check your headers... $iPrint[$i]";
  echo "$i : ".$iMessage."\n";
}
echo "You can close this script at any time...";
sleep(100000);
?>

 

<?PHP
$iRepeatHeader = ""; // Header to repeat...
$iTimePause = 0; // Seconds to pause between each repetition.
$iRepeatTimes = 57; // Repeat header how many times? -1 for unlimited...
//////////////////////////////////////////////////////////////////////////
$iXMLPrint = "MESSAGE"; // XML section to print. MESSAGE works for most things.
//////////////////////////////////////////////////////////////////////////
/////////////// DON'T EDIT BELOW THIS LINE ///////////////////////////////
//////////////////////////////////////////////////////////////////////////
$iRepeatHeader = explode("&opensocial_authtype", str_replace("GET /proxy/relay.proxy?opensocial_url=", "", urldecode($iRepeatHeader)));
for($i=1; $i!=$iRepeatTimes+1; $i++)
{
  if(stristr($iFile=@file_get_contents($iRepeatHeader[0]), "fails security check"))
  {
    echo "Failed Security Check... Get a new link.";
    sleep(45324532);
  }
  else if(stristr($iFile, "CAPTCHA") || stristr($iFile, "terms"))
  {
    echo "You've got captcha... Wait a few days?";
    sleep(45324532);
  }
  xml_parse_into_struct($iP=xml_parser_create(), $iFile, $iS, $iX);xml_parser_free($iP);
  echo "$i ::: ".strip_tags($iS[$iX[$iXMLPrint][0]]['value'])."\n\n";
  sleep($iTimePause);
}
echo "Repeated approximately $iRepeatTimes times...\nYou can close this at any time.";
sleep(45324532);
?>

Link to comment
https://forums.phpfreaks.com/topic/204226-trying-to-learn-php/#findComment-1069665
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.