Script Error
Posted: Thu Jul 21, 2011 7:07 pm
I have a client that has a website one of my ex developers designed. It has an admin page for them to add a user name and pw and creates a directory so they can upload there campgrounds to display for sale.
This developer has been gone for several years now and I am having an issue with his admin.php file he created.
Here is the error I get when I try to add a new user:
You are user admin.
Warning: Variable passed to each() is not an array or object in /srv/httpd/www/campgroundsforsale.com/htdocs/admin.php on line 154
New user was created successfully
However it does not add the new user.
The following is the code for that area
<p>Please fill out the following form to create new user:</p>
<?php
makeForm(Array(0, "", "", "", Array()));
break;
case "fileuser":
$viewerID = $_REQUEST{'viewerID'};
if ($viewerID){
//delete this user first
$query="DELETE FROM Perms WHERE ViewerID=$viewerID";
mysql_query($query);
$query="DELETE FROM Viewers WHERE ViewerID=$viewerID";
mysql_query($query);
}
ini_set(magic_quotes_gpc, 1);
$userID = $_REQUEST{'userID'};
$userPass = $_REQUEST{'userPass'};
$userDesc = $_REQUEST{'userDesc'};
$query="INSERT INTO Viewers (ViewerUname, ViewerPass, ViewerDesc) VALUES
('$userID', '$userPass', '$userDesc')";
mysql_query($query);
$viewerID=mysql_insert_id();
$campID = $_REQUEST{'campID'};
$query="INSERT INTO Perms (ViewerID, CampNumber) VALUES ($viewerID, $num)";
while(list($oy, $num) = each($campID)){
mysql_query($query);
}
echo "<p>New user was created successfully.</p><hr>";
makeMenu();
break;
THE BOLD SECTION IN RED IS LINE 154. I HAVE NO CLUE ABOUT PHP SO ANY HELP OR SUGGESTIONS IS GREATLY APPRECIATED.
This developer has been gone for several years now and I am having an issue with his admin.php file he created.
Here is the error I get when I try to add a new user:
You are user admin.
Warning: Variable passed to each() is not an array or object in /srv/httpd/www/campgroundsforsale.com/htdocs/admin.php on line 154
New user was created successfully
However it does not add the new user.
The following is the code for that area
<p>Please fill out the following form to create new user:</p>
<?php
makeForm(Array(0, "", "", "", Array()));
break;
case "fileuser":
$viewerID = $_REQUEST{'viewerID'};
if ($viewerID){
//delete this user first
$query="DELETE FROM Perms WHERE ViewerID=$viewerID";
mysql_query($query);
$query="DELETE FROM Viewers WHERE ViewerID=$viewerID";
mysql_query($query);
}
ini_set(magic_quotes_gpc, 1);
$userID = $_REQUEST{'userID'};
$userPass = $_REQUEST{'userPass'};
$userDesc = $_REQUEST{'userDesc'};
$query="INSERT INTO Viewers (ViewerUname, ViewerPass, ViewerDesc) VALUES
('$userID', '$userPass', '$userDesc')";
mysql_query($query);
$viewerID=mysql_insert_id();
$campID = $_REQUEST{'campID'};
$query="INSERT INTO Perms (ViewerID, CampNumber) VALUES ($viewerID, $num)";
while(list($oy, $num) = each($campID)){
mysql_query($query);
}
echo "<p>New user was created successfully.</p><hr>";
makeMenu();
break;
THE BOLD SECTION IN RED IS LINE 154. I HAVE NO CLUE ABOUT PHP SO ANY HELP OR SUGGESTIONS IS GREATLY APPRECIATED.