Ok, looking under 'Support Requests' (#447076) there is a note about using ereg instead of preg, so i went back to convert my lone instance of a preg in the code.
But try as hard as I might, I can't manage to use eregi_replace to do the same thing as my bit of code.
lib.inc.php3 - line 694 $sql = preg_replace( '/\W'.$data[1].'./i', ' '.$data[0].'.', $sql);
Could somebody else make a suggestion about the query I can use? my best conversion of the pcre was "[!a-zA-Z0-9_]".$data[1]."." but that doesn't work :-(.
I have also realized that my code adds a nasty little bug. this is the SQL i was using to test the above: SELECT c.id, s.id FROM classes c, staff s WHERE c.staff = s.id ORDER BY s.id
now if i change the fields section at the start just slightly, and the where clause by taking out some of the white space: SELECT c.id,s.id FROM classes c, staff s WHERE c.staff=s.id ORDER BY s.id
then the ',' in the fields gets replaced with a space, and your perfectly valid query is now invalid. The same thing happens with the '=' in the where clause. We need to find a way to preserve the other character that matched the \W in the pcre as well as add a space after it. I had the \W in there so that trying to match 's.' would not match 'foods.' . Any suggestions on this one?
On Sat, 18 Aug 2001, Robin Johnson wrote:
Ok, looking under 'Support Requests' (#447076) there is a note about using ereg instead of preg, so i went back to convert my lone instance of a preg in the code.
But try as hard as I might, I can't manage to use eregi_replace to do the same thing as my bit of code.
lib.inc.php3 - line 694 $sql = preg_replace( '/\W'.$data[1].'./i', ' '.$data[0].'.', $sql);
Could somebody else make a suggestion about the query I can use? my best conversion of the pcre was "[!a-zA-Z0-9_]".$data[1]."." but that doesn't work :-(.
I have also realized that my code adds a nasty little bug. this is the SQL i was using to test the above: SELECT c.id, s.id FROM classes c, staff s WHERE c.staff = s.id ORDER BY s.id
now if i change the fields section at the start just slightly, and the where clause by taking out some of the white space: SELECT c.id,s.id FROM classes c, staff s WHERE c.staff=s.id ORDER BY s.id
then the ',' in the fields gets replaced with a space, and your perfectly valid query is now invalid. The same thing happens with the '=' in the where clause. We need to find a way to preserve the other character that matched the \W in the pcre as well as add a space after it. I had the \W in there so that trying to match 's.' would not match 'foods.' . Any suggestions on this one?
Does this work?
$sql=eregi_replace('([^a-zA-Z0-9])'.$data[1].'.', '\1 '.$data[0].'.', $sql);
On Sat, 18 Aug 2001, Ignacio Vazquez-Abrams wrote:
Does this work?
$sql=eregi_replace('([^a-zA-Z0-9])'.$data[1].'.', '\1 '.$data[0].'.', $sql);
Yes it does thanks! Regex have never been my strong suit.
[About user administration pages]
Would it be possible to make it work also without javascript ? For example the "Go" button on "add user" is not a standard submit button, and this user administration page would be quite practical on sysadmin work, on console+lynx... :)
This MUST be done... but rewritting this script in a convenient format
with
such requirements is at least a one full day work. And I don't have so
many
free times now :(
And I hope that, a sysadmin under console know how to use mysql, mysqladmin and all these tools in command line. PhpMyAdmin compliant with Lynx is a little bit excessive, isn't it ? :)
Armel.