i've got a php script that is throwing back errors.
on line 10:
$lines = file($url_path.'/admin/lists/'.$new_file_name);
, I'm getting a timeout error, "failed to open stream: Connection timed out." Then, of course, the for each loop which follows fails completely. I'm assuming there may be a server issue, but wondering if a more experienced PHP guru can spot any red flags in the code in general.
I verified that the file is in fact being uploaded to the correct directory . . . so it's there. I'm wondering if this script has any obvious deprecated code or known incompatibilities... any insight is greatly appreciated!
code:
<? include $_SERVER['DOCUMENT_ROOT']."/includes/config.inc";?>
<?
if ($action =='upload_members') {
$new_file_name = time() .'_'. basename($_FILES['member_list']['name']);
$uploadfile = $site_root .'/admin/lists/'.$new_file_name;
move_uploaded_file($_FILES['member_list']['tmp_name'], $uploadfile);
chmod($uploadfile, 0777);
$clear_table = mysql_query("truncate table accounts");
$lines = file($url_path.'/admin/lists/'.$new_file_name);
foreach($lines as $key=>$val) {
//echo "$key -> $val ++<BR><BR>";
$accountArray = explode(",", $val);
$arraySize = sizeof($accountArray);
//echo "$key -> $val -> $arraySize +++<BR>";
$accountNumber = $accountArray[0];
if ($arraySize == 2) $accountName = $accountArray[1];
else {
array_shift($accountArray);
$accountName = join(",", $accountArray);
}
$accountInsert = "INSERT INTO accounts SET accountNumber = '$accountNumber', accountCompany = '".addslashes($accountName)."'";
//echo "$accountInsert ++<BR><BR>";
$accountResult = mysql_query($accountInsert);
}
echo "You list has been uploaded.";
}
?>