Jump to content

GsXtAsY

Members
  • Posts

    35
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

GsXtAsY's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. What im trying to do it display all the files uploaded to the server through the upload script. is there any easier way to doing this? I want them to be able to download these files too...you can see the code I have from the post above.
  2. ok going with a new script...but im getting an error... Warning: opendir(http://www.domain.com/acceptance/admin/upload/files/) [function.opendir]: failed to open dir: not implemented in /home/nlvip/public_html/acceptance/admin/upload/multiple_upload_example.php on line 105 Line 105 is: if ($handle = opendir($dir)) { Code: <?php $folder = $DOCUMENT_ROOT."/acceptance/admin/upload/files/"; // the folder which you want to list the files from function select_files($dir) { global $PHP_SELF; $teller = 0; if ($handle = opendir($dir)) { $mydir = "<p><strong>Choose image to download from the list below...</strong></p>\n"; $mydir .= "<form name=\"form1\" method=\"post\" action=\"thisDownloadsPage.php\">\n"; // change page to your download page... $mydir .= " <select name=\"file_in_folder\" id=\"file_in_folder\">\n"; $mydir .= " <option value=\"\" selected>... </option>\n"; while (false !== ($file = readdir($handle))) { $files[] = $file; } sort($files); foreach ($files as $val) { if ($val != "." && $val != "..") { $mydir .= " <option value=\"".$val."\">"; $mydir .= (strlen($val) > 30) ? substr($val, 0, 30)."...</option>\n" : $val."</option>\n"; $teller++; } } $mydir .= " </select>"; $mydir .= "<p><input type=\"submit\" class=\"submit\" name=\"download\" value=\"Download\"></p>"; $mydir .= "</form>\n"; closedir($handle); } if ($teller == 0) { echo "<p> </p>\n<p> </p>\n<p class=\"green\">(There are currently no files available for downloading.)</span>"; // this will display if the folder is empty } else { echo $mydir; } } if (isset($download)) { $fullPath = $folder.$_POST['file_in_folder']; if ($fd = fopen ($fullPath, "r")) { $fsize = filesize($fullPath); $path_parts = pathinfo($fullPath); $ext = strtolower($path_parts["extension"]); switch ($ext) { case "jpg": header("Content-type: image/jpg"); header("Content-Disposition: attachment; filename=\"".$path_parts["basename"]."\""); // use "attachment;" for forcing download rather than just viewing on page - as jpgs and gifs will be displayed if attachment isn't indicated. break; case "zip": header("Content-type: application/zip"); header("Content-Disposition: filename=\"".$path_parts["basename"]."\""); break; default; header("Content-type: application/octet-stream"); header("Content-Disposition: filename=\"".$path_parts["basename"]."\""); } header("Content-length: $fsize"); header("Cache-control: private"); while(!feof($fd)) { $buffer = fread($fd, 2048); echo $buffer; } } fclose ($fd); exit; } ?>
  3. Can anyone tell me what i need to change in my script so I can have these files save to an Upload folder on my first post script Thanks
  4. I cant get this upload script to work...any extra help would be awesome!
  5. Thank you I will try that...now for displaying the uploads on the page allowing users to download the files...how would i go about doing that?
  6. I have 3 total files so far and what i am wanting to do is instead of uploading the files into the main directory where the .php files are stored how would i go about having the files upload into a "upload" folder? Also I want to be able to display the files uploaded on one page without looking like a directory listing. Here is the code: <form name="form1" method="post" action="uploadForm2.php"> <p>Enter the amount of boxes you will need below. Max = 9.</p> <p> <input name="uploadNeed" type="text" id="uploadNeed" maxlength="1"> </p> <p> <input type="submit" name="Submit" value="Submit"> </p> </form> <form name="form1" enctype="multipart/form-data" method="post" action="processFiles.php"> <p> <? // start of dynamic form $uploadNeed = $_POST['uploadNeed']; for($x=0;$x<$uploadNeed;$x++){ ?> <input name="uploadFile<? echo $x;?>" type="file" id="uploadFile<? echo $x;?>"> </p> <? // end of for loop } ?> <p><input name="uploadNeed" type="hidden" value="<? echo $uploadNeed;?>"> <input type="submit" name="Submit" value="Submit"> </p> </form> <? $uploadNeed = $_POST['uploadNeed']; // start for loop for($x=0;$x<$uploadNeed;$x++){ $file_name = $_FILES['uploadFile'. $x]['name']; // strip file_name of slashes $file_name = stripslashes($file_name); $file_name = str_replace("'","",$file_name); $copy = copy($_FILES['uploadFile'. $x]['tmp_name'],$file_name); // check if successfully copied if($copy){ echo "$file_name | uploaded sucessfully!<br>"; }else{ echo "$file_name | could not be uploaded!<br>"; } } // end of loop ?>
  7. what i am trying to do is I have a drop down full of contacts...but if the user selects "New Contact" I want it to automatically add the following to the contact form: Name, Email, Phone, Position, Company How would I go about doing this? I am using smarty template engine.
  8. the thing is im incorporating it into files that I have created myself ... so the index.php file that i listed above is all my code and im trying to get this script to check my pages so someone cant go any further if they didnt log in yet at login.php
  9. where do I define the function?
  10. I do not want them to be able to just type the page name in manually and get the page to display...I need to find a way to check to make sure the user is logged in and if the user is not logged in then take them to login.php
  11. session_start(); checkLogin('1 2'); Thats how it looks in my file...i am using PHP Login and their Help file says to protect pages check pages using checkLogin('1 2'); to make sure user is logged in
  12. I want to check to see if the user is logged in before they can access this page...its telling me to add checkLogin('2') after the session starts but when i do that I get an error of: Fatal error: Call to undefined function: checklogin() in /home/nlvip/public_html/index.php on line 3 Any Suggestions? <?php session_start(); require_once('includes/db_login_evp.inc'); require_once('includes/functions/site_display.inc'); require_once('includes/functions/session_control.inc'); $username = $_POST['username']; $thanks = $_SESSION['thankyou']; $email = $_SESSION['work_email']; $_SESSION = array(); // clear session whenever user comes to front page // --- PAGE SPECIFIC CODE --- // // get account_id from nickname in URL if($_GET['name']){ $account_set = session_load_account_from_name($_GET['name']); }elseif($_GET['id']){ $account_set = session_load_account($_GET['id']); } if($account_set){ // forward to next page if($_SESSION['paid_options']){ $goto = 'paid_option.php'; }else{ $goto = 'welcome.php'; } insert_track($PHP_SELF); // insert tracking info into DB header('Location: http://www.nationlinkvip.com/'.$goto); exit; } // end if login has been selected insert_track($PHP_SELF); // insert tracking info into DB // --- SITE-WIDE CODE --- // // Account Logo $logo = display_account_logo($_SESSION['account_logo']); // Get Random Testimonial $testimonial = get_testimonial(); // Get Banner Image $banner_img = set_banner(); // Set welcome message $welcome_msg = set_welcome_message($_SERVER['PHP_SELF']); // Custom Account Content //$photo_banner = get_special_page('photo_banner.tpl'); //$left_column_nav = get_special_page('left_column_nav.tpl'); $right_column_content = get_special_page('evphome.tpl'); //$footer = get_special_page('footer.tpl'); // overide to eliminate sprint branding if(!isset($_SESSION['account_id'])){ //$style .= "\n\t".'<style type="text/css" media="all"><!-- body{background: #3E3629;} --></style>'; //$left_column_nav = 'evp/noSprint/left_column_nav.tpl'; //$footer = 'evp/noSprint/footer.tpl'; } // --- APPLY SMARTY TEMPLATE --- // include('smarty/Smarty.class.php'); $smarty = new Smarty; // Standard $smarty->assign('title', 'Home'); $smarty->assign('style', $style); $smarty->assign('javascript', $javascript); $smarty->assign('account_logo', $logo); $smarty->assign('offer_bar', $welcome_msg); $smarty->assign('left_column_nav', $left_column_nav); $smarty->assign('right_column_content', $right_column_content); $smarty->assign('footer', $footer); // Additional $smarty->assign('photo_banner', $photo_banner); $smarty->assign('testimonial', $testimonial); $smarty->assign('thanks', $thanks); $smarty->assign('email', $email); $smarty->assign('username', $username); // Display the page $smarty->display('evp/index1.tpl'); ?>
  13. I am having troubles writing a rewrite for http://www.site.com/login to forward to http://www.site.com/login/login.php Can someone help me What I have right now is: RewriteRule /login /login/login.php?$1
  14. i just went ahead and put $_POST['username'] in replacement of $username and that worked!! Thank you for your help!
  15. still nothing...im so lost on why this will not fill in the = part...any more ideas?
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.