Seguidores

viernes, 11 de octubre de 2019

clase numero 10

CREACION DE UNA BASE DE DATOS CON PHP en MySql

CODIGO PARA CONECTAR BASE DE DATOS 1
<?php
$host ="localhost";
$usuario ="root";
$password="root";
$database="tienda1";

$conec=@mysql_connect($host,$usuario,$password) or die(mysql_error());
$db =@mysql_select_db($database,$conec) or die(mysql_error());
?>
conectar.php

CODIGO PARA LA LISTA 1
<html>
<?php
include "conectar.php";
?>
<body>
<h3>LISTA DE PRODUCTOS </h3> <br> 
<hr>
<table border='1'>
<tr><td>CODIGO</td> <td>    DESCRIPCION </td> <td> PRECIO </td>
 </tr>
<?php
$sql="select * from producto";
$res=mysql_query($sql,$conec);

while($row=@mysql_fetch_array($res))
    echo"";
    echo"<tr>"
    echo"<td>"echo $row['codigo']; echo"</td>";
    echo"<td>"echo $row['descripcion']; echo"</td>";
    echo"<td>"echo $row['precio']; echo"</td>";
     echo"</tr>"
    echo"";
}
?> 
</table>
<body>
</html>

CODIGO 2
<?php
$host ="localhost";
$usuario ="root";
$password="root";
$database="clientes";
$conec=@mysql_connect($host,$usuario,$password) or die(mysql_error());
$db =@mysql_select_db($database,$conec) or die(mysql_error());
?>


CODIGO DE CLIENTES 2
<html> <link rel="stylesheet" href="css/sin_linea.css"> <?php include "conectar1.php"; ?> <body bgcolor="#00ace6"> <header> <center> <h3>lista de clientes </h3></center></header> <form method="post"action="cliente.php"> <fieldset> <legend> datos del cliente </legend> <table border="1"> <tr> <td>dni</td><td><input type= "text" name="txcod" id="txcod"></td> </tr><tr> <td> nombre </td> <td><input type= "text" name="txdes" id="txdes"></td> </tr> <tr> <td> direccion </td><td><input type= "text"name="txpre" id="txpre"></td></tr> </tr></table > </fieldset> <fieldset> <legend> lista de clientes </legend> <table border='1'> <tr bgcolor="#FF0000"> <td>CODIGO</td> <td> DESCRIPCION </td> <td> PRECIO </td> </tr> <?php $sql="select * from cliente1"; $res=mysql_query($sql,$conec); while($row=@mysql_fetch_array($res)) { echo""; echo"<tr bgcolor= #b38600>"; echo"<td>"; echo $row['dni']; echo"</td>"; echo"<td>"; echo $row['nombre']; echo"</td>"; echo"<td>"; echo $row['direccion']; echo"</td>"; echo"</tr>"; echo""; } ?> </table></fieldset> <fieldset> <legend> opciones </legend> <button> <input type="submit" value="guardar" name="g" id="g"> </button> <button> <input type="button" value="salir"> </button></fieldset> <?php mysql_query("set names'utf8'"); $sql="select * from cliente1"; $result=mysql_query($sql,$conec); $codi=$_POST['txcod']; $desc=$_POST['txdes']; $prec=$_POST['txpre']; $sql="insert into cliente1(dni,nombre,direccion) values ('$codi','$desc','$prec')"; $result=mysql_query($sql,$conec); ?> </form> <body> <style> TR:HOVER { background:#EEEEEE; } button{ text-align: center; color: white; background-color:black; rgb(211, 15, 25); padding: 5px; font-size: 18px; font-family: Impact; } header{ background-color: #24282b; color: #fff; padding-top: 10px; min-height: 30px; border-bottom: 2px solid #1293d4; } </style> </html>

CODIGO FINAL DE LISTA DE PRODUCTOS

<html>
<link rel="stylesheet" href="css/sin_linea.css">
<?php
include "conectar.php";
?>
<body bgcolor="#00ace6">
    <header> <center>
<h3>mantenimiento de productos </h3></center></header>
<form method="post"action="producto_new.php">
<fieldset>
<legend>
datos del producto
</legend> <table border="1">
    <tr>
<td>CODIGO</td><td><input type= "text" name="txcod" id="txcod"></td>
</tr><tr>
 <td>    DESCRIPCION </td> <td><input type= "text" name="txdes" id="txdes"></td> </tr>
 <tr>
 <td> PRECIO </td><td><input type= "text"name="txpre" id="txpre"></td></tr>
 </tr></table >
</fieldset>
<fieldset>
    <legend> lista  de productos </legend>
<table border='1'>
<tr bgcolor="#FF0000">
<td>CODIGO</td>
 <td>    DESCRIPCION </td> 
 <td> PRECIO </td>
 </tr>
<?php
$sql="select * from producto";
$res=mysql_query($sql,$conec);

while($row=@mysql_fetch_array($res))
    echo"";
    echo"<tr bgcolor= #b38600>"; 
    echo"<td>"; echo $row['codigo']; echo"</td>";
    echo"<td>"; echo $row['descripcion']; echo"</td>";
    echo"<td>"; echo $row['precio']; echo"</td>";
     echo"</tr>"; 
    echo"";
}
?> 
</table></fieldset>
<fieldset>
    <legend> opciones
    </legend>
    <button>  <input type="submit" value="guardar"name="g"id="g">  </button>
    <button> <input type="button" value="salir"> </button></fieldset>
    <?php


mysql_query("set names'utf8'");
if($_POST['txcod']=='' and $_POST['g'])
{}
else
 {
    if ($_POST['txcod']=='')
    {   echo "Faltan datos";}
    else
    {
        $codi=$_POST['txcod'];
        $desc=$_POST['txdes'];
        $prec=$_POST['txpre'];
        $sql="insert into producto (codigo,descripcion,precio)
              values ('$codi','$desc','$prec')";
        $result=mysql_query($sql,$conec);
echo"<meta http-equiv='refresh'content='l':url=producto_new.php";
    }
}

?>
</form>
<body>

    <style>
        TR:HOVER {
background:#EEEEEE;
}
button{
                text-align: center;
                color: white;
                background-color:black; rgb(211, 15, 25);
                 padding: 5px;
                 font-size: 18px;
                 font-family: Impact;
            }
            header{

background-color: #24282b;

color: #fff;

padding-top: 10px;

min-height: 30px;

border-bottom: 2px solid #1293d4;



}
    </style>

</html>
enlace de los similares
http://artespixel.com/3.rar





viernes, 4 de octubre de 2019

novena clase


<?php
$host ="localhost";
$usuario ="root";
$password="root";
$database="tienda1";

$conec=@mysql_connect($host,$usuario,$password) or die(mysql_error());
$db =@mysql_select_db($database,$conec) or die(mysql_error());
?>

<body>
VER PRODUCTOS <br>

<?php
$sql="select * from producto";
$res=mysql_query($sql,$conec);

while($row=@mysql_fetch_array($res))
{
echo $row['codigo'];
echo $row['descripcion'];
echo $row['precio'];
echo "<br>";
}

?>

<body>
</html>

jueves, 3 de octubre de 2019

octava clase

CODIGO PARA PROMEDIO

<html>
    <body bgcolor="green">
        


<title> Estructuras condicionales </title>
Uso de las estructuras condicionales IF <br>
ingreso de Notas y solucionar Notas promediales <br><br>
Nombre del Alumno Nota1 Nota 2 Nota 3 Promedio <br>
<input type="button" value ="promedio" onclick ="prom();"> <br>
<input type="text" id="tnom" size="20">
<input type="text" id="t1"value="0" size="4">
<input type="text" id="t2" value="0"  size="4">
<input type="text" id="t3" value="0"  size="4">
<input type="text" id="tprom" value="0" size="4">
<input type="text" id="tobs" value="0"size="15">
<br>


<script>
function prom(){
    var n1=document.getElementById('t1').value;
    var n2=document.getElementById('t2').value;
    var n3=document.getElementById('t3').value;
    var pro=(parseInt(n1)+parseInt(n2)+parseInt(n3))/3;
    document.getElementById('tprom').value=pro
    if (pro<10.4){
        document.getElementById('tobs').value="desaprobado"
    } else{
        document.getElementById('tobs').value="aprobado"
    }
}


</script>
CODIGO PARA TU  PROGRAMA HTML <br><fieldset>
<textarea>
    
        <html>
                <title> Estructuras condicionales </title>
                Uso de las estructuras condicionales IF <br>
                ingreso de Notas y solucionar Notas promediales <br><br>
                Nombre del Alumno Nota1 Nota 2 Nota 3 Promedio <br>
                <input type="text" id="t1" size="16">
                <input type="text" id="t2" size="4">
                <input type="text" id="t1" size="4">
                <input type="text" id="t1" size="4">
                <input type="text" id="t1" size="4">
                <br>
                <input type="button" id="b1" value="Promedio">
                </html>
</textarea></fieldset>
</body></html>


CODIGO PARA UNA TIENDA
<html>
<body style="background-color:rgb(255,0,0);">
</body>
<font size="10" color="black">BODEGA "ELITA"</font>
<hr>
<body background="bg.jpg">
<form name="examen" method="">
<h2>Cantidad &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Descripcion &nbsp;&nbsp;
&nbsp;&nbsp;Precio &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type="button" value="total" onclick="TOT();">
</h2>
<p>
<input type="text" id="t1" value="6" size="08">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type="text" id="t2" value="4" size="15">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type="text" id="t3" value="2" size="7">&nbsp;&nbsp;&nbsp;&nbsp;
<input type="text" id="t4" value="0" size="7">
<p>
<input type="text" id="t5" value="4" size="08">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type="text" id="t6" value="8" size="15">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type="text" id="t7" value="6" size="7">&nbsp;&nbsp;&nbsp;&nbsp;
<input type="text" id="t8" value="0" size="7">
<hr>
<font size="6">Subtotal</font>&nbsp;&nbsp; <input type="text" id="tp" size="8">
<p>
<font size="6">Descuento del 10%</font>
<br>
<input type="radio" name="radio1" id="radio1" />Si<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;<input type="text" id="y9" size="5"><p>
<input type="radio" name="radio1" id="radio1" />No<br>
<hr>
<input type="button" name="result" id="result" value="RESPUESTA" onclick="cont()"/>
<input type="text" id="y9" size="5">
</form>
<script>
function TOT() {
var n1=document.getElementById('t1').value;
var n2=document.getElementById('t2').value;
var n3=document.getElementById('t3').value;
var total= parseInt(n1) + parseInt(n2) + parseInt(n3) ;
document.getElementById('t4').value=total
var n1a=document.getElementById('t5').value;
var n2a=document.getElementById('t6').value;
var n3a=document.getElementById('t7').value;
var totala= parseInt(n1a) + parseInt(n2a) + parseInt(n3a) ;
document.getElementById('t8').value=total
var tit= parseInt(total)/2 + parseInt(totala)/2;
document.getElementById('tp').value=tit
}
</script>

</html>
OPERACIONES
<html>
<body bgcolor="grenn">
<script>
function cont() {
var c=0;
if(document.forms['examen']['radio1'][0].checked)
{ c++;
var n1=document.forms['examen']['t1'].value;
var n2=document.forms['examen']['t2'].value;
var sum=parseInt(n1)+ parseInt(n2);
document.forms['examen']['tr'].value=sum;
}
else
{ var n1=document.forms['examen']['t1'].value;
var n2=document.forms['examen']['t2'].value;
var res=parseInt(n1)- parseInt(n2);
document.forms['examen']['tr'].value=res; }
}
</script>
<form name="examen">
Numero 01 <input type="text" id="t1"><br>
Numero 01 <input type="text" id="t2">
<hr>
<input type="radio" name="r1" id="radio1"> Sumar
<input type="radio" name="r1" id="radio1"> Restar
<hr>
<input type="button" Value="Respuesta" onclick="cont();">
<input type="text" id="tr">
</form>
</body>
</html>
tabla
<html>
<fieldset style="width:20%">
Tabla de multiplicar <br>
</fieldset>
<fieldset style="width:20%">
<script>
var i=0; for (i=0;i<=12;i++)
{
document.write("N. " + i +" x 2 =" );
document.write("<font color=blue>" + (i*2) + "</font>");
document.write("<br />");
}
document.write("<hr>");
for (i=0;i<=12;i++)
{
document.write("N. " + i+" x 3 =" + (i*3 ) );
document.write("<br />");
}
document.write("<hr>");
for (i=0;i<=5;i++)
{
document.write("N. " + i+" x 4 =" + (i*4 ) );
document.write("<br />");
}
document.write("<hr>");
for (i=0;i<=5;i++)
{
document.write("N. " + i+" x 5 =" + (i*5 ) );
document.write("<br />");
}
</script>
</html>

</html>

imagen 


<html>
<body background="01.jpg">
</body>
<br>
<center><H1><marquee behaviador="alterne" hspace="400" scrollamount="10">
<font face="Cooper" color="black">
Ayacucho - Peru
</font>
</marquee><H1></center>
<body bgcolor="#ACD1D0">
</body>
<h1> Ciudad de Ayacucho </h1>
La fe del pueblo ayacuchano se refleja en los templos construidos a lo largo de la ciudad. Además, disfruta la arquitectura colonial presente en cada rincón.
<br><br>
<button type="button" onclick="verfoto1()">platos tipicos</button>
<button type="button" onclick="verfoto2()">carnavales</button>
<button type="button" onclick="verfoto3()">semana santa</button>
<div id="myDiv" style="border:1px solid black; height:400;
width:400;">
Imagen capturada</div>
<script>
function verfoto1()
{ document.getElementById("myDiv").style.backgroundImage="url('platos.png')";}
function verfoto2()
{ document.getElementById("myDiv").style.backgroundImage="url('rural.jfif')";}
function verfoto3()
{ document.getElementById("myDiv").style.backgroundImage="url('santa.jpg')";}
</script>
</body>
</html>

index

<!DOCTYPE html>
<html>
<head>
<title></title>
<link rel="stylesheet" type="text/css" href="miestilo.css">
</head>
<body>
<div id="titulo">
<h1>Bienvenidos a mi Pagina Web</h1>
</div>
<div id="amarillo">
<img src="imagenes/image01.png">
</div>
<div id="verde">
<p>
Crea un sitio web de aspecto profesional en sólo 3 fáciles pasos. Escoge entre miles de diseños de sitios personalizados para tu negocio..
</p>
<img class="cambio" src="imagenes/image02.png">
<img class="cambio" src="imagenes/image04.png">
<img class="cambio1"src="imagenes/image05.png">
</div>
</body>
</html>

cambio de dolares

<html>
        <h1> Convertirde soles a dolares </h1> 
        <hr>
            Valor de Soles <input type="text" id="txvalor"> <br>
            Tipo de Cambio <input type="text" id="txcambio">
        <hr>
           <input type="button" value="Total">
           <input type="text" id="txtot">
           dolares
        
        </html>








martes, 1 de octubre de 2019

septima clase


CODIGO PARA USUARIO EN HTML CON CONTRASEÑA PARA VARIOS USUARIO



<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Login para varios usuario</title>
</head>

<body>
<h1>ACCESO AL SISTEMA DE USUARIO
</h1> 
<CENTER>
<form name="login"> 
     <table width="200" border="0"> 
       <tr> 
         <th scope="row"><h2>Usuario</h2></th> 
         <td><span class="cnt"> 
           <input name="usuario" type="text" class="Input" value="" size="20" /> 
         </span></td> 
       </tr> 
       <tr> 
         <th height="33" scope="row"><h2>Contraseña</h2></th> 
         <td><span class="cnt"> 
           <input name="password" type="password" class="Input" value="" size="20" /> 
         </span></td> <br>
         <td><span class="cnt"> <br><br><br><br><br>
<fieldset>
           <input value="Entrar" target="_parent" onclick="Login()" type="button" class="boton"/> </fieldset>
         </span></td> 
       </tr> 
       <tr> 
         <th scope="row"><fieldset><input type="reset" name="Borrar"
id="Borrar" value="LIMPIAR" class="boton" /></fieldset>
         <button  name="button" > <a href="index.html">salir</a>  </button>
 </fieldset></th> 

       </tr> 
     </table> 
</form> </CENTER>

<script language="JavaScript"> 
function Login(){ 
var done=0
var usuario=document.login.usuario.value
var password=document.login.password.value
if (usuario=="USUARIO1" && password=="CONTRASEÑA1") { 
window.location="paneles1.html"
}
else
         alert("Porfavor ingrese, nombre de usuario y contraseña correctos."); 
    }  
if (usuario=="USUARIO2" && password=="CONTRASEÑA2") { 
window.location="MOVIMIENTO.HTML"

if (usuario=="" && password=="") { 
window.location="errorpopup.html"

        </script> 
</center> 
<script language="Javascript"> 
<!-- Begin 
document.oncontextmenu = function(){return false
// End --> 
</script>
</body>
<style>
            header{
              colorred;
              font-familyImpact;
            }
            body{
                text-aligncenter;
                colorwhite;
                background-colorblack;
                 padding50px;
                 font-size18px;
             
            }
            table {
  borderred 5px solid ;

}
fieldset {
background-colorrgb(328245);
}
            button{
                text-aligncenter;
                colorwhite;
                background-colorrgb(2111525);
                 padding5px;
                 font-size18px;
                 font-familyImpact;
            }
            h1{
              colorred;
            }
    </style>
</html>

netbeans java

LEJGUAJE DE PROGRAMACION I Ejercicios sobre operadores aritméticos Java Ejercicio 1: Si a, b y c son variables enteras con valores a=8, b=...