/    Sign up×
Community /Pin to ProfileBookmark

Add Squad Module errors

today i just found a new bug in my add squad system in a clan management system for my friends website since i his webmaster and when i went to test add squad module and it came bck after entering all the information with these errorrs

[CODE]
Notice: Use of undefined constant password – assumed ‘password’ in /home/bcdesign/public_html/dbs/addSquad.php on line 20

Notice: Use of undefined constant disable – assumed ‘disable’ in /home/bcdesign/public_html/dbs/addSquad.php on line 20

Notice: Use of undefined constant rank – assumed ‘rank’ in /home/bcdesign/public_html/dbs/addSquad.php on line 20

Notice: Use of undefined constant rank – assumed ‘rank’ in /home/bcdesign/public_html/dbs/addSquad.php on line 86

Notice: Undefined variable: clan in /home/bcdesign/public_html/dbs/addSquad.php on line 97

Notice: Undefined variable: leader in /home/bcdesign/public_html/dbs/addSquad.php on line 98

Notice: Undefined variable: site in /home/bcdesign/public_html/dbs/addSquad.php on line 99

Notice: Undefined variable: date in /home/bcdesign/public_html/dbs/addSquad.php on line 100

Notice: Undefined variable: channel in /home/bcdesign/public_html/dbs/addSquad.php on line 101

Notice: Undefined variable: members in /home/bcdesign/public_html/dbs/addSquad.php on line 103
[/CODE]

Here is the code for it

[code=php]
if ($username == NULL) {
$username = $usercook;
$password = $passcook;
}

error_reporting(E_ALL);
?>

<?php

include(“header.php”);
$today = date( “Ymd”, time() );
$today2 = date( “m-d-Y”, time() );

$result = @mysql_query(“SELECT * FROM members WHERE username = “$username””);
$myrow = mysql_fetch_array($result);

if ($password == $myrow[password] and $username != NULL and $myrow[disable] != 1 and $myrow[rank] >= 16) {

if($myrow[“rank”] == 20) {
$rank = “Commander”;
}
if($myrow[“rank”] == 19) {
$rank = “General”;
}
if($myrow[“rank”] == 18) {
$rank = “Lt. General”;
}
if($myrow[“rank”] == 17) {
$rank = “Maj. General”;
}
if($myrow[“rank”] == 16) {
$rank = “Brig. General”;
}
if($myrow[“rank”] == 15) {
$rank = “Colonel”;
}
if($myrow[“rank”] == 14) {
$rank = “Lt. Colonel”;
}
if($myrow[“rank”] == 13) {
$rank = “Major”;
}
if($myrow[“rank”] == 12) {
$rank = “Captain”;
}
if($myrow[“rank”] == 11) {
$rank = “1st Luit.”;
}
if($myrow[“rank”] == 10) {
$rank = “2nd Luit.”;
}
if($myrow[“rank”] == 9) {
$rank = “Sgt. Major”;
}
if($myrow[“rank”] == 8) {
$rank = “Mstr. Gunnery Sgt.”;
}
if($myrow[“rank”] == 7) {
$rank = “1st Sgt.”;
}
if($myrow[“rank”] == 6) {
$rank = “Gunnery Sgt.”;
}
if($myrow[“rank”] == 5) {
$rank = “Staff Sgt.”;
}
if($myrow[“rank”] == 4) {
$rank = “Sergeant”;
}
if($myrow[“rank”] == 3) {
$rank = “Corporal”;
}
if($myrow[“rank”] == 2) {
$rank = “Lance Corporal”;
}
if($myrow[“rank”] == 1) {
$rank = “Priv. 1st Class”;
}
if($myrow[“rank”] == 0) {
$rank = “Private”;
}

if ($myrow[rank] >= 16) {

@mysql_query(“INSERT INTO squads SET clan = “$clan”, status = “$status”, leader = “$leader”,
site = “$site”, date = “$today”, channel = “$channel”, members = “$members”
“);

@mysql_query(“INSERT INTO log SET info = “$rank $username added $clan to squads page on $today2.”,
ip = “$ip””);

echo(”
<br>&nbsp;<br><br>&nbsp;<br>
Squad: $clan<br>
Leader: $leader<br>
Website: $site<br>
Date: $date<br>
Channel: $channel<br>
Number of Members: $members
<br>&nbsp;<br>
Click <a href=index.php>here</a> to return to login.<p>
“);

}
else {
echo(”
<br>&nbsp;<br><br>&nbsp;<br>
I’m sorry you do not have high enough rank.<a href=index.php>Back</a>
“);
}
}

else {
echo(”
<br>&nbsp;<br><br>&nbsp;<br>
Please Login
“);
}

include(“footer.php”);
[/code]

How can i fix this?

to post a comment
PHP

2 Comments(s)

Copy linkTweet thisAlerts:
@littlenedAug 19.2006 — does the script work?

they are only notices and you really shouldnt need to worry about them. If they appear when you try to run the site then I think you need to get your host to see if you can change the way PHP is handling errors.
Copy linkTweet thisAlerts:
@NogDogAug 19.2006 — In some places you are not quoting your string literals that are being used as array indexes, such as:
[code=php]
if ($myrow[rank] >= 16) {
[/code]

Though this may work, to be truly correct and forward-compatible, it should be:
[code=php]
if ($myrow["rank"] >= 16) {
[/code]

See this: [url=http://www.php.net/manual/en/language.types.array.php#language.types.array.foo-bar]Why is [i]$foo[bar][/i] wrong?[/url]
×

Success!

Help @william232 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.28,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...