Einzelnen Beitrag anzeigen
Alt 06.03.2005, 16:20  
Gast
 
Beiträge: n/a
Standard [Erledigt] warum kann nicht SVG files laden?

dasselbe Programm an den URL /hotel ,macht noch ein Fehler:
wenn man sich als admin einlogt -->adminhaupt link waehlt und--->
addhotel.php files neues DB einfuhlt mit difrenet Country name und City name, dann kann nicht die .jpg und .svg files laden,gibt error:

"The type of the file is not correct!It must be with extension .jpg ,.png or .gif!Please go back and upload correct file!";

dann kann die .jpg file nicht in :
$uploaddir = "\\home\\localhost\\www\\"; ...laden??
wo soll diese Phad sein??
hier die ganze Code:
<?php
session_start();
if (!session_is_registered("valid_user")|| $valid_user!="admin")
{
echo "Only the administrator has permisions to visit this page!</br>";
exit();

}
include ("func.php");

ConectDb();

$flag=true;

if (!$hotel_name || !$hotel_addr || !$hotel_catagory || !$hotel_info || !$hotel_details || !$hotel_room)

{
echo "You didn't fill some field(s)!Please go back and fill all correct!";
$flag=0;
saveForm("hotelForm.php");
exit();

}

if (!(ereg("^[a-zA-Z0-9]+$",$hotel_name)))
{
echo "<tr><td>Notice:</td></tr>";
echo "<tr><td>The name of the hotel is maybe not correct!Please go back and try again!</td></tr></br>";
$flag=0;
saveForm("hotelForm.php");
exit();
}

$query="SELECT city.city_id FROM countries,city WHERE countries.country_name='$hotel_country' and city.city_name='$hotel_city' and city.c_id=countries.c_id;";
$res=mysql_query($query);
if (!$num_rows=@mysql_num_rows($res))
{

$query_country="SELECT countries.c_id FROM countries WHERE countries.country_name='$hotel_country';";
$res_country=mysql_query($query_country);
if (!$num_rows=@mysql_num_rows($res_country))
{
echo "<center>This country doesn't exist in the database!Please go back and enter it first!</center>";
saveForm("hotelForm.php?flag=NECountry");
exit();
/*$relative_url="addcountry.php?name=$hotel_country &kind=country";
header("Location: http://".$_SERVER['HTTP_HOST']
.dirname($_SERVER['PHP_SELF'])
."/".$relative_url);
exit();*/
}


else
{
$temparray=@mysql_fetch_array($res_country);
$c_id=$temparray["c_id"];
$query_city="SELECT city.city_id FROM city WHERE city.city_name='$hotel_city';";
$res_city=mysql_query($query_city);
if (!$num_rows=@mysql_num_rows($res_city))
{
echo "<center>This city doesn't exist in the database!Please go back and enter it first!</center>";
saveForm("hotelForm.php?flag=NECity&c_id=$c_id");
exit(); /*$relative_url="addcountry.php?name=$hotel_city&c_ id=$c_id&kind=city";
header("Location: http://".$_SERVER['HTTP_HOST']
.dirname($_SERVER['PHP_SELF'])
."/".$relative_url);


exit();*/
}
else
{
echo "<center>You have entered wrong city and country!Please go back and try again!</center></br>";
saveForm("hotelForm.php");
exit();
}
}
}

else
{
$temparray=@mysql_fetch_array($res);
$hotel_city_id=$temparray["city_id"];
$flag=1;
}


//PROVERKA NA VHODNITE DANNI OT hotelForm.php

if ((strlen($hotel_addr) < 3) || (strlen($hotel_addr) > 100))
{
echo "The addres of the hotel is maybe not correct!Please go back and try again!</br>";

$flag=0;
saveForm("hotelForm.php");
exit();
}
if (!(ereg("^[0-9]+$",$hotel_catagory)) || ($hotel_catagory > 5))
{
echo "<tr><td>The catagory of the hotel is not correct!Please go back and try again!</td></tr></br>";
$flag=0;
saveForm("hotelForm.php");
exit();
}
if (!empty($userfile))
{
if($userfile_size==0)
{
echo "Uploaded file is zero length";
$flag=0;
saveForm("hotelForm.php");
exit();
}
if(($userfile_type!="image/jpg") && ($userfile_type!="image/png") && ($userfile_type!="image/gif"))
{
echo "The type of the file is not correct!It must be with extension .jpg ,.png or .gif!Please go back and upload correct file!";
echo "$userfile_type";
$flag=0;
saveForm("hotelForm.php");
exit();
}
}
//echo "<form><input type='button' name='Back' value='Back' onclick='history.back();'></form>";
//KRAI NA PROVERKATA NA VHODNITE DANNI
if ($flag)
{
$hotel_name=trim($hotel_name);
$hotel_catagory=trim($hotel_catagory);
if (!empty($userfile))
{
$uploaddir = "\\home\\localhost\\www\\";
$uploadfile = $uploaddir.$userfile_name;
if (!move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile))
{
echo "Could not move file into directory!";
saveForm("hotelForm.php");
exit();
}
}
//$data=addslashes(fread(fopen($hotel_view, "rb"), filesize($hotel_view)));
$query_ins="INSERT INTO hotels (city_id,name,addr,stars,info,hoteldetails,roomama nity,h_pic) VALUES ('$hotel_city_id','$hotel_name','$hotel_addr','$ho tel_catagory','$hotel_info','$hotel_details','$hot el_room','$userfile_name')";
$res_ins=mysql_query($query_ins);
if (!$res_ins)
{
echo "The operation failed! Please try again later!";
exit();

}
else
{
//PREDAVANE KYM SCRIPT ZA VYVEJDANE NA TIPOVE STAI
//$query_sel="SELECT h_id FROM hotels WHERE name='$hotel_name';";
//$res_sel=mysql_query($query_sel);
//$temparray=@mysql_fetch_array($res_sel);
//$hotel_id=$temparray["h_id"];
$hotel_id=mysql_insert_id();


$relative_url="addroom.php?hotel_id=$hotel_id";
header("Location: http://".$_SERVER['HTTP_HOST']
.dirname($_SERVER['PHP_SELF'])
."/".$relative_url);
exit();
//echo "The information for the hotel was entered successful";



}

}
echo "<html>";
echo "<body link='#4040FF' vlink='#463FA3' bgcolor='#eeeeee' >";
TableAdmin();

?>

</body>

</html>
 
Sponsor Mitteilung
PHP Code Flüsterer

Registriert seit: 21.08.2005
Beiträge: 4682
PHP-Kenntnisse:
Fortgeschritten