473,480 Members | 1,799 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

updating an html page via a php script

Hello,
I've got a page, actually a friend does, that he'd like to update with
his schedule for the week. THis is a simple html page, and he'd like to do
this via a php script. Ideally one would load the page, see a current week
schedule if any, or nothing if there is none, and be able to add events.
This should be as simple as possible and not require a database for this is
simple text entry. I've fofilled part of this, i can open the index file,
and write information to it, but i'm not sure how to lock the file so
simultaneous writes can not occur and i do not know how o place the
information in a specific area.
Any help appreciated.
Thanks.
Dave.
Jul 17 '05 #1
5 1937
jn
"dave" <dm*******@woh.rr.com> wrote in message
news:HC*******************@fe3.columbus.rr.com...
Hello,
I've got a page, actually a friend does, that he'd like to update with
his schedule for the week. THis is a simple html page, and he'd like to do
this via a php script. Ideally one would load the page, see a current week
schedule if any, or nothing if there is none, and be able to add events.
This should be as simple as possible and not require a database for this is simple text entry. I've fofilled part of this, i can open the index file,
and write information to it, but i'm not sure how to lock the file so
simultaneous writes can not occur and i do not know how o place the
information in a specific area.
Any help appreciated.
Thanks.
Dave.


Store the text in a text file, and use a script to edit the contents of the
text file.

Then instead of having a plain HTML page display the data, create it as a
PHP page and include() the text file where ever the schedule goes. Or you
can just use a server-side include in a normal HTML page if it is supported.

You can even use flock() to keep multiple people from editing it at the same
time.
Jul 17 '05 #2

Uzytkownik "jn" <us********************************@jasonnorris.ne t> napisal
w wiadomosci news:eh**********************@twister.tampabay.rr. com...
"dave" <dm*******@woh.rr.com> wrote in message
news:HC*******************@fe3.columbus.rr.com...
Store the text in a text file, and use a script to edit the contents of the text file.

Then instead of having a plain HTML page display the data, create it as a
PHP page and include() the text file where ever the schedule goes. Or you
can just use a server-side include in a normal HTML page if it is supported.
You can even use flock() to keep multiple people from editing it at the same time.


You can't keep a file lock between requests, so flocking won't prevent
multile people from editing the same file. To do that you'd need to
implement your own file-based locking mechanism, or go poke around PHP's
session files.

You can also approach the problem this way: Save the md5 of the file in a
session variable, then check the md5 of the file again before overwriting it
with the submitted content. If the md5s don't match, the user gets a error
message, telling him/her that someone has modified the file.
Jul 17 '05 #3
Hello,
Thanks, i thought of that. I can't rename pages, or do anything with
ssi's even though that would be easiest. I need to have like an input area
on a form, where text is entered, then when a submit button is pushed the
information is written to the indicated file. But i'm not sure how to get
the information to a specific place in the file.
Thanks.
Dave.
Jul 17 '05 #4

"dave" <dm*******@woh.rr.com> wrote in message
news:ot*******************@fe3.columbus.rr.com...
Hello,
Thanks, i thought of that. I can't rename pages, or do anything with
ssi's even though that would be easiest. I need to have like an input area
on a form, where text is entered, then when a submit button is pushed the
information is written to the indicated file. But i'm not sure how to get
the information to a specific place in the file.
Thanks.
Dave.


You need to have some server side stuff.
Ideally PHP enabled webspace.
Very easy of you have this.

Ricgard Grove
http://shopbuilder.org
Jul 17 '05 #5

"dave" <dm*******@woh.rr.com> wrote in message
news:HC*******************@fe3.columbus.rr.com...
Hello,
I've got a page, actually a friend does, that he'd like to update with
his schedule for the week. THis is a simple html page, and he'd like to do
this via a php script. Ideally one would load the page, see a current week
schedule if any, or nothing if there is none, and be able to add events.
This should be as simple as possible and not require a database for this is simple text entry. I've fofilled part of this, i can open the index file,
and write information to it, but i'm not sure how to lock the file so
simultaneous writes can not occur and i do not know how o place the
information in a specific area.
Any help appreciated.
Thanks.
Dave.


He should start with a proper database, and stop trying to write one from
scratch (which is what he's doing). Sooner or later, he's going to find more
useful things to do with it and he'll end up rewriting bucket loads of code
to handle databases instead of fiddling with text files and permissions.
It's not even difficult, and it's a skill he can re-use over and over.

Garp

Jul 17 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
1768
by: Paul | last post by:
I have a simple frame-based application where title information appears in a top frame and a lower frame contains the content for the application. One of the needs for this app is for a status...
5
5853
by: Raffi | last post by:
Hi folks, I'm new to JavaScript and need some help. I have a form with a select field. Depending on what is selected in this field, I want to display or not display another select field. For...
3
1777
by: Jim Cobban | last post by:
I have a set of web pages that are organized in pairs. One of each pair contains a graphic and the other is an extended description of the graphic. I am trying to set it up that selecting a single...
10
5777
by: sqlboy2000 | last post by:
Hello all, I have something very simple going on here and I'm scratching my head as to what the problem is. There are 4 items in my project, 2 webforms, a user control, and a module: ...
2
2492
by: Alani | last post by:
Hello All, I'm a new ASP.NET programmer and I want to create a custom control consist of two properties (Number1) and (Number2) and both of them are integers and default value = 0, now I'm...
9
1892
by: paul | last post by:
Hi All, We have a small dilemma. We have the following page: http://giggsey.com/m00Cow.php (don't ask about the content) that we want to turn into an interactive application for some new intake...
2
1761
by: rpjd | last post by:
I am trying to submit entries in a form to a database. I am using " within my submission form and $_POST I am getting the connection to the database but I my script is not executing,...
9
3984
by: mevryck | last post by:
Greetings I have a huge Javascript with inclusion of external scripts and all. I got this by doing a XSLT . Now I have the contents in a Javascript variable, but I'm not able to update the...
2
5678
by: =?Utf-8?B?TUNN?= | last post by:
I have an asp.net page that contains an update panel. Within the update panel, controls get added dynamically. During partial page post backs the controls within the panel will change. I have a...
0
7040
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
6905
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7041
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7080
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
5331
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4772
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
2980
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1299
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
178
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.