You are here:  » admin password and 1 small issue

Support Forum



admin password and 1 small issue

Submitted by ostaveland on Sun, 2010-03-07 19:59 in

Hi,

I have now worked on my site with your system on it for a looong time, and now it is all working rather perfect!

BUT, i have 2 small problems and wondered if you could point me in the right direction ? :)

1. When i add a password to my config.advanced.php i get an error while inside the admin directory, this is the error i get:

Notice: Undefined index: admin in /Users/mymac/Sites/www/includes/admin.php on line 544

Warning: Cannot modify header information - headers already sent by (output started at /Users/mymac/Sites/www/includes/admin.php:544) in /Users/mymac/Sites/www/includes/admin.php on line 546

Warning: Cannot modify header information - headers already sent by (output started at /Users/mymac/Sites/www/includes/admin.php:544) in /Users/mymac/Sites/www/admin/admin_header.php on line 4

This only happends inside the admin folder, and only when a password is set in config.advanced.php

Any idea what i am doing wrong ?

2. I have made a menu like this:

<ul>
<h4>Fragrances</h4>
<li><a href="search.php?q=fragrance+children">Children</a></li>
<li><a href="search.php?q=fragrance+men">Men</a></li>
<li><a href="search.php?q=fragrance+women">Women</a></li>
<li><a href="search.php?q=fragrance+unisex">Unisex</a></li>
</ul>

And when you click the "Men" link i get hits for "Women" aswell, since women include the word men....

Is there a way to spesify that unless it says exactly "Men" it should not be searched for ?

like... search.php?q=fragrance+men+NO WOMEN PERFUME PLS

hehe :)

so i want to be able to specify this in the link directly.

Thanx
Ole

Submitted by support on Mon, 2010-03-08 11:06

Hello Ole,

Regarding the warning message; this is happening because of the error reporting level setting on your server - I will correct it in the distribution; but it can be removed easily as follows. In includes/admin.php, look for the following code on line 544:

      if ($_COOKIE["admin"] <> md5($remoteAddr.$config_adminPassword))

...and REPLACE with:

      if (!isset($_COOKIE["admin"])) $_COOKIE["admin"] = "";
      if ($_COOKIE["admin"] <> md5($remoteAddr.$config_adminPassword))

Regarding the search for "men" also including "women", this is happening because that particular query uses the basic search method (which is invoked when any keyword is less than 4 characters); so to fix this, a manual override for that particular keyword would have to be added to the search code. To do this, look for the following code on line 193 of search.php:

$where = implode(" AND ",$wheres);

...and REPLACE with:

$where = implode(" AND ",$wheres);
if ($q == "fragrance men")
{
  $where .= " AND search_name NOT LIKE ('women') ";
}

Hope this helps!

Cheers,
David.

Submitted by ostaveland on Mon, 2010-03-08 19:59

Hi again David, thanx for the help!

It seems it solved 1 problem, i am now able to see the login form and use the password i have chosen in config.advanced.php.

Although there is still an error above the login form, this is the error above the login form:

Notice: Undefined variable: admin_checkPassword in /Users/mymac/Sites/www/includes/admin.php on line 539

Warning: Cannot modify header information - headers already sent by (output started at /Users/mymac/Sites/www/includes/admin.php:539) in /Users/mymac/Sites/www/admin/admin_header.php on line 4

BUT, after typing my password and hitting the return key i get a similar error message, it shows me only the error message and will not continue.

This is the error message i get in AFTER typing my password :

Notice: Undefined variable: admin_checkPassword in /Users/mymac/Sites/www/includes/admin.php on line 539

Warning: Cannot modify header information - headers already sent by (output started at /Users/mymac/Sites/www/includes/admin.php:539) in /Users/mymac/Sites/www/admin/login.php on line 16

Warning: Cannot modify header information - headers already sent by (output started at /Users/mymac/Sites/www/includes/admin.php:539) in /Users/mymac/Sites/www/admin/login.php on line 18

Thanx
Ole :)

Submitted by support on Mon, 2010-03-08 21:11

Hello Ole,

That warning is indicating that some white space has crept onto the end of includes/admin.php. Open the file in your text editor, go right to very end and then delete anything after the closing PHP tag - that should do the trick...

Cheers,
David.

Submitted by ostaveland on Thu, 2010-03-18 19:33

Hi again David,

I checked the file for whitespace and even tried with a brand new version of PT, but i still get the same error, guess i just have to turn my error reporting level down.

And changes done in the search function did not change anything, the search still comes up with both men and women when i search for men.

BUT, is it possible to rewrite the search.php to make it only show the products that have exactly the search phrase in it, and leave out everything that does not match exactly ?

i mean that if a person search for "perfume for men" the only products i want them to find is the ones with exactly "perfume for men" in it, everyone else should be left out.

I really need this to make the search work like i want it so i really appreciate your help!

Ole S.

Submitted by support on Thu, 2010-03-18 19:41

Hello Ole,

Sure - could you email me your search.php and I'll modify it to an exact match only...

Cheers,
David.