chris_rulez001 Posted May 28, 2007 Share Posted May 28, 2007 hi, im getting problems with my php script, can someone please help me? its in a text file, so you can view the php script better. http://h1.ripway.com/1111ab/main.txt the problems that are occuring: Notice: Undefined index: ava_username in /www/1111mb.com/c/h/r/chrisrulez/htdocs/gamestest/includes/main.php on line 364 Notice: Undefined index: ava_userid in /www/1111mb.com/c/h/r/chrisrulez/htdocs/gamestest/includes/main.php on line 368 Notice: Use of undefined constant task - assumed 'task' in /www/1111mb.com/c/h/r/chrisrulez/htdocs/gamestest/includes/main.php on line 293 Notice: Undefined index: task in /www/1111mb.com/c/h/r/chrisrulez/htdocs/gamestest/includes/main.php on line 293 Notice: Use of undefined constant task - assumed 'task' in /www/1111mb.com/c/h/r/chrisrulez/htdocs/gamestest/includes/main.php on line 295 Notice: Undefined index: task in /www/1111mb.com/c/h/r/chrisrulez/htdocs/gamestest/includes/main.php on line 295 Notice: Use of undefined constant task - assumed 'task' in /www/1111mb.com/c/h/r/chrisrulez/htdocs/gamestest/includes/main.php on line 297 Notice: Undefined index: task in /www/1111mb.com/c/h/r/chrisrulez/htdocs/gamestest/includes/main.php on line 297 Notice: Use of undefined constant task - assumed 'task' in /www/1111mb.com/c/h/r/chrisrulez/htdocs/gamestest/includes/main.php on line 299 Notice: Undefined index: task in /www/1111mb.com/c/h/r/chrisrulez/htdocs/gamestest/includes/main.php on line 299 Notice: Use of undefined constant task - assumed 'task' in /www/1111mb.com/c/h/r/chrisrulez/htdocs/gamestest/includes/main.php on line 301 Notice: Undefined index: task in /www/1111mb.com/c/h/r/chrisrulez/htdocs/gamestest/includes/main.php on line 301 Notice: Use of undefined constant task - assumed 'task' in /www/1111mb.com/c/h/r/chrisrulez/htdocs/gamestest/includes/main.php on line 303 Notice: Undefined index: task in /www/1111mb.com/c/h/r/chrisrulez/htdocs/gamestest/includes/main.php on line 303 Notice: Use of undefined constant task - assumed 'task' in /www/1111mb.com/c/h/r/chrisrulez/htdocs/gamestest/includes/main.php on line 305 Notice: Undefined index: task in /www/1111mb.com/c/h/r/chrisrulez/htdocs/gamestest/includes/main.php on line 305 Notice: Use of undefined constant task - assumed 'task' in /www/1111mb.com/c/h/r/chrisrulez/htdocs/gamestest/includes/main.php on line 307 Notice: Undefined index: task in /www/1111mb.com/c/h/r/chrisrulez/htdocs/gamestest/includes/main.php on line 307 Notice: Use of undefined constant task - assumed 'task' in /www/1111mb.com/c/h/r/chrisrulez/htdocs/gamestest/includes/main.php on line 309 Notice: Undefined index: task in /www/1111mb.com/c/h/r/chrisrulez/htdocs/gamestest/includes/main.php on line 309 Notice: Use of undefined constant task - assumed 'task' in /www/1111mb.com/c/h/r/chrisrulez/htdocs/gamestest/includes/main.php on line 311 Notice: Undefined index: task in /www/1111mb.com/c/h/r/chrisrulez/htdocs/gamestest/includes/main.php on line 311 Notice: Use of undefined constant task - assumed 'task' in /www/1111mb.com/c/h/r/chrisrulez/htdocs/gamestest/includes/main.php on line 313 Notice: Undefined index: task in /www/1111mb.com/c/h/r/chrisrulez/htdocs/gamestest/includes/main.php on line 313 Notice: Use of undefined constant task - assumed 'task' in /www/1111mb.com/c/h/r/chrisrulez/htdocs/gamestest/includes/main.php on line 318 Notice: Undefined index: task in /www/1111mb.com/c/h/r/chrisrulez/htdocs/gamestest/includes/main.php on line 318 Notice: Use of undefined constant task - assumed 'task' in /www/1111mb.com/c/h/r/chrisrulez/htdocs/gamestest/includes/main.php on line 12 Notice: Undefined index: task in /www/1111mb.com/c/h/r/chrisrulez/htdocs/gamestest/includes/main.php on line 12 Notice: Use of undefined constant task - assumed 'task' in /www/1111mb.com/c/h/r/chrisrulez/htdocs/gamestest/includes/main.php on line 15 Notice: Undefined index: task in /www/1111mb.com/c/h/r/chrisrulez/htdocs/gamestest/includes/main.php on line 15 Notice: Use of undefined constant task - assumed 'task' in /www/1111mb.com/c/h/r/chrisrulez/htdocs/gamestest/includes/main.php on line 18 Notice: Undefined index: task in /www/1111mb.com/c/h/r/chrisrulez/htdocs/gamestest/includes/main.php on line 18 Notice: Use of undefined constant task - assumed 'task' in /www/1111mb.com/c/h/r/chrisrulez/htdocs/gamestest/includes/main.php on line 21 Notice: Undefined index: task in /www/1111mb.com/c/h/r/chrisrulez/htdocs/gamestest/includes/main.php on line 21 Notice: Use of undefined constant task - assumed 'task' in /www/1111mb.com/c/h/r/chrisrulez/htdocs/gamestest/includes/main.php on line 24 Notice: Undefined index: task in /www/1111mb.com/c/h/r/chrisrulez/htdocs/gamestest/includes/main.php on line 24 Notice: Use of undefined constant task - assumed 'task' in /www/1111mb.com/c/h/r/chrisrulez/htdocs/gamestest/includes/main.php on line 27 Notice: Undefined index: task in /www/1111mb.com/c/h/r/chrisrulez/htdocs/gamestest/includes/main.php on line 27 Notice: Use of undefined constant task - assumed 'task' in /www/1111mb.com/c/h/r/chrisrulez/htdocs/gamestest/includes/main.php on line 30 Notice: Undefined index: task in /www/1111mb.com/c/h/r/chrisrulez/htdocs/gamestest/includes/main.php on line 30 Notice: Use of undefined constant task - assumed 'task' in /www/1111mb.com/c/h/r/chrisrulez/htdocs/gamestest/includes/main.php on line 33 Notice: Undefined index: task in /www/1111mb.com/c/h/r/chrisrulez/htdocs/gamestest/includes/main.php on line 33 Notice: Use of undefined constant task - assumed 'task' in /www/1111mb.com/c/h/r/chrisrulez/htdocs/gamestest/includes/main.php on line 36 Notice: Undefined index: task in /www/1111mb.com/c/h/r/chrisrulez/htdocs/gamestest/includes/main.php on line 36 Notice: Use of undefined constant task - assumed 'task' in /www/1111mb.com/c/h/r/chrisrulez/htdocs/gamestest/includes/main.php on line 39 Notice: Undefined index: task in /www/1111mb.com/c/h/r/chrisrulez/htdocs/gamestest/includes/main.php on line 39 Notice: Use of undefined constant task - assumed 'task' in /www/1111mb.com/c/h/r/chrisrulez/htdocs/gamestest/includes/main.php on line 42 Notice: Undefined index: task in /www/1111mb.com/c/h/r/chrisrulez/htdocs/gamestest/includes/main.php on line 42 Notice: Use of undefined constant cat_id - assumed 'cat_id' in /www/1111mb.com/c/h/r/chrisrulez/htdocs/gamestest/includes/main.php on line 46 Notice: Undefined index: cat_id in /www/1111mb.com/c/h/r/chrisrulez/htdocs/gamestest/includes/main.php on line 46 Quote Link to comment https://forums.phpfreaks.com/topic/53309-php-problems/ Share on other sites More sharing options...
Barand Posted May 28, 2007 Share Posted May 28, 2007 You get "Notice: Use of undefined constant " usually if you are addressing an array element with a string as a key, but the string is unquoted. echo $array[key]; // undefined constant echo $array['key']; // OK Quote Link to comment https://forums.phpfreaks.com/topic/53309-php-problems/#findComment-263462 Share on other sites More sharing options...
chris_rulez001 Posted May 28, 2007 Author Share Posted May 28, 2007 it hasn't worked, can anyone suggest anything else? Quote Link to comment https://forums.phpfreaks.com/topic/53309-php-problems/#findComment-263477 Share on other sites More sharing options...
chris_rulez001 Posted May 29, 2007 Author Share Posted May 29, 2007 can anyone help? Quote Link to comment https://forums.phpfreaks.com/topic/53309-php-problems/#findComment-264323 Share on other sites More sharing options...
MadTechie Posted May 29, 2007 Share Posted May 29, 2007 try print_r($_COOKIES); or $HTTP_COOKIE_VARS to check their set Quote Link to comment https://forums.phpfreaks.com/topic/53309-php-problems/#findComment-264329 Share on other sites More sharing options...
conker87 Posted May 30, 2007 Share Posted May 30, 2007 Abit off topic here, but I noticed you have loads of if ($_GET['task'] == 'whatever') { include("whatever.php"); } Try removing them all and adding: if ($_GET['task'] && file_exists($_GET['task'] . ".php")) { include($_GET['task'] . ".php"); } Just something to cut down on the size. I cant help with the problem at hand though, no clue... Quote Link to comment https://forums.phpfreaks.com/topic/53309-php-problems/#findComment-264396 Share on other sites More sharing options...
MadTechie Posted May 30, 2007 Share Posted May 30, 2007 @conker87 could be a little bit on a secuirty risk in some cases.. giving the user that much control..! Quote Link to comment https://forums.phpfreaks.com/topic/53309-php-problems/#findComment-264567 Share on other sites More sharing options...
chris_rulez001 Posted May 30, 2007 Author Share Posted May 30, 2007 try print_r($_COOKIES); or $HTTP_COOKIE_VARS to check their set where abouts in my code do i put it Quote Link to comment https://forums.phpfreaks.com/topic/53309-php-problems/#findComment-264584 Share on other sites More sharing options...
MadTechie Posted May 30, 2007 Share Posted May 30, 2007 at the top of the function causing the problem.. check the line numbers Quote Link to comment https://forums.phpfreaks.com/topic/53309-php-problems/#findComment-264586 Share on other sites More sharing options...
chris_rulez001 Posted May 30, 2007 Author Share Posted May 30, 2007 shouldnt $HTTP_COOKIE_VARS be like $HTTP_COOKIE_VARS; Quote Link to comment https://forums.phpfreaks.com/topic/53309-php-problems/#findComment-264605 Share on other sites More sharing options...
MadTechie Posted May 30, 2007 Share Posted May 30, 2007 erm.. no print_r($_COOKIES); or print_r($HTTP_COOKIE_VARS); Quote Link to comment https://forums.phpfreaks.com/topic/53309-php-problems/#findComment-264609 Share on other sites More sharing options...
chris_rulez001 Posted May 30, 2007 Author Share Posted May 30, 2007 ive tried them both and it says: Notice: Undefined variable: HTTP_COOKIE_VARS in /www/1111mb.com/c/h/r/chrisrulez/htdocs/gamestest/includes/main.php on line 364 Quote Link to comment https://forums.phpfreaks.com/topic/53309-php-problems/#findComment-264620 Share on other sites More sharing options...
chris_rulez001 Posted May 30, 2007 Author Share Posted May 30, 2007 can anyone help me? Quote Link to comment https://forums.phpfreaks.com/topic/53309-php-problems/#findComment-265053 Share on other sites More sharing options...
per1os Posted May 30, 2007 Share Posted May 30, 2007 do not use $HTTP_COOKIE_VARS that has been depreciated. Instead use $_COOKIE['cookiename']; And before you call that cookie do a nice check like so: <?php $username = isset($_COOKIE['username'])?$_COOKIE['username']:''; ?> Whaat I did there is called the ternary operator the ? and : which is like a shortened if statement, if the index username is defined in the array $_cookie than assign $username the value. Else assign $username '' Hope that helps. Quote Link to comment https://forums.phpfreaks.com/topic/53309-php-problems/#findComment-265070 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.