<?php
/*
  ===============================================================

  inGenio X
  http://ingenio.area421.com

  Created by 
  Julian Moreno Hidalgo (Software developer)
  Jesus Moreno Hidalgo (Communication's tree)

  inGenio X is a free software licensed under CC-GNU GPL

  ===============================================================
*/
	if (!defined("IGNX")) { die("Attempt..."); }

function myconnect($host,$user,$pass,$namedb,$err='')
{
	
	$conn = mysql_connect($host,$user,$pass);
	if (!$conn)
	{
		if ($err != "")
		{
			die ($err);	

		} else {
		
			die ('<script>
				var url = document.location;
				var seg = 4;
				window.setTimeout(\'window.location.href=url;\', seg+\'000\');
				</script>');
		}
		
	} else {
		
		$sel = mysql_select_db($namedb,$conn);
		if (!$sel)
		{
			die (mysql_error());		
		}
	}
}

function myquery($q,$err='')
{
	$ress = mysql_query($q);
	if (!$ress)
	{
		die ($err." ".mysql_error()." [SQL: ".$q."]");
	} else {
		return $ress;
	}	
}

function myfetch($q)
{	
	return mysql_fetch_array($q);
}

function mynumrows($q)
{
	return mysql_num_rows($q);
}

function myinsertid()
{
	return mysql_insert_id();
}

?>