johanafm;10927239 wrote:I've never used PHP4, so I may be way off, but I'd start by checking php.ini for register globals. I'm assuming the program was written to use it (and you shouldn't), so if you do not know how to code that would be an easy, albeit dirty, fix.
checked the php.ini under Windows folder and I see..
register_globals = Off
I still have no clue how to fix this problem..here are some codes in the customer.php
<?
include("common.php");
include("layout.php");
// clear company page session
$_SESSION[currcompanyid] = "";
$_SESSION[sqlwhere2] = "";
if ($db = @mysql_connect($dbhostname,$dbusername,$dbpassword)) {
mysql_select_db("$dbName") or die("Unable to select database\n");
}
$errmsg = ""; $error = "";
if (mysql_error() != "") {
$sqlerr = mysql_error();
$error = "There is a problem with your database, please contact wenchang for help<br>$sqlerr";
} else {
$submit = trim($submit);
if ($submit != "") $action = "";
if ($action != "") {
$area=$z;$phone1 = $a;$phone2=$b;$mon=$c;$day=$d;$year=$e;$ticket=$f;$quantity=$g;$price=$h;
}
/************** delete all found records ****************/
if ($action == "DeleteAll") {
if ($_SESSION[custsqlwhere] != "") {
mysql_query("DELETE FROM custrecord $_SESSION[custsqlwhere]",$db);
if (mysql_error() != "") {
$sqlerr = mysql_error();
$error = "There is a problem with your database, please contact wenchang for help<br>$sqlerr";
} else {
$errmsg = "Records displayed have been deleted!";
}
} else {
$errmsg = "No records to delete!";
}
}
if ($submit == "" && $action == "") {
// initialize variables
$mon = date('m');
$day = date('d');
$year = date('Y');
}
/*************** clear and reset the screen ***************/
if ($submit == "Clear") {
$area == "000";$phone1 = "";$phone2 = "";$mon = "";$day = "";$year = "";$ticket = "";$quantity = "";$price = "";
$_SESSION[custsqlwhere] = "";
header("Location: $httploc/customer.php?action=clear");
exit;
}
/*************** delete by date range ***************/
if ($submit == "Delete") {
$delmon = trim($delmon);$delday = trim($delday);$delyear = trim($delyear);
$delmon2 = trim($delmon2);$delday2 = trim($delday2);$delyear2 = trim($delyear2);
if ($delmon == "" || !is_numeric($delmon)) $errmsg2 = "Start Month is not valid.";
if ($delday == "" || !is_numeric($delday)) $errmsg2 = "Start Day is not valid.";
if ($delyear == "" || !is_numeric($delyear)) $errmsg2 = "Start Year is not valid.";
if ($delmon2 == "" || !is_numeric($delmon2)) $errmsg2 = "End Month is not valid.";
if ($delday2 == "" || !is_numeric($delday2)) $errmsg2 = "End Day is not valid.";
if ($delyear2 == "" || !is_numeric($delyear2)) $errmsg2 = "End Year is not valid.";
if ($errmsg2 == "") {
$start = strtotime("$delyear-$delmon-$delday");
$start = date('Y-m-d',$start);
$end = strtotime("$delyear2-$delmon2-$delday2");
$end = date('Y-m-d',$end);
$sql = "DELETE FROM custrecord where date_in >= '$start' and date_in <= '$end'";
mysql_query($sql,$db);
if (mysql_error() != "") {
$sqlerr = mysql_error();
$error = "There is a problem with your database, please contact wenchang for help<br>$sqlerr";
} else {
$errmsg2 = "Records between date range $start and $end has been deleted";
}
}
}
/************ add new records ***********/
if ($submit == "Add New") {
$sqlwhere = "";
$phone1 = trim($phone1);
$phone2 = trim($phone2);
if ($phone1 == "" || strlen($phone1) != 3) $errmsg = "Please enter a valid phone number.";
if ($phone2 == "" || strlen($phone2) != 4) $errmsg = "Please enter a valid phone number.";
if ($area == "000") $phone = "$phone1-$phone2";
else $phone = "$area-$phone1-$phone2";
$mon = trim($mon);
$day = trim($day);
$year = trim($year);
if ($mon == "" || !is_numeric($mon)) $errmsg = "Month is not valid.";
if ($day == "" || !is_numeric($day)) $errmsg = "Day is not valid.";
if ($year == "" || !is_numeric($year)) $errmsg = "Year is not valid.";
if ($errmsg == "") {
$thedate = strtotime("$year-$mon-$day");
$thedate = date('Y-m-d',$thedate);
}
$ticket = trim($ticket);
$quantity = trim($quantity);
$price = trim($price);
if ($ticket == "") $errmsg = "Ticket Number is not valid.";
if ($quantity == "" || !is_numeric($quantity)) $errmsg = "Quantity is not valid.";
if ($price == "" || !is_numeric($price)) $errmsg = "Please enter a valid price.";
if ($errmsg == "") {
// insert into database
$sql = "INSERT INTO custrecord (phone,date_in,ticketnum,quantity,price) VALUES ";
$sql .= "('$phone','$thedate','$ticket',$quantity,'$price')";
mysql_query($sql,$db);
if (mysql_error() != "") {
$sqlerr = mysql_error();
$error = "There is a problem with your database, please contact wenchang for help<br>$sqlerr";
} else {
$lastid = mysql_insert_id();
$sqlwhere = "where ID=$lastid";
$result = mysql_query("select * from custrecord $sqlwhere",$db);
$_SESSION[custsqlwhere] = $sqlwhere;
$rows = mysql_num_rows($result);
$errmsg = "Insert New Record Successful!";
// clear
$area = "000";$phone1 = "";$phone2 = "";$mon = date('m');$day = date('d');$year = date('Y');$ticket = "";$quantity = "";$price = "";
$_SESSION[custsqlwhere] = "";
}
}
}
/************ find records ************/
if ($submit == "Find" || $action == "Find") {
$sqlwhere = "";
$phone1 = trim($phone1);
$phone2 = trim($phone2);
$mon = trim($mon);
$day = trim($day);
$year = trim($year);
$ticket = trim($ticket);
$quantity = trim($quantity);
$price = trim($price);
if ($area != "000") $phone = "$area%-";
else $phone = "%";
if ($phone1 != "") $phone .= "$phone1%-";
else $phone .= "%";
if ($phone2 != "") $phone .= "$phone2%";
else $phone .= "%";
if ($phone != "%%%") $sqlwhere = "phone like '$phone'";
if ($mon != "" && $day != "" && year != "") {
$thedate = strtotime("$year-$mon-$day");
$thedate = date('Y-m-d',$thedate);
if ($sqlwhere != "") $sqlwhere .= " AND ";
$sqlwhere .= "date_in = '$thedate'";
}
if ($ticket != "") {
if ($sqlwhere != "") $sqlwhere .= " AND ";
$sqlwhere .= "ticketnum = '$ticket'";
}
if ($quantity != "") {
if ($sqlwhere != "") $sqlwhere .= " AND ";
$sqlwhere .= "quantity = $quantity";
}
if ($price != "") {
if ($sqlwhere != "") $sqlwhere .= " AND ";
$sqlwhere .= "price = '$price'";
}
if ($sqlwhere != "") $sqlwhere = "WHERE ".$sqlwhere;
$sql = "SELECT * FROM custrecord $sqlwhere order by date_in";
$result = mysql_query($sql,$db);
if (mysql_error() != "") {
$sqlerr = mysql_error();
$error = "There is a problem with your database, please contact ..
This is the everything.. just copied and pasted about half of it