uid == 0 ) { $dest = $_SERVER['REQUEST_URI']; ?> Please log in to access this page. 0) { $output .= form_textfield(t('Username'), 'name', $edit['name'], 30, 64, t('Enter your %s username, or an ID from one of our affiliates: %a.', array('%s' => variable_get('site_name', 'local'), '%a' => implode(', ', user_auth_help_links())))); } else { $output .= form_textfield(t('Username'), 'name', $edit['name'], 30, 64, t('Enter your %s username.', array('%s' => variable_get('site_name', 'local')))); } $output .= form_password(t('Password'), 'pass', $pass, 30, 64, t('Enter the password that accompanies your username.')); $output .= form_submit(t('Log in')); return form($output, 'post', url("user/login?destination=$dest")); } $serverpath = "http://beta.mapleprimes.com/files/"; $uploaddir = '/srv/www/htdocs/drupal/files/'; function ftpMaplenet( $localpath, $filename ) { $maplenet_settings['maplenet_ftp_server'] = "maplenet.maplesoft.com"; $maplenet_settings['maplenet_server_name'] = "maplenet.maplesoft.com"; $maplenet_settings['maplenet_ftp_root'] ="mapleprimes"; $maplenet_settings['maplenet_ftp_login']="primesftp"; $maplenet_settings['maplenet_ftp_passwd'] = "dxsjmk56"; $maplenet_settings['maplenet_max_file_size'] = 100000; $dir=$maplenet_settings['maplenet_ftp_root']; $ftp=new ftp_communication($maplenet_settings['maplenet_ftp_server'], $maplenet_settings['maplenet_ftp_login'], $maplenet_settings['maplenet_ftp_passwd'], $maplenet_settings['maplenet_server_name']); // $ftp->change_directory($maplenet_settings['maplenet_ftp_root']); // $res=$ftp->change_directory($dir, false); /* if(!$res) { $ftp->create_directory($dir); $ftp->change_directory($dir); } */ //$ftp->upload_file($dir.'/'.$file, $_FILES['userfile']['tmp_name'], FTP_BINARY); $ftp->upload_file($dir.'/'.$filename, $localpath, FTP_BINARY); // @unlink($_FILES['userfile']['tmp_name']); $ftp->close_ftp_connection(); } $me = $_SERVER['REQUEST_URI']; if ($_SERVER['REQUEST_METHOD'] == 'POST' ) { // The user got here by submitting a form, process it $fileName = basename($_FILES['userfile']['name']); $fileError = basename($_FILES['userfile']['error']); $newName = $user->uid. "_". $fileName; $uploadfile = $uploaddir . $newName; //echo "

$uploadfile

"; if ( $fileName == "" ) { echo "

Upload error. Perhaps the file is too large

"; }elseif($_FILES['userfile']['size'] > 200000 ) { echo "File size cannot exceed 200000 bytes."; }else{ $extensions = array("doc", "dvi", "eps", "gif", "gz", "hdb", "html", "ind", "jpeg", "jpg", "lib", "m", "mla", "mm", "mpl", "mw", "mws", "pdf", "png", "ppt", "ps", "tar", "tex", "tgz", "txt", "xls", "zip" ); $ext=substr(strrchr($_FILES['userfile']['name'], "."), 1); $ext=strtolower($ext); if(!in_array( $ext, $extensions ) ) { echo "

File is not of an allowed type, it has type, $ext
Allowed types:"; foreach( $extensions as $curext ) { echo "$curext, "; } echo "

"; }elseif ( move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile ) ) { if ( $ext == "mw" ) { ftpMaplenet( $uploadfile, $newName); } $query = "INSERT INTO filemanager (filename, userid, ext) VALUES ('$newName','". $user->uid. "', '$ext')"; // echo $query; mysql_query($query); //$data = $_POST["userfile"]; }elseif ( $fileError == UPLOAD_ERR_NO_FILE ) { echo "

Please give a filename

"; } else { echo "

Invalid file, permission denied

"; } } } if ( isset($_GET['id']) ) { $id = $_GET['id']; /* $query="SELECT * FROM filemanager WHERE fileid = $id"; $result=mysql_query($query); $formfilename=mysql_result($result,$i,"filename"); $formname=mysql_result($result,$i,"name"); $formtype=mysql_result($result,$i,"type"); //Remove this element so we just read it when it is submitted $query="DELETE FROM filemanager WHERE fileid = $id"; $result=mysql_query($query); */ } else { $formfilename=""; $formname=""; $formtype=0; } $by = "fileid"; $order= "DESC"; if ( isset($_GET['by']) and strcmp($_GET['by'], "filename" ) == 0) { $by = "filename"; $order = "ASC"; } if ( isset($_GET['order']) and strcmp($_GET['order'], "asc") == 0 ) { $order = "ASC"; } if ( isset($_GET['order']) and strcmp($_GET['order'], "desc") == 0 ) { $order = "DESC"; } $query="SELECT * FROM filemanager WHERE userid='".$user->uid. "' ORDER BY $by $order"; $result=mysql_query($query); $num=mysql_numrows($result); //mysql_close(); ?>

Please Wait...