Previous Thread
Next Thread
Print Thread
Rate Thread
#43305 05/12/2001 5:37 AM
Joined: May 2001
Posts: 50
Member
Member
Offline
Joined: May 2001
Posts: 50
This is a fix from a thread written by Rob Carnell, which is presently located here:

http://ubbforums.infopop.com/cgi-bin/ultimatebb.cgi?ubb=get_topic&f=16&t=001378

Quote
quote:

Affected files in version 5.47e are cpanel3.cgi and ubb_library2.cgi.

Sponsored Links
Joined: Dec 2000
Posts: 139
Member
Member
Offline
Joined: Dec 2000
Posts: 139
Quote
quote:

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? confused

Thanks! wink

Joined: Jan 2000
Posts: 56
Member
Member
Offline
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

Joined: May 2001
Posts: 50
Member
Member
Offline
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 ]

Joined: Dec 2000
Posts: 151
Member
Member
Offline
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.

Sponsored Links
Joined: Apr 2001
Posts: 57
Member
Member
Offline
Joined: Apr 2001
Posts: 57
Just this line:

for ($eachpage == 1; $eachpage <= $TotalPages; $eachpage++) {

It should be:

for ($eachpage = 1; $eachpage <= $TotalPages; $eachpage++) {

Joined: May 2001
Posts: 6,708
Member
Member
Offline
Joined: May 2001
Posts: 6,708
I think he means that u change the fisrt == in a line to one =.

Joined: Jun 2000
Posts: 2
Junior Member
Junior Member
Offline
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??

Joined: May 2001
Posts: 6,708
Member
Member
Offline
Joined: May 2001
Posts: 6,708
What are ya talking bout?

Joined: Sep 2000
Posts: 37
Member
Member
Offline
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.

Sponsored Links

Link Copied to Clipboard
Donate Today!
Donate via PayPal

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.
Recommended Hosts
We have personally worked with and recommend the following Web Hosts:
Stable Host
bluehost
InterServer
Visit us on Facebook
Member Spotlight
Posts: 70
Joined: January 2007
Forum Statistics
Forums63
Topics37,573
Posts293,925
Members13,849
Most Online5,166
Sep 15th, 2019
Today's Statistics
Currently Online
Topics Created
Posts Made
Users Online
Birthdays
Top Posters
AllenAyres 21,079
JoshPet 10,369
LK 7,394
Lord Dexter 6,708
Gizmo 5,833
Greg Hard 4,625
Top Posters(30 Days)
Top Likes Received
isaac 82
Gizmo 20
Brett 7
WebGuy 2
Morgan 2
Top Likes Received (30 Days)
None yet
The UBB.Developers Network (UBB.Dev/Threads.Dev) is ©2000-2024 VNC Web Services

 
Powered by UBB.threads™ PHP Forum Software 8.0.0
(Preview build 20240430)