Jump to content
MakeWebGames

[For Hire] php/mySQL/js/jQuery/Ajax Coder [Custom Scripts/Modifications]


Sim

Recommended Posts

Hey. I have been programming for over 10years and freelancing for over 2years. I have worked on some large sites non related to gaming with over 100,000 members and some sites with over 1,000,000 downloads.

 

I can do custom CMS scripts, blogging systems, rating systems, image manipulations.

 

I have created several scripts from scratch and have also done modifications for many game scripts. Any feature you can think of can be coded. I have done coding on quests system's, image manipulation such as placing things such as paperdolling systems (tattoo systems), guild/clan systems and much more.

 

 

Price per hour is roughly $15-$20/hr.

The longer hours I am hired for the lower the hourly rate.

You can contact me

FounderSim

email: [email protected]

Edited by Sim
Link to comment
Share on other sites

  • 7 months later...
  • 1 month later...

I am looking for work again guys/gals. Below is some code sample:

 

<?
include "../includes/constants.php";
class category
{
//vars
private $db;
private $smarty;


public function __construct($dbRef, $smartyRef)
{
	//vars
	$this->db = $dbRef;
	$this->smarty = $smartyRef;

	//if adding a category
	if(isset($_POST['SubmitForm']))
	{
		$this->AddCategory($_POST['textCat'], $_POST['select'], $_POST['textDesc'],$_POST['selectLogin'], "new");
	}

	//see what we are doing here...
	switch ($_GET['what'])
	{
		case "add";
			$this->displayAddCategory(0);
			$this->smarty->assign("site_page", "Add category");
			break;
		case "manage";

			if(isset($_POST['StartEditDetails']))
			{
				$this->displayEditDetails($this->db->escape($_POST['hidden']));
			}
			elseif(isset($_POST['StartDelete']))
			{
				$this->displayConfirmDelete();
			}
			elseif(isset($_POST['ConfirmDelete']))
			{
				$this->proccessDelete();
				$this->displayCategoryListings();
			}
			elseif(isset($_POST['EditDetails']))
			{
				$this->AddCategory($_POST['textCat'], $_POST['select'], $_POST['textDesc'],$_POST['selectLogin'], "edit");
			}
			else
			{
				$this->smarty->assign("site_page", "Manage Categories");
				$this->displayCategoryListings();
			}

			break;
	}

}

//delete categories and file's
public function proccessDelete()
{
	//current category
	$rec = $this->db->fetch("SELECT catSubID, catTitle FROM " . CAT_TABLE . " WHERE catID='" . $this->db->escape($_POST['hidden']) . "'");
	$rows = $this->db->fetch_array("SELECT imageID, imageFileType FROM " . IMAGE_TABLE . " WHERE imageCatID='" . $rec['catSubID'] . "'");

	//delete current category images
	foreach($rows as $rec2)
	{
		unlink("../images/" . $rec2['imageID'] . '.' . $rec2['imageFileType']);
	}


	//get sub categories
	$recs = $this->db->fetch("SELECT COUNT(catID) AS ammount FROM " . CAT_TABLE . " WHERE catSubID='" . $this->db->escape($_POST['hidden']) . "'");

	//if sub categories
	if($recs['ammount'] > 0)
	{
		//set some default values..
		$cont = false;
		$max = 1;
		$i = 0;

		$IDS[] = $this->db->escape($_POST['hidden']);

		//loop threw all words
		while($max > $i)
		{
			$rec = $this->db->fetch("SELECT *, COUNT(catID) AS amount FROM " . CAT_TABLE . " WHERE catSubID='" . $IDS[$i] . "'");
			$msg .= $rec['catTitle'] . " Category and Images deleted...<br>";

			if($rec['amount'] > 0)
			{
				$IDS[] = $rec['catID'];
				$max++;
			}

			$i++;

		}


		//loop threw all cat ids to be deleted
		for($i=0; $i<count($IDS);$i++)
		{

			//get all images associated with category being deleted
			$rows = $this->db->fetch_array("SELECT imageID, imageFileType FROM " . IMAGE_TABLE . " WHERE imageCatID='" . $IDS[$i] . "'");

			//cycle threw all image records
			foreach($rows as $rec)
			{
				//if file exists
				if(is_file("../images/" . $rec['imageID'] . '.' . $rec['imageFileType']))
				{
					//delete image file
					unlink("../images/" . $rec['imageID'] . '.' . $rec['imageFileType']);
				}
			}

			//delete records
			$this->db->del("DELETE FROM " . CAT_TABLE . " WHERE catID='" . $IDS[$i] . "'");
			$this->db->del("DELETE FROM " . IMAGE_TABLE . " WHERE imageCatID='" . $IDS[$i] . "'");
		}
	}

	//first category.. delete from
	$this->db->del("DELETE FROM " . IMAGE_TABLE . " WHERE imageCatID='" . $this->db->escape($_POST['hidden']) . "'");
	$this->db->del("DELETE FROM " . CAT_TABLE . " WHERE catID='" . $this->db->escape($_POST['hidden']) . "'");
	$this->smarty->assign("msg", $msg);
}

//display confirm delete buttton
public function displayConfirmDelete()
{
	$this->smarty->assign("delete", 'y');
	$this->smarty->assign("id", $_POST['hidden']);

}

//display details to edit
public function displayEditDetails($id)
{
	//query
	$rec = $this->db->fetch("SELECT catID, catSubID, catSubID, catTitle, catDesc, catReqLogin FROM " . CAT_TABLE . " WHERE catID='$id'");


	//set template vars
	$this->smarty->assign("edit", 'y'); 
	$this->smarty->assign("id", $rec['catID']); 
	$this->smarty->assign("name", $rec['catTitle']); 
	$this->smarty->assign("desc", $rec['catDesc']); 
	$this->smarty->assign("login_" . $rec['catReqLogin'], "selected"); 

	//list categories
	$this->displayAddCategory($rec['catSubID']);
}

//attempt to add category
public function addCategory($cat_name, $select, $desc, $login_req, $action)
{
	//query to check if category name exists for sub category if one selected..
	$rec = $this->db->fetch("SELECT COUNT(*) AS ammount FROM " . CAT_TABLE . " WHERE catTitle='" . $this->db->escape($cat_name) . "' AND catSubID='" . $this->db->escape($select) . "'");


	//setup data
	$data = array("catTitle" => $cat_name, "catDesc" => $desc,"catReqLogin" => $login_req,  "catSubID" => $select, "catDate" => time());

	if($action == "edit")
	{
		//update record
		$this->db->update(CAT_TABLE, $data, "catID='" . $_POST['hidden'] . "'");
		$this->smarty->assign("msg", "<BR>Category updated...");
		$this->displayCategoryListings();
	}

	//category doesn't exist, create it
	if($rec['ammount'] == 0 && $action == "new")
	{
		//insert data
		$this->db->insert(CAT_TABLE, $data);
		$this->smarty->assign("msg", "<BR>Category created...");
	}
	elseif($action == "new")
	{
		$this->smarty->assign("msg", "<BR>Category name allready exists...");
	}
}

//display categories for category add form
public function displayAddCategory($selected)
{
	//query
	$rows = $this->db->fetch_array("SELECT catID, catSubID, catTitle FROM " . CAT_TABLE . " ORDER BY catTitle");

	$selects[0] = "None"; 
	//loop through records
	foreach($rows as $rec)
	{
		$selects[$rec['catID']] = $rec['catTitle']; 
	}


	//set template var
	$this->smarty->assign("selects", $selects); 
	$this->smarty->assign("selected", $selected); 
}


//display all categories with some stats
public function displayCategoryListings()
{
	$Data = array();
	//query
	$rows = $this->db->fetch_array("SELECT * FROM " . CAT_TABLE . " ORDER BY catTitle");

	//loop through records
	foreach($rows as $rec)
	{			
		//set data for category in template
		$Data[] = array('name' => $rec['catTitle'], 'login_req' => $rec['catReqLogin'], 'id' => $rec['catID'], 'downloads' => $row['ammount'], 'views' => $rec['catViews'], 'description' => $rec['catDesc']);
	} 

	//assign template vars
	$this->smarty->assign("looper", $Data); 
	$this->smarty->assign("list", 'y'); 
}

}
?>
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...