Jump to content

ajoo

Members
  • Content Count

    815
  • Joined

  • Last visited

Posts posted by ajoo


  1. Hi, 

    I am using vagrant to fire up my local server. 

    My hosts file for firing the server using the mobile network is as below:

    Quote

    # localhost name resolution is handled within DNS itself.
    #    127.0.0.1       localhost
    #    ::1             localhost
    #    0.0.0.1    mssplus.mcafee.com

    #    192.168.111.17    franchisee.com        # Using Office WIFI

        192.168.89.18    franchisee.com        # Using Mobile WIFI

     

    and my corresponding Vagrantfile is :-

    Quote

    # -*- mode: ruby -*-
    # vi: set ft=ruby :

    Vagrant.configure("2") do |config|
        config.vm.box = "syone/lamp"

       # config.vm.network "public_network", ip: "192.168.111.17"     # Using Office WIFI
        config.vm.network "public_network", ip: "192.168.89.18"    # Using Mobile WIFI      
            #Vagrant v2.0+

        .

        .

     

    With these settings I am able to access my website using chrome on windows. 

    However if I change the settings for using the Office WIFI, i.e. comment out the lines for Mobile Wifi and un-comment those for the Office Wifi,  I get the following error.

    Quote

    This site can’t be reached

    franchisee.com took too long to respond.

    Try:

    Checking the connection

    Checking the proxy and the firewall

    Running Windows Network Diagnostics

    ERR_CONNECTION_TIMED_OUT

    I am sure that previously I have made the switch numerous times and it worked. I wonder why I am unable to switch networks !? I have cleared the DNS Cache as well as the chrome browsing data but that did not help either.

    Hoping that someone can shed some light on this.

    Thanks all !

     


  2. hmm, 

    So I can finally use 

    isset($_POST["whatever"]) && is_string($_POST["whatever"]) && trim($_POST["whatever"]) != ""

    because, as you said, if it's a string, it won't be false or null.

    Thanks.

     

     


  3. Hi !

    @ gw1500se :  While it's complicated I don't think it would require a regex since it's also basic. 

    @requinix : Since this is an input received via ajax, someone can try and doctor the input to try and break the code. Hence I had the == false as well. And since a string won't be equal to false, I am thinking that it may be necessary to check that the input received is indeed a string. Wouldn't that be so ? Would you still go ahead with your code that you pasted above?

    Thanks ! 

     

     


  4. Hi, 

    The following seems to work but still allows for a non string 0.

    (isset($str) && $str !==false && $str !==''){
    .
    .
    .
    
    }

    Maybe I need to check for an is_string as well. I was hoping to find something simpler if it exists.

    Thanks !


  5. Hi, 

    I wish to check for a condition that a string received is not white space or false or null but it should allow the string '0'.

    This must be a very simple problem but it is definitely quite confusing.

    Thanks loads.


  6. Hi Guru Barand, 

    Thanks loads for your help,

    Sir, so far, there is no further query that requires this data. It will be displayed on the home page of the tutor, so that he can see instantly the 'gap' ( the no of days elapsed between the current and last  login) in logins of the students as well as 'absents', the totals number of days the student has been irregular in the program. He can then use this information to check this rate and minimize it or take suitable action. 

    For this I am actually using a complete separate table. I am doing it wrong as.I am storing the latest values of login and other parameters like lastlogin date, scores, calculated absents etc for each student in table A by taking them off from another table B that stores the same information for each day since the child registers. Then I am using this table A with latest values to display the status, lastlogin date and scores and gaps and absents etc after due calculation in php on the tutor's home page. Creating table A from B is incorrect since its duplication of data.

    With this query, I will to remove table A completely and do the calculations on the fly of gaps and absents and scores ( which were on the fly in any case but I was storing them in table A) to display them on the tutor home page. 

    Thanks loads !🙏

     

     

     

     

     

     

     

     


  7. Hi Guru Barand, 

    I modified your code just a trifle to get the table in the inverse order, and that makes it more accurate as a row has a complete information now for the query that I wish to execute. 

    Here's the code modified just so as also some var names,

    SELECT recno
    , timeoflogout
    , gaps
    , @tot := @tot + IFNULL(gaps,0) as absents
    FROM (
    SELECT recno
     , DATEDIFF(timeoflogout, @prevlog ) - 1 as gaps
     , @prevlog := timeoflogout as timeoflogout
    FROM (
       SELECT recno
    		, timeoflogout
       FROM ajoo 
       ORDER BY timeoflogout ASC
     ) as sorted
     JOIN (SELECT @prevlog := NULL, @tot := 0) as initialise
    )recs;

    which gives the output as

    Quote

    +-------+-----------------------------+--------+-----------+
    | recno | timeoflogout               | gaps | absents |
    +-------+-----------------------------+--------+-----------+
    |     4   | 2019-09-30 13:13:15 | NULL |       0     |
    |    21  | 2019-10-02 07:47:35 |    1     |       1     |
    |    23  | 2019-10-03 13:28:17 |    0     |       1     |
    |    24  | 2019-10-04 21:41:17 |    0     |       1     |
    |    25  | 2019-10-05 11:18:18 |    0     |       1     |
    |    26  | 2019-10-15 16:56:55 |    9     |      10    |
    |    27  | 2019-10-18 16:37:43 |    2     |      12    |
    |    28  | 2019-10-19 12:31:23 |    0     |      12    |
    |    29  | 2019-10-21 15:23:54 |    1     |      13    |
    |    30  | 2019-10-24 17:37:35 |    2     |      15    |

    The row that I now wish to examine is the last row of the table. It seems quite tricky to me to retrieve this value as if I invert the order to pick the first row, the calculated field remains at the last, unchanged, and If i use the recno reference at the end of the query (WHERE recno = 30), the calculated field becomes 0. 

    So How do I retrieve the last row values from the above table, if possible, without creating a temporary table and then querying it?

    Thanks loads !


  8. Any way that we can count and get the total absents in the query itself. 

    I tried as below 

    SELECT recno
    , DATEDIFF(@prevlog, TimeOfLogout) - 1 as absents
    , @prevlog := TimeOfLogout as TimeOfLogout
    , @tot := @tot+ absents as total
    FROM (
    SELECT recno
        , TimeOfLogout
    FROM india_sessdata WHERE StudentLogin = 'nina12345'
    ORDER BY TimeOfLogout DESC
    ) as sorted,
    (SELECT @tot:=0) t
    JOIN (SELECT @prevlog:=NULL) as initialise;

    but it gives this error below 😒

    Quote

    Unknown column 'absents' in 'field list'

    Thanks 

     


  9. Hi Psycho,

    The absents is not part of the table. It was there to show what I wanted as output. So all absents have to be calculated on the fly and then summed to get to the figure of 15 absents on date 30th.  

    Some kind of iterative loop is needed I guess.  

    Thanks.

     

     


  10. hi all !

    I have the following set of data 

    Quote

    +---------+-----------------------------+------------+
    | RecNo |     TimeOfLogout        | Absents |
    +---------+-----------------------------+------------+
    |    30     | 2019-10-24 17:37:35 |               |
    |             |                                    |        2     |
    |    29     | 2019-10-21 15:23:54 |               |
    |             |                                    |        1     |
    |    28     | 2019-10-19 12:31:23 |               |
    |             |                                    |        0     |
    |    27     | 2019-10-18 16:37:43 |               |
    |             |                                    |        2     |
    |    26     | 2019-10-15 16:56:55 |               |
    |             |                                    |        9     |
    |    25     | 2019-10-05 11:18:18 |               |
    |             |                                    |        0     |
    |    24     | 2019-10-04 21:41:17 |               |
    |             |                                    |        0     |
    |    23     | 2019-10-03 13:28:17 |               |
    |             |                                    |        0     |
    |    21     | 2019-10-02 07:47:35 |               |
    |             |                                    |        1     |
    |     4      | 2019-09-30 13:13:15 |               |
    +---------+-----------------------------+------------+
    |             |                                    |       15    |
    +---------+-----------------------------+------------+
     

    The first 2 columns are the data, the 3rd column, absent, is what I wish to calculate at each level of entry and finally then sum of all the absents till that particular entry. So here for example on RecNo 30, the total of all absents so far is 15. I wish to do this using mysql alone.  

    Any help appreciated. 

    Thanks !

     


  11. Hi all !

    I am using the phpgraphlib library for charting. I am using a bar-graph. (example 3 on https://github.com/elliottb/phpgraphlib/commit/d5096c8cbb38d75452f4d7036b7a64979b5e19db). I am displaying the dates on the x-axis. However the dates only show the month and date but the year is cutoff. Is there some way to get the x-axis to move up to accommodate the complete date along the x-axis?

    Thank you.

     

     


  12. Hi,

    This is a probably a wrong way of inserting new email into the DB and can result in race conditions. You should be inserting the new email directly into the DB and your column for ermail ids should be unique so that it throws an exception for duplicate entries.

     

    • Like 2

  13. HI,

    Why can't I import a table into my existing DB using the command below:

     mysql -u root -p mydatabase < file.sql;
    

    This has always worked but now I get the following error.

    Quote

    ERROR 1064 (42000) at line 1: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'mysql  Ver 14.14 Distrib 5.7.27, for Linux (x86_64) using  EditLine wrapper Copy' at line 1
     

    mysql version is 

    Quote

    vagrant@vagrant:~$ mysql --version
    mysql  Ver 14.14 Distrib 5.7.25, for Linux (x86_64) using  EditLine wrapper
     

    Thanks !

     


  14. Hi, 

    No I don't. I did read some posts where they said that these are to be fixed by google at their end but also quite a few which attempted to fix these "irritating" warnings. Hence I thought that I would try and make changes so that these won't appear. I think that the  missed error messages, at the very beginning, created a lot of confusion. 

    So i do nothing at all and let google fix these as and when in some future version?

    Thanks.


  15. Hi, 

    I could have sworn that I posted the error messages but as rightly stated they are not there !😲 Sorry about that.

    Here are the messages that I receive  (15 of them):

    Quote

    A cookie associated with a cross-site resource at http://google.com/ was set without the `SameSite` attribute. A future release of Chrome will only deliver cookies with cross-site requests if they are set with `SameSite=None` and `Secure`. You can review cookies in developer tools under Application>Storage>Cookies and see more details at https://www.chromestatus.com/feature/5088147346030592 and https://www.chromestatus.com/feature/5633521622188032.

    A cookie associated with a cross-site resource at https://mail.google.com/ was set without the `SameSite` attribute. A future release of Chrome will only deliver cookies with cross-site requests if they are set with `SameSite=None` and `Secure`. You can review cookies in developer tools under Application>Storage>Cookies and see more details at https://www.chromestatus.com/feature/5088147346030592 and https://www.chromestatus.com/feature/5633521622188032.


    flogin.php:1 A cookie associated with a cross-site resource at https://mail-ads.google.com/ was set without the `SameSite` attribute. A future release of Chrome will only deliver cookies with cross-site requests if they are set with `SameSite=None` and `Secure`. You can review cookies in developer tools under Application>Storage>Cookies and see more details at https://www.chromestatus.com/feature/5088147346030592 and https://www.chromestatus.com/feature/5633521622188032.


    flogin.php:1 A cookie associated with a cross-site resource at https://google.com/ was set without the `SameSite` attribute. A future release of Chrome will only deliver cookies with cross-site requests if they are set with `SameSite=None` and `Secure`. You can review cookies in developer tools under Application>Storage>Cookies and see more details at https://www.chromestatus.com/feature/5088147346030592 and https://www.chromestatus.com/feature/5633521622188032.


    flogin.php:1 A cookie associated with a cross-site resource at https://drive.google.com/ was set without the `SameSite` attribute. A future release of Chrome will only deliver cookies with cross-site requests if they are set with `SameSite=None` and `Secure`. You can review cookies in developer tools under Application>Storage>Cookies and see more details at https://www.chromestatus.com/feature/5088147346030592 and https://www.chromestatus.com/feature/5633521622188032.

    with different URLS all originating in google.

    I get these messages in chrome after I deleted the cookies manually and also deleted all the rest in chrome from the settings. 

    In FireFox however, I receive no such messages ??

    Thanks !

     

     


  16. chrome warnings are the same as in the previous message;

    Request Header:

    Quote

    Accept:text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3

    Accept-Encoding:  gzip, deflate, br

    Accept-Language: en-US,en;q=0.9

    Cache-Control: no-cache

    Connection: keep-alive

    Cookie: sec_session_id=bb76fff5de222aab7262f16c21d3b584

    Host: noos-800-tnv-5564-test-project.sp.smiles.cloud

    Pragma: no-cache

    Sec-Fetch-Mode: navigate

    Sec-Fetch-Site: none

    Sec-Fetch-User: ?1

    Upgrade-Insecure-Requests: 1

    User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.87 Safari/537.36

     

    Response Header

    Quote

    Cache-Control:no-store, no-cache, must-revalidate

    Connection:close

    Content-Length:4333

    Content-Security-Policy-Report-Only:default-src 'self'; img-src 'self' data: http:; script-src 'self' data: https://www.google.com/ https://ajax.googleapis.com/ https://www.gstatic.com/ https://noos-800-tnj-5565-test-project.sp.smiles.cloud/; report-uri https://noos-800-tnj-5565-test-project.sp.smiles.cloud/reports/reportcspviolation.php

    Content-Type: text/html; charset=UTF-8

    Date: Thu, 07 Nov 2019 10:29:12 GMT

    Expires: Thu, 19 Nov 1981 08:52:00 GMT

    Pragma: no-cache

    Server: Apache

     

    image.thumb.png.263daaf09a58886f8c39ea5b1b53ccf5.png

     

    image.png.0fbfcb8e26fc9a71afb5f78154e6e66d.png

     

    Here's all the relevant information I think. The cookies in storage shows samesite as none which was earlier blank. The cookies under Network in devops shows samesite as blank. Why does domain and path shows as N/A?

    This is how my site invokes the setting of the cookie on my index page.

    if(!isset($_SESSION)) sess_start();

     and sess_start is the code that I posted in my earlier reply. 

    Thanks ! 

     

     


  17. 	$session_name = 'sec_session_id'; 
            $secure = true; 
            $httponly = true; 
            ini_set('session.use_only_cookies', 1);
            $cookieParams = session_get_cookie_params(); 
    	$cookieParams["domain"] = $cookieParams["domain"]."; SameSite=None";
            session_set_cookie_params($cookieParams["lifetime"], $cookieParams["path"], $cookieParams["domain"], $secure, $httponly);   
            session_name($session_name); 
            session_start();

    Here's the rest of it.

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