View file gogi/admins/tamagochi_edit.php

File size: 2.36Kb
<?
include("rat.php");
include("function.php");
include ("../modules/info.php");
mysql_connect($host,$user,$parol);
mysql_select_db($database);

if (@$edit) {
$query="UPDATE `pet_tamagochi` SET `t_name`='$t_name',`t_login`='$t_login',`t_password`='$t_password',`kind`='$kind',`temper`='$temper',`birthday`='$birthday',`birth_lx`='$birth_lx',`eda`='$eda',`nastr`='$nastr',`um`='$um',`health`='$health',`toilet`='$toilet',`vanna`='$vanna' WHERE `id`='$id'";
$sql=mysql_query($query);
}

if (@$del) {
$query="DELETE FROM `pet_tamagochi` WHERE `id`='$id'";
mysql_query($query);
}

//постраничный вывод
$query="SELECT * FROM `pet_tamagochi` ORDER BY 'id' DESC";
$sql=mysql_query($query);
$records=mysql_num_rows($sql);
if (!@$_GET["r_start"]) {$r_start=0;}
$URL="tamagochi_edit.php?r_start=";
$inpage=10;
echo other_pages($records,$r_start,$URL,$inpage);
$start=$r_start*$inpage;
//конец постраничный вывод

$query="SELECT * FROM `pet_tamagochi` ORDER BY 'id' DESC LIMIT $start,$inpage";
$sql=mysql_query($query);
if (mysql_num_rows($sql)!="0") {

echo "<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=windows-1251\"></head><body>";

while ($row=mysql_fetch_assoc($sql)) {
$id=$row["id"];
$t_name=$row["t_name"];
$t_login=$row["t_login"];
$t_password=$row["t_password"];
$kind=$row["kind"];
$temper=$row["temper"];
$birthday=$row["birthday"];
$birth_lx=$row["birth_lx"];
$eda=$row["eda"];
$nastr=$row["nastr"];
$um=$row["um"];
$health=$row["health"];
$toilet=$row["toilet"];
$vanna=$row["vanna"];

$skin=file("skin/tamagochi_edit.htm");
for ($i=0;$i<count($skin);$i++) {
  $skin[$i]=str_replace("%id%",$id,$skin[$i]);
  $skin[$i]=str_replace("%t_name%",$t_name,$skin[$i]);
  $skin[$i]=str_replace("%t_login%",$t_login,$skin[$i]);
  $skin[$i]=str_replace("%t_password%",$t_password,$skin[$i]);
  $skin[$i]=str_replace("%kind%",$kind,$skin[$i]);
  $skin[$i]=str_replace("%temper%",$temper,$skin[$i]);
  $skin[$i]=str_replace("%birthday%",$birthday,$skin[$i]);
  $skin[$i]=str_replace("%birth_lx%",$birth_lx,$skin[$i]);
  $skin[$i]=str_replace("%eda%",$eda,$skin[$i]);
  $skin[$i]=str_replace("%nastr%",$nastr,$skin[$i]);
  $skin[$i]=str_replace("%um%",$um,$skin[$i]);
  $skin[$i]=str_replace("%health%",$health,$skin[$i]);
  $skin[$i]=str_replace("%toilet%",$toilet,$skin[$i]);
  $skin[$i]=str_replace("%vanna%",$vanna,$skin[$i]);
print $skin[$i];
}



}
echo "</body></html>";
}

mysql_close();
?>