All pastes #459618 Raw Edit

Unnamed

public php v1 · immutable
#459618 ·published 2007-04-26 16:14 UTC
rendered paste body
<?php include "seguridad/seguridad.php";include "seguridad/acceso.php";comprobar('lamparas');include "includes/funciones.php"; include "includes/query.php";$rutentra = $_SESSION['rut'];$rut2 = $_SESSION["rut2"];?><?php// Include MySQL classrequire_once('inc/mysql.class.php');// Include database connectionrequire_once('inc/global.inc.php');// Include functionsrequire_once('inc/functions.inc.php');// Start the session$rutentra = $_SESSION['rut'];session_start();// Process actions$cart = $_SESSION['cart'];$action = $_GET['action'];switch ($action) {	case 'add':		if ($cart) {			$cart .= ','.$_GET['id'];		} else {			$cart = $_GET['id'];		}		break;	case 'delete':		if ($cart) {			$items = explode(',',$cart);			$newcart = '';			foreach ($items as $item) {				if ($_GET['id'] != $item) {					if ($newcart != '') {						$newcart .= ','.$item;					} else {						$newcart = $item;					}				}			}			$cart = $newcart;		}		break;	case 'update':	if ($cart) {		$newcart = '';		foreach ($_POST as $key=>$value) {			if (stristr($key,'qty')) {				$id = str_replace('qty','',$key);				$items = ($newcart != '') ? explode(',',$newcart) : explode(',',$cart);				$newcart = '';				foreach ($items as $item) {					if ($id != $item) {						if ($newcart != '') {							$newcart .= ','.$item;						} else {							$newcart = $item;						}					}				}				for ($i=1;$i<=$value;$i++) {					if ($newcart != '') {						$newcart .= ','.$id;					} else {						$newcart = $id;					}				}			}		}	}	$cart = $newcart;	break;}$_SESSION['cart'] = $cart;?><?php/**********************************CONSULTA DE ID********************************/$sql2 = "select max(idreg) as cantidad from registroepp";$link2 = Conectarse();$result2 = mysql_query($sql2, $link2); if($row2 = mysql_fetch_array($result2)) {	if($row2["cantidad"] != null)	{  $idlampara = $row2["cantidad"] + 1; }		else { $idlampara = 1; }										}$sql2 = "select max(idreg) as cantidad from registroepp";$link2 = Conectarse();$result2 = mysql_query($sql2, $link2); if($row2 = mysql_fetch_array($result2)) 	{	if($row2["cantidad"] != null){  $idreg = $row2["cantidad"] + 1; }	else { $idreg = 1; }}$rut2= $_SESSION["rut2"];$link = Conectarse();$insert = "INSERT INTO `registroepp` ( `idreg` , `rut` , `idepp` , `horaretiro` , `fecharetiro`, `status` )";$insert .= " VALUES ( ".$idreg.", '".$rut2."', '".$idepp."', '".date(" H:i:s",time())."', '".date('Y')."-".(int)date("m")."-".date('d')."','');";//echo $insert;//mysql_query($insert, $link);/**echo '<script src="includes/js.js"></script>'; /**echo '<script> 	  location.href ="registroEntra.php?cod='.$id.'"; 	  </script>';/**************************FIN DE INGRESO DE DATOS *****************************/?></div><div id="contents"><h1>Listado Epp Agredados </h1><?phpecho saveCart();?><p><a href="catalogo.php">Volver al Catalogo</a></p><?php ob_end_flush();?>