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

data not being transferred from one php file to another (POST)

CheckLogin.php
<?php
ob_start();
$host="localhost"; // Host name
$username="root"; // Mysql username
$password="secret"; // Mysql password
$db_name="game"; // Database name
$tbl_name="members"; // Table name

// Connect to server and select databse.
mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");

// Define $myusername and $mypassword
$myusername=$_POST['Username'];
$mypassword=$_POST['Password'];

$sql="SELECT * FROM $tbl_name WHERE username='$myusername' and password='$mypassword'";
$result=mysql_query($sql);

// Mysql_num_row is counting table row
$count=mysql_num_rows($result);
// If result matched $myusername and $mypassword, table row must be 1 row

if($count==1){
// Register $myusername, $mypassword and redirect to file "LoginOK.php"
$_session['username']=$myusername;
$_session['password']=$mypassword;
session_register("Username");
session_register("Password");
header("location:LoginOK.php");
}
else {
echo "Wrong Username or Password";
}

ob_end_flush();
?>
LoginOK.php
<?
session_start();
echo "hello";
$Username=$_GET['Username'];
echo $Username;
if(!session_is_registered('username')){
header("location:index.php");
}
?>
I'm not able to see the value of Username in LoginOK.php. Please help me with this.

Is there any IDE or debugger which will help me trace the values of variables?
Mar 13 '08 #1
5 1676
Markus
6,050 Expert 4TB
CheckLogin.php


LoginOK.php


I'm not able to see the value of Username in LoginOK.php. Please help me with this.

Is there any IDE or debugger which will help me trace the values of variables?
Well, is username present in the url?
url:
Expand|Select|Wrap|Line Numbers
  1. somewebsite.com?username=makusn00b
  2.  
Wait, you say it's being POSTed, then why are you using GET?
[php]
$username = $_POST['username'];
[/php]
Mar 13 '08 #2
Well, is username present in the url?
url:
Expand|Select|Wrap|Line Numbers
  1. somewebsite.com?username=makusn00b
  2.  
Wait, you say it's being POSTed, then why are you using GET?
[php]
$username = $_POST['username'];
[/php]
Nope. The username is not present in the URL
Mar 13 '08 #3
TheServant
1,168 Expert 1GB
Nope. The username is not present in the URL
GET is used when the variable is stored in the URL. POST is done behind the scenes. Try POST instead of GET in your form.
Mar 14 '08 #4
Another small question....Is there any IDE or debugger which will help me trace the values of variables?
Tried Eclipse with some defualt plugin for PHP. But it threw an error whenever it saw a MySQL statement.
Mar 14 '08 #5
TheServant
1,168 Expert 1GB
Another small question....Is there any IDE or debugger which will help me trace the values of variables?
Tried Eclipse with some defualt plugin for PHP. But it threw an error whenever it saw a MySQL statement.
No sure about free and official ones, but I recommend just using echo statements to echo variables as you go through.

{function1}
echo ("After function 1: A=".$var_a." B=".$var_b);
{function2}
echo ("After function 2: A=".$var_a." B=".$var_b);
Mar 14 '08 #6

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

Similar topics

7
by: Will | last post by:
On the subject of Data Warehouses, Data Cubes & OLAP…. I would like to speak frankly about Data Warehouses, Data Cubes and OLAP (on-line analytical processing). Has it dawned on anyone else...
6
by: Ishbel Kargar | last post by:
I've bought a new laptop (running Windows XP home edition) to replace my old one (running Windows 98). I don't have cable connection between the two computers, so I've transferred most of the...
16
by: StenKoll | last post by:
Help needed in order to create a register of stocks in a company. In accordance with local laws I need to give each individual share a number. I have accomplished this by establishing three tables...
3
by: Shmulik | last post by:
I have an application written in C# that creates a queue of items to process, connects via a TCP connection to a server on a Unix box, and then passes data files to the Unix box for processing...
9
by: David Harris | last post by:
Ok, so I'm semi-new to .NET, having done everything manually with SQL code back in VB6. So before I program this up completely manually again, I thought I'd ask for better ways to think through...
2
by: prakharv | last post by:
Hi All, I would like to unsderstand how POST data is sent from Web Browser to a Webserver esp when we try to upload a file to a server from HTML page. And how webserver decodes that...
1
by: BLUE | last post by:
I want to pass chunks of an xml file or an entire xml file to my WS. I'm surprised to see fro MSDN that no System.Xml class is serializable (XmlDocument, XmlElement and XmlNode): - I should use a...
14
by: Abhishek Bhatt | last post by:
The data is transferred from one table to another when user clicks on a button on the screen. The transfer takes approax 10-15 seconds. During this time I am able to move the mouse but not able to...
7
by: RB0135 | last post by:
Hi All, I have some Windows BMP, 1BPP, monochrome files that I need to get the raw data from to load a graphics buffer on a Roll Printer (which I know can be done). Lets forget about the Roll...
3
by: Mark B | last post by:
We've got a table with around 50,000 rows. Periodically we want our Outlook Add-in (C#) app to automatically download it as XML for reference look-up use. Is the best way to use write a...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
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...

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.