Help with removing Globals

Need help, My PHP server wont allow globals, how do i convert these globals in my script?

[code]<?

function form_newplayer(){

global $dir, $url, $site, $uinfo, $misc, $out;

if($misc[newplayer]!=“yes”){

include("$dir[func]/error.php");

display_error(“Signups are currently disabled.
”);

}

//TABLE ATERNATING COLORS

$altcolora="#000033";

$altcolorb="#000020";

$tablehead=table_head(“show”,“100%”,"",“left”);

$tablefoot=table_foot(“show”);

$bannerhead=table_head(“show”,“488”,“80”,“center”);

$bannerfoot=table_foot(“show”);

$out[body]=$out[body]."

$bannerhead

$out[banner]

$bannerfoot


$tablehead

   $site[longname] New Player Signup


";

if($uinfo[allow]==“yes”){

if($uinfo[force]==“yes”){

$isoption=“Required”;

}else{

$isoption=“Optional”;

}

$out[body]=$out[body]."

";

}

$out[body]=$out[body]."

";

if($misc[joinage]){

$out[body]=$out[body]."

";

}

if($url[policy]){

$out[body]=$out[body]."

";

}

if($misc[newsletter]==“yes”){

$out[body]=$out[body]."

";

}

$out[body]=$out[body]."

Player Information (Required)

Player Name/Alias

Player Password

Player Password Again

Email

Email Again

User Information ($isoption)

First Name

Middle Name

Last Name

Address

City

State

Alabama Alaska Arizona Arkansas California Colorado Connecticut Delaware District of Columbia Florida Georgia Hawaii Idaho Illinois Indiana Iowa Kansas Kentucky Louisiana Maine Maryland Massachusetts Michigan Minnesota Mississippi Missouri Montana Nebraska Nevada New Hampshire New Jersey New Mexico New York North Carolina North Dakota Ohio Oklahoma Oregon Pennsylvania Rhode Island South Carolina South Dakota Tennessee Texas Utah Vermont Virginia Washington West Virginia Wisconsin Wyoming International / Not in United States

Zip Code

Phone Number

()

Birthdate

Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec

/

01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31

/

1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999

Occupation

K-12 student college/graduate student sales/marketing tradesman/craftsman executive/managerial professional (doctor, lawyer, etc.) academic/educator computer technical/engineering other technical/engineering service/customer support clerical/administrative homemaker self-employed/own company unemployed, looking for work retired other

Optional Information

Icq Number

Aim Name

MSN Messenger

Website Url

Player Logo

Miscelaneus Information

I am at least $misc[joinage] years of age

I agree to abide by the rules of this site

I would like to receive the $site[shortname] newsletter


$tablefoot";

include("$dir[curtheme]");

}

function form_newplayerb($n_alias,$n_pass,$n_passa,$n_email,$n_emaila,$n_icq,$n_aim,$n_yahoo,$n_url,$n_logo,$n_newsletter,$n_fname, $n_mname,$n_lname,$n_addrs,$n_city,$n_state,$n_zip,$n_phonea,$n_phoneb,$n_bdaym,$n_bdayd,$n_bdayy,$n_occup,$agree_age,$agree_policy){

global $dir, $uinfo, $url, $file, $site, $out;

include("$dir[func]/checkdata.php");

$errormessage=check_agrees($errormessage, $agree_age, $agree_policy);

$errormessage=check_matching($errormessage, $n_pass, $n_passa, “You Passwords Do Not Match”);

$errormessage=check_matching($errormessage, $n_email, $n_emaila, “You Email Addresses Do Not Match”);

$errormessage=check_validlength($errormessage, $n_alias, “3”, “30”, “Your Player Alias Must be 3-25 Characters Long”);

$errormessage=check_validlength($errormessage, $n_pass, “2”, “15”, “Your Password Must be 2-10 Characters Long”);

error_check($errormessage);

if(($uinfo[allow]==“yes”) || ($uinfo[force]==“yes”)){

$n_fname=change_charecters($n_fname);

$n_mname=change_charecters($n_mname);

$n_lname=change_charecters($n_lname);

$n_addrs=change_charecters($n_addrs);

$n_city=change_charecters($n_city);

$n_state=change_charecters($n_state);

$n_zip=change_numbersonly($n_zip);

$n_phonea=change_numbersonly($n_phonea);

$n_phoneb=change_numbersonly($n_phoneb);

$n_bdaym=change_numbersonly($n_bdaym);

$n_bdayd=change_numbersonly($n_bdayd);

$n_bdayy=change_numbersonly($n_bdayy);

$n_occup=change_numbersonly($n_occup);

}

$n_phone="$n_phonea$n_phoneb";

if($uinfo[force]==“yes”){

$errormessage=check_requsernfo($errormessage,$n_fname,$n_mname,$n_lname,$n_addrs,
$n_city,$n_state,$n_zip,$n_phone,$n_bdaym,$n_bdayd,$n_bdayy,$n_occup);

}

error_check($errormessage);

$errormessage=check_validlength($errormessage, $n_alias, “3”, “50”, “Your Player Alias Must be 3-25 Characters Long”);

$errormessage=check_validlength($errormessage, $n_pass, “2”, “25”, “Your Password Must be 2-10 Characters Long”);

error_check($errormessage);

$errormessage=check_emailaddress($n_email);

error_check($errormessage);

$errormessage=check_unvalusersinfoexist($errormessage, $n_alias, $n_emaila, $ip);

$errormessage=check_usersinfoexist($errormessage, $n_alias, $n_emaila, $ip);

error_check($errormessage);

$n_icq=change_numbersonly($n_icq);

$n_aim=change_charecters($n_aim);

$n_yahoo=change_charecters($n_yahoo);

$n_url=change_url($n_url);

$n_logo=change_url($n_logo);

$n_logo=change_charecters($n_logo);

$n_url=change_charecters($n_url);

$n_email=change_charecters($n_email);

$errormessage=check_ban($errormessage, $n_alias, $n_email, $ip);

error_check($errormessage);

$tday=date(“Y-m-d H:i:s”);

$bday="$n_bdayy-$n_bdaym-$n_bdayd";

$ip=getenv(“REMOTE_ADDR”);

$mcode=md5(uniqid(microtime()));

$valicode="$mcode";

mysql_query("INSERT INTO validate VALUES (

‘$valicode’,

‘$n_alias’,

‘$n_pass’,

‘$n_email’,

‘$n_icq’,

‘$n_aim’,

‘$n_yahoo’,

‘$n_url’,

‘$n_logo’,

‘$n_newsletter’,

‘$tday’,

‘$ip’,

‘$n_fname’,

‘$n_mname’,

‘$n_lname’,

‘$n_addrs’,

‘$n_city’,

‘$n_state’,

‘$n_zip’,

‘$n_phone’,

‘$bday’,

‘$n_occup’);");

$tablehead=table_head(“show”,“500”,"",“left”);

$tablefoot=table_foot(“show”);

$bannerhead=table_head(“show”,“488”,“80”,“center”);

$bannerfoot=table_foot(“show”);

$out[body]=$out[body]."

$bannerhead

$out[banner]

$bannerfoot


$tablehead

   Thank you for signing up on $site[shortname]


Before you can play on the Ladders you must Validate your account.

An email was sent to $n_email with a Validation Code.

If your email supports html just click on the link in the email,

Otherwise Click on “Validate Account” on the Menu to type in the Code.

$tablefoot

";

$emailbody="Thank you for signing up on $site[shortname].n
Your UserName is : $n_alias
Your Password is : $n_pass n

Validation Code: $valicode

$url[base]/$file[join]?action=validate&vc=$valicodenn
n

";

include("$dir[func]/email.php");

send_email($n_alias,$n_email,“Validation Code”,$emailbody);

include("$dir[curtheme]");

}

?>[/code]

Thanks you guys!

[size=99px]edit Q1712: putted a blank into the script to avoid horizontal scrolling[/size]

ur code is full of errors, please put error_reporting(E_ALL) at the beginning of ur script and get rid of em first. e.g. $array[key] is wrong, it has to be $array[‘key’]

if u are talking about the global keyword: global $dir; is the same as $dir=&$GLOBALS[‘dir’].

http://php.net/global

maybe the variables are request-vars in that case use $_POST[‘dir’] or $_GET[‘dir’]

otherwise i don’t know what u mean

Need help, My PHP server wont allow globals, how do i convert these globals in my script?

To answer the question: turn them into parameters.

Furthermore, there are so many things wrong with the code you gave us that it makes my eyes bleed. PLEASE REMOVE ANY IRRELEVANT CODE!

Sponsor our Newsletter | Privacy Policy | Terms of Service