Jump to content

Waiting Time


balkan7

Recommended Posts

Hi guys

i have created code when user send msg for new msg must wait 30 minuts, so i wanna show minuts for expire whiout refrshing browser, only that can be whit ajax, but im new whit ajax.

 

code is:

<?php if (isset($_POST['send'])){

$user = $userdata['user_name'];
$zelba = stripinput($_POST['muzicka_zelba']);
$date = time() + 1800;

if ($zelba != ""){
      $result = dbquery("INSERT INTO ".$db_prefix."zelbi VALUES ('', '$user', '$zelba', '12', '0', '$date')");
if ($result) echo "<script type=\"text/javascript\">alert(\"".$locale['007']."\");</script>";
      } else {
$error = $locale['005'];
}
}
$result = dbquery("SELECT * FROM ".$db_prefix."zelbi WHERE korisnik='".$userdata['user_name']."'");
$find = dbrows($result);
//if ($find != 0){
  $row = dbarray($result);
  $date_now = time();
  $minus = $row['date'] - $date_now;
  $expire = date("i", $minus);
  $check_date = date("d-m-Y H:i:s", $row['date']);
	$now = date("d-m-Y H:i:s");
	if ($now < $check_date){
		//$expire = $check_date - $now;
		echo "<br><div align='center'>".$locale['040']."<b>".$expire."</b>".$locale['041']."</div><br>";
 } else {
echo $locale['002']."<br /><form method='post' action='$PHP_SELF'>
<input type='hidden' name='send'>
<table align='center' cellpadding='0' cellspacing='0'>
<tr>
<td class='tbl'>".$locale['003']." <b>".$userdata['user_name']."</b></td>
</tr>
<tr>
<td class='tbl'>".$locale['004']." ".$error."<br /><textarea name='muzicka_zelba' cols='50' rows='4' class='textbox'></textarea></td>
</tr>
<tr>
<td align='center'>
<br />
<input type='submit' class='button' value='".$locale['008']."' onClick=\"this.disabled=true; this.form.submit; this.value='".$locale['009']."'\" /></td>
</tr>
</table>
</form>\n";
  } ?>

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.