Re: [PHP] redirect based off server string
If you are using apache you can use the redirect module Servername www.ces.ncsu.edu ServerAlias * Redirect permanent / http://www.nc4h.org/ -- Leon On Wednesday 10 August 2005 16:52, Robert Sossomon wrote: > Anyone have a script or know of a way to check and see what the url is of a > system and then sending it to another url if it is not right? > > I have this problem where if someone is using: > http://www.ces.ncsu.edu/depts/fourh > instead of: > http://www.nc4h.org > > to get to my site it is breaking other pieces within it (though there is > code in place which supposedly stops this from happening, I have found that > this is not the case) > > what I plan on doing is invoking the script on the main page of each man > sub-directory and the main page so that it should catch the majority of > folks. > > Any suggestions/help would be greatly appreciated! > > Robert > > -- > Robert Sossomon, Business and Technology Application Technician > 4-H Youth Development Department > 512 BrickHaven Drive Suite 220L, Campus Box 7606 > N.C. State University > Raleigh NC 27695-7606 > Phone: 919/515-8474 > Fax: 919/515-7812 > [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] html_entity_decode () for …, ’, etc.
Hi Marco To awnser you question I do not know why it is excluded from the default decode array. Maybe it could be that these are multibyte characters (any takers)? You can get a list of the entities that are changed $trans = get_html_translation_table(HTML_ENTITIES); echo"";print_r($trans);echo""; to add some extras as you have below, use something similar to function htmldecode($string) { $trans = get_html_translation_table(HTML_ENTITIES); $trans[chr(0xe2).chr(0x80).chr(0xa6)] = '…'; $trans = array_flip($trans); return strtr($string, $trans); } $string = "…&"; echo htmldecode($string) ."\n"; Note: obviously hex e2 80 a6 make up the hellip chars. Hope this helps Cheers -- Leon On Wednesday 10 August 2005 20:55, Marco wrote: > I tried using html_entity_decode () but why won't these characters decode: > > ’ > – > … > “ > ” -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Regular expression question
Hi I would like to convert from one naming convention within a sql statement to another. I have the following, $str = "insert into userComment (userID, userName, userSurname) values (0, 'Leon', 'Vismer')"; $match = array( "/([a-z]+)(ID)/", "/([a-z]+)([A-Z])/" ); $replace = array( "\$1_id", "\$1_\$2" ); $nstr = preg_replace($match, $replace, $str); echo $nstr ."\n"; the above gets me to insert into user_Comment (user_id, user_Name, user_Surname) values (0, 'Leon', 'Vismer') however I want to get to insert into user_comment (user_id, user_name, user_surname) values (0, 'Leon', 'Vismer') Some help from the regex experts ;-) Many thanks -- Leon -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Regular expression question
Hi > Just a quick note; why dont' you search on "user" since it's the constant > and replace 'user[A-Z]' with 'user_[a-z]' or in the case of userID > 'user[A-Z]{2}' This is part of my problem user will not always be constant, I basically want to be able to change between two naming conventions. Example: userID becomes user_id clientID becomes client_id tableName becomes table_name anotherTableName becomes another_table_name etc. Thanks -- Leon -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Regular expression question
Hi Robin Many thanks for this, how would one extend this to support the following: $str = "insert into userComment (userID, userName, userSurname) values (0, 'Leon', 'mcDonald')"; one does not want $str = "insert into user_comment (user_id, user_name, user_surname) values (0, 'Leon', 'mc_donald')"; unfortunately lookbehind assertions does not support non-fixed length chars so /(?<=(? $str = "insert into userComment (userID, userName, userSurname) values > (0, 'Leon', 'Vismer')"; > > $match = '/(?<=[a-z])([A-Z]+)/e'; > $replace = 'strtolower("_$1")'; > print preg_replace($match, $replace, $str); > ?> > > insert into user_comment (user_id, user_name, user_surname) values (0, > 'Leon', 'Vismer') > > -robin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] SOAP and php
Hi What would be the best option for PHP and SOAP support. Many thanks -- Leon -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php