• Welcome to the Chevereto User Community!

    Here, users from all over the world come together to learn, share, and collaborate on everything related to Chevereto. It's a place to exchange ideas, ask questions, and help improve the software.

    Please keep in mind:

    • This community is user-driven. Always be polite and respectful to others.
    • Support development by purchasing a Chevereto license, which also gives you priority support.
    • Go further by joining the Community Subscription for even faster response times and to help sustain this space

chevereto con registro de usuarios

Status
Not open for further replies.

kingworld

Chevereto Noob
hola a todos navegando por internet encontre un codigo muy bueno en php que sirve para que los usuarios se logeen o se registren.
bueno mi idea es si abria alguna forma de integrarlo a chevereto. sin mas que desir el codigo es:
usuarios.sql :
-- phpMyAdmin SQL Dump
-- version 2.11.9
-- http://www.phpmyadmin.net
--
-- Servidor: localhost
-- Tiempo de generación: 16-02-2009 a las 20:52:27
-- Versión del servidor: 5.0.67
-- Versión de PHP: 5.2.6

SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";


/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;

--
-- Base de datos: `usuarios`
--

-- --------------------------------------------------------

--
-- Estructura de tabla para la tabla `users`
--

CREATE TABLE `users` (
`id` int(11) NOT NULL auto_increment,
`username` varchar(30) NOT NULL,
`password` varchar(20) NOT NULL,
`email` varchar(40) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;

--
-- Volcar la base de datos para la tabla `users`
--

registro.php :
<?
// Configura los datos de tu cuenta
$dbhost='localhost';
$dbusername='nombre_usuario';
$dbuserpass='contraseña';
$dbname='nombre_base_de_datos';

// Conexión a la base de datos
mysql_connect ($dbhost, $dbusername, $dbuserpass);
mysql_select_db($dbname) or die("Cannot select database");

// Preguntaremos si se han enviado ya las variables necesarias
if (isset($_POST["username"])) {
$username = $_POST["username"];
$password = $_POST["password"];
$cpassword = $_POST["cpassword"];
$email = $_POST["email"];
// Hay campos en blanco
if($username==NULL|$password==NULL|$cpassword==NULL|$email==NULL) {
echo "<center>un campo está vacio.</center>";
}else{
// ¿Coinciden las contraseñas?
if($password!=$cpassword) {
echo "<center>Las contraseñas no coinciden</center>";
}else{
// Comprobamos si el nombre de usuario o la cuenta de correo ya existían
$checkuser = mysql_query("SELECT username FROM users WHERE username='$username'");
$username_exist = mysql_num_rows($checkuser);

$checkemail = mysql_query("SELECT email FROM users WHERE email='$email'");
$email_exist = mysql_num_rows($checkemail);

if ($email_exist>0|$username_exist>0) {
echo "<center>EL nombre de usuario o la cuenta de correo estan ya en uso<center>";
}else{
//Todo parece correcto procedemos con la inserccion
$query = "INSERT INTO users (username, password, email) VALUES('$username','$password','$email')";
mysql_query($query) or die(mysql_error());
echo "<center>El usuario $username ha sido registrado de manera satisfactoria.</center>";
echo "<center>Pincha en login para loguearte.</center>";
}
}
}
}
?>
<head>
<link href="images/estilo.css" rel="stylesheet" type="text/css">
<body background="images/Fondo.png">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Registro</title>
</head>

<body>
<center>
<h1>Registro panel</h1>
<form action="registro.php" method="POST">
<table style="border:1px solid #000000;">
<tr>
<td align="right">
Nombre de usuario: <input type="text" size="15" maxlength="25" name="username">
</td>
</tr>
<tr>
<td align="right">
Password: <input type="password" size="15" maxlength="25" name="password">
</td>
</tr>
<tr>
<td align="right">
Repite Password: <input type="password" size="15" maxlength="25" name="cpassword">
</td>
</tr>
<tr>
<td align="right">
Email: <input type="text" size="15" maxlength="40" name="email">
</td>
</tr>
<tr>
<td align="center">
<input type="submit" value="Registrar">
</td>
</tr>
<tr>
<td align="center">
<center><font class=\"content\">[ <a href="login.php">"Login"</a> ]</font></center>
</td>
</tr>
</table>
</form>
</center>

login.php:
<?php
// Configura los datos de tu cuenta
$dbhost='localhost';
$dbusername='nombre_usuario';
$dbuserpass='contraseña';
$dbname='nombre_base_de_datos';

session_start();

// Conectar a la base de datos
mysql_connect ($dbhost, $dbusername, $dbuserpass);
mysql_select_db($dbname) or die('Cannot select database');

if ($_POST['username']) {
//Comprobacion del envio del nombre de usuario y password
$username=$_POST['username'];
$password=$_POST['password'];

if ($password==NULL) {
echo "<center>La password no fue enviada<center>";
}else{
$query = mysql_query("SELECT username,password FROM users WHERE username = '$username'") or die(mysql_error());
$data = mysql_fetch_array($query);
if($data['password'] != $password) {
echo "<center>Login incorrecto<center>";
}else{
$query = mysql_query("SELECT username,password FROM users WHERE username = '$username'") or die(mysql_error());
$row = mysql_fetch_array($query);
$_SESSION["s_username"] = $row['username'];
header("Location: index.php");
}
}
}
?>
<html>
<link href="images/estilo.css" rel="stylesheet" type="text/css">
<body background="images/Fondo.png">

<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Login</title>
</head>

<body>
<center>
<h1>Login Usuario</h1>
<center>
<form action='login.php' method='POST'>
<table style='border:1px solid #000000;'>
<tr>
<td align='right'>
Nombre de usuario: <input type='text' size='15' maxlength='25' name='username'>
</td>
</tr>
<tr>
<td align='right'>
Password: <input type='password' size='15' maxlength='25' name='password'>
</td>
</tr>
<tr>
<td align='center'>
<input type="submit" value="Login">
<input type="reset" value="Borrar">
</td>
</tr>
<tr>
<td align='center'>
<center><font class=\"content\">[ <a href="registro.php">"Regístrate"</a> ]</font></center>
</td>
</tr>
</table>
</form>
</html>

eso es todo yo lo prove en una pagina de prueba y anda bien pero no se si se podra integrar a chevereto.
:______________________________________________________________:

espero que les guste esta pequeya colaboracion 😉
 
1. No encrypt method for password...
2. Useless script, we can't manage files, there is no advantage to be a member...
 
Status
Not open for further replies.
Back
Top