<?php
	/*
	** File: ADD_VARIATION
	** Description: Adds a variation to the database
	** Version: $Revision: 1.6 $
	** Created: 04/21/1999
	** Author: Leon Atkinson
	** Email: leon@clearink.com
	** CVS Author: $Author: leon $
	** Last Revised: $Date: 1999/12/09 23:23:18 $
	**
	** Log : $Log: ADD_VARIATION,v $
	** Log : Revision 1.6  1999/12/09 23:23:18  leon
	** Log : Changed ActionResults use so that it's an array instead of a
	** Log : continually-growing string.  Note the little function in standard_library
	** Log : for printing out all the action results.
	** Log :
	** Log : Revision 1.5  1999/11/09 21:47:12  leon
	** Log : More localization.
	** Log :
	** Log : Revision 1.4  1999/08/18 22:31:46  leon
	** Log : Returning opening PHP tag to XML-friendly tag
	** Log :
	** Log : Revision 1.3  1999/07/28 19:27:12  leon
	** Log : Mass update based on code donation from a live project
	** Log :
	**
	** Copyright (c) 1999 Working Dogs.  All rights reserved.
	*/


	

	/* Make sure the user has admin rights. */
	if( !$UserInfo["Permission"]["Administrate"] )
	{
		print(L_ADDVAR_DENIED . "<BR>\n");
	}
	else
	{
		//validate input data
		$attribute = (int)$attribute;
		$inputDisplayPrecedence = (int)$inputDisplayPrecedence;

		//add attribute record
		$Query = "INSERT INTO variation (Attribute, Name, Description, " . 
			"Graphic, DisplayPrecedence) ";
		$Query .= "VALUES (";
		$Query .= "$attribute, ";
		$Query .= "'" . substr(addslashes($inputName),0,255) . "', ";
		$Query .= "'" . substr(addslashes($inputDescription),0,255) . "', ";
		$Query .= "'" . substr(addslashes($inputGraphic),0,255) . "', ";
		$Query .= "$inputDisplayPrecedence) ";

		//execute query
		if(!mysql_query($Query, $DatabaseLink))
		{
			$ActionResults[] =  mysql_errno() . ": " . mysql_error();
		}
		else
		{
			$ActionResults[] =  L_ADDVAR_SUCESS;
		}
	}

?>
