Does anyone need a PHP interface class for PointShop?

Hey there. I am posting, asking if anyone needs a PHP interface for Pointshop. This allows for easy manipulation of Pointshop and a speedy integration with a Paypal IPN for anyone wishing to create and give dona tor specific items. A requirement is that Pointshop works off a MySQL database. To anyone wishing to acquire this interface, please PM me. I will not be able to give it to you, however, until after the 5th of June.

<?php
	// PHP - MySQL for Pointshop
	// API
	
class PointshopApi{

	public $MySQL_IP = "";
	public $MySQL_Database = "";
	public $MySQL_User = "";
	public $MySQL_Pass = "";
	
	public $Users;
	public $LoggedIn;
	
	function __construct( $Login ){
		// Authenticate
		if ( $Login == "" ){
			
			$this->Users = array( );
			mysql_connect($this->MySQL_IP, $this->MySQL_User, $this->MySQL_Pass) or die(mysql_error());
			mysql_select_db($this->MySQL_Database) or die(mysql_error());
			$result = mysql_query("SELECT * FROM pointshop_data") or die(mysql_error());
			
			
			while($row = mysql_fetch_array($result)){
				$this->Users[ $row["uniqueid"] ] = new PointshopUser( $row["uniqueid"], $row["points"], $row["items"], $this );
			}
			
			mysql_close();
			$this->LoggedIn = true;
		}else{
			$this->LoggedIn = false;
		}
	}
	
	function InvalidateUser( $ID , $Instance ){
		mysql_connect($this->MySQL_IP, $this->MySQL_User, $this->MySQL_Pass) or die(mysql_error());
		mysql_select_db($this->MySQL_Database) or die(mysql_error());
		$this->Users[ $ID ] = $Instance;
		$result= "UPDATE pointshop_data SET points=". $Instance->GetPoints() .", items='". json_encode($Instance->GetItems()) ."' WHERE uniqueid='". $Instance->GetUniqueID()."'";
		mysql_query($result) or die(mysql_error());
		mysql_close();
	}
	
	function GetUser( $ID ){ return $this->Users[ $ID ]; }
	function IsLoggedIn( ){ return $this->LoggedIn; }
	
	function SteamID_to_UniqudeID( $SteamID ){
		return sprintf( "%u/n", crc32( "gm_" . $SteamID . "_gm" ) );
	}


}

class PointshopUser{
	public $UniqueID;
	public $Points;
	public $Items;
	public $ParentClass;
	
	function __construct( $UniqueID , $Points, $Items, $Parent ){
		$this->UniqueID = $UniqueID;
		$this->Points = (int)$Points;
		$this->Items = json_decode( $Items, true );
		$this->ParentClass = $Parent;
	}
	
	function Invalidate( ){ $this->ParentClass->InvalidateUser( $this->GetUniqueID(), $this ); }
	function GetUniqueID( ){ return $this->UniqueID; }
	
	function GetPoints( ){ return $this->Points; }
	function SetPoints( $Points ){ $this->Points = $Points; $this->Invalidate( );}
	function AddPoints( $Points ){ $this->SetPoints( $this->GetPoints() + $Points ); }
	
	function GetItems( ){ return $this->Items; }
	function AddItem( $ID, $Modifiers, $Equipped ){
		$this->Items[ $ID ] = array(
			"Modifiers"=> $Modifiers, 
			"Equipped"=> $Equipped ); 
		$this->Invalidate( );
	}
	function RemoveItem( $ID ){
		$this->Items[ $ID ] = NULL;
		$this->Invalidate( );
	}
	// clear
}

?>

Example Usage:


$API = new PointshopApi( "......" );
$API->GetUser( "5465432168" )->AddItem( "VIP Hat" , array( ), false );
$API->GetUser( "3456875549" )->AddItem( "Facepunch Hat" , array( ), false );

Can’t you just release it once you finish it?

It is finished, that’s not why I can’t release it.

Why would you post about this two and a half weeks before you can release it? It would be a very handy thing though. And why can’t you release it until the 5th of June?

Yes, Im in need of this.

I would love something like this, would help out on my servers a lot.

Ye i would love this on my server

That would go quite nicely cheers man

2 days till the big release. Get out the balloons.

Updated the OP. I’m 3 minutes late.