note 59729 deleted from ref.session by dmytton
| From: | dmytton@php.net | Date: | Wed, 14 Dec 2005 14:53:52 +0000 |
| Subject: | note 59729 deleted from ref.session by dmytton | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-100138@lists.php.net to get a copy of this message | ||
Note Submitter: useradd at example dot com
Reason: useless
----
I forgot you'll need another file. You must call it 'funciones.php'...
<?php
function aleatoriza_texto($cadena1)
{
for($x=0;$x<(strlen($cadena1)-1);$x++){
$p=rand(0,(strlen($cadena1)-1));
$v=$cadena1{$x};
$cadena1{$x}=$cadena1{$p};
$cadena1{$p}=$v;
}
return $cadena1;
}
function aleatoriza_texto_conservando_inicio_y_fin($cadena1)
{
for($x=1;$x<(strlen($cadena1)-2);$x++)
{
$p=rand(1,(strlen($cadena1)-2));
$v=$cadena1{$x};
$cadena1{$x}=$cadena1{$p};
$cadena1{$p}=$v;
}
return $cadena1;
}
function cifra_mensaje($cadena1)
{
$palabras = split(" ", $cadena1);
for ($i=0;$i<(count($palabras));$i++)
{
$resultado=aleatoriza_texto_conservando_inicio_y_fin($palabras[$i]);
$resultado_final .= " " . $resultado;
}
return $resultado_final;
}
function abre_web($titulo)
{
$salida=<<<pre
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xml:lang="sp" lang="sp">
<head>
<title>$titulo</title>
</head>
<body>
pre;
return $salida;
}
function cierra_web()
{
$salida=<<<pre
</body>
</html>
pre;
return $salida;
}
function formulario_principal()
{
echo abre_web(Entrada);
$salida=<<<pre
<form action ="ahorcado.php" method = "post">
<p>Palabra a adivinar</p>
<input type ="text" name ="palabra"/>
<br>
<p>Numero de intentos</p>
<input type ="text" name ="max_intentos"/>
<br>
<input type = "submit" value= "JUGAR"/>
<input type = "reset" value= "borrar"/>
</form>
pre;
echo $salida;
echo cierra_web();
}
?>