|
#43306
05/12/2001 12:26 PM
|
Joined: Dec 2000
Posts: 139
Member
|
Member
Joined: Dec 2000
Posts: 139 |
Affected files in version 5.47e are cpanel3.cgi and ubb_library2.cgi.[/b][/QUOTE] Okay, I hope this is not a stupid question! What exactly are we supposed to do? Thanks!
|
|
|
#43307
05/12/2001 5:29 PM
|
Joined: Jan 2000
Posts: 56
Member
|
Member
Joined: Jan 2000
Posts: 56 |
So are you saying that the problem is in the double = in the For statement and that the if statements are fine?
For example:
for ($eachpage == 1; $eachpage <= $TotalPages; $eachpage++) { if ($eachpage == 1) { $PageName = "$ThreadNumber"; } else { $PageName = "$ThreadNumber-$eachpage"; } if ($PageNumber == $eachpage) {
should be:
for ($eachpage = 1; $eachpage <= $TotalPages; $eachpage++) { if ($eachpage == 1) { $PageName = "$ThreadNumber"; } else { $PageName = "$ThreadNumber-$eachpage"; } if ($PageNumber == $eachpage) { or do I need to change the double = in the if statements too?
Parker
|
|
|
#43308
05/12/2001 5:48 PM
|
Joined: May 2001
Posts: 50
Member
|
Member
Joined: May 2001
Posts: 50 |
Exactly. You only need to alter the first line.
Change the double equals (==), which is a logical comparison and not an assignment, to a single equals (=).
for ($eachpage == 1; $eachpage <= $TotalPages; $eachpage++) {
Becomes
for ($eachpage = 1; $eachpage <= $TotalPages; $eachpage++) {
Open all the CGI files in your favourite advanced text editor and do a search and replace. That'll fix everything and will only take a second or two.
[ May 13, 2001 04:52 AM: Message edited by: Shockwave ]
|
|
|
#43309
05/31/2001 11:53 AM
|
Joined: Dec 2000
Posts: 151
Member
|
Member
Joined: Dec 2000
Posts: 151 |
Before I set out removing all the "==" a little more explanation would be helpful.
When should the double equals sign be used?
When should it not?
You mentioned that a single = should be used in comparative situations, is this true for all such situations?
(spaces have been added so this can post)
As an example ( from the announce file ): if ( document . cookie ) {
if ( testUserName == null ) {
That is comparing right, so you are saying it should only be one equals sign?
If this is the case then they are all over the place.
It would also seem that you are saying a double = is used for assignments only, such as X==Y yet all over the place they used only one equals sign?
A bit more clarification would be helpful, please.
|
|
|
#43310
05/31/2001 10:47 PM
|
Joined: Apr 2001
Posts: 57
Member
|
Member
Joined: Apr 2001
Posts: 57 |
Just this line:
for ($eachpage == 1; $eachpage <= $TotalPages; $eachpage++) {
It should be:
for ($eachpage = 1; $eachpage <= $TotalPages; $eachpage++) {
|
|
|
#43311
06/01/2001 7:47 PM
|
Joined: May 2001
Posts: 6,708
Member
|
Member
Joined: May 2001
Posts: 6,708 |
I think he means that u change the fisrt == in a line to one =.
|
|
|
#43312
06/04/2001 4:03 AM
|
Joined: Jun 2000
Posts: 2
Junior Member
|
Junior Member
Joined: Jun 2000
Posts: 2 |
why should I change, in a for loop, it's supposed to do compare first do do ACtion right? single = is an assignment right??
|
|
|
#43313
06/04/2001 4:17 AM
|
Joined: May 2001
Posts: 6,708
Member
|
Member
Joined: May 2001
Posts: 6,708 |
What are ya talking bout?
|
|
|
#43314
06/04/2001 11:53 AM
|
Joined: Sep 2000
Posts: 37
Member
|
Member
Joined: Sep 2000
Posts: 37 |
Perl has a C like syntax designed for computers, not humans - hence this sort of coding error gets made even by the best programmers.
In the for statement, the first part is the initialize, then the comparison, then the increment. So the error was to have two comparsions using ==.
I prefer languages where the = sign means assign or compare and the context of the statement will determine it automatically.
|
|
|
Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.
Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.
|
|
Posts: 70
Joined: January 2007
|
|
Forums63
Topics37,573
Posts293,925
Members13,849
|
Most Online5,166 Sep 15th, 2019
|
|
Currently Online
Topics Created
Posts Made
Users Online
Birthdays
|
|
|
|
|