Jump to content

[solved] problam with time()


redarrow

Recommended Posts

for some unknown reason the if statement gives a error please advise me cheers.


[code]

<?php

$query_time="select * from member_comments where date_added='".$record['date_added']."' and

time_added='".$record['time_added']."' ";

$result_time=mysql_query($query_time);

while($timmed=mysql_fetch_assoc($result_time)){

$time_added=$timmed['time_added'];

$time_added=strtotime($time_added);

$time_know=(time()+120);

if($time_know > $time_added){

echo " sorry wait 2 minutes please";
}

?>
[/code]
Link to comment
Share on other sites

$time_know=(time()+120);

can you tell me if this is the correct way to add 120 secons

database result


1154863305// from the database as a posted entry.

1154821215// time from time now.

looks very lomg and wrong to me there should only be 2 minutes between them both please help.
Link to comment
Share on other sites

for some strange reason i am always getting the echoed message so i think i proberly not doing this correct i am trying to create a flood controll but not working becouse the word is always echoed.


[code]
$query_time="select * from member_comments WHERE time_added='$time_added' and date_added='$date_added' and user_id='$user_id'

";

echo $query_time;

$result_time=mysql_query($query_time);

while($timmed=mysql_fetch_assoc($result_time)){

$time_check=$timmed['time_sent'];
}

$check=strtotime($time_check);

echo "<br>$check<BR>";

$time_know=time() + 120;

echo "<br>$time_know<br>";

if($time_know > $check){

echo " sorry wait 2 minutes please";
exit;

}

[/code]
Link to comment
Share on other sites

What am i doing wrong please been up all night read the hole php for dumies no luck.

the database is correct and all the settings are correct but the time diffrence does not seem to work please help cheers.

all i get is the echoed message as below cheers.

[code]
<?php
$query_time="select * from member_comments WHERE time_added='$time_added'
and date_added='$date_added' and user_id='$user_id'

";

echo $query_time;

$result_time=mysql_query($query_time);

while($timmed=mysql_fetch_assoc($result_time)){

$time_check=$timmed['time_sent'];
}

$check=strtotime($time_check);

echo "<br>$check<BR>";

$time_know=time() + 120;

echo "<br>$time_know<br>";

if($check < $time_know){

echo " sorry wait 2 minutes please";
exit;

}
?>
[/code]
Link to comment
Share on other sites

solved



[code]
<?php
$query_time="select * from member_comments WHERE time_added='$time_added' and date_added='$date_added' and user_id='$user_id'
";

echo $query_time;

$result_time=mysql_query($query_time);

while($timmed=mysql_fetch_assoc($result_time)){

$time_check=$timmed['time_sent'];
}

$check=strtotime($time_check);

echo "<br>$check<BR>";

$time_know=time()-60;

echo "<br>$time_know<br>";

if($check > $time_know){

echo " sorry wait 2 minutes please";
exit;

}
[/code]
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.