Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Using multiple arrays
Old 12-08-2005, 08:46 PM Using multiple arrays
amw_drizz's Avatar
Ultra Talker

Posts: 340
Name: Jon
Location: New York
Trades: 0
okay i have used arrays before but now im getting in to using more and more arrays.

the problem is that my page is blank and im positive it is the array for any actions for login, logout and stuff like that, but im somewhat unsure how to word the if statement so it detects if there is a value for $do and if that is false then to cancel that array and to continue. well here is my code

PHP Code:
                                                $function $_GET['function'];
                        
$page $_GET['p'];
                        
$do $_GET['do'];
                        
                        
$do_arrary = array(
                                                
'login'  =>  '/scripts/login.php',
                                                
'signup' =>  'scripts/signup.php',
                                                
'logout' =>  'scripts/logout.php',
                                                
'recover_pass' => 'scripts/recoverpass.php',
                                                
'change_pass'  => 'scripts/changeuserpass.php',
                        );
                        
                        
$actions = array(   
                                                
'empty'    => '',
                                                
'blank'    => 'pages/home.php'
                                                
'pak'      => 'pages/pak.php'
                                                
'about'    => 'pages/about.php',
                                                
'contact'  => 'pages/contact.php',
                                                
'news'     => 'pages/news.php',
                                                
'contact'  => 'pages/contact.php',
                                                
'offline'  => 'pages/offline.php',
                                                                

                         ); 
                        
                        if (
$function == "offline") {
                        echo 
"<center><h1>Sorry Function Not Avalible Yet</h1></center>";
                        
$page 'offline';
                        }
                        
                        if(!
$do || !array_key_exists($do$do_array)){
                        
$do_action 'NO';
                        }
                        else{
                        include(
$do_array$do ]);
                        
$do_action 'yes';
                        }
                                            
                        if(
$do_action == NO){
                        if(!isset(
$page) || !array_key_exists($page$actions)) {
                          
//  $HTTP_GET_VARS['page'] = 'blank'; // set a default 
                        
$page 'blank';
                        include(
$actions$page ]);
                        }
                        else{
                        include(
$actions$page ]); 
                        }
                        } 
__________________
AMW_Drizz
Dev Machine:: Apache 2.2.6 PHP 5.2.6 MySQL 5.1

Last edited by amw_drizz; 12-08-2005 at 08:55 PM..
amw_drizz is offline
Reply With Quote
View Public Profile Visit amw_drizz's homepage!
 
 
Register now for full access!
Old 12-08-2005, 08:50 PM
amw_drizz's Avatar
Ultra Talker

Posts: 340
Name: Jon
Location: New York
Trades: 0
**** im so dumb

i had an exit; command in the wrong spot

you may reveiw the code and letme know of anything you think i should change

OKAY NVM i am still getting an error say that

Quote:
Warning: array_key_exists(): The second argument should be either an array or an object in c:\program files\apache group\apache\htdocs\index.php on line 133
Line 133 is 2nd if

PHP Code:
                        if ($function == "offline") {
                        echo 
"<center><h1>Sorry Function Not Avalible Yet</h1></center>";
                        
$page 'offline';
                        }
                        
                        if(!
$do || !array_key_exists($do$do_array)){
                        
$do_action 'NO';
                        }
                        else{
                        include(
$do_array$do ]);
                        
$do_action 'yes';
                        } 
__________________
AMW_Drizz
Dev Machine:: Apache 2.2.6 PHP 5.2.6 MySQL 5.1

Last edited by amw_drizz; 12-08-2005 at 08:54 PM..
amw_drizz is offline
Reply With Quote
View Public Profile Visit amw_drizz's homepage!
 
Reply     « Reply to Using multiple arrays
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.10236 seconds with 12 queries