\documentclass[10pt,a4paper]{article} % Packages \usepackage{fancyhdr} % For header and footer \usepackage{multicol} % Allows multicols in tables \usepackage{tabularx} % Intelligent column widths \usepackage{tabulary} % Used in header and footer \usepackage{hhline} % Border under tables \usepackage{graphicx} % For images \usepackage{xcolor} % For hex colours %\usepackage[utf8x]{inputenc} % For unicode character support \usepackage[T1]{fontenc} % Without this we get weird character replacements \usepackage{colortbl} % For coloured tables \usepackage{setspace} % For line height \usepackage{lastpage} % Needed for total page number \usepackage{seqsplit} % Splits long words. %\usepackage{opensans} % Can't make this work so far. Shame. Would be lovely. \usepackage[normalem]{ulem} % For underlining links % Most of the following are not required for the majority % of cheat sheets but are needed for some symbol support. \usepackage{amsmath} % Symbols \usepackage{MnSymbol} % Symbols \usepackage{wasysym} % Symbols %\usepackage[english,german,french,spanish,italian]{babel} % Languages % Document Info \author{Sara (lasago)} \pdfinfo{ /Title (dwcs.pdf) /Creator (Cheatography) /Author (Sara (lasago)) /Subject (DWCS Cheat Sheet) } % Lengths and widths \addtolength{\textwidth}{6cm} \addtolength{\textheight}{-1cm} \addtolength{\hoffset}{-3cm} \addtolength{\voffset}{-2cm} \setlength{\tabcolsep}{0.2cm} % Space between columns \setlength{\headsep}{-12pt} % Reduce space between header and content \setlength{\headheight}{85pt} % If less, LaTeX automatically increases it \renewcommand{\footrulewidth}{0pt} % Remove footer line \renewcommand{\headrulewidth}{0pt} % Remove header line \renewcommand{\seqinsert}{\ifmmode\allowbreak\else\-\fi} % Hyphens in seqsplit % This two commands together give roughly % the right line height in the tables \renewcommand{\arraystretch}{1.3} \onehalfspacing % Commands \newcommand{\SetRowColor}[1]{\noalign{\gdef\RowColorName{#1}}\rowcolor{\RowColorName}} % Shortcut for row colour \newcommand{\mymulticolumn}[3]{\multicolumn{#1}{>{\columncolor{\RowColorName}}#2}{#3}} % For coloured multi-cols \newcolumntype{x}[1]{>{\raggedright}p{#1}} % New column types for ragged-right paragraph columns \newcommand{\tn}{\tabularnewline} % Required as custom column type in use % Font and Colours \definecolor{HeadBackground}{HTML}{333333} \definecolor{FootBackground}{HTML}{666666} \definecolor{TextColor}{HTML}{333333} \definecolor{DarkBackground}{HTML}{EABFFF} \definecolor{LightBackground}{HTML}{F9EFFF} \renewcommand{\familydefault}{\sfdefault} \color{TextColor} % Header and Footer \pagestyle{fancy} \fancyhead{} % Set header to blank \fancyfoot{} % Set footer to blank \fancyhead[L]{ \noindent \begin{multicols}{3} \begin{tabulary}{5.8cm}{C} \SetRowColor{DarkBackground} \vspace{-7pt} {\parbox{\dimexpr\textwidth-2\fboxsep\relax}{\noindent \hspace*{-6pt}\includegraphics[width=5.8cm]{/web/www.cheatography.com/public/images/cheatography_logo.pdf}} } \end{tabulary} \columnbreak \begin{tabulary}{11cm}{L} \vspace{-2pt}\large{\bf{\textcolor{DarkBackground}{\textrm{DWCS Cheat Sheet}}}} \\ \normalsize{by \textcolor{DarkBackground}{Sara (lasago)} via \textcolor{DarkBackground}{\uline{cheatography.com/70899/cs/18545/}}} \end{tabulary} \end{multicols}} \fancyfoot[L]{ \footnotesize \noindent \begin{multicols}{3} \begin{tabulary}{5.8cm}{LL} \SetRowColor{FootBackground} \mymulticolumn{2}{p{5.377cm}}{\bf\textcolor{white}{Cheatographer}} \\ \vspace{-2pt}Sara (lasago) \\ \uline{cheatography.com/lasago} \\ \end{tabulary} \vfill \columnbreak \begin{tabulary}{5.8cm}{L} \SetRowColor{FootBackground} \mymulticolumn{1}{p{5.377cm}}{\bf\textcolor{white}{Cheat Sheet}} \\ \vspace{-2pt}Not Yet Published.\\ Updated 20th February, 2019.\\ Page {\thepage} of \pageref{LastPage}. \end{tabulary} \vfill \columnbreak \begin{tabulary}{5.8cm}{L} \SetRowColor{FootBackground} \mymulticolumn{1}{p{5.377cm}}{\bf\textcolor{white}{Sponsor}} \\ \SetRowColor{white} \vspace{-5pt} %\includegraphics[width=48px,height=48px]{dave.jpeg} Measure your website readability!\\ www.readability-score.com \end{tabulary} \end{multicols}} \begin{document} \raggedright \raggedcolumns % Set font size to small. Switch to any value % from this page to resize cheat sheet text: % www.emerson.emory.edu/services/latex/latex_169.html \footnotesize % Small font. \begin{tabularx}{17.67cm}{x{7.5988 cm} x{9.6712 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{17.67cm}}{\bf\textcolor{white}{MySQL}} \tn % Row 0 \SetRowColor{LightBackground} Conectarse desde CMD & C:{[}...{]}\textbackslash{}XAMPP\textbackslash{}mysql\textbackslash{}bin\{\{nl\}\}mysql -u root \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} Cerrar conexión con el servidor & quit \tn % Row Count 4 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{17.67cm}{p{1.727 cm} x{15.543 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{17.67cm}}{\bf\textcolor{white}{SQL}} \tn % Row 0 \SetRowColor{LightBackground} & show databases; \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} & create database \seqsplit{nombre\_de\_base\_de\_datos} character set utf8; \tn % Row Count 3 (+ 2) % Row 2 \SetRowColor{LightBackground} & use mibasedatos; \tn % Row Count 4 (+ 1) % Row 3 \SetRowColor{white} & show tables; \tn % Row Count 5 (+ 1) % Row 4 \SetRowColor{LightBackground} & describe alumno; \tn % Row Count 6 (+ 1) % Row 5 \SetRowColor{white} & CREATE TABLE tblUsuarios ( idx INT PRIMARY KEY AUTO\_INCREMENT, usuario VARCHAR(20), \tn % Row Count 9 (+ 3) % Row 6 \SetRowColor{LightBackground} & INSERT INTO tblUsuarios VALUES ('1','BRE2271','BRENDA'), \tn % Row Count 11 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{17.67cm}{x{2.5905 cm} x{14.6795 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{17.67cm}}{\bf\textcolor{white}{Ligar ficheros}} \tn % Row 0 \SetRowColor{LightBackground} \seqsplit{Include} & include 'bdconfig.php'; salta error y continúa \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} \seqsplit{Require} & no salta error pero se detiene \tn % Row Count 4 (+ 2) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{2}{x{17.67cm}}{include\_once} \tn % Row Count 5 (+ 1) % Row 3 \SetRowColor{white} \mymulticolumn{2}{x{17.67cm}}{require\_once} \tn % Row Count 6 (+ 1) % Row 4 \SetRowColor{LightBackground} & if( isset(\$\_POST{[}"carrito"{]}))\{ header( "Location: verCarrito.php" ); \} \tn % Row Count 9 (+ 3) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{17.67cm}{x{7.5988 cm} x{9.6712 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{17.67cm}}{\bf\textcolor{white}{Configurar y conectarse a BD}} \tn % Row 0 \SetRowColor{LightBackground} Iniciar sesión y seleccionar BD & include "" \$usuario = "root"; \$password = ""; \$servidor = "localhost"; \$basededatos = "agenda"; \tn % Row Count 5 (+ 5) % Row 1 \SetRowColor{white} \mymulticolumn{2}{x{17.67cm}}{} \tn % Row Count 5 (+ 0) % Row 2 \SetRowColor{LightBackground} Conectarse a base de datos & \$conexion = \seqsplit{mysqli\_connect("localhost"}, "root", "", "tienda") or die("No se ha podido conectar."); \tn % Row Count 10 (+ 5) % Row 3 \SetRowColor{white} Seleccionar BD a usar & \$db = mysqli\_select\_db( \$conexion, \$basededatos ) or die ( "No se ha podido conectar a la base de datos!" ); \tn % Row Count 15 (+ 5) % Row 4 \SetRowColor{LightBackground} \mymulticolumn{2}{x{17.67cm}}{-} \tn % Row Count 16 (+ 1) % Row 5 \SetRowColor{white} Información sobre la conexión & \$info\_con = \seqsplit{mysqli\_get\_host\_info(\$conexión\_bd);} \tn % Row Count 19 (+ 3) % Row 6 \SetRowColor{LightBackground} & \$info\_serv = \seqsplit{mysqli\_get\_server\_info(\$conexión\_bd);} \tn % Row Count 22 (+ 3) % Row 7 \SetRowColor{white} Devolver error de conexión & \$msg\_error = \seqsplit{mysqli\_connect\_error();} \$num\_error = \seqsplit{mysqli\_connect\_errno();} \seqsplit{mysqli\_error(\$con\_bd)} \tn % Row Count 27 (+ 5) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{17.67cm}{x{8.635 cm} x{8.635 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{17.67cm}}{\bf\textcolor{white}{Consultas a BD desde PHP}} \tn % Row 0 \SetRowColor{LightBackground} Conseguir consulta de base de datos (devuelve objeto mysqli\_result o false) & \seqsplit{if(\$resultadoConsulta} = \seqsplit{mysqli\_query(\$conexion}, \$sql)) \tn % Row Count 4 (+ 4) % Row 1 \SetRowColor{white} Saca el número de filas conseguidas por la consulta & \seqsplit{if(mysqli\_num\_rows(\$resultadoConsulta)} \textgreater{} 0)\{ \tn % Row Count 7 (+ 3) % Row 2 \SetRowColor{LightBackground} Guardar una fila de resultados como un array con índice de acceso numérico o asociativo & while(\$fila = mysqli\_fetch\_array(\$resultadoConsulta))\{\{nl\}\} echo "\textless{}td\textgreater{}" . \$fila{[}'amigo'{]} . "\textless{}/td\textgreater{}"; \tn % Row Count 12 (+ 5) % Row 3 \SetRowColor{white} Cerrar la conexión & \seqsplit{\$mysqli\_close(\$conexión)} \tn % Row Count 14 (+ 2) % Row 4 \SetRowColor{LightBackground} Buscar la fila numerada en desplazamiento & \seqsplit{mysqli\_data\_seek(\$res}, 0); // Pone el descriptor al principio \tn % Row Count 18 (+ 4) % Row 5 \SetRowColor{white} Borrar resultado de una consulta & \seqsplit{mysqli\_free\_result(\$res)} \tn % Row Count 20 (+ 2) % Row 6 \SetRowColor{LightBackground} El número de columnas de una consulta & \$num\_colum = mysqli\_num\_fields ( \$res ); \tn % Row Count 22 (+ 2) % Row 7 \SetRowColor{white} el número de la columna en la que se encuentra el descriptor de acceso al resultado de la consulta que estamos tratando: & \$colum = mysqli\_field\_tell ( \$res ); \tn % Row Count 29 (+ 7) % Row 8 \SetRowColor{LightBackground} Y podemos posicionar el descriptor en la columna que nos interese (para acceder a la primera columa 0) con : & \seqsplit{\$pos\_column\_error} = mysqli\_field\_seek (\$res , \$colum ); \tn % Row Count 35 (+ 6) \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{17.67cm}{x{8.635 cm} x{8.635 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{17.67cm}}{\bf\textcolor{white}{Consultas a BD desde PHP (cont)}} \tn % Row 9 \SetRowColor{LightBackground} Devuelve el campo siguiente en el conjunto de resultados & \$obj\_colum = \seqsplit{mysqli\_fetch\_field} ( \$res ); \tn % Row Count 3 (+ 3) % Row 10 \SetRowColor{white} \mymulticolumn{2}{x{17.67cm}}{-} \tn % Row Count 4 (+ 1) % Row 11 \SetRowColor{LightBackground} & \$res\_array = \seqsplit{mysqli\_fetch\_assoc(\$res);} \tn % Row Count 6 (+ 2) % Row 12 \SetRowColor{white} & \$res\_array = \seqsplit{mysqli\_fetch\_row(\$res)} \tn % Row Count 8 (+ 2) % Row 13 \SetRowColor{LightBackground} & \$res\_obj = \seqsplit{mysqli\_fetch\_object(\$res);} \tn % Row Count 10 (+ 2) % Row 14 \SetRowColor{white} & \$res\_array = \seqsplit{mysqli\_fetch\_all(\$res}, MYSQLI\_ASSOC); \tn % Row Count 13 (+ 3) % Row 15 \SetRowColor{LightBackground} & \seqsplit{mysqli\_free\_result(\$res);} \tn % Row Count 15 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{17.67cm}{x{8.635 cm} x{8.635 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{17.67cm}}{\bf\textcolor{white}{Formularios}} \tn % Row 0 \SetRowColor{LightBackground} La página donde se envía la información del formulario & \textless{}form action="http://foo.com"\textgreater{} \tn % Row Count 3 (+ 3) % Row 1 \SetRowColor{white} Define cómo se envía la información de la URL & method="" \tn % Row Count 6 (+ 3) % Row 2 \SetRowColor{LightBackground} & input name="" \tn % Row Count 7 (+ 1) % Row 3 \SetRowColor{white} Pide al servidor un recurso que le responde con un body vacío & \textless{}form \seqsplit{action="http://foo.com"} method="get"\textgreater{} \tn % Row Count 11 (+ 4) % Row 4 \SetRowColor{LightBackground} Radio & \textless{}form name="tema" method="GET" action="fichero.php"\textgreater{} \textless{}input type="radio" name="tema" value="rosa" checked\textgreater{} Rosa\textless{}br\textgreater{} \textless{}input type="radio" name="tema" value="verde"\textgreater{} Verde\textless{}br\textgreater{} \textless{}input type="submit" value="Enviar" id="enviar"\textgreater{}\textless{}/input\textgreater{} \textless{}/form\textgreater{} \tn % Row Count 24 (+ 13) % Row 5 \SetRowColor{white} & \$\_REQUEST{[}'tema'{]} == "rosa" \tn % Row Count 26 (+ 2) % Row 6 \SetRowColor{LightBackground} Checkbox & \textless{}input type="checkbox" name="role{[}{]}" value="1" id="admin"\textgreater{} \textless{}label for="admin"\textgreater{}Admin\textless{}/label\textgreater{} \textless{}input type="checkbox" name="role{[}{]}" value="2" id="publisher"\textgreater{} \tn % Row Count 35 (+ 9) \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{17.67cm}{x{8.635 cm} x{8.635 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{17.67cm}}{\bf\textcolor{white}{Formularios (cont)}} \tn % Row 7 \SetRowColor{LightBackground} Select & \textless{}form \seqsplit{action="/action\_page}.php" id="carform"\textgreater{} Firstname:\textless{}input type="text" name="fname"\textgreater{} \textless{}input type="submit"\textgreater{} \textless{}/form\textgreater{} \textless{}select name="carlist" form="carform"\textgreater{} \textless{}option value="volvo"\textgreater{}Volvo\textless{}/option\textgreater{} \textless{}option value="saab"\textgreater{}Saab\textless{}/option\textgreater{} \textless{}option value="opel"\textgreater{}Opel\textless{}/option\textgreater{} \textless{}option value="audi"\textgreater{}Audi\textless{}/option\textgreater{} \textless{}/select\textgreater{} \tn % Row Count 17 (+ 17) % Row 8 \SetRowColor{white} & \textless{}input type="password" name="psw"\textgreater{} \tn % Row Count 19 (+ 2) % Row 9 \SetRowColor{LightBackground} & \textless{}input type="reset"\textgreater{} \tn % Row Count 21 (+ 2) % Row 10 \SetRowColor{white} & \textless{}input type="color" name="favcolor"\textgreater{} \tn % Row Count 23 (+ 2) % Row 11 \SetRowColor{LightBackground} & \textless{}input type="date" name="bday" min="2000-01-02"\textgreater{}\textless{}br\textgreater{} \tn % Row Count 26 (+ 3) % Row 12 \SetRowColor{white} & \textless{}input \seqsplit{type="datetime-local"} name="bdaytime"\textgreater{} \tn % Row Count 29 (+ 3) % Row 13 \SetRowColor{LightBackground} & \textless{}input type="email" name="email"\textgreater{} \tn % Row Count 31 (+ 2) \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{17.67cm}{x{8.635 cm} x{8.635 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{17.67cm}}{\bf\textcolor{white}{Formularios (cont)}} \tn % Row 14 \SetRowColor{LightBackground} & Select a file: \textless{}input type="file" name="myFile"\textgreater{} \tn % Row Count 3 (+ 3) % Row 15 \SetRowColor{white} & \textless{}input type="month" name="bdaymonth"\textgreater{} \tn % Row Count 5 (+ 2) % Row 16 \SetRowColor{LightBackground} & \textless{}input type="number" name="quantity" min="1" max="5"\textgreater{} \tn % Row Count 8 (+ 3) % Row 17 \SetRowColor{white} Submit & \textless{}input type="submit" value="Submit"\textgreater{} \tn % Row Count 10 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{17.67cm}{p{1.727 cm} x{15.543 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{17.67cm}}{\bf\textcolor{white}{Obetenr información de formulario}} \tn % Row 0 \SetRowColor{LightBackground} & \$\_GET{[}'nombredeformulario'{]} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} & \$\_POST{[}'nombredeformulario'{]} \tn % Row Count 2 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{17.67cm}{x{8.635 cm} x{8.635 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{17.67cm}}{\bf\textcolor{white}{Sesiones}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{2}{x{17.67cm}}{Variable común a todos las páginas de sesión, su información es almacenada como un array en el servidor hasta cerrarse la sesión. Els ervidor genera un identificador de usuario único durante su vida.} \tn % Row Count 5 (+ 5) % Row 1 \SetRowColor{white} \mymulticolumn{2}{x{17.67cm}}{(Opcional) Establece un nombre de sesión que diferencia a otras sesiones} \tn % Row Count 7 (+ 2) % Row 2 \SetRowColor{LightBackground} Abrir sesión & session\_start(); \tn % Row Count 8 (+ 1) % Row 3 \SetRowColor{white} Instanciar y guardar datos en una sesión & \$\_SESSION{[}"favcolor"{]} = "green"; \tn % Row Count 11 (+ 3) % Row 4 \SetRowColor{LightBackground} Visualizar (obtener) datos de sesión & session\_start(); echo "Favorite color is " . \$\_SESSION{[}"favcolor"{]} . ".\textless{}br\textgreater{}"; \tn % Row Count 15 (+ 4) % Row 5 \SetRowColor{white} Guardar el tiempo de creación de sesión & \$\_SESSION{[}"timeout"{]} = time(); \tn % Row Count 18 (+ 3) % Row 6 \SetRowColor{LightBackground} Cuenta el tiempo transcurrido & \$sessionTTL = time() - \$\_SESSION{[}"timeout"{]}; \tn % Row Count 21 (+ 3) % Row 7 \SetRowColor{white} & if(\$sessionTTL \textgreater{} \$inactividad)\{ session\_destroy(); header("Location: /logout.php"); \} \tn % Row Count 27 (+ 6) % Row 8 \SetRowColor{LightBackground} Función que regenera el ID cuando se guarda información sensible( usuario, contyraseña...) & \seqsplit{session\_regenerate\_id();} \tn % Row Count 32 (+ 5) \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{17.67cm}{x{8.635 cm} x{8.635 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{17.67cm}}{\bf\textcolor{white}{Sesiones (cont)}} \tn % Row 9 \SetRowColor{LightBackground} Mostrar todas las variables de sesión & print\_r(\$\_SESSION); \tn % Row Count 2 (+ 2) % Row 10 \SetRowColor{white} Modificar variable de sesión & // to change a session variable, just overwrite it \$\_SESSION{[}"favcolor"{]} = "yellow"; \tn % Row Count 7 (+ 5) % Row 11 \SetRowColor{LightBackground} Deshacer sesión & session\_unset(); \tn % Row Count 8 (+ 1) % Row 12 \SetRowColor{white} Eliminar sesión & // remove all session variables session\_unset(); // destroy the session session\_destroy(); \tn % Row Count 13 (+ 5) % Row 13 \SetRowColor{LightBackground} \mymulticolumn{2}{x{17.67cm}}{-} \tn % Row Count 14 (+ 1) % Row 14 \SetRowColor{white} & session\_start(); if (!isset(\$\_SESSION{[}'usuario'{]})) \seqsplit{header("location:validar}.php"); \tn % Row Count 19 (+ 5) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{17.67cm}{x{5.6991 cm} x{11.5709 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{17.67cm}}{\bf\textcolor{white}{Cookies}} \tn % Row 0 \SetRowColor{LightBackground} Crear cookie & //Define las variables para usar en cookies \$nombreDeCookie = 'bienvenida'; \$valorGuardado = \$\_POST{[}'nombre'{]}; //\$ruta = "/ruta/" //\$dominio = "localhost" \$tiempoExpiracion = time() + 30 * 2 ; \$activarHTTPS = true; //Define una cookie \seqsplit{setcookie(\$nombreDeCookie}, \$valorGuardado, \$tiempoExpiracion, \$activarHTTPS); \tn % Row Count 13 (+ 13) % Row 1 \SetRowColor{white} & setcookie(\$nombre, \$valor, \$expiración, \$ruta, \$dominio, \$seguridad, \$solohttp); \tn % Row Count 17 (+ 4) % Row 2 \SetRowColor{LightBackground} & setcookie ("some\_var", "some\_value", time()+3600{\emph{24}}365) \tn % Row Count 20 (+ 3) % Row 3 \SetRowColor{white} & setcookie(\$cookie\_name, \$cookie\_value, time() + (86400 * 30), '/'); // 86400 = 1 day \tn % Row Count 24 (+ 4) % Row 4 \SetRowColor{LightBackground} Llamar a cookie & \$\_COOKIE{[}'usuario'{]}; \tn % Row Count 26 (+ 2) % Row 5 \SetRowColor{white} Comprobar existencia & if(count(\$\_COOKIE) \textgreater{} 0) \tn % Row Count 28 (+ 2) % Row 6 \SetRowColor{LightBackground} \mymulticolumn{2}{x{17.67cm}}{Si se quiere modificar algun parámetro (la fecha de expiración, path o dominio) se ha de sobreescribir la cookie con setcookie() y el mismo nombre.} \tn % Row Count 31 (+ 3) \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{17.67cm}{x{5.6991 cm} x{11.5709 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{17.67cm}}{\bf\textcolor{white}{Cookies (cont)}} \tn % Row 7 \SetRowColor{LightBackground} Borrar una cookie & setcookie(\$cookie\_name, '', time() - 3600); \tn % Row Count 2 (+ 2) % Row 8 \SetRowColor{white} & setcookie("persona{[}nombre{]}", \$persona{[}0{]}, time()+3600); setcookie("persona{[}apellido{]}", \$persona{[}1{]}, time()+3600); setcookie("persona{[}edad{]}", \$persona{[}2{]}, time()+3600);\{\{nl\}\}echo "El nombre es: ".\$\_COOKIE{[}'persona'{]}{[}'nombre'{]}; echo "El apellido es: ".\$\_COOKIE{[}'persona'{]}{[}'apellido'{]}; \tn % Row Count 13 (+ 11) % Row 9 \SetRowColor{LightBackground} & \$modelo = \$resultado{[}'Modelo'{]}; \tn % Row Count 15 (+ 2) % Row 10 \SetRowColor{white} & \textless{}input type='number' name=productos{[}'\$modelo'{]} value=''/\textgreater{} \tn % Row Count 18 (+ 3) % Row 11 \SetRowColor{LightBackground} & foreach (\$\_REQUEST{[}'productos'{]} as \$modelo =\textgreater{} \$cantidad) \{ \{\{nl\}\}setcookie("carrito{[}\$modelo{]}", \$cantidad); \{\{nl\}\} foreach (\$\_COOKIE{[}'carrito'{]} as \$Mostrarmodelo =\textgreater{} \$Mostrarcantidad) \{ echo "Modelo: " . \$Mostrarmodelo . ", Cantidad: \$Mostrarcantidad \textless{}br\textgreater{}"; \tn % Row Count 28 (+ 10) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \end{document}