1
blyfoten
wierd code?
  • 2004/11/1 8:35

  • blyfoten

  • Just popping in

  • Posts: 3

  • Since: 2004/10/29


in register.php i find this code on line 118 and 122, a switch() statement on an variable that's set just a couple of rows earlier??
$op 'register';  //row 118
foreach ( $_POST as $k => $v ) {
    $
$k $v;
}
switch ( 
$op ) {   //row 122
case 'newuser':
    .
    .
    
/*helluvalot of code thats never going to be executed?!*/
    
.
    .
case 
'finish':
    .
    .
    
/* even more useless code */
    
.
    .
/* and finaly */
case 'register':
default:
    include 
'header.php';
    
//OpenTable();
    
include 'include/registerform.php';
    
$reg_form->display();
    
//CloseTable();
    
include 'footer.php';
    break;
}


2
blyfoten
Re:wierd code?
  • 2004/11/1 8:40

  • blyfoten

  • Just popping in

  • Posts: 3

  • Since: 2004/10/29


oops sorry for my doublepost

3
ackbarr
Re:wierd code?

and you are questioning the need for such code?

$op is a variable used to control which action (or operation) the page is currently handling.
$op 'register';  //row 118

This line sets the default value for $op (in case the page is requested without an $op variable set.

foreach ( $_POST as $k => $v ) {
    $
$k $v;
}


This section retrives every variable submitted in the POST page request and creates a local variable for it. 'op' can be (and usually is) defined in the POST request and if it is, its value is assigned to the local variable $op. Now $op variable is looked at, and the proper requested action is run.

Login

Who's Online

163 user(s) are online (66 user(s) are browsing Support Forums)


Members: 0


Guests: 163


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits