1
(POO) Programación Orientada a Objetos / Re:Aplicacion que convierte letras en morse [Python]
« en: 23 de Agosto de 2012, 21:40:44 pm »
en que se podra usar esto ?
Esta sección te permite ver todos los posts escritos por este usuario. Ten en cuenta que sólo puedes ver los posts escritos en zonas a las que tienes acceso en este momento.
<?
//Iniciamos cURL.
$ch = curl_init();
//Accedemos a la URL
curl_setopt($ch, CURLOPT_URL, "http://**********/*****.php");
//Indicamos que vamos a enviar datos por Post.
curl_setopt ($ch, CURLOPT_POST, true);
//Iniciamos una sesion
curl_setopt($ch, CURLOPT_COOKIE, 'PHPSESSID=cookie;');
//Indicamos que queremos imprimir el resultado
curl_setopt($ch, CURLOPT_RETURNTRANSFER, false);
//Hacemos uso de un User Agent
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 6.1; es-ES; rv:1.9.2.13) Gecko/20101203 Firefox/3.6.13");
//Enviamos los datos por post
curl_setopt ($ch, CURLOPT_POSTFIELDS, "rastreguias=".urlencode("R5066004"));
//Ejecutamos e imprimimos el resultado
$curl = curl_exec($ch);
curl_close ($ch);
$imagen= preg_match_all('#<table width="400px" align="center">(.+?)</table>i#', $curl, $matches);
// Mostrar el resultado
print_r ($matches);
?>
if (isset($_POST[registrar]))
{
session_start();
$conexion = mysql_connect("localhost", "****", "****");
mysql_select_db("*****", $conexion);
$nameimagen = $_FILES['imagen']['name'];
$tmpimagen = $_FILES['imagen']['tmp_name'];
$extimagen = pathinfo($nameimagen);
$ext = array("png","gif","jpg");
$urlnueva = "imagenes/".$nameimagen;
if(is_uploaded_file($tmpimagen)) {
if(array_search($extimagen['extension'],$ext)){
copy($tmpimagen,$urlnueva);
//insertamos los datos en la bd
#Buscamos haver si hay algun mail o nombre de usuario igual al introducido
$consultamos = 'SELECT * FROM Miembros WHERE email="' . $_POST['i5'] . '"';
$comprovacion = mysql_query($consultamos);
#Buscamos haver si hay algun usuario o correo ya igual al seleccionado
if(mysql_num_rows($comprovacion)==0){
$registrar = "INSERT INTO Miembros (Miembro_id,Nombre,Last_Name,Last_Name2,Sexo,DOB,Grupo,ec,Fecha_Iglesia,Foto,Ph_Casa,Ph_Trabajo,Extension,Ph_Celular,email,email2,Nextel,Bautizado,Direccion_Foranea,Iglesia_Procedencia,Profesion_Empleo,Lugar_Trabajo,Calle,#_externo,#_interno,Entre_calle_1,Entre_calle_2,Colonia,CP,Ciudad,Estado,Posicion) VALUES ('',' ".$_POST['dp1']."','".$_POST['dp2']."','".$_POST['dp3']."','".$_POST['dp4']."','".$_POST['dp5']."','".$_POST['dp6']."','".$_POST['dp7']."','".$_POST['dp8']."','".$urlnueva."''".$_POST['i1']."','".$_POST['i2']."','".$_POST['i3']."','".$_POST['i4']."','".$_POST['i5']."','".$_POST['i6']."','".$_POST['i7']."','".$_POST['o1']."','".$_POST['o2']."','".$_POST['o3']."','".$_POST['o4']."','".$_POST['o5']."','".$_POST['d1']."','".$_POST['d2']."','".$_POST['d3']."','".$_POST['d4']."','".$_POST['d5']."','".$_POST['d6']."','".$_POST['d7']."','".$_POST['d8']."', '".$_POST['d9']."','".$_POST['o6']."')";
if(mysql_query($registrar)){ #Comprovamos si se ha realizado el registro
echo"Ha sido registrado, ¡¡¡Enhorabuena!!!"; #Si se a registrado le decimos que a sido registrado
} else {
echo"No se a podido registrar, ¡¡¡sorry!!!"; #Si no a sido registrado le decimos que no a sido registrado
}d
#Buscaremos si hay errores y si los hay creamos la variable con el contenido adecuado
} else {
$error = "El nombre de usuario y/o el correo electronico ya a sido registrado";
}
}
#Comprovamos haver si hay alguna variable que contenga un error
if($error){
#Si es asi lo mostramos
echo"$error";
} else {
#Si no hau errores registramos al usuario
}
} else {
echo "Error: Solo imagenes con formato (jpg, png o gif)";
}
} else {
echo "Elija una imagen";
}
}
}
<html>
<head>
<title>Demo</title>
<style type="text/css">
<!--
body,td,th {
font-family: Verdana, Geneva, sans-serif;
font-size: 10px;
color: #FFF;
}
body {
background-color: #666;
}
div#wn {
position:relative;
width:100%; height:469px;
overflow:hidden;
}
</style>
<script src="js/dw_event.js" type="text/javascript"></script>
<script src="js/dw_scroll.js" type="text/javascript"></script>
<script src="js/scroll_controls.js" type="text/javascript"></script>
<script type="text/javascript">
function init_dw_Scroll() {
var wndo = new dw_scrollObj('wn', 'lyr1');
wndo.setUpScrollControls('scrollLinks');
}
// if code supported, link in the style sheet and call the init function onload
if ( dw_scrollObj.isSupported() ) {
//dw_writeStyleSheet('css/scroll.css');
dw_Event.add( window, 'load', init_dw_Scroll);
}
</script>
<script type="text/javascript">
function init_dw_Scroll() {
var wndo = new dw_scrollObj('wn', 'lyr1');
wndo.setUpScrollControls('scrollLinks2');
}
// if code supported, link in the style sheet and call the init function onload
if ( dw_scrollObj.isSupported() ) {
//dw_writeStyleSheet('css/scroll.css');
dw_Event.add( window, 'load', init_dw_Scroll);
}
</script>
</head>
<body>
<!-- Save for Web Slices (paginavinoyorch.psd) -->
<table id="Table_01" align="center"width="983" height="633" border="0" cellpadding="0" cellspacing="0">
<tr>
<td colspan="21">
<img src="images/index_01.jpg" width="982" height="9" alt=""></td>
<td>
<img src="images/spacer.gif" width="1" height="9" alt=""></td>
</tr>
<tr>
<td rowspan="13">
<img src="images/index_02.jpg" width="10" height="623" alt=""></td>
<td colspan="4" rowspan="5">
<img src="images/index_03.jpg" width="275" height="108" alt=""></td>
<td colspan="16">
<img src="images/index_04.jpg" width="697" height="30" alt=""></td>
<td>
<img src="images/spacer.gif" width="1" height="30" alt=""></td>
</tr>
<tr>
<td colspan="2" rowspan="5">
<img src="images/index_05.jpg" width="178" height="85" alt=""></td>
<td colspan="3">
<img src="images/index_06.jpg" width="48" height="16" alt=""></td>
<td>
<img src="images/index_07.jpg" width="70" height="16" alt=""></td>
<td>
<img src="images/index_08.jpg" width="71" height="16" alt=""></td>
<td rowspan="2">
<img src="images/index_09.jpg" width="74" height="17" alt=""></td>
<td>
<img src="images/index_10.jpg" width="53" height="16" alt=""></td>
<td rowspan="3">
<img src="images/index_11.jpg" width="1" height="48" alt=""></td>
<td>
<img src="images/index_12.jpg" width="74" height="16" alt=""></td>
<td colspan="3">
<img src="images/index_13.jpg" width="81" height="16" alt=""></td>
<td colspan="2" rowspan="3">
<img src="images/index_14.jpg" width="47" height="48" alt=""></td>
<td>
<img src="images/spacer.gif" width="1" height="16" alt=""></td>
</tr>
<tr>
<td colspan="5" rowspan="2">
<img src="images/index_15.jpg" width="189" height="32" alt=""></td>
<td rowspan="2">
<img src="images/index_16.jpg" width="53" height="32" alt=""></td>
<td colspan="4" rowspan="2">
<img src="images/index_17.jpg" width="155" height="32" alt=""></td>
<td>
<img src="images/spacer.gif" width="1" height="1" alt=""></td>
</tr>
<tr>
<td>
<img src="images/index_18.jpg" width="74" height="31" alt=""></td>
<td>
<img src="images/spacer.gif" width="1" height="31" alt=""></td>
</tr>
<tr>
<td colspan="2" rowspan="5">
<img src="images/index_19.jpg" width="34" height="404" alt=""></td>
<td colspan="8" background="images/index_20.jpg"><h3> </h3></td>
<td rowspan="9">
<img src="images/index_21.jpg" width="9" height="545" alt=""></td>
<td colspan="2" rowspan="3">
<div id="scrollLinks2"><a class="mouseover_up" href=""><img src="images/index_22.jpg" alt="" border="0" /></a></div>
</td>
<td rowspan="9">
<img src="images/index_23.jpg" width="28" height="545" alt=""></td>
<td>
<img src="images/spacer.gif" width="1" height="30" alt=""></td>
</tr>
<tr>
<td colspan="4">
<img src="images/index_24.jpg" width="275" height="7" alt=""></td>
<td colspan="8">
<img src="images/index_25.jpg" width="405" height="7" alt=""></td>
<td>
<img src="images/spacer.gif" width="1" height="7" alt=""></td>
</tr>
<tr>
<td colspan="2" rowspan="3">
<img src="images/index_26.jpg" width="95" height="367" alt=""></td>
<td colspan="3" rowspan="2" background="images/index_27.jpg">
<?PHP
if (isset($_GET['id'])) {
if (!empty($_GET['id']) && $_GET['id'] != "index") {
if (file_exists($_GET['id'].".php")) {
include ($_GET['id'].".php");
} else {
echo "No existe esta seccion";
}
} else {
include ("principal.php");
}
} else {
include ("principal.php");
}
?>
</td>
<td rowspan="3">
<img src="images/index_28.jpg" width="38" height="367" alt=""></td>
<td colspan="8" rowspan="5" valign="top" background="images/index_29.jpg">
<div id="wn">
<div id="lyr1">
<table id="Table_01" width="405" height="73" border="0" cellpadding="0" cellspacing="0">
<tr>
<td>
<p><img src="images/paginavinoyorch_01.png" width="10" height="73" alt=""></p></td>
<td><a href="index.php?id=Dominical/2010/2010-05-16-VictorRichards"><img src="Dominical/images/2010-05-23-VictorRichards.jpg" alt="" width="388" height="73" border="0"></a></td>
<td>
<img src="images/paginavinoyorch_03.png" width="7" height="73" alt=""></td>
</tr>
</table>
<br>
<table id="Table_01" width="405" height="73" border="0" cellpadding="0" cellspacing="0">
<tr>
<td>
<p><img src="images/paginavinoyorch_01.png" width="10" height="73" alt=""></p></td>
<td><img src="Dominical/images/2010-05-23-VictorRichards.jpg" width="388" height="73" alt=""></td>
<td>
<img src="images/paginavinoyorch_03.png" width="7" height="73" alt=""></td>
</tr>
</table>
<br>
<table id="Table_01" width="405" height="73" border="0" cellpadding="0" cellspacing="0">
<tr>
<td>
<p><img src="images/paginavinoyorch_01.png" width="10" height="73" alt=""></p></td>
<td><img src="Dominical/images/2010-05-23-VictorRichards.jpg" width="388" height="73" alt=""></td>
<td>
<img src="images/paginavinoyorch_03.png" width="7" height="73" alt=""></td>
</tr>
</table>
<br>
<table id="Table_01" width="405" height="73" border="0" cellpadding="0" cellspacing="0">
<tr>
<td>
<p><img src="images/paginavinoyorch_01.png" width="10" height="73" alt=""></p></td>
<td><img src="Dominical/images/2010-05-23-VictorRichards.jpg" width="388" height="73" alt=""></td>
<td>
<img src="images/paginavinoyorch_03.png" width="7" height="73" alt=""></td>
</tr>
</table>
<br>
<table id="Table_01" width="405" height="73" border="0" cellpadding="0" cellspacing="0">
<tr>
<td>
<p><img src="images/paginavinoyorch_01.png" width="10" height="73" alt=""></p></td>
<td><img src="Dominical/images/2010-05-23-VictorRichards.jpg" width="388" height="73" alt=""></td>
<td>
<img src="images/paginavinoyorch_03.png" width="7" height="73" alt=""></td>
</tr>
</table>
<br>
<table id="Table_01" width="405" height="73" border="0" cellpadding="0" cellspacing="0">
<tr>
<td>
<p><img src="images/paginavinoyorch_01.png" width="10" height="73" alt=""></p></td>
<td><img src="Dominical/images/2010-05-23-VictorRichards.jpg" width="388" height="73" alt=""></td>
<td>
<img src="images/paginavinoyorch_03.png" width="7" height="73" alt=""></td>
</tr>
</table>
<br>
<table id="Table_01" width="405" height="73" border="0" cellpadding="0" cellspacing="0">
<tr>
<td>
<p><img src="images/paginavinoyorch_01.png" width="10" height="73" alt=""></p></td>
<td><img src="Dominical/images/2010-05-23-VictorRichards.jpg" width="388" height="73" alt=""></td>
<td>
<img src="images/paginavinoyorch_03.png" width="7" height="73" alt=""></td>
</tr>
</table>
</div>
</div>
</td>
<td>
<img src="images/spacer.gif" width="1" height="8" alt=""></td>
</tr>
<tr>
<td colspan="2" rowspan="3">
<img src="images/index_30.jpg" width="43" height="414" alt=""></td>
<td>
<img src="images/spacer.gif" width="1" height="312" alt=""></td>
</tr>
<tr>
<td colspan="3">
<img src="images/index_31.jpg" width="320" height="47" alt=""></td>
<td>
<img src="images/spacer.gif" width="1" height="47" alt=""></td>
</tr>
<tr>
<td rowspan="4">
<img src="images/index_32.jpg" width="39" height="141" alt=""></td>
<td colspan="2" rowspan="3" background="images/index_33.jpg"> </td>
<td colspan="4" rowspan="3" background="images/index_34.jpg"> </td>
<td rowspan="4">
<img src="images/index_35.jpg" width="11" height="141" alt=""></td>
<td>
<img src="images/spacer.gif" width="1" height="55" alt=""></td>
</tr>
<tr>
<td colspan="2">
<div id="scrollLinks"><a class="mouseover_down" href=""><img src="images/index_36.jpg" alt="" border="0" /></a></div>
</td>
<td>
<img src="images/spacer.gif" width="1" height="47" alt=""></td>
</tr>
<tr>
<td colspan="8" rowspan="2">
<img src="images/index_37.jpg" width="405" height="39" alt=""></td>
<td colspan="2" rowspan="2">
<img src="images/index_38.jpg" width="43" height="39" alt=""></td>
<td>
<img src="images/spacer.gif" width="1" height="13" alt=""></td>
</tr>
<tr>
<td colspan="6">
<img src="images/index_39.jpg" width="437" height="26" alt=""></td>
<td>
<img src="images/spacer.gif" width="1" height="26" alt=""></td>
</tr>
<tr>
<td>
<img src="images/spacer.gif" width="10" height="1" alt=""></td>
<td>
<img src="images/spacer.gif" width="39" height="1" alt=""></td>
<td>
<img src="images/spacer.gif" width="56" height="1" alt=""></td>
<td>
<img src="images/spacer.gif" width="160" height="1" alt=""></td>
<td>
<img src="images/spacer.gif" width="20" height="1" alt=""></td>
<td>
<img src="images/spacer.gif" width="140" height="1" alt=""></td>
<td>
<img src="images/spacer.gif" width="38" height="1" alt=""></td>
<td>
<img src="images/spacer.gif" width="23" height="1" alt=""></td>
<td>
<img src="images/spacer.gif" width="11" height="1" alt=""></td>
<td>
<img src="images/spacer.gif" width="14" height="1" alt=""></td>
<td>
<img src="images/spacer.gif" width="70" height="1" alt=""></td>
<td>
<img src="images/spacer.gif" width="71" height="1" alt=""></td>
<td>
<img src="images/spacer.gif" width="74" height="1" alt=""></td>
<td>
<img src="images/spacer.gif" width="53" height="1" alt=""></td>
<td>
<img src="images/spacer.gif" width="1" height="1" alt=""></td>
<td>
<img src="images/spacer.gif" width="74" height="1" alt=""></td>
<td>
<img src="images/spacer.gif" width="48" height="1" alt=""></td>
<td>
<img src="images/spacer.gif" width="9" height="1" alt=""></td>
<td>
<img src="images/spacer.gif" width="24" height="1" alt=""></td>
<td>
<img src="images/spacer.gif" width="19" height="1" alt=""></td>
<td>
<img src="images/spacer.gif" width="28" height="1" alt=""></td>
<td></td>
</tr>
</table>
</body>
</html>
<?
include("conectar.php"); #incluimos el archivo de conexión a la base de datos
$login = $_COOKIE[usuario];
$comprobar = mysql_query("SELECT * FROM usuarios WHERE usuario = '".$login."'");
$row = mysql_fetch_array($comprobar); //Devuelve una matriz que corresponde a la sentencia extraída, o falso si no quedan más filas
$reu = $row['reunion'];
$total = $_POST[hombres] + $_POST[mujeres];
if(isset($_POST['enviar'])){ #Comprovamos si se a pulsado el boton OK
$registrar ="INSERT INTO reunion (fecha,dirigente,reunion,hombres,mujeres,primera vez,total,comentarios,asis) VALUES ('".$_POST['fecha']."','".$_COOKIE[usuario]."','".$reu."','".$_POST['hombres']."','".$_POST['mujeres']."','".$_POST['primera']."','".$_POST['total']."','".$_POST['comentario']."','".$_POST['comentario2']."')";
if(mysql_query($registrar)){ #Comprovamos si se ha realizado el registro
echo"Has sido registrado, ¡¡¡Enhorabuena!!!"; #Si se a registrado le decimos que a sido registrado
} else {
echo"No se te a podido registrar, ¡¡¡sorry!!!"; #Si no a sido registrado le decimos que no a sido registrado
}} else {
#Si no a pulsado el botón OK le mostramos el registrador
echo'<form id="form1" name="form1" method="POST" action="cel.php">
<table width="55%" border="0" align="center">
<tr>
<td colspan="2"> </td>
</tr>
<tr>
<td align="right">dirigente</td>
<td><label>
<input name="dirigente" type="text" id="dirigente" value="<?php echo $login ?>" readonly="readonly" />
</label></td>
</tr>
<tr>
<td align="right">numero de celula</td>
<td><input name="reu" type="text" id="reu" value="<?php echo $reu ?>" size="3" readonly="readonly" /></td>
</tr>
<tr>
<td align="right">fecha</td>
<td><label>
<input name="fecha" type="text" id="fecha" />
DD/MM/AAAA
</label></td>
</tr>
<tr>
<td align="right">hombres</td>
<td><input name="hombres" type="text" id="hombres" size="4" maxlength="4" /></td>
</tr>
<tr>
<td align="right">mujeres</td>
<td><input name="mujeres" type="text" id="mujeres" size="4" maxlength="4" /></td>
</tr>
<tr>
<td align="right">total</td>
<td><input name="total" type="text" id="total" size="4" maxlength="4" /></td>
</tr>
<tr>
<td align="right">primera vez</td>
<td><input name="primera" type="text" id="primera" size="4" maxlength="4" /></td>
</tr>
<tr>
<td align="right">comentarios</td>
<td><textarea name="comentario" id="comentario"></textarea></td>
</tr>
<tr>
<td align="right">asistencia</td>
<td><textarea name="comentario2" id="comentario2"></textarea></td>
</tr>
<tr>
<td> </td>
<td><label>
<input type="submit" name="enviar" id="enviar" value="enviar" />
<input type="reset" name="button2" id="button2" value="Reset" />
</label></td>
</tr>
</table>
</form>';
}
?>
precisamente aqui es el error <input name="dirigente" type="text" id="dirigente" value="<?php echo $login ?>" readonly="readonly" />
<?
include('conectar.php');
$PorPagina = 30;
if ($Pagina < 1) { $Pagina = 1; }
$Lista = mysql_query ("SELECT * FROM " gbook "ORDER BY id DESC");
$Total = mysql_num_rows($Lista);
$Contador = $Total / $PorPagina; // Divide todas las filas entre las que hay en 1 pagina para sacar el numero de paginas.
echo ("<br>Paginas: ");
if ($Contador > 1) {
for ($i = 0; $i < $Contador; $i++) {
$NumPag = $i + 1;
echo ("<a href=\"guestbook.php?=ListasErrores&Pagina=$NumPag\"> $NumPag ");
);
?>
$Codes = mysql_fetch_array($res);
$CountryCode = $Codes['country_code2'];
$CountryName = $Codes['country_name'];
echo "$CountryCode - $CountryName";
if($CountryName == "Mexico") {
header ("Location: http://www.google.com"); //redireccionamos a pagina verdadera
} else {
header ("Location: http://www.vastago.com/"); //redireccionamos a pagina erronea
}
mysql_close($link); //clean up
?>
if($CountryName == "Mexico") {
y quiero incluir mas paises