$Conn=mysql_connect("localhost","villorej_web","webweb");
mysql_select_db("villorej_Web",$Conn);
class Recordset {
var $result, // result id
$rowcount, // number of rows in result
$curpos, // index of current row (begin=0, end=rowcount-1)
$fieldcount, // number of fields in result
$fn, // Array of fields names
$rowset, // Array of fields with keys on field name
$connection, // connection id
$sql; // sql query
//Constructor
function Recordset($Sql,$Conn) {
$this->connection=$Conn;
$this->sql=$Sql;
$this->fn=array();
$this->rowset=array();
$this->Query();
}
// Execute query
function Query() {
$this->Close();
$this->result = @mysql_query($this->sql,$this->connection);
if (!$this->result)
return(0);
$this->rowcount = @mysql_num_rows($this->result);
$this->fieldcount = @mysql_num_fields($this->result);
for ($i=1;$i<=$this->fieldcount;$i++) {
$f=@mysql_fetch_field($this->result,$i-1);
// Fill fields names array
$this->fn[$i]=$f->name;
}
$this->curpos=0;
}
//Move to first record
function MoveFirst() {
$this->curpos=0;
}
//Return current row elements and move to next record
function MoveNext() {
if (!$this->result) return(0);
if ($this->curpos==$this->rowcount) return(0);
for($i=1;$i<=$this->fieldcount;$i++)
$this->rowset[$this->fn[$i]] = @mysql_result($this->result,$this->curpos,$this->fn[$i]);
$this->curpos++;
return($this->rowset);
}
//Return true if last record
function Eof() {
if ($this->curpos==$this->rowcount-1)
return(1);
return(0);
}
//Return true if first record
function Bof() {
if (!$this->curpos)
return(1);
return(0);
}
// Free result if exist
function Close() {
if ($this->result && $this->rowcount)
mysql_free_result($this->result);
$this->result=0;
$this->fn=array();
$this->rowset=array();
$this->rowcount=0;
$this->fieldcount=0;
}
}
?>
global $REMOTE_HOST, $REMOTE_ADDR, $HTTP_X_FORWARDED_FOR, $MIRRORS;
$Ip = $HTTP_X_FORWARDED_FOR ? $HTTP_X_FORWARDED_FOR : $REMOTE_ADDR;
$Fecha = date("Y",time()) . "-" . date("n",time()) . "-" . date("j",time());
$Hora = date("H",time()) . ":" . date("i",time());
$Web = $_SERVER['PHP_SELF'];
$rs = new Recordset("INSERT INTO `Visitas` (`IP`,`Fecha`,`Hora`,`Web`,`Ano`,`Mes`,`Dia`,`Horahora`,`DiaSem`) VALUES('".$Ip."','".$Fecha."','".$Hora."','".$Web."','".date("Y",time())."','".date("F",time())."','".date("j",time())."','".date("H",time())."','".date("l",time())."');",$Conn);
// echo $rs->sql;
$rs->Close();
?>
Villorejo.com