Jump to content


Photo

From windows to linux/unix server


  • Please log in to reply
5 replies to this topic

#1 silver32

silver32
  • New Members
  • Pip
  • Newbie
  • 8 posts

Posted 20 July 2006 - 07:03 PM

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.

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">';
}

Thanks in advance.

#2 ChaosXero

ChaosXero
  • Members
  • PipPipPip
  • Advanced Member
  • 80 posts

Posted 20 July 2006 - 07:08 PM

add an or die(mysql_error()) to your mysql lines and see if it's reaching the database or not.  Make sure your database info is all the same including server name/ip etc... and that the tables are exactly the same too.

#3 silver32

silver32
  • New Members
  • Pip
  • Newbie
  • 8 posts

Posted 20 July 2006 - 07:28 PM

Thanks, havent thought to check the table names :P thanks a lot

#4 nesargha

nesargha
  • New Members
  • Pip
  • Newbie
  • 4 posts

Posted 08 September 2006 - 07:36 AM

hi,
i wanted to know how to use the "md5_encrypt and md5_decrypt" which u are using in login form code. is there any class or include file by including which we can use the above function. sorry if am barging into the topic. i just wanted to know how can i encrypt and decrypt a string.

nesargha

#5 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 08 September 2006 - 07:44 AM

md5 is a one way street and can not be decoded and used for passwords mainly but also can be used for other things ok.

example
<?php

$password="redarrow21345675432";

$encoded=md5($password);

echo $encoded;

?>

echoed result
c26afe4c5e3e01fcd6929bc71e406e56

Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc

#6 Jenk

Jenk
  • Members
  • PipPipPip
  • Advanced Member
  • 778 posts

Posted 08 September 2006 - 09:15 AM

if ($do == Login)

should be:

if ($do == 'Login')


and

$do = stripslashes($_REQUEST['do']);


should be:

function magic_strip($value)
{
    if (get_magic_quotes_gpc())
    {
        $value = stripslashes($value);
    {
    return $value;
}

$do = magic_strip($value);





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users