login not working

Discussion in 'PHP' started by asterix, Aug 30, 2007.

  1. #1
    hii , i have this custom made php script seems to be not letting me in ( login ) , it seems to work fine on other server though. wondering what could be wrong ??
    it has php 5 (@ mediatemple ) . db config is all fine .

    this is the login code ####

    <?php
    session_start();
    if(empty($action))
    {
    ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    
    	<head>
    		<meta http-equiv="content-type" content="text/html;charset=iso-8859-1"/>
    		<title>Login</title>
    
    <link href="style.css" rel="stylesheet" type="text/css">
    </head>
    
    	<body bgcolor="#ffffff">
    		<div id="header">
    			<h1><a href="#">blah</a></h1>
    			<ul id="menu">
    				<li><a href="index.php">Home</a></li>
    				<li><a href="login.php">Projects</a></li>
    				<li><a href="logout.php">Logout</a></li>
    			</ul>
    		</div>
    
    	<div  id="loginbox" align=center>
                <table width="400" align=center border="0" cellpadding="0" cellspacing="0" >
            
              <tr>
                <td colspan="2"  valign=top id="logintop"><font color=white>Login</font></td>
              </tr>
              <tr>
                <td colspan="2" >&nbsp;</td>
              </tr>
              <form action="login.php"  method="post">
              <input type="hidden" name="action" value="check">
              <input type="hidden" name="id" value="<?php echo $id; ?>">
              <tr>
                <td width="137" align="left"><b>&nbsp;E-mail:</b></td>
                <td width="263"><input name="email" type="text" size =35></td>
              </tr>
    			  <tr>
                <td width="137" align="left">&nbsp;</td>
                <td width="263">&nbsp;</td>
              </tr>
              <tr>
                <td align="left"><b>&nbsp;Password: </b></td>
                <td><input name="password" type="password" size=35></td>
              </tr>
              <tr>
                <td colspan="2">&nbsp;</td>
              </tr>
              <tr>
                <td colspan="2" align="right">&nbsp;
                </td>
              </tr>
              <tr>
                <td colspan="2">&nbsp;</td>
              </tr>
              <tr>
                <td colspan="2" align="right">
                  <input type="image"  src="images/login_07.jpg" >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
                </tr>
              <tr>
                <td colspan="2" align="right">&nbsp;</td>
              </tr>
              <tr>
                <td align="left">&nbsp;</td>
                <td align="right"><input name="rememberme" type="checkbox" value="1">
                  Remember me &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
    				
              </tr>
    			</form>
              <tr>
                <td colspan="2" align=left>&nbsp;</td>
              </tr>
            </table>
           
    </div>
    
    <? include("footer.php");
    }
    else
    {
    include("db.php");
    $lekerdez = mysql_query("select * from project_users where email='$email' and password='$password'");
    if(mysql_num_rows($lekerdez) > 0)
    {
    $sor = mysql_fetch_array($lekerdez);
    $_SESSION["uid"] =  $sor["id"];
    $_SESSION["gid"] =  $sor["group_id"];
    $_SESSION["level"] =  $sor["level"];
    }
    mysql_free_result($lekerdez);
    mysql_close($link);
    if(empty($id))
    {
    Header("Location: index.php");
    }
    else
    {
    Header("Location: job_details.php?id=$id");
    }
    }
    ?>
    PHP:
     
    asterix, Aug 30, 2007 IP
  2. asterix

    asterix Well-Known Member

    Messages:
    1,095
    Likes Received:
    97
    Best Answers:
    0
    Trophy Points:
    165
    #2
    ok i figured out the solution ( i hope) it was a issue with PHP Sessions , going to try it now

    configuring a directive inside of a custom php.ini file to explicitly direct session files to save in a local directory on your (gs) Grid-Service instead of the default global '/tmp' folder.

    This directive must be placed inside of your php.ini file on the very last line of the file:

    session.save_path = /home/####/data/tmp

    Where '####' is your actual site number.

    so, for s1234.gridserver.com, you would use the following:

    session.save_path = /home/1234/data/tmp
     
    asterix, Aug 30, 2007 IP
  3. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #3
    It's probably a register_globals issue.

    Replace
    
    empty($action)
    
    PHP:
    With
    
    empty($_REQUEST['action'])
    
    PHP:
    And $email with $_POST['email'], and $password with $_POST['password'], and $id with $_REQUEST['id'].


    www.php.net/register_globals
     
    nico_swd, Aug 31, 2007 IP