-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy patheditarSucio.php
More file actions
45 lines (29 loc) · 1.09 KB
/
Copy patheditarSucio.php
File metadata and controls
45 lines (29 loc) · 1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<?php
include ("conexion.php");
$patronNombre="((\w)+)";
$patronDescripcion="(((\w)+(\s)+)+)";
$nombre=$_POST['txtNombre'];
$dpto=$_POST['listaDpto'];
$cat=$_POST['listaCat'];
$descr=$_POST['txtDescripcion'];
$id=$_POST['txtID'];
$bien=1;
if(!preg_match($patronNombre, $nombre)){
echo "Por favor introduce un nombre válido.";
$bien=0;
}
if(!preg_match($patronDescripcion, $descr)){
echo "Por favor agrega una descripción para tu archivo.";
$bien=0;
}
if($bien==1){
$qry="UPDATE documentos
SET Nombre='$nombre', Id_Dpto =$dpto, Id_Cat = $cat , Descripcion ='$descr' WHERE Id_Doc =$id ";
$conexion=mysqli_connect($host,$user,$password,$dbname)
or die("no se pudo contectar al servidor");
$resultado=mysqli_query($conexion,$qry) or die(mysqli_error($conexion));
header ("Location: index.php");
}
header("Location: index.php");
// $registro=mysqli_fetch_array($resultado);
?>