473,513 Members | 2,421 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Very strange problem

I have come across a strange problem. I am setting up a registration screen
with username, password, confirm password, and a couple of other things.
The submit button is named "Submit". The others are named "username",
"password", and "passwordConfirm".

The problem is that when I enter a username and a password of 5 characters
with nothing in the passwordConfirm field, I do not get the diagnostic echo
messages that I have inserted. Also, the error message is not that I need
six characters, but that the password and passwordConfirm do not match. If
I then put in the password again, also with an empty confirm password, on
that form with the single message, then the diagnostic messages appear.
Previously, when there were no diagnostic echos, the second attempt showed
the length message. (The page is, of course, ssRegister.php).

Any ideas? This is driving me crazy.
1 - Why on the first click of "Submit" doesn't it present the diagnostics?
It MUST enter there because it DOES print out an error message.
2 - Why is it printing out the wrong error message?

Shelly

The guts of my code goes something like this:

if (isset($_POST["Submit"])) {
$ss_username = $_POST['username'];
$ss_password = $_POST['password'];
$ss_passwordConfirm = $_POST['passwordConfirm'];
echo "strlen(" . $ss_password . ") = " . strlen($ss_password) . "<br>";
if (strlen($ss_password) < 6) {
echo "In strlen <br>";
$_SESSION['MM_NewUserError'] = "Error: You need a password of at least
six characters";
$insertGoTo = "ssRegister.php";
} else if (strcmp($ss_password, $ss_passwordConfirm)) {
echo "In compare <br>";
$_SESSION['MM_NewUserError'] = "Error: The Password, Confirm Password
do not match";
$insertGoTo = "ssRegister.php";
} ... more else if's ... {
} else {
..... put it in the database
$insertGoTo = "ssThankYou.html";
}
header(sprintf("Location: %s", $insertGoTo));
exit();
}

In the html area I have included in the proper place:

<?php
if (isset($_SESSION['MM_NewUserError'])) {
echo $_SESSION['MM_NewUserError'];
unset($_SESSION['MM_NewUserError']);
}
?>

Jul 17 '05 #1
3 1458
Shelly <sh************@asap-consult.com> wrote:

Any ideas? This is driving me crazy.
1 - Why on the first click of "Submit" doesn't it present the diagnostics?
It MUST enter there because it DOES print out an error message.
2 - Why is it printing out the wrong error message?

Shelly

The guts of my code goes something like this:

[snip incomplete exmaple]

Please provide a simple, selfcontained fully "working" example.

Jul 17 '05 #2
<?php

$msg='';

if($_SESSION['count_retry']<15){
if(isset($_POST["Submit"])){
if(strlen($_POST['username'])<5){$msg.='Error: You need a user name
of at least six characters<br>';}
if(strlen($_POST['password'])<5){$msg.='Error: You need a password
of at least six characters<br>';}
if($_POST['password']!=$_POST['passwordConfirm'] ){$msg.='Error: The
Password, Confirm Password do not match';}

if(empty($msg)){
header("Location:ssThankYou.html");
exit;
}else{
$_SESSION['count_retry']++;
}

}

}else{$msg='Registration disabled';}

?>
....
....

<? if(!empty($msg)){ echo $msg; } ?>

<form name="form1" method="post" action="">
username<input type="text" name="username" value="<? echo
$_POST['username']; ?>"><br>
password<input type="password" name="password"><br>
passwordConfirm<input type="password" name="passwordConfirm"><br>
<input type="submit" name="Submit" value="Submit">
</form>

Jul 17 '05 #3
I found out the problem and it was ridiculously stupid. I had created the
page ssRegister.php. I do all the php and my daughter does all the rest of
the "pretty" stuff. Well, without my knowing it she used the ssRegister.php
as index.php. So, although I was making changes locally to ssRegister.php
and pushing them to the server, that was not the code that was run on the
server.

Communication problem!!!

Shelly

"Dinçer Akay" <di*********@gmail.com> wrote in message
news:11**********************@g47g2000cwa.googlegr oups.com...
<?php

$msg='';

if($_SESSION['count_retry']<15){
if(isset($_POST["Submit"])){
if(strlen($_POST['username'])<5){$msg.='Error: You need a user name
of at least six characters<br>';}
if(strlen($_POST['password'])<5){$msg.='Error: You need a password
of at least six characters<br>';}
if($_POST['password']!=$_POST['passwordConfirm'] ){$msg.='Error: The
Password, Confirm Password do not match';}

if(empty($msg)){
header("Location:ssThankYou.html");
exit;
}else{
$_SESSION['count_retry']++;
}

}

}else{$msg='Registration disabled';}

?>
...
...

<? if(!empty($msg)){ echo $msg; } ?>

<form name="form1" method="post" action="">
username<input type="text" name="username" value="<? echo
$_POST['username']; ?>"><br>
password<input type="password" name="password"><br>
passwordConfirm<input type="password" name="passwordConfirm"><br>
<input type="submit" name="Submit" value="Submit">
</form>

Jul 17 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
2819
by: Google Mike | last post by:
I have RH9 and am using the PHP and MySQL that came with it. I was doing fine with all manner of my web pages for this app until I started having this very strange problem. It's a work order...
6
8503
by: leonecla | last post by:
Hi everybody, I'm facing a very very strange problem with a very very simple C program... My goal should be to write to a binary file some numbers (integers), each one represented as a sequence...
2
1766
by: TB | last post by:
I am seeing a very strange problem as follows... I have a loop where a fair amount of processing is going on and near the top of the loop I access a class that has only static helper functions...
5
1669
by: cody | last post by:
I have a very funny/strange effect here. if I let the delegate do "return prop.GetGetMethod().Invoke(info.AudioHeader, null);" then I get wrong results, that is, a wrong method is called and I...
3
1698
by: Trapulo | last post by:
I've two copy af the same asp.net application. The application enter on sql server, working with two separate databases (on the same sql server instance, of course). The connection is made with...
2
1408
by: Buddy Ackerman | last post by:
I have a web app that I have setup on numerous web servers. I've set one up for a new client at their hosting facility and cannot get it to connect to their database. I get a "SQL Server does not...
6
1389
by: Chris Ashley | last post by:
I have been tearing my hair out (or indeed, what's left of it) all day with this one. I'm not sure if it's a .NET issue, a server issue or anything else and would appreciate any guidance. ...
12
20612
by: John | last post by:
I can't get my head around this! I have the following code: <% .... Code for connection to the database ... .... Code for retrieving recordset ... If Not rs.EOF Then ... Do something...
112
4585
by: Prisoner at War | last post by:
Friends, your opinions and advice, please: I have a very simple JavaScript image-swap which works on my end but when uploaded to my host at http://buildit.sitesell.com/sunnyside.html does not...
126
4270
by: jacob navia | last post by:
Buffer overflows are a fact of life, and, more specifically, a fact of C. All is not lost however. In the book "Value Range Analysis of C programs" Axel Simon tries to establish a...
0
7386
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7543
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
7534
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...
0
5689
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4749
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3236
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1601
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
805
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
459
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.