一些未定义的索引,我不知道为什么:(

时间:2019-05-23 19:40:11

标签: php html mysql

我已经制作了一个链接到数据库的Web应用程序,我想在其中使用用户的ID尼克从表中编辑一个寄存器。在网络上,只显示以下内容:

Notice: Undefined index: imagenPerfil in 
D:\xampp\htdocs\php\Kelly\perfil.php on line 177

Notice: Undefined index: imagenPerfil in 
D:\xampp\htdocs\php\Kelly\perfil.php on line 178

Notice: Undefined index: imagenPerfil in 
D:\xampp\htdocs\php\Kelly\perfil.php on line 179

拜托,我不知道如何更改它,我已经花了数小时的时间在修改代码,但是什么也没有... 感谢您阅读<3

我试图更改代码的位置以及php部分的代码,但是什么也没有...

<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1">

        <title>Kelly English</title>

        <!-- Fuente de google -->
        <link href="https://fonts.googleapis.com/css?family=Quicksand:400,700%7CCabin:400%7CDancing+Script" rel="stylesheet">

        <!-- Bootstrap -->
        <link type="text/css" rel="stylesheet" href="css/bootstrap.min.css"/>

        <!-- Carrusel -->
        <link type="text/css" rel="stylesheet" href="css/owl.carousel.css" />
        <link type="text/css" rel="stylesheet" href="css/owl.theme.default.css" />
        <!-- Fin carrusel -->
        <link rel="stylesheet" href="css/font-awesome.min.css">
        <link type="text/css" rel="stylesheet" href="css/style.css"/>
        <?php
            include'ConexionyCreacion/conexion.php';
            session_start();
        ?>
    </head>
    <body>

        <!-- Cabecera -->
        <header id="header">

            <!-- Top nav -->
            <div id="top-nav">
                <div class="container">

                <!-- logo -->
                <div class="logo">
                    <a href="index.php"><img src="./imagenes/logo.jpg" alt="logo"></a>
                </div>
                <!-- logo -->

                <!-- Moviles -->
                <button class="navbar-toggle">
                    <span></span>
                </button>
                <!-- Moviles -->

                <!-- Redes -->
                <ul class="social-nav">
                    <?php
                        if(!empty($_SESSION["nick"])){
                        ?>
                        <p><a href="perfil.php">Mi Perfil</a></p>
                        <p><a href="ConexionyCreacion/logout.php">Cerrar Sesión</a></p>
                        <?php
                        } else{ ?>
                        <p><a href="index.php">Iniciar Sesión</a></p>
                        <?php
                        };
                        ?>
                </ul>
                <!-- /Redes -->

                </div>
            </div>
            <!-- /Top nav -->

            <!-- Bottom nav -->
            <div id="bottom-nav">
                <div class="container">
                <nav id="nav">

                    <!-- nav -->
                    <ul class="main-nav nav navbar-nav">
                        <li><a href="inicio.php">Inicio</a></li>
                        <li><a href="contenido.php">Contenido</a></li>
                        <li><a href="foro.php">Foro</a></li>
                        <li><a href="sobre.php">Sobre Mí</a></li>
                        <li><a href="contacto.php">Contacto</a></li>
                    </ul>
                    <!-- /nav -->

                    <!-- contact nav -->
                    <ul class="contact-nav nav navbar-nav">
                        <li><a href="#"><i class="fa fa-phone"></i> 688 61 27 55</a></li>
                        <li><a href="#"><i class="fa fa-map-marker"></i> Bilbao, Iparraguirre 55</a></li>
                    </ul>
                    <!-- contact nav -->

                </nav>
                </div>
            </div>
            <!-- /Bottom nav -->


        </header>
        <!-- /Header -->

        <div class="banner-area">

            <!-- Backgound Image -->
            <div class="bg-image bg-parallax overlay" style="background-image:url(./imagenes/fondo3.jpg)"></div>
            <!-- /Backgound Image -->

            <div class="container">
                <div class="row">
                    <div class="col-md-12 text-center">
                        <h2 class="white-text title">El Foro de Kelly</h2>
                    </div>
                </div>
            </div>
        </div>


        <!--cuenta-->
        <?php
        include'ConexionyCreacion/conexion.php';
            $conexionbd = $contenido;

            if(isset($_POST['editar'])){

                $insertfila="UPDATE kelly.usuarios SET nick = '".$_POST["nick"]."', nombre = '".$_POST["nombre"]."', apellidos = '".$_POST["apellido"]."', email = '".$_POST["correo"]."', contrasegna = '".$_POST["pass"]."' WHERE nick='".$_POST["nick"]."'";
                $resultado=mysqli_query($conexionbd, $insertfila);

                if($resultado){
                    echo '<h3 style="color:blue">El usuario ha sido editado</h3>';
                    } else{
                        var_dump($resultado);
                        echo "<h3 style='color:red'>No se ha editado el usuario";
                    }
            }
            if(isset($_POST["borrar"])){
                    $insertfila="DELETE FROM kelly.usuarios where nick = '".$_POST["nick"]."'";
                    $resultado=mysqli_query($conexionbd, $insertfila);
                    session_destroy
                    header('location:index.php');
                }

            $consulfila="SELECT * FROM kelly.usuarios where nick like '".$_SESSION["nick"]."'";
            $resulconsul=mysqli_query($conexionbd,$consulfila);
            while($fila = mysqli_fetch_array($resulconsul)){
            echo '<div class="account">
                <div class="container"> 
                    <div class="account-bottom">
                        <div class="col-md-6 account-left">
                            <form action="perfil.php" enctype="multipart/form-data" method="post">
                            <div class="account-top heading">
                                <h3>Modificar y ver el perfil</h3>
                            </div>
                            <div class="address">
                                <span>Nombre</span>
                                <input name="nombre" type="text" id="nombre" class="nombre" value="'.$fila["nick"].'" autofocus=""/></p>
                            </div>
                            <div class="address">
                                <span>Apellido</span>
                                <input name="nombreProducto" type="text" id="nombreProducto" class="nombreProducto" value="'.$fila["apellido"].'" autofocus=""/></p>
                            </div>
                            <div class="address">
                                <span>Correo</span>
                                <input name="descProducto" type="text" id="descProducto" class="descProducto" value="'.$fila["correo"].'" autofocus=""/ ></p>
                            </div>
                              <label for="imagenPerfil">Foto de Perfil</label> 
                              <input id="imagenPerfil" name="imagenPerfil" size="30" type="file" />
                            <div class="address">
                                <span>Contraseña</span>
                                <input name="pass" type="text" id="pass" class="pass" value="'.$fila["contrasegna"].'" ></p>
                            </div>
                            <div class="address">
                                <span>Repetir Contraseña</span>
                                 <input name="repass" type="text" id="repass" class="repass" placeholder="Repite la contraseña" /></p>
                            </div>
                            <div class="address new">
                                <input type="submit" name="editar" value="Editar">
                                <input type="submit" name="borrar"value="Borrar">
                            </div>';

                        $nombre_img = $_FILES['imagenPerfil']['name'];
                        $tipo = $_FILES['imagenPerfil']['type'];
                        $tamano = $_FILES['imagenPerfil']['size'];

                        if (($nombre_img == !NULL) && ($_FILES['imagenPerfil']['size'] <= 200000)) 
                        {

                           if (($_FILES["imagenPerfil"]["type"] == "image/jpeg")
                           || ($_FILES["imagenPerfil"]["type"] == "image/jpg")
                           || ($_FILES["imagenPerfil"]["type"] == "image/png"))
                           {
                              $directorio = $_SERVER['DOCUMENT_ROOT'].'/php/Kelly/imagenesPerfil/';
                              move_uploaded_file($_FILES['imagenPerfil']['tmp_name'],$directorio.$nombre_img);
                            } 
                            else 
                            {
                               echo "No se puede subir una imagen con ese formato ";
                            }
                        } 
                        else 
                        {
                           if($nombre_img == !NULL) echo "La imagen es demasiado grande "; 
                        }
            }
            mysqli_close($contenido);
            ?>
            </div>
            </div>
            </div>
            </div>
            </div>
    <!-- cuenta-->
        </div>
        <!-- Contact -->

        <!-- Footer -->
        <footer id="footer">

            <!-- container -->
            <div class="container">

                <!-- row -->
                <div class="row">

                    <!-- copyright -->
                    <div class="col-md-6">
                        <span class="copyright">&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;Copyright @2019 All rights reserved Kelly English</span>
                    </div>
                    <!-- /copyright -->

                </div>
                <!-- /row -->

            </div>
            <!-- /container -->

        </footer>
        <!-- /Footer -->

        <!-- Preloader -->
        <div id="preloader">
            <div class="preloader">
                <span></span>
                <span></span>
                <span></span>
            </div>
        </div>
        <!-- /Preloader -->

        <!-- jQuery Plugins -->
        <script type="text/javascript" src="js/jquery.min.js"></script>
        <script type="text/javascript" src="js/bootstrap.min.js"></script>
        <script type="text/javascript" src="js/owl.carousel.min.js"></script>
        <script src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false"></script>
        <script type="text/javascript" src="js/main.js"></script>
        <?php
        ob_end_flush();
        ?>
    </body>
</html>

0 个答案:

没有答案
相关问题