a variable that is undefined

Links for php scripts

Moderators: macek, egami, gesf

ff-dna
New php-forum User
New php-forum User
Posts: 5
Joined: Tue Jun 24, 2003 11:45 am
Contact:

a variable that is undefined

Postby ff-dna » Tue Jun 24, 2003 11:51 am

i want a variable that is undefined... um.. i dunt think u understand what i'm talking about. heres my script.

Code: Select all

<?
$user[0] = "ff-dna";
$user[1] = "mysql";
$user[3] = "john";
if ($user[$number] == "$username") { echo "access granted."; } else { echo "access denied"; } ?>

for the $number variable, is there a variable that represents all numbers... as in every number.... or checks if its a number... anyone have any idea?

i appreciate any help/...

liquedus
php-forum Active User
php-forum Active User
Posts: 266
Joined: Tue Apr 08, 2003 5:18 am
Location: Ottawa, Canada
Contact:

Postby liquedus » Tue Jun 24, 2003 12:06 pm


ff-dna
New php-forum User
New php-forum User
Posts: 5
Joined: Tue Jun 24, 2003 11:45 am
Contact:

Postby ff-dna » Tue Jun 24, 2003 5:21 pm

it didnt work out as i thought.... but thanks for your help... i'm new so i'm a lil dumb....

Code: Select all

<?
$user[0] = "michael";
$user[1] = "weiyi";
$user[2] = "weiyia";
$cd = is_numeric($cd);
if ($username == "$user[$cd]") { echo "access granted"; } else { echo "access denied"; }
?>
<?print($cd);?>


i'm trying to get more like um... whenever i put a username like $username = "weiyi"; i need something or some variables to check:

$user[0]
$user[1]
$user[2]

i need it to check all those....

Flood
New php-forum User
New php-forum User
Posts: 23
Joined: Tue Jun 24, 2003 4:49 am

Postby Flood » Wed Jun 25, 2003 11:13 am

Perhaps you are looking for in_array then?
cf. http://www.php.net/in_array

/Flood


Return to “PHP Scripts”

Who is online

Users browsing this forum: No registered users and 1 guest