Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

problem with header() function running in MAMP

Status
Not open for further replies.

misslois74

Programmer
Sep 27, 2008
63
PH
i have php scripts which is running just fine in WAMP but my client is using MAMP when i tried executing its not redirecting to the correct page i cant really figure out what is the problem here is my sample code:

Code:
include "connection_dbase_settings.php";
        
                $user_name = $_POST[user];
                $pass_word = $_POST[pass];
                            
                $quer = "Select * from tbl_users where username='$user_name' and password='$pass_word'";
                $result1 = mysql_query($quer);
                $row = mysql_fetch_array($result1);
                $user_id = $row[userid];
                $level = $row[user_level];
                $user_area = $row[area];
                $user_fullname = $row[name];
                $center = $row[center_name];
                
                $num = mysql_num_rows($result1);
                
                    if(($num != 0) && ($level == 'Coordinator'))
                    {
                        session_start();
                        $_SESSION['id']=$row[userid];
                        $_SESSION['ucentername']=$center;
                        $_SESSION['uarea']=$user_area;
                        $_SESSION['ufullname']=$user_fullname;
                        header("Location: [URL unfurl="true"]http://localhost/Feeding/menu_guest.php");[/URL]
                    }
                    
                    elseif(($num != 0) && ($level == 'Administrator'))
                    {
                        session_start();
                        $_SESSION['id']=$row[userid];
                        $_SESSION['ucentername']=$center;
                        $_SESSION['uarea']=$user_area;
                        $_SESSION['ufullname']=$user_fullname;
                        header("Location: [URL unfurl="true"]http://localhost/Feeding/menu_admin.php");[/URL]
                    }
                    else
                    {
                        header("Location: [URL unfurl="true"]http://localhost/Feeding/error_login.php");[/URL]
                    }

im using this URL: whenever im running the page after loggin in the page is blank and all I can see is just the text LOG IN, it seems that its not really redirecting what could be the problem with these.....
 
don't you think that these lines
Code:
 header("Location: [URL unfurl="true"]http://localhost/Feeding/menu_admin.php");[/URL]
                    }
                    else
                    {
                        header("Location: [URL unfurl="true"]http://localhost/Feeding/error_login.php");[/URL]
                    }

should be
Code:
 header("Location: [URL unfurl="true"]http://localhost[/URL][red]:8888[/red]/Feeding/menu_admin.php");
                    }
                    else
                    {
                        header("Location: [URL unfurl="true"]http://localhost[/URL][red]:8888[/red]/Feeding/error_login.php");
                    }
 
oppssss.... sorry i wasnt able to correct this but i did my modification already on the client side which has the MAMP but still not working its my first time actually to work on MAMP what settings or configuration needs to be done... i already feel helpless...
 
if simply correcting the port/address does not fix the problem then you are probably doing something else wrong. Most likely you are outputting SOMETHING (even a space) to the browser before the header() function is called.

use this as the first piece of code in your script and report back the errors.
Code:
ini_set('display_errors', true);
ini_set('display_startup_errors', true);
error_reporting (E_ALL);

remember to enquote your array keys.
 
im just wondering if it has something to do with the browser since my client is using Safari running in a Mac OS because when i run the script exactly as it is in the IE or Mozilla i didnt encounter any problem... of course i didnt specify the port...
 
WAMP = windows apache....
LAMP = linux apache ...
MAMP = ? apache ...
Never seem this before, is it a type of Linux ?
If you ran on Solaris would it be SAMP or the more general UAMP (U for Unix)
 
MAMP = Macintosh, Apache, Mysql, Php
i hope anybody here has MAC and have tried using MAMP...
 
if you don't specify the port then you are not addressing the MAMP installation. MAMP, by default, only listens on port 8888


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top