Jump to content

hanhao

Members
  • Posts

    10
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

hanhao's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. ok i need to self close a window (like after 5 seconds) anyone knows the command to close the window? would [code=php:0]echo "self.close()"; [/code] ? be correct? if not, please tell me what i have left out with a counter example - hanhao
  2. hi, i need to dymaically create a thumbnail button that when the user clicks on it, it does 2 things 1. links to another page called (page1.php) 2. popup another page in new browser called (page2.php) but set this popup in the background but the problem is <a href only allows 1 page to be linked how do i do the above? please help
  3. [!--quoteo(post=378975:date=Jun 1 2006, 02:41 AM:name=hanhao)--][div class=\'quotetop\']QUOTE(hanhao @ Jun 1 2006, 02:41 AM) [snapback]378975[/snapback][/div][div class=\'quotemain\'][!--quotec--] generating an array which contains filenames of a dir ok i have this dir called "images" in it contain .jpg and .txt files something like: now what i need to do is to enter .jpg only into my array such that the resultant array is array_of_jpg_filenames[0] = qwe.jpg array_of_jpg_filenames[1] = kwe.jpg anyone knows how can i do that? thanks [/quote] thnx for help this is the solution [code=php:0] <?php $dh = opendir($folder); if(!$dh) { exit('Open dir function failed!'); } $file_array = array(); while (($file = readdir($dh)) !== false ){ if ($file != "." && $file != ".."){ $bits = explode(".", $file); if($bits[1] == "jpg"){ $file_array[] = $file; } } } print_r($file_array); ?> [/code]
  4. generating an array which contains filenames of a dir ok i have this dir called "images" in it contain .jpg and .txt files something like: [!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]abc.txt def.txt qwe.jpg kwe.jpg[/quote] now what i need to do is to enter .jpg only into my array such that the resultant array is array_of_jpg_filenames[0] = qwe.jpg array_of_jpg_filenames[1] = kwe.jpg anyone knows how can i do that? thanks
  5. [!--quoteo(post=378944:date=Jun 1 2006, 12:00 AM:name=hvle)--][div class=\'quotetop\']QUOTE(hvle @ Jun 1 2006, 12:00 AM) [snapback]378944[/snapback][/div][div class=\'quotemain\'][!--quotec--] your $uploaddir should be a directory, it is currently a file. change to: $uploaddir = '"/website_root/color_scripts/'; or something else. also, the directory must be already created and set to writable (0777) [/quote] ok here's the change [code] <?php // In PHP versions earlier than 4.1.0, $HTTP_POST_FILES should be used instead // of $_FILES. [b]$uploaddir = "/website_root/color_scripts/";[/b] $uploadfile = $uploaddir . basename($_FILES['userfile']['name']); echo '<pre>'; if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {    echo "File is valid, and was successfully uploaded.\n"; } else {    echo "Possible file upload attack!\n"; } echo 'Here is some more debugging info:'; print_r($_FILES); print "</pre>"; ?> [/code] the directory exists hoW do i set it to writable??
  6. problem for my uploading file script hi i got a problem with my uploading script here is the code on the page which shows the upload button. [code] <form enctype="multipart/form-data" action="uploader.php" method="POST"> <input type="hidden" name="MAX_FILE_SIZE" value="90000000" /> Choose a file to upload: <input name="uploadfile" type="file" /><br /> <input type="submit" value="Upload File" /> </form> [/code] here is the code taken from php.net, it's in upload.php [code] <?php // In PHP versions earlier than 4.1.0, $HTTP_POST_FILES should be used instead // of $_FILES. $uploaddir = "/website_root/color_scripts/querypic.jpg"; $uploadfile = $uploaddir . basename($_FILES['userfile']['name']); echo '<pre>'; if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {    echo "File is valid, and was successfully uploaded.\n"; } else {    echo "Possible file upload attack!\n"; } echo 'Here is some more debugging info:'; print_r($_FILES); print "</pre>"; ?> [/code] upon uploading i get the following error [!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--] Possible file upload attack! Here is some more debugging info:Array ( [uploadfile] => Array ( [name] => querypic.jpg [type] => image/pjpeg [tmp_name] => d:\Program Files\xampp\tmp\phpBB.tmp [error] => 0 [size] => 30489 ) ) [/quote] can anyone please help?
  7. thnx for reply! i managed to solve my problem here is the solution $server_root = $_SERVER['DOCUMENT_ROOT']; $simtxt_contents = file_get_contents("$server_root/website_root/color_scripts/sim.txt");
  8. problem with specifying directory when using file_get_content() i got a problem with this function sim.txt is the file that i wish to read. it is stored in website_root\color_scripts\sim.txt this is my code [b]$simtxt_contents = file_get_contents("color_scripts\sim.txt");[/b] here is the error message [b] Warning: file_get_contents(color_scripts\sim.txt) [function.file-get-contents]: failed to open stream: No such file or directory in C:\Program Files\xampp\htdocs\website_root\test_colorsim.php on line 21[/b] the strange thing is i specified the directory as "color_scripts\sim.txt" , and NOT \test_colorsim.php\ is there anyway to solve this problem? do i need to escape ta directory up? using apache on my computer please help
  9. i am running xampp on my computer from apachefriends.org, it's a apache server this is the php script <html> <head> <?php exec ('notepad'); ?> </head> </html> but when i execute the php script on my computer , notepad doesnt not run i used a process viewer and discovered that notepad is running in the background and i cannot see it does anyone know how NOT to make it run in the background? i wan to see the notepad window on the apache server (my computer)
  10. how do i Use matlab written scripts and C++ written scripts in php? i have the matlab and C++ script, they return values which i wish to display on my website with php the only way i know is to rewrite the whole matlab script and C++ into php form which is very tedious is there anyway to do this?
×
×
  • 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.