Jump to content

saiko

Members
  • Posts

    37
  • Joined

  • Last visited

    Never

Everything posted by saiko

  1. ill do it like this [code] <?PHP if(!isset($_POST['submit']){ echo <<<html <form enctype="multipart/form-data" action="fileproc.php" method="POST">   <p>     <input name="file" type="file" />     <br />     By uploading you file you agree to the <a href="Terms Of Service.php" class="style1 style1">Terms Of Service</a>     <input type="submit" value="Submit" /> html; }elseif(isset($_POST['submit'])){ $directory = "/home/username/public_html/files/"; $max_file_size = "1000000"; $allowedfile[] = "video/x-ms-wmv";   $allowedfile[] = "video/x-msvideo";   $allowedfile[] = "video/mpeg";   $allowedfile[] = "video/quicktime";   if (is_uploaded_file($_FILES["file"]["tmp_name"])) {         if($_FILES["file"]["size"]>$max_file_size) {                 $is_uploaded = "failed";               echo 'Sorry, this file is too large. The maximum filesize is '.$max_file_size.' bytes, although your file is '.$_FILES["file"]["size"].'. ';                 exit();             }             if(!in_array($_FILES["file"]["type"],$allowedfile)) {                     $is_uploaded = "failed";                     echo 'Sorry, wrong file type, "'.$_FILES["file"]["type"].'" is not allowed. ';                   exit();           }             if(file_exists($directory.$_FILES["file"]["name"])) {                     $is_uploaded = "failed";                     echo 'Sorry, this file already exists. ';                     exit();         if($is_uploaded!="failed") {                $replace = array("$","%","#","@","!","&","^","*","(",")","-");             $new = str_replace($replace,"",$_FILES["file"]["name"]);             $fileName = str_replace(" " , "_" , $new);         if(! is_dir($directory)){                 mkdir($directory,0777);             }         if (move_uploaded_file($_FILES["file"]["tmp_name"], $directory.$fileName)) {                 echo "Your file, ". $fileName ." has successfully been uploaded!  Click <a href=\"".$directory.$fileName."\">Here</a> to view your file.";             }     else {         echo 'Sorry, your file has not uploaded.';         exit();         }     } } else {     echo 'There has been an unknown error while uploading';     exit(); } } ?> [/code]
  2. you can do either but i usually do the php after!
  3. put ob_start(); at the start and ob_end_flush(); at the end. if u havent already
  4. $username = $_SESSION['username']; // or wateva username equals $username = ereg_replace(" ", "", $username); shuld work
  5. [!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]<?php include 'db.php'; $username = $userdata['user_name']; $filename = str_replace(' ', '', $_FILES['userfile']['name']); $tblw = strlen($filename); $ext = substr($filename, $tblw-3, $tblw); $exts = array("png", "gif", "jpg"); if ($ext == 'png' OR $ext == 'gif' OR $ext == 'jpg') { $idq = mysql_query("SELECT `id` FROM `files` ORDER BY `id` DESC LIMIT 1"); $ida = mysql_fetch_assoc($idq); $id = $ida['id'] + 1; $uploaddir = '/wamp/www/aimphotogallery/upload/'; $path = '/wamp/www/aimphotogallery/upload/'.$id. '.'.$ext; $uploadfile = $uploaddir . $id . "." . $ext; move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile); mysql_query("INSERT INTO `files` (`id`,`path`,`owner`) VALUES('$id','$path','$username')"); header("Location: [a href=\"http://www.phpfreaks.com");\" target=\"_blank\"]http://www.phpfreaks.com");[/a] }; ?>[/quote] change to [!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]<?php ob_start(); include 'db.php'; $username = $userdata['user_name']; $filename = str_replace(' ', '', $_FILES['userfile']['name']); $tblw = strlen($filename); $ext = substr($filename, $tblw-3, $tblw); $exts = array("png", "gif", "jpg"); if ($ext == 'png' OR $ext == 'gif' OR $ext == 'jpg') { $idq = mysql_query("SELECT `id` FROM `files` ORDER BY `id` DESC LIMIT 1"); $ida = mysql_fetch_assoc($idq); $id = $ida['id'] + 1; $uploaddir = '/wamp/www/aimphotogallery/upload/'; $path = '/wamp/www/aimphotogallery/upload/'.$id. '.'.$ext; $uploadfile = $uploaddir . $id . "." . $ext; move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile); mysql_query("INSERT INTO `files` (`id`,`path`,`owner`) VALUES('$id','$path','$username')"); header("Location: [a href=\"http://www.phpfreaks.com");\" target=\"_blank\"]http://www.phpfreaks.com");[/a] }; ob_end_flush(); ?>[/quote] shuld work i hope
  6. saiko

    wierd

    there is code everywhere i cant just show it! the session arnt being carried over to the other files!!
  7. mysql_query("UPDATE users SET active='yes' WHERE key='$key'"); i suggest use `` located next to the number 1 mysql_query("UPDATE `users` SET `active`='yes' WHERE `key`='$key'"); a problem i had a while back :D
  8. saiko

    wierd

    they are initialized and i have session_start(); at the start of everything that needs it. its like the sessions arnt carrying over to skin pages. it works other pages like the usercp etc.
  9. saiko

    wierd

    i think it might be because the sessions arnt carrying over to the files. is this a possibility?
  10. saiko

    wierd

    im buildin a skining system into a memberystem and when the user logs in it declares variables. one of them is $_SESSION['logged_in'] and if it is set then it does wateva else it will echo that there not logged in. now it wont pick up the variable. i have to include the users choice of skin if there logged in else it will include another. on the skin it includes a file that if logged in will display links else display the login form. it displays the login form when there logged in instead of the links. any ideas? btw my msn is saiko[at]final-designs[dot]com
×
×
  • 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.