[Phpmyadmin-devel] current user

Hi, I am using the following code to extract currently logged user name from PMA_DBI_fetch_value('SELECT USER();') // $userAndHost = PMA_DBI_fetch_value('SELECT USER();'); // $userAndHost = str_split($userAndHost); // while ($i=0 < count($userAndHost)-1) { // $username += $userAndHost[$i]; // $i++; // if ($userAndHost[$i] == "@") { // break; // } It takes a lot of time to load up the web page mainly due to the code above. Is there any alternative to this? Thanks! P.S. follow my live progress update streams at zixan.info. I find it is much more effective way to communicate more frequently. -------------------------------------------------- Best regards, Zeeshan Mughal Email: zeeshanmughal@ieee.org Web: http://www.zixan.info

Hi Dne Wed, 15 Jul 2009 01:45:36 -0400 Zeeshan Mughal <zeeshanmughal@ieee.org> napsal(a):
Hi, I am using the following code to extract currently logged user name from PMA_DBI_fetch_value('SELECT USER();')
// $userAndHost = PMA_DBI_fetch_value('SELECT USER();'); // $userAndHost = str_split($userAndHost); // while ($i=0 < count($userAndHost)-1) { // $username += $userAndHost[$i]; // $i++; // if ($userAndHost[$i] == "@") { // break; // }
Going chars one by one is not a good idea. How about just explode('@', $userAndHost)[0]? But anyway current user is available as $GLOBALS['cfg']['Server']['user'] without need for any parsing and querying MySQL. -- Michal Čihař | http://cihar.com | http://phpmyadmin.cz

Thanks! Can you also please tell me which variable stores the name for currently used "phpmyadmin" database? -------------------------------------------------- Best regards, Zeeshan Mughal Email: zeeshanmughal@ieee.org Web: http://www.zixan.info On Wed, Jul 15, 2009 at 3:43 AM, Michal Čihař <michal@cihar.com> wrote:
Hi
Dne Wed, 15 Jul 2009 01:45:36 -0400 Zeeshan Mughal <zeeshanmughal@ieee.org> napsal(a):
Hi, I am using the following code to extract currently logged user name from PMA_DBI_fetch_value('SELECT USER();')
// $userAndHost = PMA_DBI_fetch_value('SELECT USER();'); // $userAndHost = str_split($userAndHost); // while ($i=0 < count($userAndHost)-1) { // $username += $userAndHost[$i]; // $i++; // if ($userAndHost[$i] == "@") { // break; // }
Going chars one by one is not a good idea. How about just explode('@', $userAndHost)[0]?
But anyway current user is available as $GLOBALS['cfg']['Server']['user'] without need for any parsing and querying MySQL.
-- Michal Čihař | http://cihar.com | http://phpmyadmin.cz
------------------------------------------------------------------------------ Enter the BlackBerry Developer Challenge This is your chance to win up to $100,000 in prizes! For a limited time, vendors submitting new applications to BlackBerry App World(TM) will have the opportunity to enter the BlackBerry Developer Challenge. See full prize details at: http://p.sf.net/sfu/Challenge _______________________________________________ Phpmyadmin-devel mailing list Phpmyadmin-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/phpmyadmin-devel

On 16.07.2009 06:00, Zeeshan M. wrote:
Thanks!
Can you also please tell me which variable stores the name for currently used "phpmyadmin" database?
this is all written in the pma config file http://wiki.phpmyadmin.net/pma/Config#pmadb -- Sebastian Mendel

Thank you! -------------------------------------------------- Best regards, Zeeshan Mughal Email: zeeshanmughal@ieee.org Web: http://www.zixan.info On Thu, Jul 16, 2009 at 1:15 AM, Sebastian Mendel <lists@sebastianmendel.de>wrote:
On 16.07.2009 06:00, Zeeshan M. wrote:
Thanks!
Can you also please tell me which variable stores the name for currently used "phpmyadmin" database?
this is all written in the pma config file
http://wiki.phpmyadmin.net/pma/Config#pmadb
-- Sebastian Mendel
------------------------------------------------------------------------------ Enter the BlackBerry Developer Challenge This is your chance to win up to $100,000 in prizes! For a limited time, vendors submitting new applications to BlackBerry App World(TM) will have the opportunity to enter the BlackBerry Developer Challenge. See full prize details at: http://p.sf.net/sfu/Challenge _______________________________________________ Phpmyadmin-devel mailing list Phpmyadmin-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/phpmyadmin-devel
participants (4)
-
Michal Čihař
-
Sebastian Mendel
-
Zeeshan M.
-
Zeeshan Mughal