What php code is needed to determine if "394433" exists at the end of any username?
myphpadmin created the following sql: SELECT * FROM `user`WHERE `user_name` LIKE CONVERT( _utf8 '%395523%'USING latin1 )
but I can't find any meta article explaining how to make such a query and return a boolean value:
This would be used to trigger a rename_user function.
Overview- Our Single Sign-on process provides a unique username in the form of firstname_lastname_ID (the ID never changes but the name could due to marriage). If this username exists within MediaWiki, the user is logged-in. If not, an extension creates a new user. I need the above check(and rename_user function) prior to creating a new user.
This is a tangent discussion to "Best strategy to populate User data from Single Sign On?" http://mail.wikipedia.org/pipermail/mediawiki-l/2006-April/011719.html but may apply to a wider audience....
Thanks in advance for any response.. bc
I see two approaches: 1) Write a bit of (PHP/PERL/...) code that performs the query and checks the number of results (0=not found, 1 = found). 2) Upgrade the query to SELECT COUNT(*) FROM ... where the result would be 0 for not found and 1 (or more???) for found.
On 5/2/06, Brian Carpenter hopespoppa@gmail.com wrote:
What php code is needed to determine if "394433" exists at the end of any username?
myphpadmin created the following sql: SELECT * FROM `user`WHERE `user_name` LIKE CONVERT( _utf8 '%395523%'USING latin1 )
but I can't find any meta article explaining how to make such a query and return a boolean value:
This would be used to trigger a rename_user function.
Overview- Our Single Sign-on process provides a unique username in the form of firstname_lastname_ID (the ID never changes but the name could due to marriage). If this username exists within MediaWiki, the user is logged-in. If not, an extension creates a new user. I need the above check(and rename_user function) prior to creating a new user.
This is a tangent discussion to "Best strategy to populate User data from Single Sign On?" http://mail.wikipedia.org/pipermail/mediawiki-l/2006-April/011719.html but may apply to a wider audience....
Thanks in advance for any response.. bc _______________________________________________ MediaWiki-l mailing list MediaWiki-l@Wikimedia.org http://mail.wikipedia.org/mailman/listinfo/mediawiki-l
-- ---- Met vriendelijke groeten / With kind regards Hans Voss --------------------------------------- skype: hans.voss google talk enabled I am looking for people to invite to Gmail. I have 100 invitations left.
Thanks for the improved SQL statement. Any suggestions of php commands to query the database. Is a direct database query (not using Mediawiki) dangerous?
On 5/3/06, Hans Voss hans.voss@gmail.com wrote:
I see two approaches:
- Write a bit of (PHP/PERL/...) code that performs the query and checks
the number of results (0=not found, 1 = found). 2) Upgrade the query to SELECT COUNT(*) FROM ... where the result would be 0 for not found and 1 (or more???) for found.
On 5/2/06, Brian Carpenter hopespoppa@gmail.com wrote:
What php code is needed to determine if "394433" exists at the end of
any
username?
myphpadmin created the following sql: SELECT * FROM `user`WHERE `user_name` LIKE CONVERT( _utf8
'%395523%'USING
latin1 )
but I can't find any meta article explaining how to make such a query
and
return a boolean value:
This would be used to trigger a rename_user function.
Overview- Our Single Sign-on process provides a unique username in the form of firstname_lastname_ID (the ID never changes but the name could due to marriage). If this username exists within MediaWiki, the user is logged-in. If not, an extension creates a new user. I need the above check(and rename_user function) prior to creating a new user.
This is a tangent discussion to "Best strategy to populate User data from Single Sign On?" http://mail.wikipedia.org/pipermail/mediawiki-l/2006-April/011719.html but may apply to a wider audience....
Thanks in advance for any response.. bc _______________________________________________ MediaWiki-l mailing list MediaWiki-l@Wikimedia.org http://mail.wikipedia.org/mailman/listinfo/mediawiki-l
--
Met vriendelijke groeten / With kind regards Hans Voss
skype: hans.voss google talk enabled I am looking for people to invite to Gmail. I have 100 invitations left. _______________________________________________ MediaWiki-l mailing list MediaWiki-l@Wikimedia.org http://mail.wikipedia.org/mailman/listinfo/mediawiki-l
Brian,
As long as the query is just a request for info (a SELECT statement like here), there is *no possible harm* you can do to the database; The only thing is that you need to script it somewhere and that script needs a user-id and password for the database. Possibly the same one the wikicode uses (from LocalSettings.php). Just make sure that nobody else can access that script.
Things get tricky for the database once you start using statements like UPDATE, INSERT, DELETE or (shudder) DROP. One statement (DROP database wikidb) and the entire wiki is gone.
On 5/3/06, Brian Carpenter hopespoppa@gmail.com wrote:
Thanks for the improved SQL statement. Any suggestions of php commands to query the database. Is a direct database query (not using Mediawiki) dangerous?
On 5/3/06, Hans Voss hans.voss@gmail.com wrote:
I see two approaches:
- Write a bit of (PHP/PERL/...) code that performs the query and checks
the number of results (0=not found, 1 = found). 2) Upgrade the query to SELECT COUNT(*) FROM ... where the result would be 0 for not found and 1 (or more???) for found.
On 5/2/06, Brian Carpenter hopespoppa@gmail.com wrote:
What php code is needed to determine if "394433" exists at the end of
any
username?
myphpadmin created the following sql: SELECT * FROM `user`WHERE `user_name` LIKE CONVERT( _utf8
'%395523%'USING
latin1 )
but I can't find any meta article explaining how to make such a query
and
return a boolean value:
This would be used to trigger a rename_user function.
Overview- Our Single Sign-on process provides a unique username in the form of firstname_lastname_ID (the ID never changes but the name could due to marriage). If this username exists within MediaWiki, the user is logged-in. If
not,
an extension creates a new user. I need the above check(and rename_user function) prior to creating a new user.
This is a tangent discussion to "Best strategy to populate User data from Single Sign On?" http://mail.wikipedia.org/pipermail/mediawiki-l/2006-April/011719.html but may apply to a wider audience....
Thanks in advance for any response.. bc _______________________________________________ MediaWiki-l mailing list MediaWiki-l@Wikimedia.org http://mail.wikipedia.org/mailman/listinfo/mediawiki-l
--
Met vriendelijke groeten / With kind regards Hans Voss
skype: hans.voss google talk enabled I am looking for people to invite to Gmail. I have 100 invitations left. _______________________________________________ MediaWiki-l mailing list MediaWiki-l@Wikimedia.org http://mail.wikipedia.org/mailman/listinfo/mediawiki-l
MediaWiki-l mailing list MediaWiki-l@Wikimedia.org http://mail.wikipedia.org/mailman/listinfo/mediawiki-l
-- ---- Met vriendelijke groeten / With kind regards Hans Voss --------------------------------------- skype: hans.voss google talk enabled I am looking for people to invite to Gmail. I have 100 invitations left.
mediawiki-l@lists.wikimedia.org