Listing help
Author |
Message |
Amailer
|
Posted: Sun Jul 11, 2004 4:59 pm Post subject: Listing help |
|
|
Hey all,
Okay im trying to create a file update log..
it's uses phpBB so all the user info can be gotten from a session, either way..
This is how it's suppose to work..
A user can post the file path to the file they updated, and it ads it to the database with the rows filled in as..
logfileid | userid | date | status
i.e.
1 | 16 | C:/WWW/index.php | 1085894 | 0
2 | 16 | C:/WWW/modules/index.php | 1085894 | 1
3 | 3 | C:/WWW/modules/amailer.php | 1085894 | 1
And when being displayed it should be something like this for each user..
Userid 16:
C:/WWW/index.php 0 <- status
C:/WWW/modules/index.php 1
Userid 3:
C:/WWW/modules/amailer.php 1
and so on and so on.. anyone know how to do this?
Thanks |
|
|
|
|
|
Sponsor Sponsor
|
|
|
octopi
|
|
|
|
|
Amailer
|
Posted: Mon Jul 12, 2004 1:03 pm Post subject: (No subject) |
|
|
hehe, thanks But I got it
either way i got another problem
code: |
$browser = $hits[$i]['hits_browser'];
$total_borwser = $db->total_rows($browser, UNIQUE_HITS_TABLE, hits_browser);
if($browser == 'Netscape (Mozilla)')
{
$netscape = ($total_borwser/$total_hits) *100;
}
elseif($browser == 'MSIE')
{
$msie = ($total_borwser/$total_hits) *100;
}
elseif($browser == 'Lynx')
{
$lynx = ($total_borwser/$total_hits) *100;
}
elseif($browser == 'Opera')
{
$opera = ($total_borwser/$total_hits) *100;
}
elseif($browser == 'WebTV')
{
$webtv = ($total_borwser/$total_hits) *100;
}
elseif($browser == 'Konqueror')
{
$konqueror = ($total_borwser/$total_hits) *100;
}
elseif($browser == 'Bot')
{
$bot = ($total_borwser/$total_hits) *100;
}
elseif($browser == 'Other')
{
$other_browser = ($total_borwser/$total_hits) *100;
}
$total_b = $netscape + $msie + $lynx + $opera + $webtv + $konqueror + $bot + $other_browser;
$os = $hits[$i]['hits_os'];
$total_os = $db->total_rows($os, UNIQUE_HITS_TABLE, hits_os);
if($os == 'Windows')
{
$windows = ($total_os/$total_hits) *100;
}
elseif($os == 'Mac')
{
$mac = ($total_os/$total_hits) *100;
}
elseif($os == 'Linux')
{
$linux = ($total_os/$total_hits) *100;
}
elseif($os == 'FreeBSD')
{
$freebsd = ($total_os/$total_hits) *100;
}
elseif($os == 'SunOS')
{
$sunos = ($total_os/$total_hits) *100;
}
elseif($os == 'IRIX')
{
$irix = ($total_os/$total_hits) *100;
}
elseif($os == 'BsOS')
{
$beos = ($total_os/$total_hits) *100;
}
elseif(os == 'OS/2')
{
$os2 = ($total_os/$total_hits) *100;
}
elseif($os == 'AIX')
{
$aix = ($total_os/$total_hits) *100;
}
elseif($os == 'Other')
{
$other_os = ($total_os/$total_hits) *100;
}
$total_o = $windows + $mac + $linux + $freebsd + $sunos + $irix + $beos + $os2 + $aix + $other_os;
|
that code works... but it makes the page load slower (well not that slow but slower compared to the other sites)...
Any ideas on how to make it load faster? |
|
|
|
|
|
octopi
|
Posted: Mon Jul 12, 2004 2:30 pm Post subject: (No subject) |
|
|
I'd post a solution to your second question, but I'm sure you'd 'get it' right after I posted the anwser. |
|
|
|
|
|
Amailer
|
Posted: Mon Jul 12, 2004 6:12 pm Post subject: (No subject) |
|
|
okay... how about this problem... (i won't 'get it'... I need a solution :S)..
I each log has check box beside them, now the check box is used to indicate if the log has been approved or not.. (or w/e), how do I make it so that I can update the database for the certin log.. ie.. if the log check box is checked, it updated teh database status as 1, if it's un checked, it updates the database status as 0. I know how to send make it so that you can send all the check boxes as the same name ( checkboxname[] should be the name ), but i can't get it to work so that it updates only the one where the id is.. or w/e YOu know what I mean *Sigh* lol... *suck at explaining ... sad* |
|
|
|
|
|
Amailer
|
Posted: Tue Jul 13, 2004 1:29 pm Post subject: (No subject) |
|
|
actually i didn't get the first one to work.. well i did but not the way i want..
It has to be sorted by filelog_userid to work.. but i want it to be displayed in order by filelog_datetime DESEC or w/e.. any clues what to do? |
|
|
|
|
|
wtd
|
Posted: Tue Jul 13, 2004 5:19 pm Post subject: (No subject) |
|
|
Maybe this will help.
code: | $browser_hits = array("Netscape (Mozilla)" => 0,
"MSIE" => 0,
"Lynx" => 0,
"Opera" => 0,
"WebTV" => 0,
"Konqueror" => 0,
"Bot" => 0,
"Other" => 0);
$os_hits = array("Windows" => 0,
"Mac" => 0,
"Linux" => 0,
"FreeBSD" => 0,
"SunOS" => 0,
"IRIX" => 0,
"BeOS" => 0,
"OS/2" => 0,
"AIX" => 0,
"Other" => 0);
$browser_hits[$browser]++;
$os_hits[$os]++;
$total_browser_hits = array_sum($browser_hits);
$total_os_hits = array_sum($os_hits); |
|
|
|
|
|
|
Amailer
|
Posted: Tue Jul 13, 2004 5:42 pm Post subject: (No subject) |
|
|
that didn't work.. |
|
|
|
|
|
Sponsor Sponsor
|
|
|
wtd
|
Posted: Tue Jul 13, 2004 7:05 pm Post subject: (No subject) |
|
|
Try analyzing the code rather than mindlessly copying and pasting.
The basic approach I've demonstrated is to avoid all of those ridiculous conditionals and create an associative array where the index is the string you're looking for, and the thing being indexed is the number of hits attributed to that string.
Now, to increment the number of hits for a particular string (OS, Browser identification), I simply look it up in the array and auto-increment. |
|
|
|
|
|
|
|