Jump to content

silver32

New Members
  • Posts

    8
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

silver32's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. [quote author=king arthur link=topic=101982.msg406794#msg406794 date=1154381598] You are certain the cookie is set on the client machine? [/quote]Just realised that that's my actual problem. [code]<? setcookie("name", "Admin"); setcookie("pass", "Darn"); ?>[/code] This works fine but the code below doesn't, any ideas why? [code]<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>Login to your VirtualMU Account.</title> <meta http-equiv="Content-Type" content="text/html; charset=windows-1253"> <meta name="description" content="Login to your virtualMU Account"> <meta name="keywords" content="VirtualMU,online,game,MMOG,MMORPG,Role-playing,Login,MU"> <meta name="author" content="SiLvER"> <LINK REL="StyleSheet" HREF="Style.css" TYPE="text/css"> </head> <? include("Config.php"); $random = mt_rand(1000, 9999); if ($_COOKIE['pass'] == NULL) { ?> <table width="100" border="0" cellpadding="0" cellspacing="0"> <tr> <td> <TABLE width="200" border="0" dwcopytype="CopyTableRow"> <tbody> <form action="Login.php?do=Login" method="post"> <tr> <td valign="top">Login:</td> <td><input type="text" name="name" maxLength=10> </td> </tr> <tr> <td valign="top">Password:</td> <td><input type="password" name="pass" maxLength=10> </td> </tr> <tr> <td valign="top">Code:</td> <td><input type="hidden" name="extcode" id="extcode" value="<? print("$random"); ?>"> <input name="na" id="na" style="width:35 " size="11" value="<? print("$random"); ?>" READONLY> </td> </tr> <tr> <td valign="top">Confirm:</td> <td><input name="extcode1" class="lanyu" id="extcode1" style="width:35 " size="11" maxlength="6"> </td> </tr> <tr> <td valign="top"><input type="submit" value="Go!"></td> </form> </table> </font> </td> </table> </div> <? } elseif (!$_COOKIE['pass'] == NULL) { die("<a href=Logout.php>Log out</a>"); } include("Config.php"); include("System/Included/md5.php"); include("System/Included/Banned.php"); include("System/Included/Functions.php"); $do = stripslashes($_REQUEST['do']); if ($do == Login) { $name = $_POST["name"]; $pass = $_POST["pass"]; //include_once('sql_check.php'); //check_inject(); if ((eregi("[^a-zA-Z0-9_-]", $name)) || (eregi("[^a-zA-Z0-9_-]", $pass)) ) { die("SQL Injection Detected, make sure to ONLY use letters and numbers!"); } $sql_username_check = mysql_query("SELECT Login FROM `account` WHERE Login='$name'"); $username_check = mysql_num_rows($sql_username_check); $sql_pass = mysql_query("SELECT Password FROM `account` WHERE Login='$name'"); $enc_pass = mysql_fetch_row($sql_pass); $dec_pass = md5_decrypt( $enc_pass[0], "password" ); if (empty($name) || empty($pass) ) { echo "Some fields were left blank.<br>"; } if (!$username_check > 0) { die("The Login ID you entered doesn't exist.<br>"); } if (!$extcode == $extcode1) { die("The code you entered doesn't match with the original."); } if (!$pass == $dec_pass) { die("Invalid password specified.<br>"); } setcookie("name", $name); setcookie("pass", md5_encrypt( $pass, "password" )); echo '<meta http-equiv="refresh" content="0; url=SelectChar.php">'; } ?> </html>[/code]
  2. *bump* I am forcing huge incompatibility with hosting services problems because of this.
  3. you forgot to set senders e-mail, should be $result=mail('terry.richter@virgin.net', 'My Subject', $message, "From: You<you@you.com>" );
  4. $xpfornext = 4000 $Level[7] =  2000 [code]$per = $xpfornext - $Level[7] / $xpfornext * 100;[/code] I always get a 3999.5 but I must be gettting 50, what's the problem and can you suggest any easier/other ways to calculate the percentage.
  5. nothing, tho I might start using sessions
  6. I have been using a server with php 4.4.1 and my script worked fine untill I had to move to another one with ver 5.1.4. [code] $Account = $_COOKIE['name']; $Pass = $_COOKIE['pass']; if ($Account == NULL || $Pass == NULL) { die("You must logged in to select a character. If you think you are logged in please<br>allow cookies and try again."); } [/code] as mentioned it worked fine on 4.4.1, now in 5.1.4 it doesnt work, I always get the die message. any ideas, isset will work? I think I have tested isset but didnt work either, dont remember.
  7. Thanks, havent thought to check the table names :P thanks a lot
  8. Maybe this is most likely related to mysql than php, if mods think so please move it. Ok, I gave much effort to develop this browser based game, I Developed it and tested in my PC server running PHP & mysql with windows but after uploading the files to a linux/unix server I got a serious problem. The code below is for a login form, in my windows pc server everything worked fine when I entered a valid login name and password that actually existed in the mysql database. When I decided to launch the game I uploaded the script in various server but I always have the same problem, I dont know if it is the configuration of the server or the OS or something. I always get a login ID doesnt exist error, but it DOES. As I mentioned no such error on my server with the same script. Can someone carefully check the code and detect any problems with it? If you believe the answer is not here please reply with request for more information. [code]include("Config.php"); include("System/Included/md5.php"); $do = stripslashes($_REQUEST['do']); if ($do == Login) { $name = $_POST["name"]; $pass = $_POST["pass"]; include_once('sql_check.php'); check_inject(); if ((eregi("[^a-zA-Z0-9_-]", $name)) || (eregi("[^a-zA-Z0-9_-]", $pass)) ) { die("SQL Injection Detected. Make sure to ONLY use letters (a-Z) and numbers (0-9)!"); } $sql_username_check = mysql_query("SELECT Login FROM Account WHERE Login='$name'"); $username_check = mysql_fetch_row($sql_username_check); $sql_pass = mysql_query("SELECT Password from `Account` Where Login='$name'"); $enc_pass = mysql_fetch_row($sql_pass); $dec_pass = md5_decrypt( $enc_pass[0], "*****" ); $cookie_pass = md5_encrypt( $pass, "*****" ); if (empty($name) || empty($pass) ) { echo "Some fields were left blank.<br>"; } if ($username_check[0] == NULL){ die("The Login ID you entered doesn't exist.<br>"); } if ($extcode != $extcode1) { die("The code you entered doesn't match with the original."); } if ($pass == $dec_pass){ setcookie("name", $name); setcookie("pass", $cookie_pass); echo '<meta http-equiv="refresh" content="0; url=SelectChar.php">'; }[/code] Thanks in advance.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.