Raised This Month: $51 Target: $400
 12% 

MySql, base 64 bits and PHP


Post New Thread Closed Thread   
 
Thread Tools Display Modes
Author Message
nike!
Senior Member
Join Date: May 2009
Location: Melmac
Old 10-03-2010 , 21:14   MySql, base 64 bits and PHP
#1

Hi, I was wondering if anyone knows how to make a login menu with 'DB' in MySql and PHP encode in base 64.

PS: Sorry for my basic English


[ES]
https://forums.alliedmods.net/showthread.php?t=139677

PHP Code:
<?php
$dbhost
="localhost";
$dbuser="my_user";
$dbpass="my_pass";
$db="my_users";
mysql_connect("$dbhost","$dbuser","$dbpass");
mysql_select_db("$db");
?>
->
<form action="registrar.php" method="POST">
Usuario:<br>
<input type="text" name="user" id="user"><br>
Password:<br>
<input type="password" name="passwd" id="passwd"><br>
Repetir Password:<br>
<input type="password" name="passwd2" id="passwd2">
<input type="submit" value="Registrar" id="submit">
->
<?php
include('config.php');
if ((
$_POST['user']== '') or ($_POST['passwd']== '') or ($_POST['passwd2']== '')){
echo 
"Te faltaron rellenar campos";
}else{
if(
$_POST['passwd'] != $_POST['passwd2']){
echo 
"Las contrasenas no coinciden";
}else{
$user stripslashes($_POST["user"]);
$user strip_tags($user);
$pass stripslashes($_POST["passwd"]);
$pass strip_tags($pass);
/* _____________________________________ */
$pass_encriptada1 md5 ($pass);
$pass_encriptada2 crc32($pass_encriptada1);
$pass_encriptada3 crypt($pass_encriptada2"nike");
$pass_encriptada4 sha1("nike".$pass_encriptada3);
$usuarios mysql_query("SELECT usuarios FROM cuentas WHERE usuarios='$user' ");
if(
$usuarios2 mysql_fetch_array($usuarios))
{
echo 
'El usuario '.$user.' ya esta registrado';
mysql_free_result($usuarios);
// liberacion de memoria
}else{
mysql_query("INSERT INTO cuentas (usuarios,pass) values ('$user','$pass')");
echo 
"El usuario '.$user.' ha sido registrado con éxito.';
}
}
}
?>
And now the x HTML
HTML Code:
<form action="logear.php" method="POST">
 User:<br>
 <input type="text" name="user" id="pass"><br>
 Pass:<br>
 <input type="password" name="pass" id="pass"><br>
 <input type="submit" value="Logear" id="submit">
PHP Code:
<?php
include('config.php'); 
if( (
$_POST["user"] == '') or ($_POST["pass"] == '') )
{
echo 
"Necesitas introducir datos de logeo";
}else{
$user $_POST['user'];
$pass $_POST['pass'];
$pass_encriptada1 md5 ($pass);
$pass_encriptada2 crc32($pass_encriptada1);
$pass_encriptada3 crypt($pass_encriptada2"nike");
$pass_encriptada4 sha1("nike".$pass_encriptada3);
$usuarios mysql_query("SELECT * FROM cuentas WHERE usuarios='$user' and pass='$pass_encriptada4'");
if(
$usuarios2 mysql_fetch_array($usuarios))
{
session_register("login"); 
session_register("user");
$_SESSION['login'] = "SI";
$_SESSION['user'] = $usuarios2["usuarios"];
echo 
'<script language="JavaScript" type="text/javascript">
alert("Bienvenido.");
</script>'
;
echo 
"<meta http-equiv='Refresh' content='2;url=index.php'>";
}else{
echo 
'Username y Password incorrecto.';
}
}
}
?>
If you are logged Content:
PHP Code:

<?php
if ($_SESSION['login'] = "SI"){
echo 
"Hola: ".$_SESSION['user'];
}else{
echo 
"Esta seccion es prohibida";
}
?>
help is appreciated. Greetings
__________________
nike"
nike! is offline
Send a message via MSN to nike!
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 10-03-2010 , 21:59   Re: MySql, base 64 bits and PHP
#2

Scripting Help is for AMX Mod X plugins only.
__________________
fysiks is offline
Closed Thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 07:00.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode