ArcEmu: Need some help with some PHP commands - ArcEmu

Jump to content

Toggle shoutbox Lastest Announcements

dfighter  : (07 December 2014 - 12:06 PM) Arcemu is in hibernation mode, please read http://arcemu.org/fo...showtopic=26903
dfighter  : (01 January 2013 - 05:56 PM) Arcemu wishes you all a happy new year!
Hasbro  : (12 September 2012 - 10:01 AM) Please excuse our outage from the web! Our web host had a major malfunction!
dfighter  : (01 September 2012 - 04:05 PM) Since the spam bots just don't want to stop, I've enabled admin verification when registering.
dfighter  : (23 January 2012 - 09:56 PM) Please note that from now on you will need to confirm your email on the wiki in order to edit it!
Hasbro  : (31 December 2011 - 12:50 PM) Happy New Years all!
Navid  : (26 December 2011 - 04:09 AM) Merry Christmas !!!!!! Happy holidays all :)
WAmadeus  : (24 December 2011 - 03:54 PM) Merry Christmas to all!
dfighter  : (24 December 2011 - 11:05 AM) The Arcemu team wishes y'all a Merry Christmukkah!
Hasbro  : (05 October 2011 - 12:53 PM) Looking for web designers for upcoming web related project. If you're interested in designing user interfaces contact me
dfighter  : (02 September 2011 - 03:47 PM) So who here wants vehicles in Arcemu? :P http://arcemu.org/fo...showtopic=25440
Hasbro  : (14 August 2011 - 03:25 PM) Join us on irc, grab an irc client and connect to irc.freenode.net join channel #arcemu /server irc.freenode.net:6667 /join #arcemu
jackpoz  : (03 August 2011 - 05:33 AM) to all Lua Engine (old one) users: please check http://arcemu.org/fo...showtopic=25274
Hasbro  : (20 May 2011 - 05:27 PM) Looking for people experienced with CMake configuration and setup! Contact me asap
Hasbro  : (15 May 2011 - 05:03 PM) ArcEmu is recruiting C++ programmers, contact Hasbro if interested.
paroxysm  : (03 May 2011 - 06:26 PM) Updated luabridge gossip example to describe the whole gossip creation process rather than just how to create menu. Gossip tutorial
paroxysm  : (23 April 2011 - 11:35 AM) Lua writers can refer to the Luabridge Tutorials section in the Wiki to learn how to write gossip code correctly.
Hasbro  : (20 April 2011 - 05:22 PM) Thank you for your continuous contribution of bug reports, we are working on them.
Hasbro  : (17 April 2011 - 03:20 AM) Please consider donating to support our bills. Donations can be sent using PayPal to donations@arcemu.org - Thank you for your support.
paroxysm  : (10 April 2011 - 12:43 AM) Refer to the Luabridge Tutorials section in the Wiki to learn the new syntax of luabridge.
Resize Shouts Area

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Need some help with some PHP commands cant figure this out

#1 User is offline   nemo 

  • Newbie
  • Group: Members
  • Posts: 3
  • Joined: 24-August 08

Posted 30 October 2009 - 06:49 AM

okay, ive made this script to work with encrypted passwords, but i cant get it to work. this is a login script..

<?php 

include 'dbc.php';


if ($_POST['doLogin']=='Login')
{
$Account = ($_POST['taccount']);
$md5_password = md5($_POST['tpassword']);

$sql = "SELECT (login, encrypted_password, gm, banned, lastlogin, lastip, email, flags, muted, reward_points, banreason) FROM accounts WHERE login = '".$Account."' AND encrypted_password = '".$md5_password."'"; 

			
$result = mysql_query($sql) or die (mysql_error());
$num = mysql_num_rows($result);

    if ( $num == 0 ) { 
	
	list($login, $encrypted_password, $gm, $banned, $lastlogin, $lastip, $email, $flags, $muted, $reward_points, $banreason) = mysql_fetch_row($result);
	
	 
  
       
	   session_start(); 
 
		$_SESSION['account_name']= $login;  
		$_SESSION['account_password'] = $encrypted_password;
		

		
	   if(isset($_POST['remember'])){
				  setcookie("account_name", $_SESSION['account_name'], time()+60*60*24*60, "/");
				  setcookie("account_password", $_SESSION['account_password'], time()+60*60*24*60, "/");
				   }
		
			
		header("Location: myaccount.php");
		}
		else
		{
		$msg = urlencode("Invalid Login. Please try again with correct account name and password. ");
		header("Location: login.php?msg=$msg");
		}
		
}
					 
					 

?>
<html>
<head>
<title>Members Login</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="JavaScript" type="text/javascript" src="js/jquery-1.3.2.min.js"></script>
<script language="JavaScript" type="text/javascript" src="js/jquery.validate.js"></script>
  <script>
  $(document).ready(function(){
    $("#logForm").validate();
  });
  </script>
<link href="styles.css" rel="stylesheet" type="text/css">

</head>

<body>
<table width="100%" border="0" cellspacing="0" cellpadding="5" class="main">
  <tr> 
    <td colspan="3">&nbsp;</td>
  </tr>
  <tr> 
    <td width="160" valign="top"><p>&nbsp;</p>
      <p>&nbsp; </p>
      <p>&nbsp;</p>
      <p>&nbsp;</p>
      <p>&nbsp;</p></td>
    <td width="732" valign="top"><p>&nbsp;</p>
      <h3 class="titlehdr">Muppets Account Login
      </h3>  
	  <p>
	  <?

      if (isset($_GET['msg'])) {
	  $msg = mysql_real_escape_string($_GET['msg']);
	  echo "<div class=\"msg\">$msg</div>";
	  }
	  
	  ?></p>
      <form action="login.php" method="post" name="logForm" id="logForm" >
        <table width="65%" border="0" cellpadding="4" cellspacing="4" class="loginform">
          <tr> 
            <td colspan="2">&nbsp;</td>
          </tr>
          <tr> 
            <td width="28%">Account Name</td>
            <td width="72%"><input name="taccount" type="text" class="required" id="txtbox" size="25"></td>
          </tr>
          <tr> 
            <td>Password</td>
            <td><input name="tpassword" type="password" class="required" id="txtbox" size="25"></td>
          </tr>
          <tr> 
            <td colspan="2"><div align="center">
                <input name="remember" type="checkbox" id="remember" value="1">
                Remember me</div></td>
          </tr>
          <tr> 
            <td colspan="2"> <div align="center"> 
                <p> 
                  <input name="doLogin" type="submit" id="doLogin3" value="Login">
                </p>
                <p></font> <a href="forgot.php">Forgot Password</a> <font color="#FF6600"> 
              </div></td>
          </tr>
        </table>
        <div align="center"></div>
        <p align="center">&nbsp; </p>
      </form>
      <p>&nbsp;</p>
	   
      </td>
    <td width="196" valign="top">&nbsp;</td>
  </tr>
  <tr> 
    <td colspan="3">&nbsp;</td>
  </tr>
</table>

</body>
</html>


it gives this messege: Operand should contain 1 column(s) please help man
0

#2 User is offline   Bob Herman 

  • Interested
  • PipPipPipPip
  • Group: Members
  • Posts: 452
  • Joined: 11-October 08
  • Gender:Male

Posted 30 October 2009 - 07:34 AM

I just looked over it quickly and I have a question. Your numrows part says: if there are no results, then set a session and do the cookie and redirect.. Is that really what you want?
0

#3 User is offline   shumi 

  • Member
  • Pip
  • Group: Members
  • Posts: 34
  • Joined: 07-June 08

Posted 04 November 2009 - 11:18 AM

and i think you need to decript the password because the user will enter his password, not the encrypted one.
0

#4 User is offline   Raven2 

  • Member
  • Pip
  • Group: Members
  • Posts: 34
  • Joined: 18-October 09
  • Gender:Male

Posted 04 November 2009 - 12:56 PM

You can try using the * instead of typing all of the fields it will grab all of the data
Posted Image
Virtual Dj Pro License Holder - Gear: x2 Dn-s 1200 and Dn-x 120 Mixxer
0

#5 User is offline   snuke 

  • Member
  • Pip
  • Group: Members
  • Posts: 71
  • Joined: 07-June 08
  • Gender:Male
  • Location:PK

Posted 30 November 2009 - 07:19 AM

i believe that the encrypted password mechanism is not md5, but rather a combination of sha1 for both username AND password, which is this:

$password = sha1(strtoupper($_POST['taccount']) . ':' . strtoupper($_POST['tpassword']);


unless there's been some changes i'm not aware of.
pro web developer available for hire! PM me
0

#6 User is offline   pingue 

  • Member
  • Pip
  • Group: Members
  • Posts: 99
  • Joined: 18-July 09
  • Gender:Male
  • Location:EARTH LULZ!
  • Interests:web designing.. grilz n titz, wow :3

Posted 25 April 2010 - 06:41 AM

You're listing $encrypted_password which is an unused variable, your encryption pw is called $md5_password.
Posted Image
0

#7 User is offline   RageD 

  • Occasional Poster
  • PipPip
  • Group: Members
  • Posts: 131
  • Joined: 11-June 08
  • Gender:Male
  • Location:Chicago, IL

Posted 02 June 2010 - 11:37 AM

snuke is right as well. It's an SHA-encryption type consisting of CAPITAL_USER:CAPITAL_PASS. Change $md5_password to $encrypted_password with proper sha format value.

-RageD
[19:00] <Lavos^> How long would 1.5 million hours last you?
[19:01] <Astaelan> 720 based on 30 days a month
[19:01] <+RageD> Nott32 depends on the month
[19:02] <Lavos^> 2083 months.
[19:02] <Lavos^> Wow.
[19:02] <+RageD> .33 repeating of course
1.5 million divided by 720 = 2 083.33333 (Repeated lolz)
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users