Ereg, Read The Dir And Print List Of Files.
I have a dir of html files that link to websites, i would like to read the dir
and print a list of those files as a link. Which the script i have does. I
would like to take this one step further and replace the ".html" extension
with ".com" so it winds up being:
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Read / Print File To 'x' Character?
i am using a php script to write information to a text file. Upon submission of the form, the date is printed (form: yyyy.mm.dd), followed by a space, then the information entered in the form. This txt document is then read then printed line by line on a web page. Code:
How Do I Get An Ordered List Of Values To Print?
I have a database of my audio CD collection, and I'm trying to get the song titles of each album to print in an ordered list format. Each album is printed in a new table row. For some reason a new row is printed for each song title. Below is part of my script. I included what parts I thought were important. You can see the current output here. The output I want is available here. Notice that the song titles have a number next to them. PHP Code:
Print Out A List Of All Mysql Field Names
I'm trying to make a drop down menu which has got a list of all field names that are in a database so you can do a search in each field seperatly but i can't find out how to do it.. can it be done with mysql_field_name and if so then anyone knows how ??
Print Array In List/menu Form Object
how i print a full column array into a list/menu form object, so that the text links to their respective page.....it is basically for a list of interviews so you click on the band name and then goto the interview page.
Can You Read A Value Into A List Menu?
a system i am developing has both a user and an admin side. The user can add a record and then the status of this is initially set to a fixed value. What I am wondering is, if i stick with a list of say 4 possible status', how can i get whatever status the admin changes the record to to be "sticky" on the menu the next time he looks at the call, as opposed to the menu showing the default value set in dreamweaver?
How Do You Convert A TCL List Into A String That PHP Can Read?
I have a TCL proc that needs to convert what might be a list into a string to read consider this: [set string [PROPER_CASE {hello world}]]; # OUTPUTS Hello World which is fine for PHP [set string [PROPER_CASE {-hello world}]]; # OUTPUT {{-Hello}} World, which PHP will print literally as {{-Hello}} World, instead of -Hello World Is there an easy way for TCL to brute-force a list into a strictly-string-only format to prevent this potentially ugly display from being displayed by PHP/etc.?
Print All Files In A Directory.
I am building a control panel for a hosting website, and I was wondering if there is a way to display all the files in a directory .
Read Today's Date Print Tomorrow's Date
I've got a small script that writes a random number and the date to a text file. Then the script opens this text file and if date = date from this text file something must happen. If something happened this script must open this text file again and replace it with a new random number and tomorrow's date. <?php $date = date("d-m-Y"); mt_srand((double)microtime()*10000000000); $num=mt_rand(0, 20); if ($num == $num && $date == "$tomorrowdate") { echo"$num -- $date";} else echo " ";?> So if the script gets activated on the 05-05-2003 it must write tomorrow's date into the text file (06-05-2003). How will I get tomorrow's date today?
Can Php Read .xls Files Directly?
I'd like to be able to read a microsoft spreadsheet with php. I know that php can read mysql, so I was thinking that maybe it could read excel spreadsheets as well. Does anyone know if that can be done?
Read Multiple Files
I have a PHP script where I read parts of xml feeds from multiple web addresses and display data. Something like : for(){ $filedata = @file(url); parse xml -> display data } My problem : can I read more files at once (multithreading?) - because it seems to work very slow now.
How To Read Files From Directoiries/sub Directories
I am new to PHP and doing a project. I want to read all files from all directories/sub directories starting from the root of the web site. ie. I want to get the root directory programmatically. I am using linux. The purpose of the file reading is to do an internal searching. Could u give me a sample code.
Arrays And Sorting, Read From Files
this is an ecommerce website. the categories are static, but the products are not. what happens is a user clicks on a link, subgroups.php?a=miscellaneous. subgroups either has a=, p=, l=, c= or s= but not more than one. so, in a folder called 'dat' there are 5 text files: a, p, l, c, s. these contain the products for each category. what i want is a list of products to be read from the correct file and displayed in a tabled list. the files are layed out like this: miscellaneous|Sticky Tape|MS394 miscellaneous|Scissors|MS012 so, subgroups.php?a=miscellaneous will read a.txt and look for all rows starting with miscellaneous and display them in a table. along with a thumbnail (img/thumbs/MS394.gif or img/thumbs/MS012.gif) and a link to product information (dat/a/miscellaneous/ms394.txt) which will be included on the next page. How can i do this?
PHP Scripts To Parse/read OE Dbx Files ?
Does anyone know whethere a PHP class or script exists to read messages in outlook express mail databases ? I can't get OE to auto-save certain messages to regular files, and doing a manual SaveAs four times a day becomes a bit of a bore. Or should I intercept these messages directly from my pop3 mail server.
Read/write To Excel Or Same Type Of Files.
We need to be able to process invoices through the internet and have the customers be able to download these invoices. We are currently using Excel to do all the information. I was hoping to be able to use a third party program to generate these files, I have looked into .pdf, and xls files. From what I have read, it is pretty much impossible for me to get a script that will read an xls file, write data from a mysql database to it, then send the file to the customer for them to download/view with the new information. Is there a different program that works the same that I might be able to use.. or am I stuck trying to make alot of invoicing data look pretty through html tables?
Security Read Write Files And Folders
when i upload files to my webspace i set permission to my files and folders. Im wondering how im unsafe if i grand a folder or file with write permissions to all/everybody. In fact I have the intelligence to understand that ones can places files to my webspace and then execute them. But I dont have the knowledge how to implement it. How can i write to that folder and files?
List Certain Files In A Dir
I am working on a news script were my members can post what they are currently working on. I have a dir were all of there images are going to be uploaded, and I need to know if the following is possable to do. $username = the members name selected from the database $projname = the projects name selected from the database What I want to do is select only images with the filename containing the info. The filenames are like this: TheBlackshinobi_3dmountain_1.jpg TheBlackshinobi_3dmountain_2.jpg TheBlackshinobi_3dmountain_3.jpg
List Dir And Files In Sub Dir
I am trying to make a script that list all of the files in a directory and then if the file in the directory is a sub Directory it will list the files in the subdirectory. If anybody would have a clue how to do this or where to start, please tell. Also in the end i want it to check file dates and delete them if they are older then 3 days, but i dont have a clue where to start on this.
Read A Directory Files, And Create Echo HTML?
i have a foo/ directory and a foobar/ directory, and a barfoo/ directory in root/ for each directory in root, i'll put x or y or z amount of images in each directory. then, have the php write 01.html with the correct links to a) main image, b) thumb images and prev/fwd links. we could have separate php files to handle the drawing of the new sequenced .html files in each directory (probably best to pass variables), because they're slightly different, or one to rule them all (sounds like too much work). then, the syntax would need to be sorted out (so index.html has a link to foo/foo.php?=foo01) would work correctly and draw up 01.html with the correct images, being that index.html would probably have to have hardcoded variable-passing links. eh? it's sweet, 'cause updating would be fast. upload and delete image files. done. I mean, I know that you could go the database/XML route, but sigh ........
Php Foreach Dir List Files In Dir
I've got some code to loop through a directory and it's sub directories and bring back a list of files and folders. What im wanting to do is have this in a state where i can put all info into a database so i can quickly index and then see what files are in what folders. It's all my security camera triggerd avi files. The following code will loop through an give me an array of files and folders Code:
Get A List Of Files On A Website
I need to get a list of all files in a particular virtual directory on a web site, such as - http://www.myServer.com/FileStore I tried using the directory functions, but this doesn't work. if($dirHandle = opendir("http://www.myServer.com/FileStore/")) { while(false !== ($file = readdir($dirHandle))) { print($file."<br>"); } } closedir($handle); } Is there a way to do this?
How Does One Get A List Of All Files In A Folder?
need a list of all files (i have like 5k or so) in a folder, I need to add there names to a table I am doing this so i can compare two tables table 1. comments added to uploaded pics -finished pictures- table 2. no comments added yet to uploaded pics (so they can be commented on GET IT?) -unfinished pictures- All the pictures are in a single folder for the time being i'm going to be making a form based on the pictures that are on table 2 so that they can have comments and titles and file name added to table 1 (to be done still) but i need to know all the file names for the folder in question, i guess i could do it via cmd line ls or something like that, i'll get back to you.
List Php Files In Directory.
I am creating a plugins folder that I will use to store php files. I also store other folders within that "plugins" folder. The problem I have is getting the script to read only the the .php files and skip subfolders. Plugins[main folder] ->plugin1.php ->plugin2.php ->screenshot[folder] ->downloads[folder] How to keep the script from checking the folders (screenshots, downloads..) This part of my script filters the main folder and parent but not subfolders if ($file!= "." && $file!= "..") { How do i get that code to not check subfolders.
Dropdown List Of Files In Folder
I am preparing a form that includes a drop-down list consisting of the names of files in a certain folder on the server. I only need to trap the file name (jpg), not the path and I'm not trying to upload the files or anything - simply allow the user to select one of a number of different image files (they're actually location maps).
How Do I Edit A List Of Files Associated With A Product ?
-I wrote a script that you use it to add products in the database. -Each product is associated with files. -In the Form to add the product you have to enter the product name in a textfield and below there are $no_of_add_file filefields. $no_of_add_file is an integer that determines the Maximum number of filefields that you want to associate/add for each product. So it succesfully adds the product and the files in a database and the filesystem. The problem I am trying to solve is how am I going to edit those files in the product. If you know what I mean... and you have done something like that or you know a url or script that does that, pls let me know. What I need mostly, is not the PHP code but the logic and what are the possible ways of doing something like that. In the database i have two tables that this script needs: One is the products and the other the files. Products : product_id, product_name Files : file_id, file_name, product_id
Generating A List Of Files On Another Server
I have been messing about with the folder / file functions on the php.net website but they all seem to be for local folders. All I am trying to do is generate a list of files on another servers folder - so my variable to generate a list from would be "www.tnauk.org.uk/bbs/daily" but the script would be running on nimmox.com. Is it possible?
List Files In Directory Excluding Directories
I have the following code which I require to get the list of files in a given directory. However in that given directory I have other directories as well. I thought the second if condition was taking care of excluding the directories, but its not. I get a bunch of directories listed along with the files. PHP Code:
List Of Files Fetched Via Include() Or Require()
I want to be able to, at the end of an executed file, summarize what files it included and required (via include() and require()). I have a very dynamic script that depending on the situation handles several different files and scripts. To aid in developing, listing them would be helpful, to troubleshooting problems. Iss there a way to list all the files that have been included along the way?
Create PHP Pages From List Of Files In Directory
this is probably easy for a php pro... but I cant figure it out.. I have a directory of mp3 files named like this. Chevy_Car_Commercial.mp3 There are about 150 files. I am trying to find a script that will make php pages based on the file names. chevy_car_commercial.php And also dump that variable title Chevy Car Commercial into the <title> of the web page... I have made dynamic pages before... but that was using a form..
List Files In Directory For Apache Alias
I want to list the files in a given <dir> with a given file extension ... opendir() or scandir() would seem to be my solution. BUT! those files are outside the root dir of the site ... accessed via an apache alias. so opendir() and similar functions do not seem to work as I cannot feed it a relative path. is there a way to do this? my page: <http://myintranet/prodinfo/listdir.php> http location of dir to be listed: <http://myintranet/dailies/> /dailies/ is an alias pointing elsewhere on the server. indexing has been turned on for this alias in apache, so loading the above URL shows the dir contents by default. so for example ... this works because /images is in the root of the web dir: $myDir = "../images/"; $scanFiles = scandir($myDir); print_r($scanFiles); this does not work as dailies is an alias and not a dir in the web root: $myDir = "../dailies/"; $scanFiles = scandir($myDir); print_r($scanFiles); one option I see is to grab the html of that apache auto-generated index page and parse the content to grab the links out of it. but this seems rather roundabout, and with all the great php file tools, I'm hoping there's a much simpler way. does anyone have any ideas, or is there some addtl info I can provide to make my question clearer?
Fgetcsv Returns False In Dynamic Read Vs. Hard-coded Read ??
I am working with directories in PHP for the first time. I have code that I've changed multiple times to try different things. I would think this is pretty standard fare so I'm not sure why I can't seem to get it right. What I would like to see happen: The code opens the directory and loops through the files, opening them and processing them. What is happening: If I hard code the name of one particular file (it is always the same file) in my test setting, fgetcsv does not return false and the code runs fine. The file is parsed and all is well. However, if I let the code open a directory and then loop through the files, this one particular txt file does not work. For debug purposes, I have it displaying each file name and it can display the name, it just won't process it. I've even tried setting a for loop and hard coding each file name (since right now I know the names - I won't in the future) and the file is processed. It is only when it is set to my $file var dynamically rather than being hard coded. Here is the code: $handle_dir = opendir('../directory_name'); /* loop over the directory. */ $countfile=0; while (false !== ($file = readdir($handle_dir))) { $countfile++; $filevalues = ""; //Skip the first two files that where found because they are "." and ".." if ($countfile 2) { //echo $file; //begin loop through each file name $handle = fopen($file, "r"); echo "Filename is: $file<BR>";//at this point the code can print the file name if (false == ($filevalues = fgetcsv($handle,6021,','))){ echo 'problems<br>'//for one particular file, this always displays }
Print Function Won't Print?
I have been using echo in PHP but I saw most examples use the print function so I tried it, but It wouldn't display anything on the page, I am trying this on a localhost. I used echo instead and it works...so I was just wondering what is it that I haven't setup that the print function isn't working. This was the code i using: session_start(); print($counter); $counter++; session_register("counter");
List Contents Of A Folder, Make List Of Links
Does anyone know how I can write a script that: - reads in all the files in a particular directory - displays the file names in a html list and makes a link of them: <ul> <li><a href="filelocation1">filename 1</li> <li><a href="filelocation2">filename 1</li> <li><a href="filelocation3">filename 1</li> </ul> etc.? So basically it creates a list of links with the contents in that directory, so you can download them from there.
Get List Of Messages From One Table, Message List Indicator From
I have two tables. One has a list of messages left by users using fields named mbxno for the mailbox and msgno for the message number. I have another table that has mailbox settings for each user that contains a field named "messagelist" to indicate if they want to be included on the message list or not. What I'm trying to create is a list of the most-recent messages with a lookup on the users table to indicate whether a message in the list should be included in the message list based on the user's mailbox settings. SELECT messages.msgno, messages.mbxno, users.messagelist FROM messages, users WHERE (users.messagelist = Ƈ') ORDER BY msgno DESC LIMIT 100 What I'm getting, though is a list that looks like this: mbxno: 1114 msgno: 0412141623 msglist: 1 mbxno: 1114 msgno: 0412141623 msglist: 1 mbxno: 1114 msgno: 0412141623 msglist: 1 mbxno: 1114 msgno: 0412141623 msglist: 1 mbxno: 1114 msgno: 0412141623 msglist: 1 mbxno: 1114 msgno: 0412141623 msglist: 1 mbxno: 1114 msgno: 0412141623 msglist: 1 mbxno: 1114 msgno: 0412141623 msglist: 1 I think what's happening is that I'm using the wrong type of join and more rows are being created than necessary. If I add "DISTINCT" to the query, I get a list of the most-recent messages as I expect, but the "messsagelist" value is sometimes wrong (again, probably because the data is getting jumbled). For example, the messagelist value for the second row (2214) should be 0, not 1. mbxno: 1114 msgno: 0412141623 msglist: 1 mbxno: 2214 msgno: 0412141622 msglist: 1 mbxno: 2189 msgno: 0412141408 msglist: 1 mbxno: 0000 msgno: 0412141213 msglist: 1 mbxno: 0003 msgno: 0412141213 msglist: 1 mbxno: 2265 msgno: 0412132029 msglist: 1 mbxno: 0000 msgno: 0412131950 msglist: 1 How should I be doing this? If nothing else, what kind of join will work with a long list compared to a value from a short list?
The DOT (+ereg)
I have this simple code that rejects certain characters : if (ereg('([/1-9!@#$%^&*-_()|:;<>?"])', $name)) { echo 'not allowed' } Trouble is that it also rejects the dot or period (.) yet the dot is not included in the class above What can be added to that criteria to make it *allow* the dot? Would appreciate your help.
Ereg Help
I have the following code: if (!empty($aantal)) { $theresults = ereg("[0-9]", $aantal, $trashed); if ($theresults) {$isamatch = "Yes"; } else { $isamatch = "No"; } if ($isamatch == "No") { echo "<SCRIPT>alert("ERROR: Geen correct aantal");</SCRIPT>"; $aantal = "0"; } } When I run this it only filters the first character so when the value = 1.3 he just ignore it. but when it`s .1 it gives the error.
Ereg I
I've installed Apache 2.0.48 and PHP 4.3.4 on a workstation running Linux, RedHat 9.0. Let's consider the following piece of code: $patt = "[0-9]{3}/[0-9]{6}"; if (ereg("^$patt$",$matricola)) echo "foo1"; else echo "foo2"; Why the output is "foo1"? It should be "foo2". I 've tried the same code to another PHP & Apache installation (sorry but I do not remind the version) on a windows box and it works fine.
Ereg
Can you use ereg to find two different words in a string (I'm trying to look for AND and OR) and then do two more ereg's to look for those same words but seperately.
Ereg And Url
do any of you have a working ereg() that converts a url string into a link? say i want to read through a block of text to replace url text with actual links? how would that ereg() look?? the kind of urls i want to be able to convert is: www.somedomain..... http://www.somedomain..... http://somedomain....... ftp://somedomain.......
A Little Ereg
I need an ereg that satisfies the following rule: The slash character "/" can only occur in the string, if it's surrounded from both sides with space characters " ". For example, foo / bar is ok (spaces on both sides), foo/bar is not ok (no spaces) foo/ bar is not ok (space only on one side)
Ereg
I want my users to have to use at least 4 alphabetic characters (a-zA-Z)and at least 2 alphanumeric characters (0-9) for their passwords. Here is what I tried: ----------------------------------------------------------------------------- if (ereg("([a-zA-Z]{4,}[0-9]{2,})",$variable,$regs) echo "Syntax OK"; else echo "Syntax not OK"; ----------------------------------------------------------------------------- It only works if I have 4 alphabetic characters or more followed by 2 alphanumeric characters or more. It doesn't work if I have the numbers at the begining of the password or in the middle or one in the middle and another at the end.
Ereg Question
Hi, I want to use ereg to check wether the input from a field consists of only numbers. I tried the following line of code: if(ereg([0-9])) but then everything is accepted. Now I've got the other way: if(ereg("[.,~`@#!$%^&*/(/)-/+_=/{}<>/?/|/a-zA-Z]",$amount[$i])) this works, but I want a more normal way. I hope that anyone can help me. Thanks in Advance, Corine
Ereg Expression Help Please
Hi there, Am trying to figure out the expression I use with ereg to check my email and password format. Doesn't workout quite right tho. For password I have... if (ereg("[^a-zA-Z0-9]",$login_password)) { I think this works OK - but still to test. In the password I only want upper/lower case alpha and numeric characters entered. It's the email one I'm stuck on. I want it to check the input for having one @ character and one or more . characters - also bearing in mind that some email addresses use xx.xx@xx.xx format Is there a neat way to do this?
Ereg Problem.... Can You Help?
Ok, heres the story, I am trying to build a script that parses a html txt document for <span class="????" name="????"> blah blah blah blah <b> blah </b> blah </span>. from this i need it to output 3 variable arrays ... or one sequencial variable. The variables being 1. the class ???? bit 2. the name ???? bit 3. all the text between the <span> tags. There will be more than one <span... </span> tag set in the document. for some reason the ereg function works fine for one <span> tag but no more than that, after one it starts giving garbled results. i think it looks backwards for the </span> tag. any way, heres what i tried...
Ereg Problem
I want to assign data coming from a form to a variable. I want if $your_code exist in data coming from form then value assign to $new variable otherwise assign to $old variable but the function ereg does not recognizing the $ as a normal text, and always assign the text value to $old even $your_code exist. It works when I remove the $ from $your_code, what is worng with code, can some1 help? ########## if ($_REQUEST['title'] == "start") { $template = $_REQUEST['text']; if(ereg('$your_code', $template)) $new = $template; else $old = $template . " " . '$your_code' } else error_function(); ##########
Ereg Question
I have a little problem with ereg (eregi) in PHP - in some cases it behaves differently than I expect and I don`t know if my expectations are strange or there is any "syntax subtlety" I have missed. I want to find a value for key1 in string: key1=>value_of key1[EOT]key2=>other_value[EOT]key3=>value[3][EOT] and I use an ereg pattern ereg("key1=>([[:print:][:space:]]*)[EOT]",$line,$regs); unfortunately ereg match differs from "value_of key1", which I wanted to receive. Ereg finds the last apperance of [EOT] in string $line and the value of $regs[1] is "key1=>value_of key1[EOT]key2=>other_value[EOT]key3=>value[3]" Can I achieve an effect, that ereg matches the first occurence of [EOT] and as a result I`'ll get "value_of key1" as a result?
|