php-windows Digest 25 Jul 2003 17:16:33 -0000 Issue 1840
Topics (messages 20899 through 20909):
Re: ascii to utf-16
20899 by: Joel Rees
php_oci8.dll error in ISAPI Mode
20900 by: Rudolf Sianto
20902 by: Philippe Saladin
replacing strings... (hope it isn't too basic...)
20901 by: Bobo Wieland
20903 by: Luis Moreira
20904 by: sven
Radio Button issues
20905 by: Jon Phipps
20906 by: Jon Phipps
20908 by: Mikey
Sorry
20907 by: Jon Phipps
Install Help for a Newbie - please...
20909 by: Bill Broman
Administrivia:
To subscribe to the digest, e-mail:
[EMAIL PROTECTED]
To unsubscribe from the digest, e-mail:
[EMAIL PROTECTED]
To post to the list, e-mail:
[EMAIL PROTECTED]
----------------------------------------------------------------------
--- Begin Message ---
> Is there a way to convert a string to unicode utf-16?
Apparently not built into php, which sort of surprises me..
You could make one if you want, it's not hard. It's just a bunch of
shifting, testing, and adding, and the algorithm is very straightforward.
Just be aware that recognizing the long forms of short encodings is a
security risk. (Check that a three byte sequence doesn't yield a code
point that should be represented in a one or two byte sequence.)
Hmm. Looking at the character handling available, maybe it's not as
straightforward as I thought. (I keep forgetting php is not C. 8-/)
Unpack dumps its result into a hash, which seems like a little too much
work to me. However, strncmp() and substr() should do in a pinch.
However, I'm not sure why you would want to.
> The reason I want to do this is to use greek fonts in bookmars in pdf files
> generated by pdflib. This is done only by utf-16 characters.
What are you feeding the text to?
Web browsers and many other applications recognize UTF-8 without
problems, particularly if you tell them in advance that it's UTF-8.
> I know there is a utf8_encode() function. What about a utf16_encode? I found
> something about iconv but it is too complicated to use (since I work on
> windows and not on linux). Can someone help?
If you REALLY REALLY REALLY want a conversion function, I might be able
to build one for you next week. But I don't think you want one. Try this
instead:
header( 'Content-Type: text/html; charset=UTF-8' );
--
Joel Rees, programmer, Kansai Systems Group
Altech Corporation (Alpsgiken), Osaka, Japan
http://www.alpsgiken.co.jp
--- End Message ---
--- Begin Message ---
I have followed all instruction and default setting in PHP manual, but still
found error when loading php_oci8.dll in ISAP Mode. There were no problem
loading php_oracle8.dll in ISAPI mode or php_oci8.dll in CGI executable mode
(php.exe).
The procedure entry point OCILobFreeTemporary could not be located in the
dynamic link library OCI.DLL
Unknown(): Unable to load dynamic library
'c:/php/exetensions/php_oci8.dll' - The specified procedure could not be
found
My configuration: PHP Version 4.3.2, Apache 1.3, Windows 2000, Oracle 8.0.5.
This is my installation steps:
copy c:\php\php.ini-recommended c:\winnt\php.ini
copy http.default.conf http.conf
copy c:\php\php4ts.dll c:\winnt\system32
copy c:\php\php4ts.dll sapi
copy c:\orant\bin\oci*.dll \winnt\system32
php.ini changes:
---------------
doc_root = c:\apache\apache\htdocs
extension_dir = "c:/php/exetensions/"
extension=php_oci8.dll
extension=php_oracle.dll
httpd.conf changes (below #AddHandler type-map var)
---------------------------------------------------
LoadModule php4_module c:/php/php4apache.dll
AddModule mod_php4.c
AddType application/x-httpd-php .php .html .htm .phtml
AddType application/x-httpd-php-source .phps
Any helps would be appreciated. TIA
Rudolf
--- End Message ---
--- Begin Message ---
>
> The procedure entry point OCILobFreeTemporary could not be located in the
> dynamic link library OCI.DLL
> Unknown(): Unable to load dynamic library
> 'c:/php/exetensions/php_oci8.dll' - The specified procedure could not be
> found
Is it a typo ? it is written 'exetensions' instead of 'extensions' in the
path
Philippe
--- End Message ---
--- Begin Message ---
Q1 :If I'm for example is going to replace all occurences of "foo" in the
following sentence with "bar" in case-insensetiv manner how would I do it?
"Foo foo foo Foo fOO fOo" should be replaced with "Bar bar bar Bar bAR
bAr"...
I guess I would need regular expressions? Right?
-----------------
Q2: I belive that there will be no cases with "fOO" or "fOo" only "Foo" or
"foo".
What I'm doing right now is a
str_replace(strtolower("FOO"),uc_first(strtolower("BAR")),$myVar_str);
This works okey most of the time, but the format from Q1 would be prefered.
Would I suffer a great deal of speed trying to fix the above output?
-----------------
Q3: Would it work to do a
str_replace("foo","foobar","foo foo foo foo foo");
-----------------
Q4: Is ther a predefined function for inserting a string into another string
at n characters?
$myVar_str = "My bar string";
str_insert("foo",$myVar_str, 3);
would result in $myVar_str == My foobar string.
I couldn't find this in the manual....
-----------------
.b [EMAIL PROTECTED]
--- End Message ---
--- Begin Message ---
Q1:
See the script below
Q2 : n/a
Q3 : n/a
Q4 :
You have to find the insertion point with strpos, and then insert like this
$pos = strpos($mystring,$findme);
if ($pos>0)
{
$leftmost = substr($mystring,0,$pos);
$rightmost = substr($mystring,$pos,strlen($mystring)-$pos);
$new_string = $leftmost . "XPTO" . $rightmost;
}
else
$new_string = $mystring;
The script
<?php
$mystring = 'foo foo foo test Foo FOO Foo fOO foo';
$x = 'test';
$pos = strpos($mystring,$x);
echo "POS=$pos<br>";
$b = eregi_replace("foo","bar",$mystring);
echo "A=$mystring<br>B=$b<br>";
$leftmost = substr($mystring,0,$pos);
$rightmost = substr($mystring,$pos,strlen($mystring)-$pos);
$new_string = $leftmost . "XPTO" . $rightmost;
echo "NEW = $new_string";
?>
would result in
POS=12
A=foo foo foo test Foo FOO Foo fOO foo
B=bar bar bar test bar bar bar bar bar
NEW = foo foo foo XPTOtest Foo FOO Foo fOO foo
Does this help ?
Luis
----- Original Message -----
From: "Bobo Wieland" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, July 25, 2003 12:21 PM
Subject: [PHP-WIN] replacing strings... (hope it isn't too basic...)
> Q1 :If I'm for example is going to replace all occurences of "foo" in the
> following sentence with "bar" in case-insensetiv manner how would I do it?
>
> "Foo foo foo Foo fOO fOo" should be replaced with "Bar bar bar Bar bAR
> bAr"...
>
> I guess I would need regular expressions? Right?
>
> -----------------
> Q2: I belive that there will be no cases with "fOO" or "fOo" only "Foo" or
> "foo".
> What I'm doing right now is a
>
> str_replace(strtolower("FOO"),uc_first(strtolower("BAR")),$myVar_str);
>
> This works okey most of the time, but the format from Q1 would be
prefered.
> Would I suffer a great deal of speed trying to fix the above output?
>
> -----------------
> Q3: Would it work to do a
>
> str_replace("foo","foobar","foo foo foo foo foo");
>
> -----------------
> Q4: Is ther a predefined function for inserting a string into another
string
> at n characters?
>
> $myVar_str = "My bar string";
> str_insert("foo",$myVar_str, 3);
>
> would result in $myVar_str == My foobar string.
>
> I couldn't find this in the manual....
>
> -----------------
>
>
> .b [EMAIL PROTECTED]
>
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
--- End Message ---
--- Begin Message ---
Bobo Wieland wrote:
> Q1 :If I'm for example is going to replace all occurences of "foo" in
> the following sentence with "bar" in case-insensetiv manner how would
> I do it?
>
> "Foo foo foo Foo fOO fOo" should be replaced with "Bar bar bar
> Bar bAR bAr"...
>
> I guess I would need regular expressions? Right?
hi,
this should work.
$barString = preg_replace('/foo/i', 'bar', $fooString);
if you only want to match 'foo' but not foofoo, you have to use '/\Wfoo\W/i'
ciao SVEN
--- End Message ---
--- Begin Message ---
I am having a couple problems with the following code
1) I need to return the value of the radio button (True or False)
2) I need to wait on the file write until the data is changed
if ($app_Security){
echo 'Yes','<input type="radio" name="security" value="True" checked>';
echo ' ', 'No','<input type="radio" name="security" value="False">';
}else{
echo 'Yes','<input type="radio" name="security" value="True" >';
echo 'No','<input type="radio" name="security" value="False" checked>';
}
$temp= 'Security=' + $value;
$handle=(fopen("e:\\jon\\site_dev\\php-html\\configs\\phphtml.cfg","a+"));
fwrite($handle, 'Security=');
fwrite($handle, //value of radio button goes here );
fclose($handle);
any help would be greatly appreciated
Thanks in advance
Jon
--- End Message ---
--- Begin Message ---
I am having a couple problems with the following code
1) I need to return the value of the radio button (True or False)
2) I need to wait on the file write until the data is changed
if ($app_Security){
echo 'Yes','<input type="radio" name="security" value="True" checked>';
echo ' ', 'No','<input type="radio" name="security" value="False">';
}else{
echo 'Yes','<input type="radio" name="security" value="True" >';
echo 'No','<input type="radio" name="security" value="False" checked>';
}
$temp= 'Security=' + $value;
$handle=(fopen("e:\\jon\\site_dev\\php-html\\configs\\phphtml.cfg","a+"));
fwrite($handle, 'Security=');
fwrite($handle, //value of radio button goes here );
fclose($handle);
any help would be greatly appreciated
Thanks in advance
Jon
--- End Message ---
--- Begin Message ---
> I am having a couple problems with the following code
> 1) I need to return the value of the radio button (True or False)
You will not get the return value of the radio button until your form has
been posted back to the server.
> 2) I need to wait on the file write until the data is changed
Then this should be written upon submission of your form, not when you are
sending the form to the client.
May I recommend that you try reading the manual section dealing with forms
before continuing? http://www.php.net/manual/en/tutorial.forms.php
HTH,
Mikey
> if ($app_Security){
> echo 'Yes','<input type="radio" name="security" value="True" checked>';
> echo ' ', 'No','<input type="radio" name="security" value="False">';
> }else{
> echo 'Yes','<input type="radio" name="security" value="True" >';
> echo 'No','<input type="radio" name="security" value="False" checked>';
> }
> $temp= 'Security=' + $value;
> $handle=(fopen("e:\\jon\\site_dev\\php-html\\configs\\phphtml.cfg","a+"));
> fwrite($handle, 'Security=');
> fwrite($handle, //value of radio button goes here );
> fclose($handle);
>
> any help would be greatly appreciated
> Thanks in advance
> Jon
>
>
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
--- End Message ---
--- Begin Message ---
Sorry bout the double post of the radio buttons issue, Outlook express
crashed so it got sent twice.
--- End Message ---
--- Begin Message ---
Greetings,
PHP Newbie here. Hoping for some help. Yes, I searched the archives. Cannot find the
answer. Yes, I read the manual. Cannot find the answer. Here's the situation...
Running...
Win98SE
PHP 4.3.2 (cgi-fcgi) (obtained from command prompt)
php.ini is installed in \windows
php4ts.dll is in \windows ; \windows\system ; \php ; \inetpub\wwwroot\cgi-bin
will work on command prompt: for example - php -i, php -h, php -f index.php ... all
run fine.
I have checked and edited the php.ini file properly (according to the manual - the
install script did not do this?)
But, it appears, it is not parsing pages - for example the file containing...
<html>
<head>
<title>PHP Example</title>
</head>
<body>
<?php
echo "Hi, I'm a PHP script!";
?>
</body>
</html>
located at...
http://localhost/index.php
is generating...
The page cannot be displayed
The page you are looking for is currently unavailable. The Web site might be
experiencing technical difficulties, or you may need to adjust your browser settings.
<clip>
When the page is browsed to... C:\Inetpub\wwwroot\index.php
The <title> in properly dispalyed, but all I get is white space, when I should have...
Hi, I'm a PHP script!
Your thoughts and direction are most appreciated.
The PHP/MySQL newbie
PS Also having the same issues with the sample .php script for MySQL I pulled from the
manual - but assume that is due to the same. MySQL is running fine (it appears) from
command prompt and GUI, can start/stop msqld, create db's, create tables, add data,
etc. Hopefully, someone will share the PHP magic that I need to get this up and
running and then I will have MySQL too :)
---------------------------------
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
--- End Message ---