GIDForums  

Go Back   GIDForums > Computer Programming Forums > MySQL / PHP Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 20-Aug-2004, 12:13
skyloon skyloon is offline
Junior Member
 
Join Date: Jun 2003
Posts: 53
skyloon is an unknown quantity at this point

Undefined variable


when i tried it on my own pc as server; localhost, it works...no problem....

when i tried to upload to my website, it comes out some error, don't know why..
need to define nickname????

Notice: Undefined variable: nickname in /home/httpd/vhosts/testing.com/httpdocs/uploading.php on line 32


PHP Code:

<?php
include_once("config.php");
checkLoggedIn("yes");
doCSS();
?>


PHP Code:

print("Hello <b>".$_SESSION["nickname"]."</b><br>\n"); 




PHP Code:

$uploadfile = $uploaddir . $nickname.$image_types_extensions[$_FILES['userfile']['type']]; 


Last edited by JdS : 21-Aug-2004 at 21:12. Reason: Please insert your example PHP codes between [php] and [/php] tags
  #2  
Old 21-Aug-2004, 19:04
JasonMichael's Avatar
JasonMichael JasonMichael is offline
Awaiting Email Confirmation
 
Join Date: Jul 2004
Posts: 135
JasonMichael has a spectacular aura about
The short answer is :

yes.. you have to define 'nickname'... but specifically the session variable for 'nickname' - $_SESSION['nickname']

You must not be loading it somewhere.... are other parts of the code working?

Maybe you need to modify your .htaccess file, because typically going from one server to another, often times sessions get handled differently. I would recommend having an .htaccess file at the root of your webpages that has the following content:

Filename: .htacccess
Code:
php_value error_reporting 0 php_value variables_order GPCS php_value gpc_order GPC php_flag asp_tags off php_flag magic_quotes_gpc off php_value output_buffering 4096


I've had problems before... OH One way to see if one server is configured differently than another is to run the following script on each one:

Filename: test.php (put everything below in one file... it works great)
PHP Code:

<?php

    define('boolean', 1);
    define('string', 2);
    define('integer', 3);

    $php_ini_all = Array(
        Array(string, 'arg_separator.input'),
        Array(string, 'arg_separator.output'),
        Array(boolean, 'display_errors'),
        Array(boolean, 'display_startup_errors'),
        Array(boolean, 'magic_quotes_runtime'),
        Array(integer, 'error_reporting'),
        Array(string, 'variables_order'),
        Array(string, 'gpc_order')
    );
        
    $php_ini_perdir = Array(
        Array(boolean, 'asp_tags'),
        Array(boolean, 'magic_quotes_gpc'),
        Array(string, 'output_buffering'),
        Array(boolean, 'register_globals'),
        Array(boolean, 'short_open_tag')
    );
?>

<?php
    function display_php_conf() {
     echo "<PRE>";
        foreach ( $GLOBALS['php_ini_all'] as $option ) {
            $value = ini_get($option[1]);
            echo "ini_set('$option[1]', '$value');\n";
        }
        echo "</PRE>";
    }

    function display_htaccess_conf() {
        global $php_ini_all, $php_ini_perdir;
        echo "<pre>";
        foreach ( array_merge($php_ini_all, $php_ini_perdir) as $option ) {
            $value = ini_get($option[1]);
            
            if ( $option[0] == boolean ) {
                $value = $value ? 'on' : 'off';
                $directive = 'php_flag';
            } else {
                $directive = 'php_value';
            }

            echo "$directive $option[1] $value\n";
            
        }
                echo "</pre>";
    }
?>


Hope that helps ya.
  #3  
Old 22-Aug-2004, 09:58
skyloon skyloon is offline
Junior Member
 
Join Date: Jun 2003
Posts: 53
skyloon is an unknown quantity at this point
the problem solved after adding this code

PHP Code:

$nickname="$_SESSION[nickname]"; 


 
 

Recent GIDBlogOnce again, no time for hobbies by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Get value for variable name defined as string mirizar C Programming Language 3 21-Jun-2004 18:36
A Comprehensive Digest of C++ mithunjacob C++ Forum 39 20-Jun-2004 20:09
Forbidden You don't have permission to access Undefined index: ../PHP_SELF ghyndman MySQL / PHP Forum 2 15-Dec-2003 09:17
Keeping track of a private variable outside the class viperv80 C++ Forum 1 03-Dec-2003 18:25

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 02:53.


vBulletin, Copyright © 2000 - 2009, Jelsoft Enterprises Ltd.