Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    PHP




Allow To Edit Within X Hours


I have data that is inserted into a database, one of the fields is named 'time_stamp' and is a "datetime; 0000-00-00 00:00:00" type.

I was wondering how one could make an if statement that will show code (code is just the editing portion of the page) if the 'time_stamp' is less than the 'time_stamp' + 72 hours. Other wise, don't show the code and inform them that they can no longer edit.




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Find Difference In Hours- Edit Code From Days To Hours?
I'm trying to find the difference in hours between one date from another, and my code currently finds the difference in days- could somebody edit the code to use hours instead of days?

$expirationdate[0] = $row3[datetillcompletion];
$startdate[0] = date('Y-m-d');
$startdate = strtotime($startdate[0]);
$expirationdate = strtotime($expirationdate[0]);
$delta = $expirationdate - $startdate;
$final=round($delta/86400);

Add Hours To A Date
I want to show a date coming from mysql (datetime format) to users, logging on from different timezones. Each user has it's own time:When a user logs on a session is created which hold the the time difference from the servertime e.g. user John has $_SESSION['mytime']=2; which means user John is in a timezone 2 hours later than the server.

Now if a servertime gives a datetime value of 2002-20-10 18:15:05 How can I make it display 2 hours later, so it will show 2002-20-10 20:15:05? I know mysql has a Date_add function, but I want to keep my queries as they are already, and keep my datedifferences calculation in my include file. So I am looking for a PHP-coded solution.

Restarting Every 24 Hours
How would i reset a .txt file with a number in it to 0 ever 24 hours?

Add 16 Hours To Datetime
I have a mysql database table that gets the "datetime" column automatically filled when a user fills in the php form page.

$curdate = date("Y-m-d H:i:s");

Trouble is, the database server is in the USA which is 16 hours behind my time. Does anyone know a way to change this so that the 16 hours get added to the datetime?

Adding Hours To Time
Whats the most effective way of adding 3 hours to a time in the format of 1:30 (h:mm), and turning it into a 24 hour format?

I was thinking of turning it into a timestamp and working from there, but it seems a bit inefficient.

Finding Records Within The Last 48 Hours?
I can't seem to find anything on querying to find records dated within the last 48 hours. Not just two days/calendar dates, but 48 actual hours.

I'm hoping to do something like:

SELECT record FROM table WHERE postdate > (NOW - 48hrs)

does that make sense?

Time Again To Show Plus (+) 6 Hours
I want this to show plus (+) 6 hours:

$ftanggal=date("d M Y - H:i", (date("U")));

How?

Update Content Every 24 Hours
I'm looking for some basic guidance on the best method to automate the following task:

1) Pull some basic data / image from a database.
2) 24 hours later go back to database and redo the above to replace current content with new content.

I've looked around and can't find scripts close enough to the above for me to work out the best way to approach it. I know it involves two basic concepts:

1) Some sort of date / time comparison to control the 24hr update sequence (no date or timestamp is included in the Db table to be used).
2) Some way to randomly pick replacement content from the Db by id number.

Any suggestions or script samples are welcome. Not looking for any finished scripting here just pointers / samples on how best to approach it.

Adding 5 Hours To A Time Using PHP?
I would like to take a date of this format:

DATE("Y-m-d H:i:s")
and add 5 hours to it.

Is there an easy way it can be done? I was thinking about just changing the string, but there's too much to acount for (leap years, etc).

Figuring Out When 2 Hours Have Passed
What I'd like to do is this.  get a date and time and determine if it has been a certain amount of time since then.  For example, I make an entry in the database of 11:00pm, and I want to periodically check, and if it is 1:00am or later, then I would update the database.  Any suggestions?

How To Get Current Datetime Plus 24 Hours?
Can I somehow make $expiredate = date('Y-m-d h:s:m') + 24 hours? In my case the date will always be based on the current timestamp, but for future reference I would like to know if you can do it for other dates?

Converting Seconds To Hours:minutes
I have a large number (seconds) that I need to convert into hours and minutes and display it on the page like this:

Time
01:45

That would mean 01 hours and 45 minutes.

Mktime, Date, And Adding Hours
I want to take the current time and add 8 hours using the following format: PHP Code:

Find The Days, Hours, Minutes And Seconds?
I am making a function the will determine the amout of days, hours, minutes and seconds that are in a certian amout of seconds.

For example: $all_seconds = 11405;

I want to have this returned:

$days = 0;
$hours = 3;
$min = 10;
$sec = 5;

Time In Hours-Minutes-Seconds (accumulated)
Time in Hours-Minutes-Seconds (accumulated)

How do I do this?

I have minutes:
$minutes_online = intval((time() - strtotime($data[$i]['dLastLogon']))/60);

Ex:
$minutes_online = 8758;

How do I show this in Hour:Minute:Second - 10:32:22

Check Date And Time And Display A Link Between Certain Hours
I need to write a PHP script that can check the date and time, and if it falls in between certain hours to display a link, and if not display another link.

The application is for a realaudio broadcast which goes live 7-9pm every wednesday. If it's not "live" then the link would be to the archive from the previous show.

Determining Total Of Days, Hours And Seconds Between Two Dates
If i have two timestamps, is there a built in function to give me the different between the two as days, hours and seconds?

Difference In Hours Between Server Time (London) And User's Location
I've spent hours going round in circles with this and really dont get it. I'd like some code which simply works out how many hours ahead/behind a users local time is to the time of the server (in London). It needs to take into account summer time +1 hrs etc.

e.g. the code works out that a user is in Paris (or France) and then works out that they are +1 hr ahead of uk time. This would allow me to add an hour to times stored in databases when they are showed to the users, as the site is an international networking site.

Deduct Date/time From Daste/time To Display Hours/days Difference
what i'm wanting to do is take away date logged from date closed therefore leaving the time between the 2 date/time stamps so that i can work out the average time later on and display as average time: 1day 2hours .

EDIT CSS
i need a script that will allow my to edit the css file through a website. Like without going through the cPanle I could just click a link throught the site and it will allow me to edit it.

PHP Edit Itself?
Can a PHP script edit itself? And if so would it be faster to store/retrieve information this way instead of using a database? Or would it be slower?

Edit/replace?
How would I edit or replace a field of a row in my database?

Edit MySQL Using PHP
I know that I need to include a textbox and everything, but dont know how. In my database I would like to be able to edit it from my website that has a textbox and a button that allows it to change a field in the database and replace it with the text in the box.

Trying To Edit A Txt File
Hi I am trying to edit a text file... the format of which is like

#####abc.conf
poll somethin
proto pop3
via 127.9.02.1
user "me@me.com"
pass "dell"
is me.nutcase
preconnect "abc abc abc abc"
##
poll ak #
proto pop3
via 11.11.22.33
user "ak@bk.com"
pass "eatme"
is nutter
fetchall
preconnect "abs -e -f -f /ss/ss/ "
##

The way i am tryin to edit this file is ....

<?php
$file = "/som/thing/abc.conf"
$dele = "poll ak";
$open = fopen($file, "r+w");
$read = fread($open, filesize($file));
$sep1 = explode($dele, $read);
$sep2 = explode('##', $sep1[1]);

$read = str_replace(array($dele, $sep2[0]), array("", "
"), $read);
fseek($open, 0);
fwrite($open, $read);
fclose($open);

The result of what happens is it delete the tag from poll ak till the ##

but also adds some text at file end like ....

Resource id #2Resource id #2Resource id #2Resource id #2Resource id
#2Resource id #2Resource id #2Resource id #2Resource id #2Resource id
#2Resource id #2Resource id #2Resource id #2Resource id #2Resource id
#2Resource id #2Resource id #2Resource id #2Resource id #2Resource id
#2Resource id #2Resource id #2Resource id #2Resource id #2Resource id
#2Resource id #2Resource id #2Resource id #2Resource id #2Resource id
#2Resource id #2Resource id #2Resource id #2Resource id #2Resource id
#2Resource id #2Resource id #2Resource id #2Resource id #2Resource id
#2Resource id #2Resource id #2defaults
via 11.11.22.33
user "ak@bk.com"
pass "eatme"
is nutter
fetchall
preconnect "abs -e -f -f /ss/ss/ "

Edit Profile
I would like the user to edit their own profile. But how can I retrieve the data in the form to perform update, instead of display as the code below? PHP Code:

Read And Edit Xml With PHP
I'm trying to write some php that will read in some xml and then allow me to modify the tag and write back out to xml.

In the following example, I want to read in 'text_for_paragraph_1',
then allow it to be viewed, edited, and saved back to the xml... I
have absolutely no clue even where to start...

Php Edit Xml File
I have an xml file that looks roughly like this:

<?xml version="1.0" encoding="ISO-8859-1" ?>
<videos>
<video url="new.flv" desc="Guitar Solo" />
</videos>

what i want to be able to do is add more entries like "<video url="new.flv" desc="Guitar Solo" />". How can I get it to add the entry into the right place, so it doesnt show up after the </videos>?

Video Edit
It is possible to upload your own video and then mix it the way you want. Is there available a php library for modifying flv videos to mix them and add effects just like in eyespot. I know for flvtool 2 but i am not sure it will do the thing and i couldnt find any documentation for it.

Edit Regarding Check Box?
I am trying to write a little script that when the user chooses to edit there ad on the site, it will display a list of there images as thumbnails. They then check a box for the images they want to keep. Is this the correct syntax? Code:

Edit Php To Html
I have a website on a cd and is in php format.How do i change from php to html?Or what program should i use so i can publish the website.

Script To Edit Mp3 ID3v2 Tag
I need a script for updating the Title of a mp3 song (ID3v2 tag). I am
sending the data via POST and trying to write to 'Title'.

Edit TXT File If Script Is Not There.
I want this script to instead of saying you're a guest, into deleting a line in a TXT file.

Is this possible?

Below is the script I'm using.

if(stripos(file_get_contents('http://www.othersite.com/page.html'), '<script')!== false)
echo('You're an affiliate.');
else
echo('You're a guest.')

also is it possible to "search" for a tag or something in the text code and delete it?

Edit All_url_fopen In Runtime
Currently in PHP, you cannot use ini_set() to edit allow_url_fopen
during runtime. Has anyone found a workaround or has any other ideas so
that I can use fopen() and file_get_contents() on a file hosted
somewhere else?

Script To Edit Players
i have a (mysql) table called "Players" where I store First name Last name and Category. For adding players I use a dynamiclly create a dropdown menu from the table Category. My question is: In the edit player page I want the selected option in the menu to be selected <option selected value="">?</option> For the value I put the value stored in the Players table, but how do I also get the category name where I put the "?", Do I have to do a new query or can I add something to the existing query? PLEASE HELP :-) I`ve included a part of the script below. Code:

Dir Read / Write / Edit
I have some files in web server in a dir (e.g. /download/*.*) I don’t want any kind of database support.

Objectives:

- I want to upload files in that dir.
- I want to see all files in that dir.
- I want to delete/Edit the files.
- I want to download the files.
- When I click download the files, In case of Image files (or, any file types that the Brower can open) it open automatically open in to that window (But I want it to download only)..

How To Edit Code For Register_globals Off
I have read the manual and several posts for this issue, but can't get it to work. How would this code need to be edited to run with register_globals off. PHP Code:

How Do I Edit The Phpini() File
I need to specify the session.save_path.

Program To Edit Php Online
im looknig for an easy way to edit the script so i dont have to ftp download and upload files manually (maybe a program that when you click open on it it downlods the file via ftp then when oyu save it it uploads it again)

and i need to be able to search throguh several files at once for phrases. for instance ill see a function being called in one file but the function is defined in a different file and i have to hunt for it very annoying. id like to jsut say "search all these files for this sting of text" (something i can do with context if anyones used it before just these files are located on a remote machnie).

Edit XML Like A DB Woth Web Form?
I have a site that takes info from a form and adds it as a record to an
XML file (RSS format), using the XML as a light-weight db.
Now I need to build a web-based management app for the data in the XML
file, where the user can grab a record from the XML file, edit it, and
save the changes back to the XML file....

Edit Apache File On The Fly
I would like to know how to read my apache conf file and for each domain put them into form fields. also would it be easier to keep each virtual hosts in their own files and is this possible? PHP Code:

Updating An Edit Field
I'm trying to alter the value of an edit field which was previously populated from my db.
Code:

Remote File Edit
i want to edit my index.php by www

i print file in 'textarea':

<textarea cols="95%" rows="20" name="text">
<?php
readfile("../index.php");
?>
</textarea>

how can i save contents after editing it (editing in this textarea)?

Edit An Existing Pdf Document
I am having a pdf link on my website
when the user clicks on the link, download window occurs .

But i am not able to edit the pdf.
When the user clicks the pdf it should be downloded with the username
of current user
on each page .
An one more thing i also want to search a specific word from the same
pdf and replace it with user's
additional info.

Done enough googling and completed half of the thing.
But looking for some good url's and help from you guys for completing
it.

Edit Lines In Txt File
i am trying to write data that i have stored in a session back
to a member.txt, but i am unable to work out why it wont write. It
displays the data i have stored in the session ok, but it wont do the
next step! I have used a similiar script in another part of my web
page which works, but this one won't. From my understanding it has
something to do with if statement if($data[0] == $user_id), so i might
be trying to compare the previouis data to the current data stored in
the txt file properly....

Edit The Entries In The Database
I have a script that allows you to edit the entries in the database. All is working fine except when you pull up an entry for editing the subject field only prints out the first word of the subject??? I know the entire subject line is in the database, but only this part of the script won't print it out. All the other fields work fine. Code:

Edit/update - All In One PHP Pages?
Let me explain how I'd generally do things. For a page where the user
edits data, I'd generally call it something like editfred.php (for
example), the page which updates the data would be called
updatefred.php and equally the page which processes a delete would be
deletefred.php. I like splitting the pages up this way, it feels less
cluttered and more organised than throwing all the functionality in one
fred.php.

Here's the problem though. If the user enters erroneous data into the
form editfred.php which is subsequently processed by updatefred.php
then that error needs to be reported to the user. Traditionally what
I've done is have updatefred.php list any errors it finds and then
provide a link to go back or ask the user to hit the back button on
their browser. This is no longer viable, instead I'd like to
automatically throw them back to editfred.php with all their data
already filled in and the fields causing errors to be highlighted. My
question is: what's the best way to do this?

There springs to mind several ways:

1) combine editfred.php and updatefred.php. Again, I'm not keen on this
but it does seem the most logical and programatically easiest.

2) use sessions to store the data, editfred.php would then check
for data in the session each time it's loaded. Is there a maximum data
size for use with session objects?

3) write code to wrap and store the data in a cookie which could then
be read by editfred.php, similar to sessions I believe. However max
cookie size is 4Kb which wouldn't be enough on some forms.

4) store the data from editfred.php in a table in the database which
again editfred.php would check for when loaded. overhead of db access
each time however.

Edit Mysql Record
I want to use a userform on a webpage so members can edit their data.

Displaying the data on the form isn't the problem.
But when members change their data how do i save then new data in their
record. I dont want a new record.

Edit Text In A Txt File
here is the php code!

i am trying to use to 'edit' hyperlink to edit txt in member.txt.
Problem is that it reads the values ok into an array, however when i
attempt and update new values into the file, i get no results. Does
anybody know where i am going wrong????

<? session_start();
// Set updated content for user

if(!isset($_POST[Submit]))
{
// read content from file and place into array, this is used to put
initial content into form
$fc=file("../username/member.txt");
$userid_no = $_GET['record_id'];
$line = split("|",$fc[$userid_no]);
$user_id = $line[0];
$password = $line[1];
$firstname = $line[2];
$lastname = $line[3];
$email = $line[4];

}
else
{
if(isset($_GET['record_id']))
{
// build record into string from post values
$update = $_POST['user_id'];
$update .= "|";
$update .= $_POST['password'];
$update .= "|";
$update .= $_POST['lastname'];
$update .= "|";
$update .= $_POST['firstname'];
$update .= "|";
$update .= $_POST['email'];
$update .= "|";
$update .= "";
$update .= "|";
$update .= "2";

Graphically Edit A Page?
I am a Java programmer who sometimes dabbles in simple PHP stuff, and
had a question that's way over my head, for you PHP experts.

I would like to know how to dynamically edit a cuurently static HTML
page which contains a map of a stands at a convention center. The
static version of the page can be found here:

I would like to be able to *visually* edit this page -- create, modify
(re-shape and move boxes, assign data, etc.), and delete boxes on the
page, and then click on a "Save" button to save the changes in my
database.

I am a feeling what I am asking for is something much more suited to
Flash but I need to do it in PHP. Does anyone know of a graphic editor
out there, something that allows drag-and-drop and stretching of HTML
(DHTML) elements?


Copyright © 2005-08 www.BigResource.com, All rights reserved