PHP - Detect Codepage To Use, Read It From System? (for Zip Files)
I am moved a clients system from one ISP running PHP5.5 to a new ISP running PHP7.2 My problem is coding of filenames when I create zip files, with non English letters. I found this to work with CP775.
$dl[$z]=iconv("UTF-8", "CP775//TRANSLIT", $dl[$z]); Now, would it be possible to detect what CP to use from the system? I found mb_detect_encoding but it does not tell me much. Similar TutorialsI have a large number of files. It is recommended to save the files with hashing system to have fast access to files through the OS. But I have no practical knowledge about hash. Could you please give me a hint, how to save a file with hash coded system via php? and how to read the hash coded filename by php? Thank you in advance! Hello,
I try to get website speed of some website, but i can read only ''domain.com'' i can't read website files like css , js ... why ? i use proxies for this job.
here is the php code:
$options = array( 'useragent' => "Firefox (+http://www.firefox.org)", // who am i 'connecttimeout' => 120, // timeout on connect 'timeout' => 120, // timeout on response 'redirect' => 10, // stop after 10 redirects 'referer' => "http://www.google.com", 'proxyhost' =>'85.25.8.14:80' ); $response = http_get("http://solve-ict.com/wp-content/themes/ict%20theme/js/jquery-1.7.1.min.js", $options , $info);but it works fine with http://domain.com/ , but with files css or js it gives 404, using some free proxy servers available ? Thanks. Hi All, the session files stored as sess_SESSION_ID... How can i read them, i cant read them using fopen or file_get_contents, without any warnings.. Can someone help me out here ? Cheers Hey, I'm looking for some PHP code which can read a certain text file i have. I need to get certain information from this text file. This is how the text file looks like: metadataIngester: now executing performAction with token: 9188147351 metadataIngester: result of performAction with token:9188147351 metadataIngester: runtime (ms) for token 9188147351: 9953 inferencer: now executing performAction with token:9188147351 inferencer: result of performAction with token:9188147351 inferencer: runtime (ms) for token 9188147351: 10903 transcoder: now executing performAction with token:9188147351 transcoder: result of performAction with token:9188147351 transcoder: runtime (ms) for token 9188147351: 65456 transcoder: now executing performAction with token:9188147351 transcoder: result of performAction with token:9188147351 transcoder: runtime (ms) for token 9188147351: 83128 streamingServerTransfer: now executing performAction with token:9188147351 streamingServerTransfer: result of performAction with token:9188147351 streamingServerTransfer: runtime (ms) for token 9188147351: 12187 middlewa now executing performAction with token:9188147351 middlewa result of performAction with token:9188147351 middlewa runtime (ms) for token 9188147351: 28148 Now, there are more parts like this with an other tokenID & runtimes. I need to get the runtime for each token (in this example it will be 9953 + 10903 + 65456 + 83128 + 12187 + 28148 = 209775 (ms)). I need PHP to display the tokenID + the total time per token. Hi, I have coded a site, whereby users can log in, and depending on their group, view all files within their group directory: Code: [Select] if ($handle = opendir("storage/Admin/$group")) { while (false !== ($file = readdir($handle))) { if ($file != "." && $file != "..") { echo "<a target=\"_blank\" href=\"storage/Admin/$group/$file\">$file</a> <br />"; } } closedir($handle); } In this example, a user can click on their file, and it will let them download it, but if there is a folder (directory) in there, once clicked on, it will open a index of the directory. Is there a way instead, to let it open a custom page and list the files within it there? i use csv file reader class to read csv file...... i need to understand where i should create the sessions array so that i dont have to go back to this class everytime to reteive data..... Hi I have been googling really hard and haven't found any satysfying solution except http://www.phpfreaks.com/forums/php-coding-help/open-and-get-contents-of-a-word-document-with-php/ Do you know any PHP class to play with *.doc (up to 2003) files on Linux server? COM is nice but only on w1ndows Thanks in advance Tom Is there a code library out there that can read the exif data from image files, without the use of the php exif extension? I have a Windows hosting package and am noticing that several hosts don't (and won't) enable the exif extension for PHP for some reason. I need Windows for one of my sites which requires MS SQL access, so I can't use a Unix/Linux host because of that. But all of them support PHP on Windows.
Suggestions?
Trying to get this done: Page_1 has many external links, when certain links are clicked i do not want user to go directly to page, but rather go to a special add page_2 where user must click a second time on the link to finally get there. The add page_2 must show on screen the name of the initial link from page_1, it must change accordingly with the link it came from page_1,once on page_2 the hyperlink redirects outside the site. So far i am thinking give an id to the div or "<a href..." on page_1 then somehow have page_2 detect that id and fill in the variable for the final external link. Other wise is there a way to detect a url from incoming? I guess a similar example is how some domain name sellers landing page will indicate the name of the site. Such as "Thisdomain.com" is for sale. same landing page but the name changes according to the domain that was typed. hello dear PHP-Fans - greetings to you - and a happy new year!! i set up a WAMP-System on my openSuse 11.4 system. In order to learn as much as i can bout PHP i want to do some tests and write some scripts. Well the WAMP is allready up and running. Now i try to give the writing access to the folder mkdir /srv/www/ where the php-scripts should go in... i want to give write permission to all to all files in /srv/www As root I generally: mkdir /srv/www/ chown <webmaster usrername> /srv/www/ /srv/www/ should be readable and traversable by all, but only writeable by it's owner (the user designated as the webmaster.) can i do this like mentioned above,... Love to hear from you greetings db1 I got a question im using izabi for me im one who loves the software. But there some quirks that they forgot to add when making the mail system. I was wondering how it would be possible to code in a peice of php where it says read after someone read the email. If you need a copy of the mail mail script let me know. So far I have managed to create an upload process which uploads a picture, updates the database on file location and then tries to upload the db a 2nd time to update the Thumbnails file location (i tried updating the thumbnails location in one go and for some reason this causes failure) But the main problem is that it doesn't upload some files Here is my upload.php <?php include 'dbconnect.php'; $statusMsg = ''; $Title = $conn -> real_escape_string($_POST['Title']) ; $BodyText = $conn -> real_escape_string($_POST['ThreadBody']) ; // File upload path $targetDir = "upload/"; $fileName = basename($_FILES["file"]["name"]); $targetFilePath = $targetDir . $fileName; $fileType = pathinfo($targetFilePath,PATHINFO_EXTENSION); $Thumbnail = "upload/Thumbnails/'$fileName'"; if(isset($_POST["submit"]) && !empty($_FILES["file"]["name"])){ // Allow certain file formats $allowTypes = array('jpg','png','jpeg','gif','pdf', "webm", "mp4"); if(in_array($fileType, $allowTypes)){ // Upload file to server if(move_uploaded_file($_FILES["file"]["tmp_name"], $targetFilePath)){ // Insert image file name into database $insert = $conn->query("INSERT into Threads (Title, ThreadBody, filename) VALUES ('$Title', '$BodyText', '$fileName')"); if($insert){ $statusMsg = "The file ".$fileName. " has been uploaded successfully."; $targetFilePathArg = escapeshellarg($targetFilePath); $output=null; $retval=null; //exec("convert $targetFilePathArg -resize 300x200 ./upload/Thumbnails/'$fileName'", $output, $retval); exec("convert $targetFilePathArg -resize 200x200 $Thumbnail", $output, $retval); echo "REturned with status $retval and output:\n" ; if ($retval == null) { echo "Retval is null\n" ; echo "Thumbnail equals $Thumbnail\n" ; } }else{ $statusMsg = "File upload failed, please try again."; } }else{ $statusMsg = "Sorry, there was an error uploading your file."; } }else{ $statusMsg = 'Sorry, only JPG, JPEG, PNG, GIF, mp4, webm & PDF files are allowed to upload.'; } }else{ $statusMsg = 'Please select a file to upload.'; } //Update SQL db by setting the thumbnail column to equal $Thumbnail $update = $conn->query("update Threads set thumbnail = '$Thumbnail' where filename = '$fileName'"); if($update){ $statusMsg = "Updated the thumbnail to sql correctly."; echo $statusMsg ; } else { echo "\n Failed to update Thumbnail. Thumbnail equals $Thumbnail" ; } // Display status message echo $statusMsg; ?> And this does work on most files however it is not working on a 9.9mb png file which is named "test.png" I tested on another 3.3 mb gif file and that failed too? For some reason it returns the following Updated the thumbnail to sql correctly.Updated the thumbnail to sql correctly. Whereas on the files it works on it returns REturned with status 0 and output: Retval is null Thumbnail equals upload/Thumbnails/'rainbow-trh-stache.gif' Failed to update Thumbnail. Thumbnail equals upload/Thumbnails/'rainbow-trh-stache.gif'The file rainbow-trh-stache.gif has been uploaded successfully. Any idea on why this is? Hello I have a simple question about file handling... Is it possible to list all files in directories / subdirectories, and then read ALL files in those dirs, and put the content of their file into an array? Like this: array: [SomePath/test.php] = "All In this php file is being read by a new smart function!"; [SomePath/Weird/hello.txt = "Hello world. This is me and im just trying to get some help!";and so on, until no further files exists in that rootdir. All my attempts went totally crazy and none of them works... therefore i need to ask you for help. Do you have any ideas how to do this? If so, how can I be able to do it? Thanks in Advance, pros I am using WPSQT plugin in my blog site .I code some files in PHP also.how to add that files in plugin files.
Code: [Select] if ($showigiteidimage) { $igitwid_divlnk = "onclick=location.href='" . get_permalink($igitwid_result->ID) . "'; style=cursor:pointer;"; $igitwid_output .= '<li id="igit_wid_rpwt_li" style="height:' . $igitwid_height . 'px; padding-bottom: 10px;" ' . $igitwid_divlnk . '>'; $igitwid_output .= '<div id="igit_wid_rpwt_main_image" style="float:left;"> <a href="' . get_permalink($igitwid_result->ID) . '" target="_top"><img src="<?php $values = get_post_custom_values("tj_video_img_url"); echo $values[0]; ?>" id="igit_rpwt_thumb" ></a></div>'; the prb is image src cant read the php code , what to do ? please helpppppppppp Ok, so I have a code that looks like so: Code: [Select] <script type="text/javascript"> var ng_config = { assests_dir: 'ng/assets/' // the path to the assets directory } </script> <script type="text/javascript" src="ng/ng_all.js"></script> <script type="text/javascript" src="ng/components/calendar.js"></script> <script type="text/javascript"> var my_cal; ng.ready(function(){ // creating the calendar var my_cal = new ng.Calendar({ input: 'enddate', start_date: 'year - 1', // the start date (default is today) display_date: ng.get('startdate').value, // the display date (default is start_date) server_date_format: 'm/d/Y' // changing the server date format for a specific calendar. }); }); var my_cal1; ng.ready(function(){ // creating the calendar my_cal1 = new ng.Calendar({ input: 'startdate', start_date: 'year - 1', // the start date (default is today) display_date: new Date(), // the display date (default is start_date) server_date_format: 'm/d/Y' // changing the server date format for a specific calendar. }); }); how do I detect the months that pass between the two dates that are selected using a popup calendar using php so that my register page know which month to display the event under. Does this make sense? Hi, Would time() produce the timestamp based on your time environment or the servers?, if it produces the timestamp based on the server; how would I generate a timestamp (which I can later use within date()); so it displays to the users timezone? Hello. Would php be the right thing to use in regards to monitoring changes in html on certain pages, Basicly, I'd need it to be something like: "Page last changed: 2 Days, 4 Hours, 34 Minutes and 13 Seconds ago." What would I use for this? Thanks I am making a demo page that I want to add a form to. The way I want this for to work is. Say you are at demo.com Now you are a client I am working with so I have given you a number. This form will as for that number and on submit it will take you to demo.com/"client number" Here is what I have done. What is in my index.php <form> <form action="search.php"> <input id="button" name="button" type="text" /> <input type="button" value="SEARCH" > </form> What is in my search.php <?php $newurl = "http://demo.mysite.com/"; $newurl .=$_GET['button']; echo "$newurl"; /*header("Location: $newurl"); */ ?> -------------------------------------------------- I have also tried taking out the search.php and having everything in index.php <form> <form> <input id="button" name="button" type="text" /> <input type="button" value="SEARCH" > </form> <?php $newurl = "http://demo.mysite.com/"; $newurl .=$_GET['button']; echo "$newurl"; /*header("Location: $newurl"); */ ?> |