tooLateAtNight();? Wo ist der ParseError…

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
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 &ouml;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>
        ";
        }
    }  	  
?>
function.inc.php
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';
        }
    }
?>
config.inc.php
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
 
Hallöle!

Ich habe mir bisher deinen Thread nur bis hierher angesehen:

if($_POST['action']==preview_&&_(!empty($_POST['image_front'])_&&_!empty($_POST['image_back'])));

Das Semikolon am Ende der Zeile bewirkt, dass die Codezeilen, die eigentlich im True-Fall ausgeführt werden sollen, nicht ausgeführt werden.

Da ich gestern gefeiert und einen dicken Kopf habe, kann ich mir den Rest deines Codes heute nicht antun
;)

Gruß McGyver
 
Hi,

jetzt ist der ParseError schon mal weg ;) Waren echt einige Flüchtigkeitsfehler drin. Nun nur noch die logische Seite korrigieren :D

PHP:
<html>
<head>
<title>Act & React 3D</title>
<link rel=stylesheet href=default.css> 
<?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');
    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"                
            <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 &ouml;ffnet sich in 5 Sekunden in einem PopUp.<meta http-equiv=refresh content=\"5; URL=javascript:popup();\">";
    break;
        }   
    }  
elseif($_POST['action']=='preview')
    { 
    if(empty($_POST['imagepath_front']) && empty($_POST['imagepath_back']))
        {
        echo"
        <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']))
        {
        echo"
        <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']))
         {
         echo"
        <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>

Danke ;)


Yves
 
So gehts schon mal halbwegs :D Ich glaub Bier und PHP um 2:00 Uhr morgens verträgt sich schlecht ;)

PHP:
<html>
<head>
<title>Act & React 3D</title>
<link rel=stylesheet href=default.css> 
<?php

require_once('config.inc.php');
//Uploadbutton initialisiert Skript     
if($_POST['action']=='preview' && (!empty($_POST['image_front']) && !empty($_POST['image_back'])))
    {
    //Dateiverarbeitung
    require_once('function.inc.php');
    //Misserfolg der Verarbeitung
    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()\">
        ";
        }
    //Erfolg der Verarbeitung
    else
        {
        echo"                
            <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>
                        Die Vorschau wird erstellt und &ouml;ffnet sich in 5 Sekunden in einem PopUp.<meta http-equiv=refresh content=\"5; URL=javascript:popup();\">
        
                    </td>
                </tr>    
            </table>
        </body>
    </html>
    ";
    exit;
        }   
    }      
//Eine der beiden Dateiinputs war leer
elseif($_POST['action']=='preview' && (empty($_POST['image_front']) || empty($_POST['image_back'])))
    { 
    //Beide leer
    if(empty($_POST['image_front']) && empty($_POST['image_back']))
        {
        echo"
        <script language=\"JavaScript\">
            function dialog()
                {
                alert (\"Sie haben keine Ansichten hochgeladen!\");
                }
        </script>
        </head>
        <body onload=\"dialog()\">
        ";
        }
    //Front leer
    elseif(empty($_POST['image_front']) && !empty($_POST['image_back']))
        {
        echo"
        <script language=\"JavaScript\">
            function dialog()
                {
                alert (\"Sie haben kein Frontansicht hochgeladen!\");
                }
        </script>
        </head>
        <body onload=\"dialog()\">
        ";
        }
    //Back leer
    elseif(!empty($_POST['image_front']) && empty($_POST['image_back']))
         {
         echo"
        <script language=\"JavaScript\">
            function dialog()
                {
                alert (\"Sie haben kein Rueckansicht hochgeladen!\");
                }
        </script>
        </head>
        <body onload=\"dialog()\">
        ";
        }  
    }
?>
</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=<?php echo"".$_SERVER['PHP_SELF'].""; ?> method=post>
                        <input type=hidden name=action value=preview>
                        <input type=file name=image_front>
                        <input type=file name=image_back>
                        <p><hr noshade width=300 size=1 align=center><p>  
                        <input type=submit value=Upload>
                    </form> 
                </td>
            </tr>    
        </table>
    </body>
</html>

Yves
 
Moin Yves,

Dein Code:

elseif($_POST['action']=='preview'_&&_(empty($_POST['image_front'])_||_empty($_POST['image_back'])))

Hier würde ich noch die letzen beiden Ausdrücke klammern. Also so:

elseif($_POST['action']=='preview'_&&_((empty($_POST['image_front'])_||_empty($_POST['image_back']))))

Denn sonst wird der else-Zweig unter Umständen auch durchlaufen, wenn "image_back" leer ist und "action" != preview ist.

Was kriegst du denn noch für Fehler oder Phänomene?

Gruß McGyver
 
Hi MC,

schon passiert.

Ich hab an dem Code noch ordentlich was geschraubt, jetzt funktioniert alles.

Das PopUp ging am Anfang nicht auf, jetzt schon :D

Die " waren nicht korrekt escaped.

Und einige „logische Folgen“ waren nicht ganz so wie sie sein sollten :D ;)


Vielen Dank also für deine Mühe, jetzt geht alles :)


Yves
 
Original geschrieben von Yves
Hi MC,

schon passiert.

Ich hab an dem Code noch ordentlich was geschraubt, jetzt funktioniert alles.

Das PopUp ging am Anfang nicht auf, jetzt schon :D

Die " waren nicht korrekt escaped.

Und einige „logische Folgen“ waren nicht ganz so wie sie sein sollten :D ;)


Vielen Dank also für deine Mühe, jetzt geht alles :)


Yves
&nbsp;

Hi Yves!

Gern geschehen :)

Gruß McGyver
 
Zurück
Oben Unten