<?xml version="1.0" encoding="utf-8"?>
<!-- generator="FeedCreator 1.7.2" -->
<rss version="2.0">
    <channel>
        <title>Lowyat.NET: Latest topics by M15T</title>
        <description></description>
        <link>http://forum.lowyat.net/</link>
        <lastBuildDate>Sun, 14 Jun 2026 20:01:53 +0800</lastBuildDate>
        <generator>FeedCreator 1.7.2</generator>
        <item>
            <title>PHP login, allow only once a day</title>
            <link>http://forum.lowyat.net/topic/3617765</link>
            <description>I have a system which users login to it. Every time a specific user logs in, I store the login date time in a MySQL db using TIMESTAMP:&lt;br /&gt;&lt;br /&gt;Each record in the table has a username, login_date and user_id . it stored in my att_log table.&lt;br /&gt;However, I want to make sure that users can only login once a day. Here my code so far&lt;br /&gt;&lt;br /&gt;    		&lt;!--c1--&gt;&lt;div class='codetop'&gt;CODE&lt;/div&gt;&lt;div class='codemain'&gt;&lt;!--ec1--&gt;&amp;#60;?php&lt;br /&gt; &amp;nbsp;	include&amp;#40;&amp;#39;conn.php&amp;#39;&amp;#41;;&lt;br /&gt; &amp;nbsp;	if &amp;#40;isset&amp;#40;&amp;#036;_POST&amp;#91;&amp;#39;submit&amp;#39;&amp;#93;&amp;#41;&amp;#41; {&lt;br /&gt; &amp;nbsp;	&amp;#036;UserName=&amp;#036;_POST&amp;#91;&amp;#39;id_emp&amp;#39;&amp;#93;; &lt;br /&gt; &amp;nbsp;	&amp;#036;Password=&amp;#036;_POST&amp;#91;&amp;#39;password&amp;#39;&amp;#93;;&lt;br /&gt; &amp;nbsp;	&amp;#036;result=mysql_query&amp;#40;&amp;#34;select * from employee where id_emp=&amp;#39;&amp;#036;UserName&amp;#39; and password=&amp;#39;&amp;#036;Password&amp;#39; &amp;#41;or die &amp;#40;mysql_error&amp;#40;&amp;#41;&amp;#41;; &lt;br /&gt; &amp;nbsp;&lt;br /&gt; &amp;nbsp;	&amp;#036;count=mysql_num_rows&amp;#40;&amp;#036;result&amp;#41;;&lt;br /&gt; &amp;nbsp;	&amp;#036;row=mysql_fetch_array&amp;#40;&amp;#036;result&amp;#41;;&lt;br /&gt; &amp;nbsp;&lt;br /&gt; &amp;nbsp;	if &amp;#40;&amp;#036;count &amp;#62; 0&amp;#41;{&lt;br /&gt; &amp;nbsp;	&amp;#036;_SESSION&amp;#91;&amp;#39;emp_id&amp;#39;&amp;#93;=&amp;#036;row&amp;#91;&amp;#39;emp_id&amp;#39;&amp;#93;;&lt;br /&gt; &amp;nbsp;	mysql_query&amp;#40;&amp;#34;insert into att_log &amp;#40;username,login_date,id&amp;#41;values&amp;#40;&amp;#39;&amp;#036;UserName&amp;#39;,NOW&amp;#40;&amp;#41;,&amp;#34;.&amp;#036;row&amp;#91;&amp;#39;emp_id&amp;#39;&amp;#93;.&amp;#34;&amp;#41;&amp;#34;&amp;#41;or die&amp;#40;mysql_error&amp;#40;&amp;#41;&amp;#41;;&lt;br /&gt;&lt;!--c2--&gt;&lt;/div&gt;&lt;!--ec2--&gt;&lt;br /&gt;&lt;br /&gt;how do i write a right statement to check case if the user_id have login on the same dates, it will reject, before it being insert into att_log table.&lt;br /&gt;With the current code, it will continuously insert the same user again and again.&lt;br /&gt;Newbie here  &lt;!--emo&amp;:help:--&gt;&lt;img src='http://static.lowyat.net/style_emoticons/default/icon_question.gif' border='0' style='vertical-align:middle' alt='icon_question.gif' /&gt;&lt;!--endemo--&gt;</description>
            <author>M15T</author>
            <category>Codemasters</category>
            <pubDate>Tue, 23 Jun 2015 22:58:27 +0800</pubDate>
        </item>
    </channel>
</rss>
