Jump to content

Time and resgister problem


L

Recommended Posts

Hello,

I have two separate problems, so i decided to keep them in one topic. My first problem is with the date and time...well mostly the time. I have a comments script running  where the date and time is inserted into the database.

$date = date("F j, Y | h:i A");
if
($_POST['submit']) { mysql_query("INSERT INTO `news` (`user`, `subject`, `news`, `date`) VALUES ('".$user."','".$subject."','".$news."','".$date."')");}

This all works, but when i check the time in the database, and when the comment is shown, the time is off by an hour. I had myself and a friend test it, and we both got wrong times. I think the problem is that the $date variable is picking the info from the server, which i don;t want. How can I make it so I can take the time and date, from the persons computer show instead?

 

Problem #2.

My second problem is about registration. I created a login script with other features....but the only part that's not working is the confirm password part. I want a user to type the same password two times, one in a Password: Input and the other in a Confirm Password: Input. Does anyone know how i can do this?

Thank you for your time

~L

Link to comment
https://forums.phpfreaks.com/topic/57011-time-and-resgister-problem/
Share on other sites

OH!!! I get it now, thanx for your help. But back to the time problem...

try the mysql function instead of php. use now for the time and even for the date now()

you can use js or php

$date = date("F j, Y | h:i A");
if
($_POST['submit']) { mysql_query("INSERT INTO `news` (`user`, `subject`, `news`, `date`) VALUES ('".$user."','".$subject."','".$news."','".$date."')");}

 

Im not familiar with mysql functions....would i replace the php date stuff with $date = date("now() | now");  ?

ohh..alright....but when i upload it, it shows up blank

 

<?PHP

include("db.php");

?>

<form id='1' name='1' method='post'>

<table width="90%" border="0" cellspacing="0" cellpadding="0">

<tr>

      <td><div align="right">Alias:  </div></td>

      <td><input name="user" type="text" size="30" value=""></td>

  </tr>

  <tr>

      <td><div align="right">Subject:  </div></td>

      <td><input name="subject" type="text" size="30" value=""></td>

  </tr>

      <td><div align="right">News:  </div></td>

      <td><textarea name="news" cols="45" rows="5" wrap="VIRTUAL"></textarea></td>

    </tr>

    <tr>

      <td></td>

      <td colspan="2">   

        <input type="submit" name="submit" value="Submit News"></td>

    </tr>

  </table>

</form>

 

<?PHP

$user = addslashes(strip_tags($_POST['user']));

$subject = addslashes(strip_tags($_POST['subject']));

$news = addslashes(strip_tags($_POST['news'],'<a>'));

$date = date("F j, Y | h:i A");

 

 

if

($_POST['submit']) { mysql_query("INSERT INTO `news` (`user`, `subject`, `news`, `date`) VALUES ('".$user."','".$subject."','".$news."',now())")

 

echo "News Posted";

?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.