S
sevY
Hi,
ich hab grade etwas gecodet und seh mal wieder vor lauter if/else/switch den Fehler nicht mehr.
Anyone an idea?
index.php
function.inc.php
config.inc.php
Yves
ich hab grade etwas gecodet und seh mal wieder vor lauter if/else/switch den Fehler nicht mehr.
Anyone an idea?
index.php
PHP:
<?php
require_once('config.inc.php');
$db_tab='act_and_react_3d';
if($_POST['action']==preview && (!empty($_POST['image_front']) && !empty($_POST['image_back'])));
{
require_once('function.inc.php');
echo"
<html>
<head>
";
if(!isset($front_success) || !isset($back_success));
{
echo"
<script language=\"JavaScript\">
function dialog()
{
alert (\"Die Verarbeitung der Ansichten ist fehlgeschlagen. Bitte versuchen Sie es erneut oder wenden Sie sich an den Systemadministrator.\");
}
</script>
</head>
<body onload=\"dialog()\">
";
}
else
{
echo"
<title>Act & React 3D</title>
<link rel=stylesheet href=default.css>
<script language=JavaScript type=text/javascript>
function popup()
{
var width = 550;
var height = 400;
topPos = (screen.availHeight-height)/2;
right = (screen.availWidth-width)/2;
act3d = open(\"preview.php\",\"preview\",\"width=550,height=400,location=0,scrollbars=no,resizable=0,status = yes\");
act3d.moveTo (right,topPos);
}
</script>
</head>
<body topmargin=0 leftmargin=0>
<table width=100% height=100% cellspacing=0 cellpadding=0 marginwidth=0 marginheight=0>
<tr>
<td align=center valign=middle>
";
echo"Die Vorschau wird erstellt und öffnet sich in 5 Sekunden in einem PopUp.<meta http-equiv=refresh content=\"5; URL=javascript:popup();\">";
break;
}
}
else
{
echo"
<html>
<head>
<title>Act & React 3D</title>
<link rel=stylesheet href=default.css>
";
if(empty($_POST['imagepath_front']) && (empty($_POST['imagepath_back']));
{
<script language=\"JavaScript\">
function dialog()
{
alert (\"Sie haben keine Ansichten hochgeladen!\");
}
</script>
</head>
<body onload=\"dialog()\">
}
elseif(empty($_POST['imagepath_front']) && (!empty($_POST['imagepath_back']));
{
<script language=\"JavaScript\">
function dialog()
{
alert (\"Sie haben kein Frontansicht hochgeladen!\");
}
</script>
</head>
<body onload=\"dialog()\">
}
elseif(!empty($_POST['imagepath_front']) && (empty($_POST['imagepath_back']));
{
<script language=\"JavaScript\">
function dialog()
{
alert (\"Sie haben kein Rueckansicht hochgeladen!\");
}
</script>
</head>
<body onload=\"dialog()\">
}
else
{
echo"
</head>
<body topmargin=0 leftmargin=0>
<table width=100% height=100% cellspacing=0 cellpadding=0 marginwidth=0 marginheight=0>
<tr>
<td align=center valign=middle>
<form enctype=multipart/form-data action=".$_SERVER['PHP_SELF']." method=post>
<input type=hidden name=action value=preview>
<input type=file name=imagepath_front>
<input type=file name=imagepath_back>
<p><hr noshade width=300 size=1 align=center><p>
<input type=submit value=Upload>
</form>
</td>
</tr>
</table>
</body>
</html>
";
}
}
?>
PHP:
<?php
require_once('config.inc.php');
$front_image=$_FILES['image_front']['tmp_name'];
$front_image_info=getimagesize($front_image);
if($front_image_info[0]==$image_front_x && $front_image_info[1]==$image_front_y)
{
if($front_image_info[2]!=='2')
{
//konvertieren_nach_non.progressiv.jpeg(); erstellen
$imagepath_front=$_FILES['image_front']['name'];
$imagepath_front_move=$imagefolder.$imagepath_front;
move_uploaded_file($_FILES['image_front']['tmp_name'],$imagepath_front_move);
chmod ("$imagepath_front_move", $file_permission);
mysql_db_query($db_dbase,"insert into $db_tab (imagepath_front) values ('$imagepath_front' where id='1'");
$front_success='1';
}
else
{
$imagepath_front=$_FILES['image_front']['name'];
$imagepath_front_move=$imagefolder.$imagepath_front;
move_uploaded_file($_FILES['image_front']['tmp_name'],$imagepath_front_move);
chmod ("$imagepath_front_move", $file_permission);
mysql_db_query($db_dbase,"insert into $db_tab (imagepath_front) values ('$imagepath_front' where id='1'");
$front_success='1';
}
}
elseif($front_image_info[0]!==$image_front_x || $front_image_info[1]!==$image_front_y)
{
//zuschneiden_auf_vorgegebene_constraints(); erstellen
if($front_image_info[2]!=='2')
{
//konvertieren_nach_non.progressiv.jpeg(); erstellen
$imagepath_front=$_FILES['image_front']['name'];
$imagepath_front_move=$imagefolder.$imagepath_front;
move_uploaded_file($_FILES['image_front']['tmp_name'],$imagepath_front_move);
chmod ("$imagepath_front_move", $file_permission);
mysql_db_query($db_dbase,"insert into $db_tab (imagepath_front) values ('$imagepath_front' where id='1'");
$front_success='1';
}
else
{
$imagepath_front=$_FILES['image_front']['name'];
$imagepath_front_move=$imagefolder.$imagepath_front;
move_uploaded_file($_FILES['image_front']['tmp_name'],$imagepath_front_move);
chmod ("$imagepath_front_move", $file_permission);
mysql_db_query($db_dbase,"insert into $db_tab (imagepath_front) values ('$imagepath_front' where id='1'");
$front_success='1';
}
}
$back_image=$_FILES['image_back']['tmp_name'];
$back_image_info=getimagesize($back_image);
if($back_image_info[0]==$image_back_x && $back_image_info[1]==$image_back_y)
{
if($back_image_info[2]!=='2')
{
//konvertieren_nach_non.progressiv.jpeg(); erstellen
$imagepath_back=$_FILES['image_back']['name'];
$imagepath_back_move=$imagefolder.$imagepath_back;
move_uploaded_file($_FILES['image_back']['tmp_name'],$imagepath_back_move);
chmod ("$imagepath_back_move", $file_permission);
mysql_db_query($db_dbase,"insert into $db_tab (imagepath_back) values ('$imagepath_back' where id='1'");
$back_success='1';
}
else
{
$imagepath_back=$_FILES['image_back']['name'];
$imagepath_back_move=$imagefolder.$imagepath_back;
move_uploaded_file($_FILES['image_back']['tmp_name'],$imagepath_back_move);
chmod ("$imagepath_back_move", $file_permission);
mysql_db_query($db_dbase,"insert into $db_tab (imagepath_back) values ('$imagepath_back' where id='1'");
$back_success='1';
}
}
elseif($back_image_info[0]!==$image_back_x || $back_image_info[1]!==$image_back_y)
{
//zuschneiden_auf_vorgegebene_constraints(); erstellen
if($back_image_info[2]!=='2')
{
//konvertieren_nach_non.progressiv.jpeg(); erstellen
$imagepath_back=$_FILES['image_back']['name'];
$imagepath_back_move=$imagefolder.$imagepath_back;
move_uploaded_file($_FILES['image_back']['tmp_name'],$imagepath_back_move);
chmod ("$imagepath_back_move", $file_permission);
mysql_db_query($db_dbase,"insert into $db_tab (imagepath_back) values ('$imagepath_back' where id='1'");
$back_success='1';
}
else
{
$imagepath_back=$_FILES['image_back']['name'];
$imagepath_back_move=$imagefolder.$imagepath_back;
move_uploaded_file($_FILES['image_back']['tmp_name'],$imagepath_back_move);
chmod ("$imagepath_back_move", $file_permission);
mysql_db_query($db_dbase,"insert into $db_tab (imagepath_back) values ('$imagepath_back' where id='1'");
$back_success='1';
}
}
?>
PHP:
<?
$db_host='localhost';
$db_login='user';
$db_pass='password';
$db_dbase='local_db';
$handler=
mysql_connect($db_host,$db_login,$db_pass);
mysql_select_db($db_dbase,$handler);
$imagefolder='img/';
$image_front_x='100';
$image_front_y='100';
$image_back_x='100';
$image_back_y='100';
$file_permission='0644';
?>
Yves