473,385 Members | 1,707 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,385 software developers and data experts.

php code working on localhost but not working online

my login php script is working on my localhost(OS:ubuntu)

but when i put it online its not working.

php code for login script:

Expand|Select|Wrap|Line Numbers
  1. <?php
  2. include('config.php');  //including configuration file
  3. session_start();   //starting session
  4. if($_SERVER["REQUEST_METHOD"]=="POST")
  5. {
  6. $myusername=addslashes($_POST['user_name']);  //getting username from form
  7. $mypassword=addslashes($_POST['pass_word']);  //gettting password  from form 
  8. $mypassword=md5($mypassword);   hashing password with md5
  9. $sql="select id from userinformation2 WHERE username='$myusername' and password='$mypassword' ";  //getting id from database of user
  10. $result=mysql_query($sql);
  11. $row=mysql_fetch_array($result);
  12. $active=$row['active'];
  13. $count=mysql_num_rows($result);
  14. if($count==1)   //checking if user is present or not
  15. {
  16. session_register("myusername");  if user is present then register session
  17. $_SESSION['login_user']=$myusername;  set login user a current user using global array
  18. header("location:welcome.php");   moving it to welcome page 
  19. }
  20. else
  21. {
  22. $error="name and password is invalid";
  23. echo $error;
  24. }
  25. }
  26. ?>
May 31 '12 #1
8 2994
Dormilich
8,658 Expert Mod 8TB
if it’s not working there must be error messages (might be in the error.log).
Jun 1 '12 #2
no error is presented in error.log file regarding this script.....
i think session isn't working .....
Jun 1 '12 #3
when i put error_reporting(E_ALL);
ini_set('display_errors', 'On');

function on my script it shows me the warning that why its not working

Warning: Unknown: Your script possibly relies on a session side-effect which existed until PHP 4.2.3. Please be advised that the session extension does not consider global variables as a source of data, unless register_globals is enabled. You can disable this functionality and this warning by setting session.bug_compat_42 or session.bug_compat_warn to off, respectively in Unknown on line 0
Jun 1 '12 #4
Dormilich
8,658 Expert Mod 8TB
do the following:

You can disable this functionality and this warning by setting session.bug_compat_42 or session.bug_compat_warn to off,
Jun 1 '12 #5
yeah
i am using
ini_set('session.bug_compat_warn', 0);
ini_set('session.bug_compat_42', 0);

now its not giving warning but not redirecting the page welcome.php
see the code
header('location:welcome.php);
Jun 1 '12 #6
Dormilich
8,658 Expert Mod 8TB
Expand|Select|Wrap|Line Numbers
  1. include "welcome.php";
since you don’t have output (at least I hope you don’t have), there is no benefit in a redirect.
Jun 1 '12 #7
@Dormilich

thnx for replies frd
but i have a lot ouputs in welcome.php

so i need to redirect the page to welcome.php
Jun 1 '12 #8
Dormilich
8,658 Expert Mod 8TB
I don’t understand. to display welcome.php you need output. whether you do that directly or via a separate HTTP request doesn’t matter.
Jun 1 '12 #9

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

Similar topics

3
by: Lenn | last post by:
Hello, I have the following example of AsyncCallback from a C# book which I wanted to implement in my project: //Class with AsyncDelegate public class AsyncProcess { public AsyncProcess() {
4
by: jason | last post by:
i am writing some simple web forms with VB.NET as the code-behind language. the code-behind files import a C# class library namespace from a .dll which is in the references list. however,...
4
by: candexis | last post by:
Hi!!!!!!! could you please tell me why this code in not working properly, the thing is that when I read one string after another, the second one is not read, and I don't know why, I am using...
2
by: geevaa | last post by:
Hi group, can anyone guide me with the link where i can find free (javascript) code for online editor like fck editor thanks
31
by: ajos | last post by:
hi frnds, i have a form,which has 2 input text boxes, the values are entering the text boxes,when i leave the 2 text boxes blank and hit submit a java script gives the message that the 2 fields are...
3
by: Mohd Baseerul Mubeen | last post by:
Hey! I am a beginner Can anybody help me with the code behind for working with responsexml
0
by: George2 | last post by:
Hello everyone, From the definition of working set, it is a subset of virtual pages resident in physical memory -- from book Windows Internals. It means working set could not be larger than...
7
by: quincy451 | last post by:
drop table . CREATE TABLE . ( NULL , (16) COLLATE SQL_Latin1_General_CP1_CI_AS NULL , NULL , NULL , (16) COLLATE SQL_Latin1_General_CP1_CI_AS NULL , (16) COLLATE
11
by: wassimdaccache | last post by:
Dear friends I am working on access 2007 sp2. I do have a database(accdb) i converted it to accde. While I am opening the converted database the VBA code is not working. For example...
2
blackgoat
by: blackgoat | last post by:
Hi! Pls help! My code is not working! Pls tell me whats wrong with it... it returns value 1 in all cases!! %dbase = { apple => "fruit", brinjal => "vegetable" , ...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.