473,804 Members | 3,088 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 "passwordConfir m".

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_passwordCon firm = $_POST['passwordConfir m'];
echo "strlen(" . $ss_password . ") = " . strlen($ss_pass word) . "<br>";
if (strlen($ss_pas sword) < 6) {
echo "In strlen <br>";
$_SESSION['MM_NewUserErro r'] = "Error: You need a password of at least
six characters";
$insertGoTo = "ssRegister.php ";
} else if (strcmp($ss_pas sword, $ss_passwordCon firm)) {
echo "In compare <br>";
$_SESSION['MM_NewUserErro r'] = "Error: The Password, Confirm Password
do not match";
$insertGoTo = "ssRegister.php ";
} ... more else if's ... {
} else {
..... put it in the database
$insertGoTo = "ssThankYou.htm l";
}
header(sprintf( "Location: %s", $insertGoTo));
exit();
}

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

<?php
if (isset($_SESSIO N['MM_NewUserErro r'])) {
echo $_SESSION['MM_NewUserErro r'];
unset($_SESSION['MM_NewUserErro r']);
}
?>

Jul 17 '05 #1
3 1481
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($_POS T['username'])<5){$msg.='Err or: You need a user name
of at least six characters<br>' ;}
if(strlen($_POS T['password'])<5){$msg.='Err or: You need a password
of at least six characters<br>' ;}
if($_POST['password']!=$_POST['passwordConfir m'] ){$msg.='Error: The
Password, Confirm Password do not match';}

if(empty($msg)) {
header("Locatio n:ssThankYou.ht ml");
exit;
}else{
$_SESSION['count_retry']++;
}

}

}else{$msg='Reg istration 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="passwordC onfirm"><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*********@gm ail.com> wrote in message
news:11******** **************@ g47g2000cwa.goo glegroups.com.. .
<?php

$msg='';

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

if(empty($msg)) {
header("Locatio n:ssThankYou.ht ml");
exit;
}else{
$_SESSION['count_retry']++;
}

}

}else{$msg='Reg istration 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="passwordC onfirm"><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
2841
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 mgmt system. I have 3 tables for the orders: TicketsOpen, TicketsVoided, and TicketsResolved. When one wants to void a ticket, they click it, choose Void, and it is copied to the TicketsVoided table, then removed from the TicketsOpen. And I can...
6
8540
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 of 32 bit. I made this stupid trial code: --------------------------------------------- FILE *fout;
2
1789
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 to perform some calculations. After some number of iterations, randomly, I'll get an uncaught NullValueException error on one of these calls, as if the class name is being treated as an object reference and is null. Here is some psuedo-code to...
5
1698
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 have no clue why. But if I store the MethodInfo in a local variable I works as expected. I do not understand why this is so, shouldn't both ways be semantically equal?
3
1712
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 integrated security, and the server is a domain controller. If I start only the first application (call the web site), all right. If I start only the second application, all right. If I start an application, and then call a page from the second,...
2
1419
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 exist or access denied." error. Well, the strangeness is that I have a SQL Query tool installed on this server and can connect to the database fine using the exact same connection parameters that I have specified in my web app. Even more strange...
6
1401
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. Basically, I have a web app that sends emails. Very basic code, nothing fancy, and I have had it working on about 5 machines! It's hardly worth pasting, but here's the send method from my email class anyway. As you can see, very basic: public void...
12
20710
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
4771
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 work. To rule out all possible factors, I made up a dummy page for an index.html to upload, along the lines of <html><head><title></title></ head><body></body></html>.; the image-swap itself is your basic <img src="blah.png"...
126
4433
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 theoretical framework for analyzing C programs. In contrast to other books where the actual technical difficulties are "abstracted away", this books tries to analyze real C programs taking into account pointers, stack frames, etc.
0
9705
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
1
10308
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10073
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9134
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7609
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6846
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4288
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 we have to send another system
2
3806
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2981
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.