You are here: Re: Useronline code does not work ?? any ideas « PHP Language « IT news, forums, messages
Re: Useronline code does not work ?? any ideas

Posted by Hilarion on 08/22/05 15:19

> > > > > ('$timestamp','$REMOTE_ADDR','$PHP_SELF')");
> > > >
> > > > $_SERVER['REMOTE_ADDR'] and $_SERVER['PHP_SELF'].
> > >
> > > No - sorry that dosn't work.
> > >
> > > Any other ideas, from behind an Apache server.
> >
> > It will work if used properly:
> >
> > $query = 'INSERT INTO useronline ( timestamp, ip, file ) '
> > . "VALUES ('" . mysql_escape_string( $timestamp ) . "', "
> > . "'" . mysql_escape_string( $_SERVER['REMOTE_ADDR'] ) . "', "
> > . "'" . mysql_escape_string( $_SERVER['PHP_SELF'] ) . "' )";
> > echo $query . "<br />\n";
> > $insert = mysql_db_query( $database, $query );
> > if ($insert===FALSE)
> > echo mysql_error() . "<br />\n";

>
> No sorry that does not work, all I get displayed is
>
> INSERT INTO useronline ( timestamp, ip, file ) VALUES ('1124698488',
> '82.15.78.135', '/family_search4/familysearch.php' )
> insert command denied to user: 'user@localhost' for table 'useronline'

This means that the user called "user" does not have correct privileges
to perform INSERT.


> But its giving me the ip address etc and thats more information than I
> managed to get.

As you see the solution Anze gave you ($_SERVER['REMOTE_ADDR']
and $_SERVER['PHP_SELF']) was correct one. Next time when some solution
you get here does not work, then doble check your code, check what
results you get (by using echo on your query statement before execution),
and what error messages you get (like mysql_error). If you still do
not get the code to work, then write how did you try to use given
solution and what results you got.


> I've checked on the priviliges for that database and table and
> evertthing seems correct

I do not know MySQL good enough to give you any hints on that, but it
really looks like you did not give proper rights to the user called "user".


Hilarion

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация