Foros del Web » Programando para Internet » PHP »

Sistema de login

Estas en el tema de Sistema de login en el foro de PHP en Foros del Web. hola a todos, llevo ya bastante tiempo y no soy capaz de crear un sistema de login para mi pagina web, haber si alguien pudiera ...
  #1 (permalink)  
Antiguo 31/10/2014, 11:12
 
Fecha de Ingreso: mayo-2014
Mensajes: 13
Antigüedad: 9 años, 11 meses
Puntos: 0
Sistema de login

hola a todos, llevo ya bastante tiempo y no soy capaz de crear un sistema de login para mi pagina web, haber si alguien pudiera ayudarme, os paso los documentos que tengo y haber si alguien es capaz de mandarmelo adaptado a mi documento, ya que e buscado por internet bastantes sistemas de logueo pero soy incapaz de adaptarlo.

en la pestaña contactar tengo hecho el formulario para el logueo:
necesito que al loguearme me redireccione a otro link php que tengo que crear.
tambien un boton que pueda cerrar sesion.

gracias de antemano.

documento portada.php:

Código PHP:
Ver original
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta http-equiv="content-type" content="text/html; charset=UTF8">
  5. <title>CASA DE PERROS</title>
  6. <LINK REL="stylesheet" TYPE="text/css" HREF="cssportada.css">
  7.  
  8. <script>
  9.     window.onload=function(){
  10.         document.getElementById("sitio").onclick=function (){mostrar(this);};
  11.         document.getElementById("conocenos").onclick=function (){mostrar(this);};
  12.         document.getElementById("Adopta").onclick=function (){mostrar(this);};
  13.         document.getElementById("abandona").onclick=function (){mostrar(this);};
  14.        
  15.     }
  16.    
  17.     function mostrar(menu){
  18.                 objCaja=document.getElementById("caja");
  19.         switch (menu.id){
  20.         case "sitio":
  21.            
  22.         break;
  23.         case "conocenos":
  24.            
  25.         break;
  26.         case "Adopta":
  27.            
  28.         break;
  29.         case "abandona":
  30.             objCaja.innerHTML = "<div id='texto3'><h2>¿NO PUEDE HACERSE CARGO DE SU PERRO?</h2></br></br></br>Para rellenar el formulario <a href='formularioperrospendiente.html'><u>PINCHA AQUÍ</u></a></br></br></div>";
  31.             objCaja.innerHTML +="<div id='login' align='right'></br><b>Iniciar Sesión</b></br></br><form name='formulario' action='entrar.php' method='post'>Username:&nbsp;&nbsp;<input type='text' placeholder='Correo electronico...' name='correo' id='texto'/></br></br>Password:&nbsp;&nbsp;<input type='text' placeholder='Clave de acceso...' name='clave' id='texto'/></br></br><input type='submit' value='Identificarme' /></form><\div>";
  32.         break;
  33.         default:
  34.             return false;
  35.         break;
  36.         }
  37.        
  38.     }
  39.    
  40.    
  41.    
  42. </script>
  43. </head>
  44. <body>
  45.     <form>
  46.         <div id="titulo" style="font-size: 250%;"> CASA DE PERROS </div>
  47.         <br/><br/>
  48.         <div id="botones">
  49.         <input type="button" value="¿Dónde estámos? " id="sitio" class="Perrera" />
  50.         <input type="button" value="¿Quienes somos?" id="conocenos" class="Perrera" />
  51.         <input type="button" value="Adopta un perro" id="Adopta" class="Perrera" />
  52.         <input type="button" value="Contactar" id="abandona" class="Perrera" />
  53.         </div>
  54.        
  55.         <div id="caja">
  56.            
  57.         </div>
  58.        
  59.        
  60.        
  61.        
  62.     </form>
  63. </body>
  64. </html>

cssportada.css:

Código CSS:
Ver original
  1. body {     
  2.             background: url(fondo6.jpg) no-repeat center center fixed;
  3.         -webkit-background-size: cover;
  4.         -moz-background-size: cover;
  5.         -o-background-size: cover;
  6.         background-size: cover;
  7.  
  8.  
  9.          }
  10.    
  11.     a {
  12.         color: black;
  13.         text-decoration:none;
  14.     }
  15.    
  16.     h1 {
  17.         color: black;
  18.         text-decoration: underline;
  19.     }
  20.    
  21.     h3 {
  22.         TEXT-ALIGN:center;
  23.         color: black;
  24.         text-shadow: 5px 5px 5px #A4A4A4;
  25.        
  26.     }
  27.    
  28.     #titulo {
  29.             text-align: center;
  30.             text-shadow: 5px 5px 5px #585858;
  31.             width:340px;
  32.             margin: auto auto;
  33.             margin-top:30px;
  34.             padding-bottom:30px;
  35.             }
  36.    
  37.     #caja {
  38.             display: block;
  39.             border-radius: 15px 15px 15px 15px;
  40.             border: solid black 3px;
  41.             width: 1207px;
  42.             height: auto;
  43.             margin: auto auto;
  44.             padding-left:12px;
  45.             padding-right:12px;
  46.             padding-bottom:30px;
  47.             background-color:#CED8F6;
  48.             }
  49.  
  50.     #botones {
  51.             width: 1238px;
  52.             height: auto;
  53.             margin: auto auto;
  54.             }
  55.    
  56.     .Perrera {
  57.             background-color: black;
  58.             color: white;
  59.             border-radius: 8px 8px 8px 8px;
  60.             width:200px;
  61.             height: 25px;
  62.             }
  63.    
  64.     #mapa {
  65.             margin-left:600px;
  66.             margin-top:-300px;
  67.             margin-bottom:12px;
  68.             border-style: solid;
  69.            
  70.             }
  71.            
  72.     #imagen {
  73.             margin-left:600px;
  74.             margin-top:-300px;
  75.             margin-bottom:12px;
  76.             border-style: solid;
  77.             }
  78.            
  79.     #texto {
  80.             position:left;
  81.             margin-left:70px;
  82.             margin-right:600px;
  83.             padding-right:12px;
  84.             }
  85.    
  86.     #texto2 {
  87.             position:left;
  88.             margin-left:70px;
  89.             margin-right:600px;
  90.             padding-right:12px;
  91.             }
  92.    
  93.     #texto3 {
  94.             position:left;
  95.             margin-left:70px;
  96.             margin-right:500px;
  97.             padding-right:12px;
  98.            
  99.             }
  100.    
  101.     #texto4 {
  102.             position:left;
  103.             margin-right:600px;
  104.             margin-left:70px;
  105.             padding-right:12px;
  106.             }
  107.    
  108.     #texto5 {
  109.            
  110.             margin-left:670px;
  111.             margin-top:-228px;
  112.             margin-bottom:12px;
  113.             width: 600px;
  114.             height: auto;
  115.            
  116.             }
  117.                
  118.     #col_der {
  119.             float: right;
  120.             width: 33%;
  121.             height: 190px;
  122.             padding-top:20px;
  123.             padding-bottom:20px;
  124.             background-color: white;
  125.             text-align: center;
  126.             margin:0 auto;
  127.             background-color:#CED8F6;
  128.             }
  129.  
  130.     #col_izq {
  131.             float: left;
  132.             width: 33%;
  133.             height: 190px;
  134.             padding-top:20px;
  135.             padding-bottom:20px;
  136.             background-color: white;
  137.             text-align: center;
  138.             margin:0 auto;
  139.             background-color:#CED8F6;
  140.             }
  141.    
  142.     #col_cen {
  143.             height: 190px;
  144.             padding-top:20px;
  145.             padding-bottom:20px;
  146.             background-color: white;
  147.             text-align: center;
  148.             margin:0 auto;
  149.             background-color:#CED8F6;
  150.             }
  151.    
  152.     #col_der_texto1 {
  153.             float: right;
  154.             width: 33%;
  155.             height: auto;
  156.             background-color:#CED8F6;
  157.             }
  158.  
  159.     #col_izq_texto2 {
  160.             float: left;
  161.             width: 33%;
  162.             height: auto;
  163.             background-color:#CED8F6;
  164.     }
  165.    
  166.     #col_cen_texto3 {
  167.             height: auto;          
  168.             background-color:#CED8F6;
  169.     }
  170.    
  171.     #imgpequenio {
  172.             border-style: solid;
  173.             border-color: black;
  174.            
  175.     }
  176.  
  177.     #imgmediano {
  178.             border-style: solid;
  179.             border-color: black;
  180.            
  181.     }
  182.    
  183.     #imggrande {
  184.             border-style: solid;
  185.             border-color: black;
  186.     }
  187.    
  188.     #todos_los_perros_texto {
  189.         text-align: center;
  190.     }
  191.    
  192.     #todos_los_perros {
  193.         border-style: solid;
  194.         margin: auto auto;
  195.         width:1000px;
  196.     }  
  197.    
  198.     #login{
  199.             display: block;
  200.             background-color: #FFFFFF;
  201.             margin-left:850px;
  202.             margin-top:-200px;
  203.             margin-bottom:12px;
  204.             width:340px;
  205.             height: 190px;
  206.             border-radius: 15px 15px 15px 15px;
  207.             border: solid black 1px;
  208.             TEXT-ALIGN:center;
  209.             }

la base de datos:

Código MySQL:
Ver original
  1. CREATE DATABASE proyectoPerrera;
  2.  
  3. use proyectoPerrera;
  4.  
  5. CREATE TABLE trabajador (
  6.     idtrabajador int (20),
  7.     nombre varchar(20) not null,
  8.     contrasenia  VARCHAR(40) not null,
  9.     telefono int (10),
  10.     PRIMARY KEY (idtrabajador)
  11.     );
  #2 (permalink)  
Antiguo 31/10/2014, 12:40
Avatar de ArturoGallegos
Moderador
 
Fecha de Ingreso: febrero-2008
Ubicación: Morelia, México
Mensajes: 6.774
Antigüedad: 16 años, 1 mes
Puntos: 1146
Respuesta: Sistema de login

Y el código PHP que crea la sesión o cookie para el login?

Cual es el error que tienes?
  #3 (permalink)  
Antiguo 31/10/2014, 14:43
 
Fecha de Ingreso: mayo-2014
Mensajes: 13
Antigüedad: 9 años, 11 meses
Puntos: 0
Respuesta: Sistema de login

es el que he intentado hacer de 300 maneras. tengo muchos y no se cual esta mas cerca, por eso prefiero no pasar ninguno y quien me pueda ayudar lo haga desde cero. aunque si tu me puedes ayudar y necesitas que te pase un documento y corregirmelo podria pasar alguno, saludos
  #4 (permalink)  
Antiguo 31/10/2014, 21:05
Avatar de NSD
NSD
Colaborador
 
Fecha de Ingreso: mayo-2012
Ubicación: Somewhere
Mensajes: 1.332
Antigüedad: 11 años, 11 meses
Puntos: 320
Respuesta: Sistema de login

Hay miles de tutoriales para esto, por ejemplo este, que tiene mas comentarios que lineas de codigo, puedes intentar seguirlo y nosotros te ayudamos con los problemas que te surjan :)
__________________
Maratón de desafíos PHP Junio - Agosto 2015 en FDW | Reglamento - Desafios

Etiquetas: formulario, html, login, sistema
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 00:12.