Jump to content

From windows to linux/unix server


silver32

Recommended Posts

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.
Link to comment
Share on other sites

  • 1 month later...
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
Link to comment
Share on other sites

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
[code]
<?php

$password="redarrow21345675432";

$encoded=md5($password);

echo $encoded;

?>
[/code]

echoed result
[code]
c26afe4c5e3e01fcd6929bc71e406e56
[/code]
Link to comment
Share on other sites

[code=php:0]if ($do == Login)[/code]

should be:

[code=php:0]if ($do == 'Login')[/code]


and

[code=php:0]$do = stripslashes($_REQUEST['do']);[/code]

should be:

[code=php:0]function magic_strip($value)
{
    if (get_magic_quotes_gpc())
    {
        $value = stripslashes($value);
    {
    return $value;
}

$do = magic_strip($value);
[/code]
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.