473,394 Members | 1,960 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

PHP header not working

I have this code:

Expand|Select|Wrap|Line Numbers
  1.     <?php
  2.     // *** Validate request to login to this site.
  3.     if (!isset($_SESSION)) {
  4.       session_start();
  5.     }
  6.  
  7.     $loginFormAction = $_SERVER['PHP_SELF'];
  8.     if (isset($_GET['accesscheck'])) {
  9.       $_SESSION['PrevUrl'] = "index.html";
  10.     }
  11.     // Declaring variables
  12.     if (isset($_POST['correo'])) {
  13.       $loginUsername=$_POST['correo'];
  14.       $password=$_POST['clave'];
  15.       $MM_fldUserAuthorization = "";
  16.       $MM_redirectLoginSuccess = "index.html";
  17.       $MM_redirectLoginFailed = "entrar.php";
  18.       $MM_redirecttoReferrer = false;
  19.       mysql_select_db($database_slotcitymx, $slotcitymx);
  20.       //Checking if teh user is in the database
  21.       $LoginRS__query=sprintf("SELECT sj_correo, sj_clave FROM sc_jugador WHERE sj_correo=%s AND sj_clave=%s",
  22.         GetSQLValueString($loginUsername, "text"), GetSQLValueString($password, "text")); 
  23.  
  24.       $LoginRS = mysql_query($LoginRS__query, $slotcitymx) or die(mysql_error());
  25.       $loginFoundUser = mysql_num_rows($LoginRS);
  26.       if ($loginFoundUser) {
  27.          $loginStrGroup = "";
  28.  
  29.         //declare two session variables and assign them
  30.         $_SESSION['MM_Username'] = $loginUsername;
  31.         $_SESSION['MM_UserGroup'] = $loginStrGroup;          
  32.  
  33.         if (isset($_SESSION['PrevUrl']) && false) {
  34.           $MM_redirectLoginSuccess = $_SESSION['PrevUrl'];    
  35.         }
  36.         header("Location: " . $MM_redirectLoginSuccess );
  37.       }
  38.       else {
  39.         header("Location: ". $MM_redirectLoginFailed );
  40.       }
  41.     }
  42.     ?>
When I run it from dreamweaver it works fine but if I call this page from my main page it doesn't do anything. Any idea why? Thank you
Aug 21 '12 #1
1 1593
Dormilich
8,658 Expert Mod 8TB
I’d say line #3. $_SESSION is available after you call session_start().

and if you don’t submit the form there shouldn’t happen anything either.
Aug 21 '12 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

18
by: Frank Thorstens | last post by:
Hi, i try to give my script headers so the output text would be downloaded in the client's browser and not displayed. But it doesn't work at all in my IE 6 and Opera. <?...
11
by: pinbot | last post by:
As far as I know, http headers should not work after content has been written. This is how my production box is working, but for some reason on my dev box I was getting away with a location header...
1
by: batista | last post by:
Hi there, I'm developing a website that is in 2 languages english and arabic. Now I wanted to have fixed header scrollable datagrid. For scrolling i found a solution which works fine. But for...
0
by: batista | last post by:
Hi there, I'm developing a website that is in 2 languages english and arabic. Now I wanted to have fixed header scrollable datagrid. For scrolling i found a solution which works fine. But...
25
by: cmd | last post by:
Hi all, I wanted to rule out other possibilities before suggesting a memory upgrade for a user who owns a Dell Inspiron 6000 laptop with 512 MB of ram. I have a report based on a parameters...
2
by: Petri Savolainen | last post by:
Hello, Is there a way to get at the "Received" header(s) or is there something in imaplib or imap server implementations that hides these? If not, what IMAP FETCH command should be used? I've...
6
by: backups2007 | last post by:
Here's my code. For some reason, it's not working. Please help... Thank you. <? $so_no=$_POST; //customer type $ctype=$_POST; //customer info $cust_id=$_POST; $walkin_id=$_POST;
5
AnuSumesh
by: AnuSumesh | last post by:
Hi All, I am using <asp:Gridview> to display my data. I am adding columns and rows dynamically. I am facing following issues: 1. I want scrollbars around the gridview and for this purpose i...
2
by: urbanedge | last post by:
I've uploaded a site to a new server and now the headers in the mail function are not working to send the required email response. This is a newly acquired site and my php knowledge is at the...
14
by: freefony | last post by:
please help me with this <?php $sc=$_POST; $name=$_POST; $emp=$_POST; include("conn.php"); $qry="select employer from corper"; $rst=mysql_query($qry) or die(mysql_error()); <select...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.