Re: sessions no longer work

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



blackwater dev wrote:
> Hello,
> 
> I have a site that was coded a while ago.  I was just told that the admin
> side no longer works.  I looked and the host recently put php 4.4.2 on the
> site.  I have tried a few things but nothing seems to work.  The problem is
> once you log in the admin page always kicks you back, doesn't see the
> session vars.  What could be wrong?  Here is the code:
> 
> <?php  require_once('Connections/db.php'); ?>
> <? if (isset($_POST["uname"])){
>     $uname=$_POST["uname"];
>     $pword=md5($_POST["pword"]);
>      $SQL="select * from users where admin=1 and pword='$pword' and
> uname='$uname'";
>     mysql_select_db($database, $wards);
>    $Result1 = mysql_query($SQL, $wards) or die(mysql_error());
>    $affected_rows = mysql_num_rows($Result1);
>     if ($affected_rows>0){
>     session_start();
>          $_SESSION['wardadmin']="yes";

try this here:

session_write_close();

>          header("location: admin.php");
>          }
>    else {$bad="Incorrect username and Password";}
> }
> 
> I can echo out the session here and see yes, but I have this code in
> admin.php
> 
> <?
> session_start();
> if ($_SESSION['wardadmin']!="yes") { header("location: login.php");
> exit;
> }
> ?>
> 
> Thanks!
> 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux