Re: [PHP] Is Function Constants the Correct Term?

2004-07-18 Thread gohaku
* Thus wrote gohaku:
Hi everyone,
I have been experimenting with defining functions as constants.
Below is what I am using to test Function Constants:
pre
?
define(LOGIN,user);
define(PASS,pass);
define(DB,mysql);
define(DBLOGIN,dblogin(LOGIN,PASS,DB));
This is simply not allowed.
see:
  http://php.net/define
Hi curt,
Can you elaborate on what is not allowed?
Are you saying defining function constants are not allowed or
are you saying redefining constants are not allowed?
Thanks.
-gohaku
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Is Function Constants the Correct Term?

2004-07-17 Thread gohaku
Hi everyone,
I have been experimenting with defining functions as constants.
Below is what I am using to test Function Constants:
pre
?
define(LOGIN,user);
define(PASS,pass);
define(DB,mysql);
define(DBLOGIN,dblogin(LOGIN,PASS,DB));
DBLOGIN;
$set = mysql_query(Select user FROM user limit 1,1);
$results = mysql_fetch_array($set);
echo Results: ,$results[user];
define(DBLOGIN,dblogin(user,incorrect_pass,DB));
DBLOGIN;
//Should print error
$set = mysql_query(Select user FROM user limit 1,1);
$results = mysql_fetch_array($set);
echo Results: ,$results[user];
function dblogin($login,$pass,$db)
{
$mysql = mysql_connect(localhost,$login,$pass);
mysql_select_db($db,$mysql);
}
?
/pre
I would like to know what the right term for this kind of constant 
since a search for function constants php
did not return any relevant results.
I would also like to know why I was able to redefine DBLOGIN, I always 
thought redefining constants could
not be done.

Thanks in advance.
-gohaku
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] GD Support without Recompiling?

2004-06-29 Thread gohaku
Hello everyone,
Much to my surprise for Windows XP, to get GD Support,
All I had to do was copy some files, edit a configuration file and 
restart
the Web Server.
I would like to know if this is possible on Mac OS X.  I have seen 
instructions
for recompiling but never as simple as for Windows.

Does anyone if such a way exists?
Thanks in advance.
-gohaku
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Handling Code Continuation

2004-06-25 Thread gohaku
Hi everyone,
I would like to know how to handle code breaks or code blocks
that takes up more than two lines.
For readability, I would like to know if there is something like the 
following:
function input($type,$size,$name,$value)
{
	return input type=\$type\ size=\$size\ value=\$value\ 
			name=\$name\;
}

Thanks.
-gohaku
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Realm Based Authentication Problem with webhost ( Yahoo domain )

2004-06-09 Thread gohaku
Hi all,
I'm trying to implement HTTP User Authentication for some files but 
not directories.
Below is the following script I am using to test HTTP User 
Authentication:

if ($PHP_AUTH_USER != user || $PHP_AUTH_PW != pass)
{
  // visitor has not yet given details, or their
  // name and password combination are not correct
  header('WWW-Authenticate: Basic realm=Realm-Name');
  header(HTTP/1.0 401 Unauthorized);
  echo h1Go Away!/h1;
  echo You are not authorized to view this resource.;
}
else
{
  // visitor has provided correct details
  echo h1Here it is!/h1;
  echo pI bet you are glad you you can see this secret page.;
}
The works on localhost but it doesn't work when uploaded to my Yahoo 
domain.
Please keep in mind that I am talking about Yahoo's Small Business 
Webhosting and not Geocities Webhosting.

Yahoo does provide Authentication but only for directories and not 
individual files.

just wondering if there's another way.
Thanks in advance.
-gohaku
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Regular Expression for a UK mobile phone number

2004-04-08 Thread gohaku
On Apr 8, 2004, at 2:40 PM, Shaun wrote:

Thanks for your reply Michal,

but the regular expression still seems to reject the number...
Just out of curiosity,
Have you tried  if(stripslashes(htmlentities($_POST[mobile_number]) ) 
!= ) ?

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Connecting to Databases

2004-04-06 Thread gohaku
On Apr 6, 2004, at 10:57 AM, Robb Kerr wrote:

I know that this message is more related to MySQL than PHP but I don't 
know
of a good MySQL board. This board is VERY active and useful.
Have you checked out MySQL General Discussion over at:
http://lists.mysql.com/ ?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] php + lynx + grep

2004-04-06 Thread gohaku


On Apr 6, 2004, at 12:53 PM, Brian L. Ollom wrote:

Try

$output = `lynx --source
http://weather.noaa.gov/weather/current/KTOL.html |grep -v
'41-35-19N' |grep TOL | head -n 1`
Those are backticks, not single quotes surrounding the
command.
I use following to retrieve output with Lynx:
$out = `lynx -dump -source http://localhost`;

Backticks didn't work either.

I got it to work by using a cron to  the info into a text file
and then include()'d the text file in the website, but I'd
rather not have to rely on the cron job if I don't have to.

| Brian Ollom  |   |
| NiteHawke.Com|  http://www.nitehawke.com/|
| An Authorized Firefly Dealer |  email  [EMAIL PROTECTED]  |

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Alternative to stripslashes(htmlentities($textstring))

2004-04-06 Thread gohaku
Hi everyone,
I was just curious if there is another function that
does the same job as stripslashes(htmlentities($textstring)).
I am using this Combined function to echo back Text that is entered in 
a Text Field.
Thanks in advance.
-gohaku

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Handling Randomly Updated XML Feeds

2004-03-29 Thread gohaku
Hello everyone,
Say, I want to retrieve the Today's XML Feed from site A but site A 
updates their XML Feed on random days.
Also, this XML Feed might have 2 items with the Same Date.
What's the best way to retrieve/display the latest XML Feed Item?
I ask this because it seems like the running time for my loop would be 
O(n*n) if I'm not  wrong.
I should add that my script looks for items created today, then looks 
for yesterday and if that item is not available, it looks again until 
it finds something.

Thanks.
-gohaku
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Null Variables after session_register() ( Radio Inputs Problem )

2004-03-23 Thread gohaku
Apologies if this has been asked before,

I'm experiencing problems with Session Variables and Radio Inputs 
values.
For some reason, after I use session_register(number) where
$number has 3 possible values { 1,2,3 }, $number IS NULL.

If I don't use session_register(number), $number IS NOT NULL.
I did not see any difference with checkbox inputs either.
Any help would be greatly appreciated.

Thank you.
-gohaku
!--Form.html--
form action=session.php method=POST
Name: input type=text name=name size=30br
input type=radio name=number value=1 CHECKED1br
input type=radio name=number value=22br
input type=radio name=number value=33br
input type=submit name=submit value=Session Test
/form
?
/***Session.php**/
$varcount = 0;
if($name)   {   $varcount++;}
if($number){$varcount++;}
session_start();
session_register(name);
session_register(number);
?
html
headtitle?=$number?/title/head
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Re: Null Variables after session_register() ( Radio Inputs Problem )

2004-03-23 Thread gohaku
Thanks.
Below is what I changed to session.php.
Are there any possible problems with my changes?

On Mar 23, 2004, at 4:28 PM, Justin Patrin wrote:

?
/***Session.php**/
$varcount = 0;
if($name){$varcount++;}
if($number){$varcount++;}
session_start();
session_register(name);
session_register(number);
?


?
/***Session.php**/
$varcount = 0;
if($name){$varcount++;}
if($number){$varcount++;}
$_SESSION[name] = $name;
$_SESSION[number] = $number;
?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Cannot send mail after upgrading to OS X v10.3

2004-02-07 Thread gohaku
On Feb 7, 2004, at 12:20 AM, John Nichel wrote:


Hi everyone,
I am using OS X v10.3.2 and just discovered that I can't send mail 
using the mail() function.
According to phpinfo(), PHP is configured with sendmail.
Before upgrading to v10.3, I did not check if the mail() function 
worked in v10.2
The script I'm using does work on other servers.
Make sure the path to sendmail is correct in your php.ini.
Ensure that sendmail is installed.
Thank You.
all I had to do was change one line in php.ini:
From
; For Unix only.  You may supply arguments as well (default: sendmail 
-t -i).
;sendmail_path =
To
; For Unix only.  You may supply arguments as well (default: sendmail 
-t -i).
;sendmail_path = sendmail -t -i

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Cannot send mail after upgrading to OS X v10.3

2004-02-07 Thread gohaku
On Feb 7, 2004, at 10:36 PM, Jason Wong wrote:

So basically you haven't made any changes to php.ini at all. So 
whatever got
your mail working was because of something else that you had done.

I stand corrected.
Now I don't remember what I did to fix this.
I waited 5 minutes between sending test emails to myself.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Cannot send mail after upgrading to OS X v10.3

2004-02-06 Thread gohaku
Hi everyone,
I am using OS X v10.3.2 and just discovered that I can't send mail 
using the mail() function.
According to phpinfo(), PHP is configured with sendmail.
Before upgrading to v10.3, I did not check if the mail() function 
worked in v10.2
The script I'm using does work on other servers.

?
  $email = $_REQUEST['email'] ;
  $message = $_REQUEST['message'] ;
  mail( [EMAIL PROTECTED], Feedback Form Results,
$message, From: $email );
  header( Location: thankyou.html );
?
I ran Postfix Enabler and still could not email myself.
What do I need to configure to get the mail() function to work?
Thank you.
-Gohaku

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Reasons for Using XML

2004-02-04 Thread gohaku
Hi everyone,
Since everyone has been talking about XML, can anybody
tell me why XML is used as opposed to using a CSV file?
I'm probably wrong about why XML is used, this is why I'm asking.
Thanks in advance.
-Gohaku
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] strtotime Question

2004-01-27 Thread gohaku
Hi everyone,
I made the mistake of using strtotime(day) instead of 
strtotime(today)
to get the current time.
I was just curious, what is strtotime(day) represent?

Below is what I used to test the day and today parameters:

Testing One Minute Differencebr
?
echo min_diff();
function min_diff()
{
$now = strtotime(today);//Return value is 60
//$now = strtotime(day);//Return value is 86400
$onemin = strtotime(-1 minute);
return $now-$onemin;
}
?
Thanks in advance.
-Gohaku

[PHP] PHP Equivalent of DBM Files

2004-01-22 Thread gohaku
Hi everyone,
I was just curious if there is an equivalent of DBM files used in Perl 
scripts.

Thanks in advance.
-Gohaku
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Getting PHP to work with SQLite

2004-01-14 Thread gohaku
Hi everyone,
I'm currently trying to use SQLite databases with PHP 4.3.2
I downloaded the  SQLite-PHP module and tried './configure' but couldn't
get that to work.
Also, even If I could get './configure' to work, where would I install  
the
appropriate files and what do I have to modify in php.ini?
Thanks in advance,
-gohaku

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Extending String Length (255) limit for Levenshtein

2003-12-21 Thread Gohaku
Hi everyone,
I would like to know if there is a way to extend the limit of 255 
characters when using the Levenshtein Function?
I have used user-defined functions such levdis and xlevdist but they 
often take too much time.
Thanks in advance.
-Gohaku

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Levenshtein and Similar_Text Comparison

2003-12-17 Thread Gohaku
Hi everyone,
I have been using the levenshtein function and similar_text function to 
evaluate which is the better function to use.

I have read that the levenshtein function runs faster than similar_text.
I haven't noticed any runtime differences but I have noticed that 
levenshtein seems to be more accurate.

Since the levenshtein function is based on Edit Distances and 
similar_text is based on Decision Trees, I'm wondering when and why 
similar_text would be used instead of  levenshtein.

Thanks.
-gohaku
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Printing PHP Source with a PHP Script

2003-12-14 Thread Gohaku
Hi everyone,
I'm trying to output PHP source within a PHP Script.  The following 
script seems to work(Viewing HTML Source reveals the PHP Source), but 
the Browser output is very different.  Is there a function or header I 
should set before echoing the PHP Source?  Thanks.

?
//filereader.php
//script arguments: filereader.php?file=
$fh = fopen($file,rb);
$src = fread($fh,filesize($file));
fclose($fh);
echo 'htmlmeta http-equiv=Content-Type content=text/plain';
echo $src;
echo '/html';
?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Printing PHP Source with a PHP Script

2003-12-14 Thread Gohaku
On Sunday, December 14, 2003, at 09:51 PM, John W. Holmes wrote:

Gohaku wrote:

Hi everyone,
I'm trying to output PHP source within a PHP Script.  The following 
script seems to work(Viewing HTML Source reveals the PHP Source), but 
the Browser output is very different.  Is there a function or header 
I should set before echoing the PHP Source?  Thanks.
?
//filereader.php
//script arguments: filereader.php?file=
$fh = fopen($file,rb);
$src = fread($fh,filesize($file));
fclose($fh);
echo 'htmlmeta http-equiv=Content-Type content=text/plain';
echo $src;
echo '/html';
?
echo htmlentities($src);

Thank you, that's just what I was looking for.
--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

php|architect: The Magazine for PHP Professionals  www.phparch.com



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] How to Calculate Similarity Percentage with Levenshtein function

2003-12-09 Thread Gohaku
Hi,
I'm trying to obtain the similarity percentage for 2 Strings when using 
the Levenshtein function but the percentages doesn't seem to match the 
percentage
returned by similar_text($str1,$str2,$match_percent);

Below is what I use to calculate the similarity percentage

$dist = levenshtein($str1,$str2);
$str1len = strlen($str1);
$str2len = strlen($str2);
if($str1len  $str2len)
{
$pct = ($str1len - $dist)/$str1len;
}
else
{
$pct = ($str2len - $dist)/$str2len;
}
$pct = $pct*100;
What am I missing from the calculation?

Thanks.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] How to Calculate Similarity Percentage with Levenshtein function

2003-12-09 Thread Gohaku
Hi,
I'm trying to obtain the similarity percentage for 2 Strings when using
the Levenshtein function but the percentages doesn't seem to match the
percentage
returned by similar_text($str1,$str2,$match_percent);
Below is what I use to calculate the similarity percentage

$dist = levenshtein($str1,$str2);
$str1len = strlen($str1);
$str2len = strlen($str2);
if($str1len  $str2len)
{
$pct = ($str1len - $dist)/$str1len;
}
else
{
$pct = ($str2len - $dist)/$str2len;
}
$pct = $pct*100;
What am I missing from the calculation?

Thanks.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Getting flush() to work with Safari Internet Explorer in OS X

2003-12-06 Thread Gohaku
Hi everyone,
I have a script that takes a long time to run and it uses flush().
Upon testing with Safari and Internet Explorer, I found out it doesn't 
work and other users have problems with this as well:
http://forums.devshed.com/t86445/s.html

I ran my script with Lynx, Links, and Omniweb, and the script ran fine.

I thought changing some settings in php.ini might help like:
implicit_flush = On
;Default is Off
but realized the On setting is for debugging purposes.
My question, what can I do to get Safari or Internet Explorer to handle 
flushed output?

Thanks in advance.
-gohaku
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Changing User Agent for fopen

2003-12-04 Thread Gohaku
Hi everybody,
There are some pages I would like to extract links from but I can't 
access the page using the following:
ini_set('php.user_agent', 'Mozilla/5.0');
	$url = http://www.google.com/search?q=php;;
$fp = fopen($url,r);
$buffer = fread($fp,100);
echo $buffer;
Also, what is the best number to use when allocating Buffer space for a 
URL?
Is 100 too much?
Thanks.
-Gohaku

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php