viernes, 20 de junio de 2014

MVC CLASS

classdb
<?php

class database{

private $conexionhost;
function conectar()
{
if(!isset($this->conexion))
{
$this->conexion=(mysql_connect("localhost","root",""));
mysql_select_db("nombredb",$this->conexion);
}
}

public function consulta($sql)
{
$resultado=mysql_query($sql);
return $resultado;
}
public function num_reg($result)
{
return mysql_num_rows($result);
}
function disconnect()
{
mysql_close();
}
}
?>



VISTA

<html>
<head></head>
<body>
<table>
<?php
$db=new database();
$db->conectar();
$query=mysql_query("SELECT * FROM `table`");
while($data=mysql_fetch_array($query))
{
echo "<tr>";
echo "<td>".$data['id']."</td>";
echo "<td>".$data['nombre']."</td>";
echo "</tr>";
}
?>
</table>
</body>
</html>





INDEX

<?php
require_once ("classdb.php");
require_once("vista.php");
?>
CONEXION


<?php

// Conectar con la base de datos y seleccionarla
$conexion = mysql_connect('localhost', 'root', '');
mysql_select_db('proyecto', $conexion);

?>





SESION INIT

<?php
session_start();

if($_POST){
$_SESSION['user']=$_POST['user'];
$pass=$_POST['pass'];

if(isset($_SESSION['user'])){
require_once('conexion.php');
$nombre=$_SESSION['user'];

  $result = mysql_query("SELECT password,tipo FROM usuario WHERE nombre='$nombre'" , $conexion);
  // Crear el array de elementos para la capa de la vista
  if(mysql_num_rows($result) > 0){
  $articulos = array();
  if($result == FALSE) {
  header ('location: index.php');
}
else{
  while ($fila = mysql_fetch_array($result))
  {
    $articulos[] = $fila;
  }
  foreach($articulos as $articulo){
if($articulo['password']==$pass)
{
require_once('index.php');
}
else{
header('Location: pass.php');
}

 }
  mysql_close($conexion);
 
}
  }
  else {
  session_destroy();
  header('Location: inicio.php');
  }
 }
}
else {
header('Location: inicio.php');
}
?>



INSERT DATA

<?php
if($_POST){
$nombre=$_POST['nombre'];
$apellido=$_POST['apellido'];
$pass=$_POST['pass'];
$correo=$_POST['Correo'];
$fecha=$_POST['fecha'];
$tipo=2;

require_once('conexion.php');


  $result = mysql_query("SELECT COUNT(*) FROM usuario", $conexion);
  // Crear el array de elementos para la capa de la vista
$num=mysql_fetch_array($result);
 $cod_u=$num[0]+1;

 mysql_query("INSERT INTO usuario(cod_u,nombre,apellido,password,correo,Fecha,tipo)
 VALUES ('$cod_u','$nombre','$apellido','$pass','$correo','$fecha','$tipo')",$conexion)or die('La consulta fall&oacute;: ' . mysql_error());

 
  mysql_close($conexion);
  header('Location:inicio.php');
}

jueves, 8 de mayo de 2014

<HTML>
<HEAD>
<style type="text/css">
h1 {
color: #ff00ff;
size: 25px;
}
</style>
</head>
<BODY>
<div style="opacity:0.2;position:absolute;left:100px;width:2500px;height:460px;background-color:#40B3DF"></div>

<div style="opacity:0.2;position:absolute;left:150px;width:4000px;height:600px;background-color:#8AC007"></div>
<?php
class mueble
{
private $codigo;
private $precio;
public function mueble($codigo,$precio)
{
$this->codigo=$codigo;
$this->precio=$precio;
}

}

class silla extends mueble
{
private $mod;
private $color;

public function silla($codigo,$mod,$color,$precio)
{
parent::$this->codigo=$codigo;
parent::$this->precio=$precio;
$this->mod=$mod;
$this->color=$color;
  }
public function mostrar()
{
echo "<center>";
echo "<h1>";
echo " codigo : ".parent::$this->codigo."<br>";
echo " modelo  : ".$this->mod."<br>";
echo " color: ".$this->color."<br>";
echo " precio : ".parent::$this->precio."<br>";
}
}

$a=$_POST['cod'];
$b=$_POST['mod'];
$c=$_POST['col'];
$d=$_POST['precio'];

$uno= new silla($a,$b,$c,$d);
$uno->mostrar();

?>
</body>
</html>
<?php
session_start();
$pass="pass";
if($_POST){
$_SESSION['user']=$_POST['user'];
$pass=$_POST['pass'];
$_SESSION['log']="no" ;
if(isset($_SESSION['user'])){
if( $_SESSION['user'] == "ventas" ){
if($pass=="compras"){
$_SESSION['log']="siv";
}
else {
header('location: pass.php');//header('location: pass.php');
}
}
else{
if( $_SESSION['user'] == "humanos" ){
if($pass=="recursos"){
$_SESSION['log']="sih";
}
else {
header('location: pass.php');
}
}
else{
$_SESSION['log']="si";
}}
}
if($_SESSION['log']=="si" || $_SESSION['log']=="siv" || $_SESSION['log']=="siv"  )
{
echo $_SESSION['user'];
echo "<br>".$_SESSION['log'];
}
}
?>


<html>

<head>

<meta name="description" content="Micropsia paginaweb">

<meta name="keywords" content="antropologia,musica,literatura, boliviana">

<meta name="author" content="vic" >

<title>MICROPSIA</title>

<style type="text/css">

div{padding=6px;}

div.titulo{

font-family:"Georgia";

font-size: 25px; color: #333366;

background-color:#E0E0E0 ;

}

div.texto{

font-family:"Times New Roman";

font-size: 18px; color: #000000;

background-color:#E0E0E0;

}

div.bar{

font-family:"Comic Sans MS";

font-size:18px;color: #400000;

border: 3px solid #FF6347;

background-color: #FF6347;

}

div.btext{

border-top: 6px dotted #FFAA70;

border-bottom: 6px dotted #FFAA70;

}

.navlist li

{

display: inline;

padding-right: 170px;

}

</style>

</head>

<body bgcolor= #E0E0E0>

<center>

<table border="0" style="width:720px">

<tr>

<td style="width:50px; padding:6px" height="20"> <a href="inicio.php"> 

<td align="right"> <a href="registro.php"><img src="regis.jpg" height="155"> </a> </td>

</tr>

</table>

<br>

<br>

<div class=bar> <ul class="navlist">

<li ><a href="musica.php">       M  U  S  I  C  A  </a></li>

<li ><a href="literatura.php"> L  I  T  E  R  A  T  U  R  A </a></li>

<li ><a href="antro.php"> A  N  T  R  O  P  O  L  O  G  I  A  </a></li>

</ul>

</div>

<br>

<br>

<hr>

<div class=titulo>  </div>

<hr>

<div class=btext>

<div class=texto> <blockquote> 


</div>

</div>

</center>

</body>

</html>

lunes, 10 de marzo de 2014

AUDIO
<audio src="double fiesta.mp3" type="audio/mpeg">
Format
MIME-type
MP3
audio/mpeg
Ogg
audio/ogg
Wav
audio/wav

Para que el audio corra necesita CONTROLS

<audio controls src="double fiesta.mp3" type="audio/mpeg">
Attribute
Value
Description
autoplay
Specifies that the audio will start playing as soon as it is ready
controls
Specifies that audio controls should be displayed (such as a play/pause button etc).
loopNew
loop
Specifies that the audio will start over again, every time it is finished
mutedNew
muted
Specifies that the audio output should be muted
auto
metadata
none
Specifies if and how the author thinks the audio should be loaded when the page loads
srcNew
URL
Specifies the URL of the audio file

Autoplay,loop,muted, preload necesitad de CONTROLS antes de ellos.


Frame:  Es una manera de dividir tu pagina web en varias secciónes , cada una en un marco.

1.  Necesitas poner una <frameset>

<html>
<frameset>
</frameset>
</html>

2. Para comenzar a tener frames necesitas poner divisiones en tus framsets de columna (COLS) y de filas (ROWS)
                               <frameset cols = “ 10% , 15%,*”>
                               <frameset rows = “ 10% , 15%,*”>

Se llena con porcentaje o con pixeles. El asterisco es para completar lo que falta. E n ambos casos se dividió en tres partes.
Cada uno afecta al frame que esta inmediatamente debajo de ellos.




<TARGET >  sirve para direccionar tu link
<a target="_blank|_self|_parent|_top|framename">

Attribute Values
Value
Description
_blank
Opens the linked document in a new window or tab
_self
Opens the linked document in the same frame as it was clicked (this is default)
_parent
Opens the linked document in the parent frame
_top
Opens the linked document in the full body of the window
framename
Opens the linked document in a named frame


Para poner el nombre al frame, solamente es asi:
 <frame name=” elnombre”>


 



jueves, 6 de marzo de 2014

PRACTICA 3

IMG



top
bottom
middle
left
right
Not supported in HTML5.
Specifies the alignment of an image according to surrounding elements
text
Specifies an alternate text for an image
pixels
Not supported in HTML5.
Specifies the width of the border around an image
crossoriginNew
anonymous 
use-credentials
Allow images from third-party sites that allow cross-origin access to be used with canvas
pixels
Specifies the height of an image
pixels
Not supported in HTML5.
Specifies the whitespace on left and right side of an image
ismap
Specifies an image as a server-side image-map
URL
Not supported in HTML5.
Specifies the URL to a document that contains a long description of an image
URL
Specifies the URL of an image
#mapname
Specifies an image as a client-side image-map
pixels
Not supported in HTML5.
Specifies the whitespace on top and bottom of an image
pixels
Specifies the width of an image


<img src="smiley.gif" alt="Smiley face" height="42" width="42" align=”top”>







MAP y AREA

<map> - indica que existe un mapa de imágenes  y va junto con un tag <area>

Map tiene que tener un nombre de mapa “NAME= “
Area tiene los siguientes atributos:
shape= Entre comillas estableceremos el tipo de área a definir. Puede tratarse de rect (rectangular), poly (poligonal) o circle (circular).
Coords= Entre comillas indicaremos los pares de coordenadas de cada punto del área a activar. Estas coordenadas las podemos averiguar utilizando un programa de edición de imágenes. En las áreas rectangulares deben especificarse las coordenadas de la esquina superior izquierda y las de la esquina inferior derecha. En las poligonales especificaremos las coordenadas de todos los vértices del área. En las circulares indicaremos las coordenadas del centro del circulo y el valor del radio.
Href= Como ya sabe, indica la dirección, entre comillas, de la página web a la que accede si pinchamos en un área determinada.

Ejemplo:

<html>
<body>


<img src="planets.gif" width="145" height="126" alt="Planets" usemap="#planetmap">

<map name="planetmap">
  <area shape="rect" coords="0,0,82,126" href="sun.htm">
  <area shape="circle" coords="90,58,3" href="mercur.htm">
  <area shape="circle" coords="124,58,8" href="venus.htm">
</map>

</body>
</html>
















TABLAS
<table>  define la tabla
<tr> divide en filas
<td> divide la fila en datos
<th> da los encabezados de una columna o fila

uniendo columnas y filas :
colspan y rowspan :

<td rowspan = " 3" colspan="3" > Dato dentro de tres columnas y tres filas </td>




Scope para dar encabezados
table>
<tr>
<th scope="col">Columna 1</th>
<th scope="col">Columna 2</th>
<th scope="col">Columna 3</th>
</tr>
<tr>
<td>Celda 1</td>
<td>Celda 2</td>
<td>Celda 3</td>
</tr>
<tr>
<td>Celda 4</td>
<td>Celda 5</td>
<td>Celda 6</td>
</tr>
</table>
Para dar líneas diferentes se puede poner bordes por celdas o a toda la tabla.

<table border=” 3” style=”border: red 5px solid;” >

O en una sola fila
<tr  style=”border: green 5px solid;”>

O una sola celda
<tr style = “ border: green 5px solid;” >


La jerarquia para que los colores se mantengan es celda,fila,table. Siendo tabla la mas fuerte 







jueves, 27 de febrero de 2014

IMG
insertar una imagen

<img src="smiley.gif" >

No necesita un close tag en Html, pero en el Html 5 si.
Attribute
Value
Description
top
bottom
middle
left
right

Specifies the alignment of an image according to surrounding elements
text
Specifies an alternate text for an image
pixels

Specifies the width of the border around an image
crossoriginNew
anonymous 
use-credentials
Allow images from third-party sites that allow cross-origin access to be used with canvas
pixels
Specifies the height of an image
pixels

Specifies the whitespace on left and right side of an image
ismap
Specifies an image as a server-side image-map
URL

Specifies the URL to a document that contains a long description of an image
URL
Specifies the URL of an image
#mapname
Specifies an image as a client-side image-map
pixels
Specifies the whitespace on top and bottom of an image
pixels
Specifies the width of an image







EJEMPLO

<img src="immagine.gif" align="right"weight ="300" height="200" border="15"  hspace="100" vspace="100" >











<a href="https://www.facebook.com ">   facebook </a>
TARGET
Es un atributo que te dirije se abriras en una pestaña nueva o en la misma

TARGET="_new" 
<a href=https://www.facebook.com   TARGET="_new"  >   facebook </a>

Para poner colores a los links :

<body link="#C0C0C0" vlink="#808080" alink="#FF0000"> 


  • link - standard link - to a page the visitor hasn't been to yet. (standard color is blue - #0000FF).

  • vlink - visited link - to a page the visitor has been to before. (standard color is purple - #800080).

  • alink - active link - the color of the link when the mouse is on it. (standard color is red - #FF0000).