/    Sign up×
Community /Pin to ProfileBookmark

How to write to folder name to text file with some customization.

I could use some help. I am fairly sure that this can work with php.

I am trying to find a way for php to read the name of a folder and write it to a specific location in a text file.

or something similar.

Example

[url]http://mydomain.com/linda[/url]

Hello <insert> and thank you for visiting your webpage.

Hello “Linda” and thank you for visiting your webpage.

The insert would need to be “l” would be needed to convert to uppercase.

The goal is for this not to happen if the come back again: Hello “Linda Linda” and thank you for visiting your webpage.

The goal is then to have the flash (swf) file read the the text file and input it into the flash portion of the website.

I managed to get this work just using java script and writing it to a html webpage. With help from some good folks from the javascript side of the forum. But to get the work in flash I will need it to pull from a txt file, I think that would be the simpliest method.

The goal is load this into about 300-1000 folders with each having a unique folder name. They will not be logging in or creating any traditional method for pulling custom data from a database.

any thoughts or ideas?

Thanks

LL

to post a comment
PHP

7 Comments(s)

Copy linkTweet thisAlerts:
@LightlordauthorJun 15.2008 — How about just getting php to read the name of the folder and writing it to a text file on the server.

I might be able to manipulate flash enough so that will be all thats required.



Thanks

LL
Copy linkTweet thisAlerts:
@andre4s_yJun 16.2008 — I will give you the idea of read the name of the folder and writing it to a text file :

1. scan the main directory using scandir() function.

2. loop the array output by the scandir() function to make sure the value is directory, using is_dir() function. done... get the name of the folder.

3. depent on your way to writing it to a text file, which i do not know, you can write it using FileSystem functions, such as file_put_contents() function and fwrite() function. done... writing it to a text file on the server...

Hope that give you idea..
Copy linkTweet thisAlerts:
@SheldonJun 16.2008 — Are you running this on an Apache server?

I have something different i just made a copy to sort of suit what i think you need.

try this out and let me know if it what you mean.

http://sheldon.ziplinestaging.com/names/

It set's urls like [COLOR="Red"]sheldon[/COLOR]">http://sheldon.ziplinestaging.com/names/[COLOR="Red"]sheldon[/COLOR]

[COLOR="red"]mark[/COLOR]">http://sheldon.ziplinestaging.com/names/[COLOR="red"]mark[/COLOR]

it will then give you the option to save the url/name. it saves it to a log file, which you can also read.

you could really easily modify it to automatically save the url.

Let me know if it is close to what you are looking for.
Copy linkTweet thisAlerts:
@ayveghJun 16.2008 — How many people will be accessing this simultaneously?

If you write to the same text file for every person, somewhere along the line someone will get the wrong name.

To solve this, you'll need to have your flash file track sessions using the same identifier as PHP, and load the text file from a temp file with the same name as the session identifier.

Hope this helps,

ayvegh
Copy linkTweet thisAlerts:
@LightlordauthorJun 16.2008 — Are you running this on an Apache server?

I have something different i just made a copy to sort of suit what i think you need.

try this out and let me know if it what you mean.

http://sheldon.ziplinestaging.com/names/

It set's urls like [COLOR="Red"]sheldon[/COLOR]">http://sheldon.ziplinestaging.com/names/[COLOR="Red"]sheldon[/COLOR]

[COLOR="red"]mark[/COLOR]">http://sheldon.ziplinestaging.com/names/[COLOR="red"]mark[/COLOR]

it will then give you the option to save the url/name. it saves it to a log file, which you can also read.

you could really easily modify it to automatically save the url.

Let me know if it is close to what you are looking for.[/QUOTE]



where you have http://sheldon.ziplinestaging.com/names/

It would need it to auto write : "Names" into the text file on the server in the same folder. Without any user intervention

i.e.

http://sheldon.ziplinestaging.com/john/ = autowrite Bob to text file without any prompting from the user

http://sheldon.ziplinestaging.com/bob/ = autowrite Bob to text file without any prompting from the user


here is the live javascript example: http://mmpventuresgroup.us/erica


Thanks!

LL
Copy linkTweet thisAlerts:
@LightlordauthorJun 16.2008 — How many people will be accessing this simultaneously?

If you write to the same text file for every person, somewhere along the line someone will get the wrong name.

To solve this, you'll need to have your flash file track sessions using the same identifier as PHP, and load the text file from a temp file with the same name as the session identifier.

Hope this helps,

ayvegh[/QUOTE]



Good point. each folder will have its own flash file that will read from only that folder. The folder name will be a constant. However there is the issue after the go to the folder more than once, it will contain the same name twice.

I think the solution is to have php overwrite the text file each visit to the folder.


Thanks

LL
Copy linkTweet thisAlerts:
@SheldonJun 22.2008 — where you have http://sheldon.ziplinestaging.com/names/

It would need it to auto write : "Names" into the text file on the server in the same folder. Without any user intervention

i.e.

http://sheldon.ziplinestaging.com/john/ = autowrite Bob to text file without any prompting from the user

http://sheldon.ziplinestaging.com/bob/ = autowrite Bob to text file without any prompting from the user


here is the live javascript example: http://mmpventuresgroup.us/erica


Thanks!

LL[/QUOTE]

Hi, My code will do what you asked, It is working from a deeper dir lever as I do a lot of test sites and scripts at the url.

It will easily work for the root dir, and work automatically.

I'll clean it up and upload it for you. But it should work as requested.

It would work as easily using a database, which could end up being a better option ?
×

Success!

Help @Lightlord spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...