Menú

Mostrar Mensajes

Esta sección te permite ver todos los mensajes escritos por este usuario. Ten en cuenta que sólo puedes ver los mensajes escritos en zonas a las que tienes acceso en este momento.

Mostrar Mensajes Menú

Temas - matute2004

#1
PHP / Escriptar contraseña MD5
27 Febrero 2010, 05:15 AM
hola como les va, soy nuevo quiero saber si me pueden ayudar con esto:

Yo ya escripte la contraseña en el registro me fije si funciona desde el mysql y funciono.

ahora tengo un problema me falta agregar "md5(" al login y no logro hacerlo, ustedes me pueden ayudar?.
Gracias.
<? session_start();
include("functions.php");
if($login == 'yes')
{
session_destroy();
session_start();
$_SESSION['username'] = $username;
$_SESSION['password'] = $password;
}

top();

//IF THERE IS NO USERNAME FROM A FORM CHECK IF ITS IN THE SESSION
if($username == $admin_username & $password == $admin_password)
{
$_SESSION['username'] = $username;
$_SESSION['password'] = $password;
?> <font size="2" face="Arial, Helvetica, sans-serif">Hi <? echo $admin_firstname; ?>! Now loading administration
applications...
</font>
<script language="javascript">
location="admin.php";
</script>
<?
bottom();
die();
}

//SCAN USERS AND PASSWORDS
$link=mysql_connect ($admin_hostname, $admin_mysqluser, $admin_db_pass) or die ('I cannot connect to the database because: ' . mysql_error());
mysql_select_db ($admin_database, $link) or die("Error selecting database. Server may be down try again in a few minutes.");
$query = "SELECT * FROM client_list WHERE username = '$username'";
$result = mysql_query($query) or die("Query failed : " . mysql_error());
$line = mysql_fetch_array($result);
if($line['username'])
{
if($password != $line['password'])
{
echo "Incorrect password for <font color=#660000>" . $line['username'] . "</font>.";
$_SESSION['username'] = "";
$_SESSION['password'] = "";
session_unset();
session_destroy();
?>
<script language="javascript" type="text/javascript">
<!--



function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
//-->
</script>
<body>
<form action="login.php" method="post">
<input type="hidden" name="login" value="yes">
  <br>
  <table width="631" border="0" cellpadding="2" cellspacing="0" bgcolor="#FFFFFF">
  <tr bgcolor="#33CCFF">
      <td width="623" bgcolor="#000000"><font color="#FFFFFF" size="2" face="Arial, Helvetica, sans-serif"><strong>Client
        Login</strong></font></td>
  </tr>
  <tr bgcolor="#33CCFF">
    <td bgcolor="#FFFFFF"><font size="2" face="Arial, Helvetica, sans-serif">Username:
        <input name="username" type="text" id="username" size="23">
      &nbsp;&nbsp; Password:
        <input name="password" type="password" id="password" size="23">
      &nbsp;&nbsp;
      <input name="Log In" type="submit" id="Log In2" value="Log In">
      </font><font size="2" face="Arial, Helvetica, sans-serif">&nbsp; </font></td>
  </tr>
  <tr>
    <td width="center" align="center"><font size="1" color="#000066" face="Arial, Helvetica, sans-serif">Forgot
      your password?</font><font size="1" color="#FF0000" face="Arial, Helvetica, sans-serif">
      <a href="forgot.php">Click Here</a></font></td>
  </tr>
</table>
</form>
<?
bottom();
die();
}
} else {

echo "The username '<font color=#660000>$username</font>' was not found in clients.<br>Please contact us for a username.";
$_SESSION['username'] = "";
$_SESSION['password'] = "";
session_unset();
session_destroy();
?>
<form action="login.php" method="post">
<input type="hidden" name="login" value="yes">
  <br>
  <table width="631" border="0" cellpadding="2" cellspacing="0" bgcolor="#FFFFFF">
  <tr bgcolor="#33CCFF">
      <td width="623" bgcolor="#000000"><font color="#FFFFFF" size="2" face="Arial, Helvetica, sans-serif"><strong>Client
        Login</strong></font></td>
  </tr>
  <tr bgcolor="#33CCFF">
    <td bgcolor="#FFFFFF"><font size="2" face="Arial, Helvetica, sans-serif">Username:
        <input name="username" type="text" id="username" size="23">
      &nbsp;&nbsp; Password:
        <input name="password" type="password" id="password" size="23">
      &nbsp;&nbsp;
      <input name="Log In" type="submit" id="Log In2" value="Log In">
      </font><font size="2" face="Arial, Helvetica, sans-serif">&nbsp; </font></td>
  </tr>
  <tr>
    <td width="center" align="center"><font size="1" color="#000066" face="Arial, Helvetica, sans-serif">Forgot
      your password?</font><font size="1" color="#FF0000" face="Arial, Helvetica, sans-serif">
      <a href="forgot.php">Click Here</a></font></td>
  </tr>
</table>
</form>
<?
bottom();
die();
}
$_SESSION['username'] = $line['username'];
$_SESSION['password'] = $line['password'];



?>
<div align="left">
  <table width="660" border="0" cellspacing="0" cellpadding="0">
    <tr>
      <td width="456"><img src="<? if($admin_subdomain=="no"){ echo "/admin"; } ?>/couchsm.jpg" width="216" height="101"><br>        <div align="left"><strong><font color="#000000" face="Arial, Helvetica, sans-serif"><? echo $admin_company; ?>
        -
              Client Lounge</font></strong><font color="#000000"><br>
          <strong><font size="2" face="Arial, Helvetica, sans-serif"><i><? echo $line['company_name']; if($line['company_name'] == "") { echo $line['first_name'] . " " . $line['last_name']; } ?></i></font></strong><font face="Arial, Helvetica, sans-serif"><font size="1" face="Arial, Helvetica, sans-serif">&nbsp;| <a style="color:black;" href="logout.php">Log
          Out</a> </font><br>
        </font></font></div>
      </td>
      <td width="204" align="right"><img src="images/logo.png" width="256" height="119"></td>
    </tr>
  </table>
  <br>
  <font color="#003399" size="2" face="Arial, Helvetica, sans-serif"><b>Hi <? echo $line['first_name']; ?>!
  | <a href="invoices.php" style="color:blue"><font size="3">View All Invoices</font></a></b></font><br>
    <br>
<?
$today = date('Y-m-d');
$query2 = 'SELECT * FROM `client_invoices` WHERE 1 AND `date_due` < \'' . $today . '\'  AND `paid` = \'due\'  AND `username` = \'' . $username . '\' LIMIT 0, 30';
//echo $query2;
$result2 = mysql_query($query2) or die("Query failed : " . mysql_error());
$line2 = mysql_fetch_array($result2);
if($line2)
{
echo "<font face='Arial, Helvetica, sans-serif' color='red' size='2'>You have overdue invoices that have not been paid.</font><br><br>";
}
?>
<?
$query2 = 'SELECT * FROM `client_list` WHERE 1 AND `username` = \'' . $username . '\'';
//echo $query2;
$result2 = mysql_query($query2) or die("Query failed : " . mysql_error());
$line2 = mysql_fetch_array($result2);
if($line2['note'])
{
echo "<font face='Arial, Helvetica, sans-serif' size='2' color='#003399'><b>You have a message:</b><br>" . str_replace("\n", "<br>", $line2['note']) . "</font><br><br>";
}
?>
  <?
bottom();
?>
        </font></div>