# @link https://z.zzw.es # if (!defined('funcionando') || preg_match(substr(__FILE__,strrpos(__FILE__,'/')+1),$_SERVER['PHP_SELF'])){ header('HTTP/1.1 403 Forbidden'); return; } class DB { private $db = ['dbhost'=>"localhost",'dbname'=>"zzamoves_var" ,'dbuser'=>"zzamoves_cafe",'dbpass'=>",judjPYuI^Oc"]; private $dbsql; public $dberror; var $on = false; function __construct(){ $db = $this->db; try { $mysqli = new mysqli($db['dbhost'],$db['dbuser'],$db['dbpass'],$db['dbname']); $mysqli->set_charset('utf8mb4'); $this->dbsql = $mysqli; $this->on = true; unset($mysqli); } catch (Exception $e) { $this->dberror = _t('exception').': '.$e->getMessage(); } } public function read($tabla,$campos,$condic,$extra='',$como=null){ $error = []; if(!is_array($campos)) $error[]= _t('param').' 2 '._t('incorrect'); if( $this->valida_select($condic) != 'OK' ) $error[]= _t('param').' 3 '._t('incorrect'); if(count($error)==0){ if($como == 'count') $sqlcampos = 'count(id)'; else if($campos==[]) $sqlcampos = '*'; else{ if(!in_array('id',$campos)) $campos = array_merge(['id'],$campos); foreach($campos as &$campo) if($campo) $campo = $this->dbsql->real_escape_string($campo); $sqlcampos = '`'.implode('`,`',$campos).'`'; } // return json_encode(['sql',"SELECT ".$sqlcampos." FROM `".$tabla // ."` WHERE ".$this->crea_valores($condic)." ".$extra.";"]); $sql=mysqli_query( $this->dbsql ,"SELECT ".$sqlcampos." FROM `".$tabla ."` WHERE ".$this->crea_valores($condic)." ".$extra.";"); if($sql){ switch($como){ case 'all': return mysqli_fetch_all($sql); break; case 'row': $ret=[]; while ($fila = $sql->fetch_row()) $ret[]= $fila; return $ret; break; default: $ret=[]; while ($fila = $sql->fetch_assoc()) { $ret[]= $fila; } return $ret; } }return ['Error',"SELECT ".$sqlcampos." FROM `".$tabla ."` WHERE ".$this->crea_valores($condic)." ".$extra.";"]; }else return ['Error',$error]; } public function write($tabla,$valores){ $vals = $this->crea_write($valores); if($vals){ $sql=mysqli_query($this->dbsql, 'INSERT INTO `'.$tabla.'` ('.$vals[0].') VALUES ('.$vals[1].');'); if($sql) return ['OK',$this->dbsql->insert_id]; else return ['Error',$this->dbsql->error]; }else return ['Error', _t('param').' 2 '._t('incorrect')]; } public function update($tabla,$valores,$condic){ $vals = $this->crea_update($valores,$condic); if($vals){ // return json_encode(['sql','UPDATE `'.$tabla.'` SET '.$vals[0].' WHERE '.$vals[1].';']); $sql=mysqli_query($this->dbsql, 'UPDATE `'.$tabla.'` SET '.$vals[0].' WHERE '.$vals[1].';'); if($sql) return ['OK',$this->dbsql->insert_id]; else return ['Error',$this->dbsql->error]; }else return ['Error', 'parametros incorrectos']; } public function del($tabla,$valores){ $vals = $this->crea_valores($valores); if($vals){ $sql=mysqli_query($this->dbsql, 'DELETE FROM `'.$tabla.'` WHERE '.$vals.';'); if($sql) return ['OK',$this->dbsql->insert_id]; else return ['Error',$this->dbsql->error]; }else return ['Error', 'parametros incorrectos']; } public function sumaa($tabla,$condic,$que){ $cond = $this->crea_update($condic,[]); // return json_encode(['sql',$cond,$que]); // return json_encode(['sql','UPDATE `'.$tabla.'` SET '.$que[0].'='.$que[0].'+'.$que[1].' WHERE '.$cond[0].';']); if($cond){ $sql=mysqli_query($this->dbsql, 'UPDATE `'.$tabla.'` SET '.$que[0].'='.$que[0].'+'.$que[1].' WHERE '.$cond[0].';'); if($sql) return ['OK',$this->dbsql->insert_id]; else return ['Error',$this->dbsql->error]; }else return ['Error', 'parametros incorrectos']; } private function crea_write($valores){ if(!is_array($valores)) return false; $campos = []; $vals = []; foreach($valores as $campo => $valor){ if($valor){ $campos[] = '`'.$campo.'`'; $vals[] = '\''.$this->dbsql->real_escape_string($valor).'\''; } } return [implode(',',$campos),implode(',',$vals)]; } private function crea_update($valores,$condic){ if(!is_array($valores)) return false; // $set = []; // foreach($valores as $ca => $va){ // $set[] = '`'.$ca.'` = '.( ($va) // ? '\''.$this->dbsql->real_escape_string($va).'\'' : 'NULL'); // } // $set = implode(', ',$set); $set = $this->crea_valores($valores); $con = $this->crea_valores($condic); return [$set,$con]; } private function crea_where($condic){ $con = []; foreach($condic as $cond){ foreach($cond as $campo => $valor){ $con[] = '`'.$campo.'` = '.( ($valor) ? '\''.$this->dbsql->real_escape_string($valor).'\'' : 'NULL'); } } $con = implode(' AND ',$con); return $con; } private function crea_valores($condic){ $return = ''; $abiertos = []; foreach($condic as $k => $cual){ // ['tipo','in',['permisos','tipo','marca']] if(count($cual)==1){ $abiertos[] = [$cual[0],0]; }else{ if($k > 0) $return .= ' AND '; $return .= '`'.$cual[0].'` '.$cual[1].' '; if( is_array($cual[2]) ){ foreach($cual[2] as &$q) $q = $this->dbsql->real_escape_string($q); $return .= "('".implode("','",$cual[2])."')"; } else $return .= '\''.$this->dbsql->real_escape_string($cual[2]).'\''; } } return $return; } private function valida_select($cuales){ $return = []; $validos = ['=','!=','in','not in','||','OR','&&','AND']; if( is_array($cuales) ){ foreach($cuales as $cual){ $return[] = ( ( in_array($cual[1],$validos) && count($cuales)>2 ) || ( is_array($cual) && count($cual)== 3 && in_array($cual[1],$validos) && ( ( $cual[1]=='in' || $cual[1]=='not in' ) && is_array($cual[2]) ) ) )? 'OK':['ko'=>json_encode($cual)]; } return ( array_key_exists('ko',$return) )? json_encode($return) : 'OK' ; } return false; } } function tuenapass($pass){ return sha1(md5($pass)); } function tuneamail($mail){ if(!$mail || strpos($mail,'@')<2) return '0'; $mail = explode('@',$mail); $mail1 = str_split(sha1(md5($mail[0]))); $mail2 = str_split(sha1(md5($mail[1]))); rsort($mail1); sort($mail2); if(count($mail1)>count($mail2)) $mail2 = array_pad($mail2,count($mail1),"z"); else $mail1 = array_pad($mail1, count($mail2), "a"); $return = ''; for($i=0;$i Cafeteando

El Café

Según el DLE de la RAE

  1. cafeto
  2. Semilla del cafeto, como de un centímetro de largo, de color amarillento verdoso , convexa por una parte y, por la otra, plana y con un surco longitudinal
  3. Bebida que se hace por infusión con la semilla tostada y molida del cafeto
  4. Taza o vaso de café (‖ bebida).
  5. Establecimiento donde se vende y toma café y otras consumiciones.
  6. coloq. Arg., Bol., Chile, Par., Perú y Ur. Reprimenda áspera. Se ha llevado un tremendo café por insolente
  7. adj. marrón2. Tonos café. Apl. a color, u. t. c. s. m. U. m. en Am
    1. Cafeto o Planta de Café

Según NESCAFE

Granos de Café
  1. Es rico en antioxidantes (polifenoles) que actúan contra los radicales libres y algunos metales pesados [...] ayudan a prevenir enfermedades y mantener una buena salud en general.
  2. Nos estimula y nos activa
  3. Aumenta el rendimiento, ayuda a estar alerta y más concentrados
  4. La cafeína acelera la termogénesis, un proceso para quemar grasa
  5. Menor índice de mortalidad por cáncer, ictus y enfermedades coronarias
  6. ...

© zzamov 2026