Foro de elhacker.net

Programación => PHP => Mensaje iniciado por: oscarj24 en 17 Junio 2010, 01:06 am



Título: Error de sintaxis en PHP :S
Publicado por: oscarj24 en 17 Junio 2010, 01:06 am
Hola, me aparecio este error en la linea 70 "unexpected T_ECHO" y no logro ubicarlo. Soy nuevo en PHP, espero su ayuda... muchas gracias  ;D

Código
  1. <?php
  2. if (isset($_POST['enviar'])){
  3. $link = mysql_connect('localhost', 'user', 'pass');
  4. mysql_select_db('database', $link);
  5. $sql = "SELECT MAX(ID) FROM inscripciones";
  6. $result = mysql_query($sql);
  7. $row = mysql_fetch_row($result);
  8. $max_id = $row[0]+1;
  9. $nombres = trim($_POST['nombres']);
  10. $apellidos = trim($_POST['apellidos']);
  11. $DNI_CarneExtranjeria = trim($_POST['DNI_CarneExtranjeria']);
  12. $tipo_persona = trim($_POST['tipo_persona']);
  13. $empresa = trim($_POST['empresa']);
  14. $cargo = trim($_POST['cargo']);
  15. $direccion = trim($_POST['direccion']);
  16. $telefono_fijo = trim($_POST['telefono_fijo']);
  17. $telefono_celular = trim($_POST['telefono_celular']);
  18. $tipo_combrobante = trim($_POST['tipo_comprobante']);
  19. $razon_social = trim($_POST['razon_social']);
  20. $RUC=trim($_POST['RUC']);
  21. $_FILES['voucher']['name'] = $max_id."_".$_FILES['voucher']['name'];
  22. $upload_dir = '/home/name/public_html/inscripciones/vouchers/';
  23. $extension = $_FILES['voucher']['type'];
  24. $mimetypes = array("image/jpeg", "image/gif", "image/png");
  25. $size = $_FILES['voucher']['size'];
  26. $upload_file = $upload_dir.($_FILES['voucher']['name']);
  27. $voucher_nombre_db = $_FILES['voucher']['name'];
  28. if(isset($_POST['nombres']) && strlen(trim($_POST['nombres']))== 0)        
  29.   echo '<html>
  30. <head>
  31. <title>Titulo Web</title>
  32. <META http-equiv="refresh" content="1; url=http://www.dominio.com/inscripciones/inscripcion.php">
  33. </head>
  34. <body>
  35. <p>ERROR: Debe ingresar sus nombres.</p>
  36. </body>
  37. </html>';    
  38.  elseif(isset($_POST['apellidos']) && strlen(trim($_POST['apellidos']))== 0)      
  39.     echo '<html>
  40. <head>
  41. <title>Titulo Web</title>
  42. <META http-equiv="refresh" content="1; url=http://www.dominio.com/inscripciones/inscripcion.php">
  43. </head>
  44. <body>
  45. <p>ERROR: Debe ingresar sus apellidos.</p>
  46. </body>
  47. </html>';
  48. elseif(isset($_POST['DNI_CarneExtranjeria']) && strlen(trim($_POST['DNI_CarneExtranjeria']))== 0)      
  49.     echo '<html>
  50. <head>
  51. <title>Titulo Web</title>
  52. <META http-equiv="refresh" content="1; url=http://www.dominio.com/inscripciones/inscripcion.php">
  53. </head>
  54. <body>
  55. <p>ERROR: Debe ingresar su DNI o Carne de Extranjeria.</p>
  56. </body>
  57. </html>';
  58. elseif((isset($_POST['tipo_persona'])== "Dependiente") && ((isset($_POST['empresa']) && strlen(trim($_POST['empresa']))== 0) || (isset($_POST['cargo']) && strlen(trim($_POST['cargo']))== 0) || (isset($_POST['direccion']) && strlen(trim($_POST['direccion']))== 0)))
  59. echo '<html>
  60. <head>
  61. <title>Titulo Web</title>
  62. <META http-equiv="refresh" content="1; url=http://www.dominio.com/inscripciones/inscripcion.php">
  63. </head>
  64. <body>
  65. <p>ERROR: Debe completar los datos de persona dependiente.</p>
  66. </body>
  67. </html>';
  68. elseif((isset($_POST['tipo_telefono'])== "Ambos" && ((isset($_POST['telefono_fijo']) && strlen(trim($_POST['telefono_fijo']))== 0) || (isset($_POST['telefono_celular']) && strlen(trim($_POST['telefono_celular']))== 0)))
  69. echo '<html>
  70. <head>
  71. <title>Titulo Web</title>
  72. <META http-equiv="refresh" content="1; url=http://www.dominio.com/inscripciones/inscripcion.php">
  73. </head>
  74. <body>
  75. <p>ERROR: Debe ingresar sus numeros telefonicos.</p>
  76. </body>
  77. </html>';
  78. elseif((isset($_POST['tipo_telefono'])== "Telf. Fijo" && (isset($_POST['telefono_fijo']) && strlen(trim($_POST['telefono_fijo']))== 0)))
  79. echo '<html>
  80. <head>
  81. <title>Titulo Web</title>
  82. <META http-equiv="refresh" content="1; url=http://www.dominio.com/inscripciones/inscripcion.php">
  83. </head>
  84. <body>
  85. <p>ERROR: Debe ingresar el numero de telefono fijo.</p>
  86. </body>
  87. </html>';
  88. elseif((isset($_POST['tipo_telefono'])== "Celular" && (isset($_POST['telefono_celular']) && strlen(trim($_POST['telefono_celular']))== 0)))
  89. echo '<html>
  90. <head>
  91. <title>Titulo Web</title>
  92. <META http-equiv="refresh" content="1; url=http://www.dominio.com/inscripciones/inscripcion.php">
  93. </head>
  94. <body>
  95. <p>ERROR: Debe ingresar el numero de telefono celular.</p>
  96. </body>
  97. </html>';
  98. elseif((isset($_POST['tipo_comprobante'])== "Factura") && ((isset($_POST['razon_social']) && strlen(trim($_POST['razon_social']))== 0) || (isset($_POST['RUC'])&& strlen(trim($_POST['RUC']))== 0)))
  99. echo '<html>
  100. <head>
  101. <title>Titulo Web</title>
  102. <META http-equiv="refresh" content="1; url=http://www.dominio.com/inscripciones/inscripcion.php">
  103. </head>
  104. <body>
  105. <p>ERROR: Debe completar los datos del comprobante factura.</p>
  106. </body>
  107. </html>';
  108. elseif((isset($_FILES['voucher']['name']) && strlen(trim($_POST['voucher']['name']))== 0) || (isset($_FILES['voucher']['type']) != ($mimetypes[0] || $mimetypes[1] || $mimetypes[2])) || (isset($_FILES['voucher']['size']) > 0 && isset($_FILES['voucher']['size']) <= 204800))
  109. echo '<html>
  110. <head>
  111. <title>Titulo Web</title>
  112. <META http-equiv="refresh" content="1; url=http://www.dominio.com/inscripciones/inscripcion.php">
  113. </head>
  114. <body>
  115. <p>ERROR: Debe adjuntar la imagen del voucher (Formatos permitidos: JPG, PNG, GIF / Tamaño Maximo: 200 KB).</p>
  116. </body>
  117. </html>';
  118. else{
  119. move_uploaded_file($_FILES['voucher']['tmp_name'], $upload_file);
  120. mysql_query("INSERT INTO inscripciones(Nombres,Apellidos,DNI_CarneExtranjeria,Tipo_Persona,Empresa,Cargo,Direccion,Telefono_Fijo,Telefono_Celular,Tipo_Comprobante,Razon_Social,RUC,Nombre_Voucher) VALUES('$nombres','$apellidos','$DNI_CarneExtranjeria','$tipo_persona','$empresa','$cargo','$direccion','$telefono_fijo','$telefono_celular','$tipo_comprobante','$razon_social','$RUC','$voucher_nombre_db')",$link);
  121. mysql_close($link);
  122. echo '<html>
  123. <head>
  124. <title>Titulo Web</title>
  125. <META http-equiv="refresh" content="2; url=http://www.dominio.com/inscripciones/inscripcion.php">
  126. </head>
  127. <body>
  128. <p>Registro exitoso.</p>
  129. </body>
  130. </html>';
  131.   }
  132.  }
  133. ?>


Título: Re: Error de sintaxis en PHP :S
Publicado por: Shell Root en 17 Junio 2010, 01:30 am
¬¬! y cual es la linea 70?


Título: Re: Error de sintaxis en PHP :S
Publicado por: Kasswed en 17 Junio 2010, 02:27 am
Te falta cerrar un paréntesis :¬¬

Saludos.


Título: Re: Error de sintaxis en PHP :S
Publicado por: oscarj24 en 17 Junio 2010, 04:49 am
hey, gracias me costo bastante encontrar el bendito parentesis un saludo!