Jump to content

PHP Timeclock 1.04 - Updated with new values but getting


jfsinternetmarketing

Recommended Posts

Hello,

 

I was wondering if anyone could help me with PHP Timeclock 1.04.

 

(Using dreamweaver replace and find)

I successfully changed the old values of the "eregi" to "preg_match with the "/" "

:

Find: eregi \(\"([^']+?)\", Replace: preg_match ('/\1/i',

 

I replaced all instances of TYPE=MyISAM with ENGINE=MyISAM in the create_tables.sql file

 

as well as correcting line 100 to say

 

timestamp bigint(14) NOT NULL,

 

instead of timestamp timestamp(14) NOT NULL,

 

When I load the timeclock.php it gives me the following errors I don't know where to start to correct:

 

Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in /home/sarab/public_html/CRISAGENCY.C0M/timesheet/display.php on line 133

 

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/sarab/public_html/CRISAGENCY.C0M/timesheet/display.php on line 6

 

Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in /home/sarab/public_html/CRISAGENCY.C0M/timesheet/leftmain.php on line 186

 

Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in /home/sarab/public_html/CRISAGENCY.C0M/timesheet/leftmain.php on line 215

 

So afterwards, I did another install under the /CRISAGENCY.C0M/timeclock and removed the "mysql_free_result" but it then gave me this:

 

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/sarab/public_html/CRISAGENCY.C0M/timeclock/display.php on line 6

 

Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in /home/sarab/public_html/CRISAGENCY.C0M/timeclock/leftmain.php on line 186

 

Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in /home/sarab/public_html/CRISAGENCY.C0M/timeclock/leftmain.php on line 215

 

Then when I try to go to the administration it says this:

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/sarab/public_html/CRISAGENCY.COM/timeclock/login.php on line 19

 

 

Obviously you can see our domain but I changed the "O" on dot come to 0 in case you want to see whats going on... afterwards I plan to just wrapper it onto our joomla.

 

 

Here is the php info: http://crisagency.c0m/info.php

 

Could anyone help or point me in the right direction?

 

Thanks!

 

Link to comment
Share on other sites

  • 3 weeks later...

Don't remove any code if your not sure what it does, or if you do, pout it back if it doesn't do what you expected.

 

change timeclock.php from:

if (($display_current_users == "yes") && ($display_office == "all") && ($display_group == "all")) {
    $current_users_date = strtotime(date($datefmt));
    $calc = 86400;
    $a = $current_users_date + $calc - @$tzo;
    $b = $current_users_date - @$tzo;

    $query = "select ".$db_prefix."info.*, ".$db_prefix."employees.*, ".$db_prefix."punchlist.*
              from ".$db_prefix."info, ".$db_prefix."employees, ".$db_prefix."punchlist
              where ".$db_prefix."info.timestamp = ".$db_prefix."employees.tstamp and ".$db_prefix."info.fullname = ".$db_prefix."employees.empfullname
              and ".$db_prefix."info.`inout` = ".$db_prefix."punchlist.punchitems and ((".$db_prefix."info.timestamp < '".$a."') and 
              (".$db_prefix."info.timestamp >= '".$b."')) and ".$db_prefix."employees.disabled <> '1' and ".$db_prefix."employees.empfullname <> 'admin'
              order by `$sortcolumn` $sortdirection";
    $result = mysql_query($query);
} 

elseif (($display_current_users == "yes") && ($display_office != "all") && ($display_group == "all")) { 

    $current_users_date = strtotime(date($datefmt));
    $calc = 86400;
    $a = $current_users_date + $calc - @$tzo;
    $b = $current_users_date - @$tzo;

    $query = "select ".$db_prefix."info.*, ".$db_prefix."employees.*, ".$db_prefix."punchlist.*
              from ".$db_prefix."info, ".$db_prefix."employees, ".$db_prefix."punchlist
              where ".$db_prefix."info.timestamp = ".$db_prefix."employees.tstamp and ".$db_prefix."info.fullname = ".$db_prefix."employees.empfullname
              and ".$db_prefix."info.`inout` = ".$db_prefix."punchlist.punchitems and ".$db_prefix."employees.office = '".$display_office."' 
              and ((".$db_prefix."info.timestamp < '".$a."') and (".$db_prefix."info.timestamp >= '".$b."'))
              and ".$db_prefix."employees.disabled <> '1' and ".$db_prefix."employees.empfullname <> 'admin'
              order by `$sortcolumn` $sortdirection";
    $result = mysql_query($query);
} 

elseif (($display_current_users == "yes") && ($display_office == "all") && ($display_group != "all")) { 

    $current_users_date = strtotime(date($datefmt));
    $calc = 86400;
    $a = $current_users_date + $calc - @$tzo;
    $b = $current_users_date - @$tzo;

    $query = "select ".$db_prefix."info.*, ".$db_prefix."employees.*, ".$db_prefix."punchlist.*
              from ".$db_prefix."info, ".$db_prefix."employees, ".$db_prefix."punchlist
              where ".$db_prefix."info.timestamp = ".$db_prefix."employees.tstamp and ".$db_prefix."info.fullname = ".$db_prefix."employees.empfullname
              and ".$db_prefix."info.`inout` = ".$db_prefix."punchlist.punchitems and ".$db_prefix."employees.groups = '".$display_group."' 
              and ((".$db_prefix."info.timestamp < '".$a."') and (".$db_prefix."info.timestamp >= '".$b."'))
              and ".$db_prefix."employees.disabled <> '1' and ".$db_prefix."employees.empfullname <> 'admin'
              order by `$sortcolumn` $sortdirection";
    $result = mysql_query($query);
} 

elseif (($display_current_users == "yes") && ($display_office != "all") && ($display_group != "all")) {

    $current_users_date = strtotime(date($datefmt));
    $calc = 86400;
    $a = $current_users_date + $calc - @$tzo;
    $b = $current_users_date - @$tzo;

    $query = "select ".$db_prefix."info.*, ".$db_prefix."employees.*, ".$db_prefix."punchlist.*
              from ".$db_prefix."info, ".$db_prefix."employees, ".$db_prefix."punchlist
              where ".$db_prefix."info.timestamp = ".$db_prefix."employees.tstamp and ".$db_prefix."info.fullname = ".$db_prefix."employees.empfullname
              and ".$db_prefix."info.`inout` = ".$db_prefix."punchlist.punchitems and ".$db_prefix."employees.office = '".$display_office."' 
              and ".$db_prefix."employees.groups = '".$display_group."' and ((".$db_prefix."info.timestamp < '".$a."') 
              and (".$db_prefix."info.timestamp >= '".$b."')) and ".$db_prefix."employees.disabled <> '1'
              and ".$db_prefix."employees.empfullname <> 'admin'
              order by `$sortcolumn` $sortdirection";
    $result = mysql_query($query);
} 

elseif (($display_current_users == "no") && ($display_office == "all") && ($display_group == "all")) {

    $query = "select ".$db_prefix."info.*, ".$db_prefix."employees.*, ".$db_prefix."punchlist.*
              from ".$db_prefix."info, ".$db_prefix."employees, ".$db_prefix."punchlist
              where ".$db_prefix."info.timestamp = ".$db_prefix."employees.tstamp and ".$db_prefix."info.fullname = ".$db_prefix."employees.empfullname
              and ".$db_prefix."info.`inout` = ".$db_prefix."punchlist.punchitems and ".$db_prefix."employees.disabled <> '1'
              and ".$db_prefix."employees.empfullname <> 'admin'
              order by `$sortcolumn` $sortdirection";
    $result = mysql_query($query);
} 

elseif (($display_current_users == "no") && ($display_office != "all") && ($display_group == "all")) {

    $query = "select ".$db_prefix."info.*, ".$db_prefix."employees.*, ".$db_prefix."punchlist.*
              from ".$db_prefix."info, ".$db_prefix."employees, ".$db_prefix."punchlist
              where ".$db_prefix."info.timestamp = ".$db_prefix."employees.tstamp and ".$db_prefix."info.fullname = ".$db_prefix."employees.empfullname
              and ".$db_prefix."info.`inout` = ".$db_prefix."punchlist.punchitems and ".$db_prefix."employees.office = '".$display_office."'
              and ".$db_prefix."employees.disabled <> '1' and ".$db_prefix."employees.empfullname <> 'admin'
              order by `$sortcolumn` $sortdirection";
    $result = mysql_query($query);
} 

elseif (($display_current_users == "no") && ($display_office == "all") && ($display_group != "all")) {

    $query = "select ".$db_prefix."info.*, ".$db_prefix."employees.*, ".$db_prefix."punchlist.*
              from ".$db_prefix."info, ".$db_prefix."employees, ".$db_prefix."punchlist
              where ".$db_prefix."info.timestamp = ".$db_prefix."employees.tstamp and ".$db_prefix."info.fullname = ".$db_prefix."employees.empfullname
              and ".$db_prefix."info.`inout` = ".$db_prefix."punchlist.punchitems and ".$db_prefix."employees.groups = '".$display_group."'
              and ".$db_prefix."employees.disabled <> '1' and ".$db_prefix."employees.empfullname <> 'admin'
              order by `$sortcolumn` $sortdirection";
    $result = mysql_query($query);
} 

elseif (($display_current_users == "no") && ($display_office != "all") && ($display_group != "all")) {

    $query = "select ".$db_prefix."info.*, ".$db_prefix."employees.*, ".$db_prefix."punchlist.*
              from ".$db_prefix."info, ".$db_prefix."employees, ".$db_prefix."punchlist
              where ".$db_prefix."info.timestamp = ".$db_prefix."employees.tstamp and ".$db_prefix."info.fullname = ".$db_prefix."employees.empfullname
              and ".$db_prefix."info.`inout` = ".$db_prefix."punchlist.punchitems and ".$db_prefix."employees.office = '".$display_office."'
              and ".$db_prefix."employees.groups = '".$display_group."' and ".$db_prefix."employees.disabled <> '1'
              and ".$db_prefix."employees.empfullname <> 'admin'
              order by `$sortcolumn` $sortdirection";
    $result = mysql_query($query);
}

 

to:

if (($display_current_users == "yes") && ($display_office == "all") && ($display_group == "all")) {
    $current_users_date = strtotime(date($datefmt));
    $calc = 86400;
    $a = $current_users_date + $calc - @$tzo;
    $b = $current_users_date - @$tzo;

    $query = "select ".$db_prefix."info.*, ".$db_prefix."employees.*, ".$db_prefix."punchlist.*
              from ".$db_prefix."info, ".$db_prefix."employees, ".$db_prefix."punchlist
              where ".$db_prefix."info.timestamp = ".$db_prefix."employees.tstamp and ".$db_prefix."info.fullname = ".$db_prefix."employees.empfullname
              and ".$db_prefix."info.`inout` = ".$db_prefix."punchlist.punchitems and ((".$db_prefix."info.timestamp < '".$a."') and 
              (".$db_prefix."info.timestamp >= '".$b."')) and ".$db_prefix."employees.disabled <> '1' and ".$db_prefix."employees.empfullname <> 'admin'
              order by `$sortcolumn` $sortdirection";
} 

elseif (($display_current_users == "yes") && ($display_office != "all") && ($display_group == "all")) { 

    $current_users_date = strtotime(date($datefmt));
    $calc = 86400;
    $a = $current_users_date + $calc - @$tzo;
    $b = $current_users_date - @$tzo;

    $query = "select ".$db_prefix."info.*, ".$db_prefix."employees.*, ".$db_prefix."punchlist.*
              from ".$db_prefix."info, ".$db_prefix."employees, ".$db_prefix."punchlist
              where ".$db_prefix."info.timestamp = ".$db_prefix."employees.tstamp and ".$db_prefix."info.fullname = ".$db_prefix."employees.empfullname
              and ".$db_prefix."info.`inout` = ".$db_prefix."punchlist.punchitems and ".$db_prefix."employees.office = '".$display_office."' 
              and ((".$db_prefix."info.timestamp < '".$a."') and (".$db_prefix."info.timestamp >= '".$b."'))
              and ".$db_prefix."employees.disabled <> '1' and ".$db_prefix."employees.empfullname <> 'admin'
              order by `$sortcolumn` $sortdirection";
} 

elseif (($display_current_users == "yes") && ($display_office == "all") && ($display_group != "all")) { 

    $current_users_date = strtotime(date($datefmt));
    $calc = 86400;
    $a = $current_users_date + $calc - @$tzo;
    $b = $current_users_date - @$tzo;

    $query = "select ".$db_prefix."info.*, ".$db_prefix."employees.*, ".$db_prefix."punchlist.*
              from ".$db_prefix."info, ".$db_prefix."employees, ".$db_prefix."punchlist
              where ".$db_prefix."info.timestamp = ".$db_prefix."employees.tstamp and ".$db_prefix."info.fullname = ".$db_prefix."employees.empfullname
              and ".$db_prefix."info.`inout` = ".$db_prefix."punchlist.punchitems and ".$db_prefix."employees.groups = '".$display_group."' 
              and ((".$db_prefix."info.timestamp < '".$a."') and (".$db_prefix."info.timestamp >= '".$b."'))
              and ".$db_prefix."employees.disabled <> '1' and ".$db_prefix."employees.empfullname <> 'admin'
              order by `$sortcolumn` $sortdirection";
} 

elseif (($display_current_users == "yes") && ($display_office != "all") && ($display_group != "all")) {

    $current_users_date = strtotime(date($datefmt));
    $calc = 86400;
    $a = $current_users_date + $calc - @$tzo;
    $b = $current_users_date - @$tzo;

    $query = "select ".$db_prefix."info.*, ".$db_prefix."employees.*, ".$db_prefix."punchlist.*
              from ".$db_prefix."info, ".$db_prefix."employees, ".$db_prefix."punchlist
              where ".$db_prefix."info.timestamp = ".$db_prefix."employees.tstamp and ".$db_prefix."info.fullname = ".$db_prefix."employees.empfullname
              and ".$db_prefix."info.`inout` = ".$db_prefix."punchlist.punchitems and ".$db_prefix."employees.office = '".$display_office."' 
              and ".$db_prefix."employees.groups = '".$display_group."' and ((".$db_prefix."info.timestamp < '".$a."') 
              and (".$db_prefix."info.timestamp >= '".$b."')) and ".$db_prefix."employees.disabled <> '1'
              and ".$db_prefix."employees.empfullname <> 'admin'
              order by `$sortcolumn` $sortdirection";
} 

elseif (($display_current_users == "no") && ($display_office == "all") && ($display_group == "all")) {

    $query = "select ".$db_prefix."info.*, ".$db_prefix."employees.*, ".$db_prefix."punchlist.*
              from ".$db_prefix."info, ".$db_prefix."employees, ".$db_prefix."punchlist
              where ".$db_prefix."info.timestamp = ".$db_prefix."employees.tstamp and ".$db_prefix."info.fullname = ".$db_prefix."employees.empfullname
              and ".$db_prefix."info.`inout` = ".$db_prefix."punchlist.punchitems and ".$db_prefix."employees.disabled <> '1'
              and ".$db_prefix."employees.empfullname <> 'admin'
              order by `$sortcolumn` $sortdirection";
} 

elseif (($display_current_users == "no") && ($display_office != "all") && ($display_group == "all")) {

    $query = "select ".$db_prefix."info.*, ".$db_prefix."employees.*, ".$db_prefix."punchlist.*
              from ".$db_prefix."info, ".$db_prefix."employees, ".$db_prefix."punchlist
              where ".$db_prefix."info.timestamp = ".$db_prefix."employees.tstamp and ".$db_prefix."info.fullname = ".$db_prefix."employees.empfullname
              and ".$db_prefix."info.`inout` = ".$db_prefix."punchlist.punchitems and ".$db_prefix."employees.office = '".$display_office."'
              and ".$db_prefix."employees.disabled <> '1' and ".$db_prefix."employees.empfullname <> 'admin'
              order by `$sortcolumn` $sortdirection";
} 

elseif (($display_current_users == "no") && ($display_office == "all") && ($display_group != "all")) {

    $query = "select ".$db_prefix."info.*, ".$db_prefix."employees.*, ".$db_prefix."punchlist.*
              from ".$db_prefix."info, ".$db_prefix."employees, ".$db_prefix."punchlist
              where ".$db_prefix."info.timestamp = ".$db_prefix."employees.tstamp and ".$db_prefix."info.fullname = ".$db_prefix."employees.empfullname
              and ".$db_prefix."info.`inout` = ".$db_prefix."punchlist.punchitems and ".$db_prefix."employees.groups = '".$display_group."'
              and ".$db_prefix."employees.disabled <> '1' and ".$db_prefix."employees.empfullname <> 'admin'
              order by `$sortcolumn` $sortdirection";
} 

elseif (($display_current_users == "no") && ($display_office != "all") && ($display_group != "all")) {

    $query = "select ".$db_prefix."info.*, ".$db_prefix."employees.*, ".$db_prefix."punchlist.*
              from ".$db_prefix."info, ".$db_prefix."employees, ".$db_prefix."punchlist
              where ".$db_prefix."info.timestamp = ".$db_prefix."employees.tstamp and ".$db_prefix."info.fullname = ".$db_prefix."employees.empfullname
              and ".$db_prefix."info.`inout` = ".$db_prefix."punchlist.punchitems and ".$db_prefix."employees.office = '".$display_office."'
              and ".$db_prefix."employees.groups = '".$display_group."' and ".$db_prefix."employees.disabled <> '1'
              and ".$db_prefix."employees.empfullname <> 'admin'
              order by `$sortcolumn` $sortdirection";
}
$result = mysql_query($query) or die("<h1>MYSQL QUERY ERROR</h1>\n<b>Query:</b> ".$query."\n<br/><br/>\n".mysql_error());

 

Basically, "Not a valid mysql result resource" means a query failed somewhere (if the code is supposed to work). Make sure you testing this with all errors and notices turned on. especially if your converting old code.

 

Tell us what it says.

 

 

Good luck.

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.