while ($iType < $FieldsType) { $NameType = mysql_field_name($ResultType, $iType); $FlagsType = mysql_field_flags($ResultType, $iType); if (strstr($FlagsType, "primary_key") == true) { $FieldKey = $NameType; } if ($this->fields[$NameType]['input'] == "file") { $ids_aux = split(",", $ids); foreach ($ids_aux as $RId) { $RecordId = str_replace("'", "", $RId); if ($this->fields[$NameType]['DownloadPath'] && file_exists($this->fields[$NameType]['DownloadPath'])) { $TEDownloadPath = $this->fields[$NameType]['DownloadPath']; } else { $TEDownloadPath = TEDownloadsPath; } $OldFileDelete = TEnombre_id($table, $FieldKey, $RecordId, $NameType); if ($OldFileDelete && file_exists($TEDownloadPath . $OldFileDelete)) { $sql = "SELECT * FROM " . $table; $result = mysql_query($sql); if (mysql_error()) { mysql_error() . '<br/>' . $sql; } while ($row = mysql_fetch_assoc($result)) { if ($row[$FieldKey] != $RecordId && $row[$NameType] == $OldFileDelete) { $del = 1; } } if ($del != 1) { unlink($TEDownloadPath . $OldFileDelete); } }
function TEUserName() { $no_user = ""; if ($_SESSION[SESSION_VAR_NAME]) { $SesUser = $_SESSION[SESSION_VAR_NAME]; $SesId = $_SESSION[SESSION_VAR_ID]; $SesType = $_SESSION[SESSION_VAR_TYPE]; if ($SesUser == CFG_USER_MASTER_USER && $SesId == CFG_USER_MASTER_ID && $SesType == CFG_USER_MASTER_TYPE) { return CFG_USER_MASTER_NAME; } else { if ($SesUser) { mysql_connect(DB_HOST, DB_USER, DB_PASS); $sql_a = "select * from " . TableUsers . " where USUARIO='" . $SesUser . "' && USUARIO_ID='" . $SesId . "' "; $result_a = mysql_db_query(DB_NAME, $sql_a); if (mysql_num_rows($result_a) > 0) { return TEnombre_id(TableUsers, "USUARIO_ID", $SesId, "NOMBRE"); } else { return $no_user; } } else { return $no_user; } } } else { return $no_user; } }