Jump to content

Deoctor

Members
  • Posts

    663
  • Joined

  • Last visited

Everything posted by Deoctor

  1. 10q for that.. ill try with this one
  2. no i dont knw that .. can u teach me that..
  3. 10q for your time thrope.. i have figured out where i was doing wrong..!! <?php function _directory_exists($dir) { if(is_dir($dir)) { echo "Directory already there!!!<br>"; chdir($dir); } else { echo "Directory not exists!!!!<br>"; mkdir($dir); chdir($dir); } } function echo_win_drives() { for($c='A'; $c<='Z'; $c++) if(is_dir($c . ':')) echo $c . ': '; } ?> <html> <head> <title> Check for files </title> </head> <body> <form enctype="multipart/form-data" action="<?php echo $_SERVER['PHP_SELF'];?>" method="POST"> <table width="500" border="0" cellspacing="4" cellpadding="4" align="center"> <tr> <td>Folder Name:</td> <td><input name="filegive" type="text" id="filegive" size="50" value=""/></td> </tr> <tr> <td><input type="submit" name="Submit" value="ccc" accesskey="ENTER" tabindex="2" /></td> </tr> </table> </form> </body> </html> <?php if(isset($_POST['Submit'])) { echo "hai"; $give=$_POST['filegive']; $path="D:\\share\\"; $path .= "$give\\"; if(!chdir($path)) { _directory_exists($path); } $date_today=date("d-m-Y"); $path .="$date_today\\"; if(!chdir($path)) { _directory_exists($path); } //echo getcwd() . "\n"; //echo_win_drives(); echo getcwd() . "\n"; } ?> now this code is working the way i wanted.. change directory is for checking whether that directory exists or not, if not exists create that directory..
  4. Hai i am trying to create one folder something like this the root directory will be d:\share so i will ask the user to enter a name of the folder. for example if he gives the name chaitu then it should check the for this folder name if not exists create that. and then create one more folder inside that with the present date. so the folder structure should be like this d:\share\chaitu\26-02-2010 i am trying with this code, but it is not working.. anh help would be appreciated.. <html> <head> <title> Check for files </title> </head> <body> <tr> <td>Folder Name:</td> <td><input name="filegive" type="text" id="filegive" size="50" value=""/></td> <td><input type="submit" name="Submit" value="ccc" accesskey="ENTER" tabindex="2" /></td> </tr> </body> </html> <?php echo "hai"; $give=$_POST['filegive']; $path="D:\\share\\"; $path .= "$give\\"; if(!chdir($path)) { _directory_exists($path); } $date_today=date("d-m-Y"); $path .="$date_today\\"; if(!chdir($path)) { _directory_exists($path); } //echo getcwd() . "\n"; function _directory_exists($dir) { if(is_dir($dir)) { echo "Directory already there!!!<br>"; } else { echo "Directory not exists!!!!<br>"; mkdir($dir); } } echo getcwd() . "\n"; ?>
  5. Does it give u with any of the error codes that i have mentioned while uploading..
  6. <form enctype="multipart/form-data" action="upload.php" method="POST"> <input type="hidden" name="MAX_FILE_SIZE" value="9999999999999999" /> Choose a file to upload: <input name="uploaded" type="file" /><br /> <input type="submit" name="submit_x" value="Upload File" /> </form> <?php //Working for uploading the files of a particular type if(isset($_POST['submit_x'])) { function file_upload_error_message($error_code) { switch ($error_code) { case 0: return 'There is no error, the file uploaded with success...'; case 1: return 'The uploaded file exceeds the upload_max_filesize directive in php.ini'; case 2: return 'The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form'; case 3: return 'The uploaded file was only partially uploaded'; case 4: return 'No file was uploaded'; case 6: return 'Missing a temporary folder'; case 7: return 'Failed to write file to disk'; case 8: return 'File upload stopped by extension'; default: return 'Unknown upload error'; } } $host="localhost"; $user="root"; $pass="admin"; $db="develop"; mysql_connect($host,$user,$pass) or die(mysql_error()); mysql_select_db($db) or die(mysql_error()); $query="select type_name from filetype"; $result=mysql_query($query); ini_set("display_errors",1); //error_reporting(E_ALL); $target = "upload/"; $target = $target . basename( $_FILES['uploaded']['name']) ; $uploaded_type=strtolower(substr($_FILES['uploaded']['name'],strrpos($_FILES['uploaded']['name'],'.')+1)); print_r($_FILES['uploaded']); $error_code=$_FILES['uploaded']['error']; $error_message = file_upload_error_message($error_code); echo "Name ".$_FILES['uploaded']['name']."<br>"; echo "Type ".$_FILES['uploaded']['type']."<br>"; echo "Error ".$error_message."<br>"; echo "Size ".$_FILES['uploaded']['size']."<br>"; //echo "<br>FileX ".$uploaded_type; while($row = mysql_fetch_array($result)) { if($uploaded_type==$row['type_name']) { if(move_uploaded_file($_FILES['uploaded']['tmp_name'], $target)) { echo "The file ". basename( $_FILES['uploaded']['name']). " has been uploaded"; break; } else { echo "Sorry, there was a problem uploading your file."; } } } } ?> try this upload script and also check the permissions of the folder upload to be 777, this script will surely upload the files.. u need to have a mysql connecting for this to work. the table structure and the data that need to b there is like this.. CREATE DATABASE /*!32312 IF NOT EXISTS*/ `develop`; /*Table structure for table `filetype` */ DROP TABLE IF EXISTS `filetype`; CREATE TABLE `filetype` ( `type_name` varchar(10) NOT NULL default '', PRIMARY KEY (`type_name`) ) TYPE=MyISAM; /*Data for the table `filetype` */ insert into `filetype`(`type_name`) values ('doc'),('gif'),('jpg'),('pdf'),('png');
  7. try this to sent mail with attachment..... <?php #Send mail attaching a file along with it... $fileatt = "address.pdf"; // Path to the file $fileatt_type = "application/pdf"; // File Type $fileatt_name = "mypdffile.pdf"; // Filename that will be used for the file as the attachment $email_from = "sales@mysite.com"; // Who the email is from $email_subject = "Your attached file"; // The Subject of the email $email_message = "Thanks for visiting mysite.com! Here is your free file.<br>"; $email_message .= "Thanks for visiting.<br>"; // Message that the email has in it $email_to = "dr.virus.india@gmail.com"; //$email_to = $_POST['email']; // Who the email is to $headers = "From: ".$email_from; $file = fopen($fileatt,'rb'); $data = fread($file,filesize($fileatt)); fclose($file); $semi_rand = md5(time()); $mime_boundary = "==Multipart_Boundary_x{$semi_rand}x"; $headers .= "\nMIME-Version: 1.0\n" . "Content-Type: multipart/mixed;\n" . " boundary=\"{$mime_boundary}\""; $email_message .= "This is a multi-part message in MIME format.\n\n" . "--{$mime_boundary}\n" . "Content-Type:text/html; charset=\"iso-8859-1\"\n" . "Content-Transfer-Encoding: 7bit\n\n" . $email_message .= "\n\n"; $data = chunk_split(base64_encode($data)); $email_message .= "--{$mime_boundary}\n" . "Content-Type: {$fileatt_type};\n" . " name=\"{$fileatt_name}\"\n" . //"Content-Disposition: attachment;\n" . //" filename=\"{$fileatt_name}\"\n" . "Content-Transfer-Encoding: base64\n\n" . $data .= "\n\n" . "--{$mime_boundary}--\n"; $ok = @mail($email_to, $email_subject, $email_message, $headers); if($ok) { echo "<font face=verdana size=2><center>You file has been sent<br> to the email address you specified.<br> Make sure to check your junk mail!<br> Click <a href=\"#\" onclick=\"history.back();\">here</a> to return to mysite.com.</center>"; } else { die("Sorry but the email could not be sent. Please go back and try again!"); } ?>
  8. do one thing.. make one page with the same name and place there in that folder usermanage.php and write this in there?? <?php echo $_SESSION['user_name']; echo $_SESSION['user_level']; ?>
  9. Paste the code of one page..i think that u can do if help is needed.. without code. it is quite impossible to do.. also check what values are there in the php.ini file for these things session.cache_expire session.gc_maxlifetime
  10. u can try my suggestion..
  11. telnet localhost 25 is this open in ur machine.. if open then it will work..
  12. u have to send headers along with the message body.. the headers should be something like this $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
  13. u can actually do one thing change that to index_new.php and then in the index_new.php u can write something like this <?php include("index.php"); ?> so what it will do is that when ever some one cliks on the link it will send the request to index_new.php file and that in turn pass the values back to the index.php so in the top of index page u can write something like this $Page=$_GET['page'];
  14. check this article as well http://www.captain.at/howto-php-sessions.php
  15. if ur accessing the file using the http://localhost/<filename.php> then it should show u the remote address as 127.0.0.1 but where as if u are accessing the file using ur ipaddress then it will be ur ip address.. http://<ip-adress>/<filename.php> then it will show as <ip-adress>
  16. isnt this topic belong to PHP regex..
  17. i am running it on my local machine and i am using this as an administrator..could not able to figure out what services more are required. i gave permissions to all the items in drives to everyone, what services else do u mean??
  18. i gave full permissions though to C and d drives for everyone.. but still no luckk.. any one else had any luck opening an application using php..
  19. no it is not abt that function.. i wrote this bat file @echo off "C:\\Program Files\\fabFORCE\\DBDesigner4.exe" exit and this is my code.. <?php $command1 = 'D:\test123\ew.bat'; exec($command1,$output); ?> but nothing seem to work that function was one of the things i got from php.net http://www.php.net/manual/en/ref.exec.php#59361
  20. @PFMaBiSmAd sorry for that but i think i made atleast one part of the query correct.. instead of passing comments on others work..
  21. i dont want the application to run on the client side i want it to be opened in the server, but this is not happening!!
  22. <?php $_SERVER['HTTP_USER_AGENT']="Mendy"; echo $_SERVER['HTTP_USER_AGENT']; ?>
×
×
  • 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.