[PHP] Re: Converting HTML to BBCode [medium]

2006-03-06 Thread Rafael
	First of all, the back-slashes added before a " character is probably 
because of the gpc_magic_quotes directive in PHP, wich tries to "escape" 
the quotes (pretty stupid, if you ask me), so you must have to use 
strip_slashes() on the string you received, e.g:

  $text = '';
  if ( isset($_POST['text']) ) {
  $text = $_POST['text'];
  if ( get_magic_quotes_gpc() ) {
  $text = stripslashes($text);
  }
  }

	Now, what you're trying to do is definetely not something "basic", 
since you want to replace some non-fixed strings that can either be in 
lower or uppercase (and without changing the case of the rest of the 
text), so basicaly what you have are patterns (some kind of 'rules' that 
shall be followed by the tags)


	By your code I can tell you've already try a little the hard way to 
solve this issue, although it would be quite more laborious than that 
because you would have to search the string almost char-by-char (in a 
figurative way, but pretty much what PHP would be doing) for all the 
tags you want to replace, and possibly be working with two strings: one 
for the original text and other with a lowercase version of it (since 
you cannot search in a case-insensitive way --only in PHP5)


	Anyway, the medium/advanced way (IMHO) would be to use regular 
expressions.  These are quite useful, but also rather cryptic, even for 
advanced users --sometimes it's easier to come up with a new one rather 
than understanding what already exists :p


The function I've test with your test HTML-code is this one:
  /**
   * Performes BBCode conversion for some simple HTML elements
   *
   * @staticvar string  $str_http_valid
   * @staticvar array   $arr_replace
   * @param string  $string
   * @returnstring
   * @since Mon Mar 06 23:44:40 CST 2006
   * @authorrsalazar
   */
  function to_bbcode( $string ) {
static  $str_http_valid = '-:\/a-z.0-9_%+';
$arr_replace= array(

"/(.+?)<\/a>/Xis"
 => '[link=\\2\\3]\\4[/link]',

"//Xis"
 => '[img]\\2\\3[/img]',
  '/<(\/)?(strong|em)>/Xise' => '( strcasecmp("em", "\\2") ? 
"[\\1b]" : "[\\1i]" )',

  '/<(\/?(?:b|i|u))>/Xis'  => '[\\1]',

  '/<(\/)?[ou]l>/Xis'=> '[\\1list]',
  '/<(\/)?li>/Xise'  => '( "\\1" == "" ? "[*]" : "" )',
);
$string = preg_replace(array_keys($arr_replace),
   array_values($arr_replace),
   $string);
return  $string;
  }

	As I mentiones before, keep in mind that reg-exp can be rather cryptic 
sometimes.  Also, this is the raw code, it should be optimized but I'm 
feeling really lazy right now, so it should have to wait for a better 
ocasion.


	It's up to you to decide wheter you'll use this function or not, what I 
would recommend you is not to forget about regexp and give them a try 
later (when you're more familiar with PHP), and I would also recommend 
you to use PREG family rather than EGREP.


J_K9 wrote:

Hi,

I'm trying to code a PHP app to convert my inputted HTML code (into a 
textarea) into BBCode, for use on a forum. I have tried to code it, 
but have had little success so far. Here is the code I wrote (sorry, 
I'm still learning):


---CODE---


Convert from HTML to BBCode



Body:  


';

// Declare HTML tags to find, and BBCode tags to replace them with

$linkStartFind = '' . "$text" . '';

?>


---/CODE---

Now, most of this doesn't work. Here is the test code I put into the 
first textarea:


---TESTCODE---
Testing bold code

Testing italics

http://link.com";>Testing link

http://image.com/img.jpg"; border="0" />

http://image.com/img2.jpg"; style="padding-right: 5px;" 
border="0" />

---/TESTCODE---

And here's what I got out:

---RESULT---
[/b]Testing bold code[/b]

[i]Testing italics[/i]

http://link.com\";>Testing link[/url]

http://image.com/img.jpg\"; border=\"0\" />

http://image.com/img2.jpg\"; style=\"padding-right: 5px;\" 
border=\"0\" />

---/RESULT---

As you can see, the bold, italic, and ending hyperlink tag 
replacements worked, but the rest didn't. Backslashes have been added 
where there are "", and if there were anything between an img 
tag's 'src="{image}"' and ' border="0" />' that wouldn't be removed, 
and therefore provide me with a faulty link.


Just to clarify the BBCode tags, they are:

[url=http://link.com]Click this link[/url]
[img]http://imagesite.com/image.jpg[/img]
[b]_BOLD_[/b]
[i]italicised[/i]
[u]underlined[/i]

I would really like to get this working, as it'll not only help me 
improve my PHP skills but also aid my tutorial conversions - it takes 
ages to do this by hand ;)


Any help would be appreciated. Thanks in advance,

--
Atentamente,
J. Rafael Salazar Magaña
Innox - Innovación Inteligente
Tel: +52 (33) 3615 5348 ext. 205 / 01 800 2-SOFTWARE
http://www.innox.com.mx

--
PHP General Mailing List (http://www.php.net/)
To unsu

RE: [PHP] PHP Post to other Servers

2006-03-06 Thread Robert Sandie
> For what purpose are you sending the uploads to a different box?

There will also be Video uploads as well so I had to nix the database idea.
Am running a media server as well of this box so there is considerable
processing already going on. Now I may be looking at this from the wrong
perspective and was hoping to gain some insight into this methodology.


- Rob

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



[PHP] Mathematical CAPTCHA

2006-03-06 Thread Louie Miranda
Is there a pear package or class for PHP?

--
Louie Miranda ([EMAIL PROTECTED])
http://www.axishift.com

//JSM-W


Re: [PHP] PHP Post to other Servers

2006-03-06 Thread Chris

Robert Sandie wrote:

Want to load balance a server and send image uploads to a different box with
PHP installed. What would the correct method to authenticate on the second
machine and send without ruining user experience by sending them to a second
page? 


For what purpose are you sending the uploads to a different box?

You could always keep the image in the database, then you don't need to 
worry about which server has the image and which doesn't, always get it 
from the db.


--
Postgresql & php tutorials
http://www.designmagick.com/

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



[PHP] PHP Post to other Servers

2006-03-06 Thread Robert Sandie
Want to load balance a server and send image uploads to a different box with
PHP installed. What would the correct method to authenticate on the second
machine and send without ruining user experience by sending them to a second
page? 

 

Initial thought was to keep the box address inside of the box address?

 

- Rob



[PHP] OpenSSL error:0E06D06C:configuration file routines:func(109):reason(108) ??!

2006-03-06 Thread Daevid Vincent
I copied and pasted the example found here:
http://www.php.net/openssl_csr_new
And this one too:
http://www.php.net/manual/en/function.openssl-pkey-new.php

And I get the output that looks like valid 'gibberish' for all three (CSR,
Cert, PK), except what concerns me is that I get fifteen of the same
(completely useless and unhelpful) errors too?!

while (($e = openssl_error_string()) !== false)
   echo $e . "\n";

error:0E06D06C:configuration file routines:func(109):reason(108)
... Snip the other 13 of these ...
error:0E06D06C:configuration file routines:func(109):reason(108)

Google doesn't return a single hit for that error message!?

I tried this "trick" to 'clear' the error buffer prior to my cert
generation, 
but no luck.
http://www.php.net/manual/en/function.openssl-error-string.php

I'm using PHP v5.0.3 on linux.

This program makes use of the Zend Scripting Language Engine:
Zend Engine v2.0.3, Copyright (c) 1998-2004 Zend Technologies
with Zend Extension Manager v1.0.9, Copyright (c) 2003-2005, by Zend
Technologies
with Zend Optimizer v2.6.0, Copyright (c) 1998-2005, by Zend
Technologies

# openssl version  
OpenSSL 0.9.7d 17 Mar 2004

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



Re: [PHP] PHP with FTP

2006-03-06 Thread Chris

_-=MealstroM=-_ wrote:

Hello Chris,

Tuesday, March 7, 2006, 1:36:54 AM, you wrote:



_-=MealstroM=-_ wrote:


Hello php-general,

Hi. I ve got some trabl with this commands
ftp_pwd() and ftp_chdir()
They work correctly with some ftp servers,
but i ve got some problems with warftp server.
This server doesn't recognize them.




If the server doesn't recognise them we can't do much.




If you can put together a small self-contained example you could post a
bug report but I think they'll tell you it's not their problem, it's the
ftp server's problem.



  I ve got the advise to make some function like this:
  int ftp_login(int ftp_stream, string username, string password);
  //where username and password may be different

  He says that's my answer, and the problem is related with
  some browser's options or something like this. But i don't really
  know what to do.

  PS: sorry for my English.


Please post to the list as well - others may be able to help you where I 
can't.


Basically you have to log in to the ftp account.

See http://www.php.net/ftp_login for examples on how to do it.

--
Postgresql & php tutorials
http://www.designmagick.com/

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



[PHP] Generating License Codes for Distribution

2006-03-06 Thread Bruce
 I am looking for some PHP code that will allow me to do something like take
a string name, an expiration date, and a 16-byte key and generate an 8-byte
license code in the form of

---

I have some Windows code that I've used for years, and I successfully ported
it to PHP, only to find out that different systems treat integer overflows
differently.

--Bruce


Re: [PHP] highlight_string()

2006-03-06 Thread Chris

Weber Sites LTD wrote:

I was afraid of that...
I need to do HTML manipulations on the text that is outside the .
After I run highlight_string the original text is messed up.
If I run the manipulations before then they will look like HTML 
And not act as HTML...


Any ideas?


You could get the php from your page, highlight it and replace it back in:

preg_replace('%%s', 'highlight_string(${1})', $content);

don't know if that will work straight out for you but that should give 
you an idea on how to proceed.



Or you could temporarily remove them, do whatever then replace it back in:

$placeholders = array();
while(preg_match('%%s', $content, $matches)) {
  $size = sizeof($placeholders);
  $placeholders[$size] = $matches[1];
  $content = str_replace($matches[0], '%%PLACEHOLDER['.$size.']%%', 
$content);

}

... other processing here.

foreach($placeholders as $i => $text) {
  $content = str_replace('%%PLACEHOLDER['.$i.']%%', 
highlight_string($text), $content);

}



-Original Message-
From: chris smith [mailto:[EMAIL PROTECTED] 
Sent: Monday, March 06, 2006 11:59 AM

To: Weber Sites LTD
Cc: php-general@lists.php.net
Subject: Re: [PHP] highlight_string()

On 3/6/06, Weber Sites LTD <[EMAIL PROTECTED]> wrote:

The only way I could work around this was to put empty  at the 
Beginning of the text and now highlight_string() highlights only what 
Is inside 


You can see an example of the problematic text in the example Area of 
this page : http://www.weberdev.com/get_example-4345.html


Notice the empty  at the beginning of the example.
Without them, all of the example, including the text and HTML Part 
will be painted by highlight_string().


Is this a bug?



No. It will highlight html as well.

You can give the illusion of it not highlighting the html by using:

ini_set('highlight.html', '#00');

--
Postgresql & php tutorials
http://www.designmagick.com/






--
Postgresql & php tutorials
http://www.designmagick.com/

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



RE: [PHP] Mysql Rows [END of thread]

2006-03-06 Thread tedd

Hi gang:



Miles said:


Why are we still chasing this thread?


No need to pursue this thread anymore -- I'll just address the 
statements put to me.


Why does he even have to see gaps? Just present the info, unless he 
wants to see the ID.


Miles, I think that's the best solution I've heard thus far -- thanks.

---

JM said:


If you don't care that a given record may have a different, unpredictable
record number each time its queried, and if you're sure no one is going to
inherit this application and be stymied by your unorthodox approach, and if
you know that in the future you will not need to access this data by a
static record number, it doesn't matter.  Otherwise, my advice would be to
add a timestamp column and sort by that instead.


LOL -- I think you drove your point home -- thanks.



Anthony Ettinger said:


I think the main reason is fora more extensible design. Sure, you may
only have the 1 table now, and think you never will enhance your
functionality...but as soon as you do  comes up with a new scenario,
you'll have to change the current behavior...easier to plan for that
ahead of time. Technically, it works the way you want it...there's no
right or wrong way, just degrees of flexibility, and it so happens
this method seems inflexible from what I gather.


Very good -- thanks.

---

Paul  said:

It's simply -- concretely -- inefficient & inelegant to modify on 
average half the records in a database simply in order to delete one 
record, when queries give us fast, simple, READ-ONLY methods for 
enumerating existing data.


Okay, I got the idea -- thank you.

You guys are great -- thanks for putting up with me. As Daniel Boone 
once wrote: "I have never been lost, but I will admit to being 
confused for several weeks."


tedd

--

http://sperling.com

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



[PHP] RE: [PHP-DB] Re: PHP4 with MYSQL5

2006-03-06 Thread Bastien Koert
it does, you need the updated mysql library that comes with the php 5 files 
(libmysql.dll for windows)


bastien



From: João Cândido de Souza Neto <[EMAIL PROTECTED]>
To: php-db@lists.php.net,php-general@lists.php.net
Subject: [PHP-DB] Re: PHP4 with MYSQL5
Date: Mon, 06 Mar 2006 18:38:56 -0300

I receive aa answer by e-mail in order this telling me that i must upgrade
my php4 to php5.

It means that a php4 server don't works fine with mysql5 server?

João Cândido de Souza Neto wrote:

> Hello everyone.
>
> I'm trying to use my php4 conecting to a mysql5 server, and then 
executing

> some command lines to create a stored procedure but it's not working.
>
> When a tried to execute "delimiter |", my php gets de follow error:
>
> You have an error in your SQL syntax; check the manual that corresponds 
to

> your MySQL server version for the right syntax to use near 'delimiter |'
> at line 1
>
> If I connect to server as local and try to execute the above command, it
> works fine.
>
> Could anyone help me about this? I'll be pleased by any tips.
>
> Thanks.

--
PHP Database 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] Re: simplify DOM api

2006-03-06 Thread Andreas Korthaus

Rob Richards wrote:

You can also look at using xmlwriter, when creating serialized trees, 
that automatically does escaping for you.


Hm, AFAIK latest xmlwriter versions provide an OO API. Do you know about 
any documentation for it?


The only code I've seen so far is:
http://cvs.php.net/viewcvs.cgi/pecl/xmlwriter/examples/xmlwriter_oo.php?view=markup&rev=1.1.2.2

And that's not too much (but promising) ;-) Or do you know about some 
more complex examples?


Btw. I need to validate my created documents against an XML schema, I 
doubt this is possible with xmlwriter.



Best regards
Andreas

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



Re: [PHP] PHP with FTP

2006-03-06 Thread Chris

_-=MealstroM=-_ wrote:

Hello php-general,

Hi. I ve got some trabl with this commands
ftp_pwd() and ftp_chdir()
They work correctly with some ftp servers,
but i ve got some problems with warftp server.
This server doesn't recognize them.


If the server doesn't recognise them we can't do much.

If you can put together a small self-contained example you could post a 
bug report but I think they'll tell you it's not their problem, it's the 
ftp server's problem.


--
Postgresql & php tutorials
http://www.designmagick.com/

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



Re: [PHP] Re: PHP4 with MYSQL5

2006-03-06 Thread Chris

João Cândido de Souza Neto wrote:

I receive aa answer by e-mail in order this telling me that i must upgrade
my php4 to php5.

It means that a php4 server don't works fine with mysql5 server?

João Cândido de Souza Neto wrote:



Hello everyone.

I'm trying to use my php4 conecting to a mysql5 server, and then executing
some command lines to create a stored procedure but it's not working.

When a tried to execute "delimiter |", my php gets de follow error:

You have an error in your SQL syntax; check the manual that corresponds to
your MySQL server version for the right syntax to use near 'delimiter |'
at line 1

If I connect to server as local and try to execute the above command, it
works fine.

Could anyone help me about this? I'll be pleased by any tips.

Thanks.





Depends on your query.

Post your exact query and we'll see if we can help.

--
Postgresql & php tutorials
http://www.designmagick.com/

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



Re: [PHP] Regexp matching in SQL

2006-03-06 Thread Chris

Brian Anderson wrote:
"IN ( exp1, exp2)" didn't seem to work for me. I've seen that used 
before for including a subquery, but somehow it didn't like the comma 
separated list.


I think this below is doing it for me.

  $separated = implode("|", (explode(" ", 
(AddSlashes($_REQUEST['terms']);


   if($_REQUEST['c'] == "and"){
   $conditional = 'AND';
   }else{
   $conditional = 'OR';
   }
 $delim = " WHERE Keyword REGEXP '$separated' $conditional 
ItemDescription REGEXP '$separated'";



I'm still curious about the IN() keyword and how it works.



in() is good for id's:

select * from table where categoryid in (1,2,3,4,5);


it's basically expanded to an or:

select * from table where categoryid=1 or categoryid=2 or categoryid=3 
or categoryid=4 or categoryid=5;





[EMAIL PROTECTED] wrote:


[snip]
I am trying to simplify an SQL query that is pretty much like below:

$sql = "SELECT * FROM table WHERE keyword RLIKE '$expression1' OR 
keyword RLIKE '$expression2' ";


The different terms '$expression1' and '$expression1' come from  an
array.

Is there any way to within one regular expression to say either term1 or

term 2? Something like this where the OR condition would be basically 
built into the regular expression:


$sql = "SELECT * FROM table WHERE keyword RLIKE '$expression'";   // the

$expression would have to signify either a or b.

Does that make sense?

[/snip]

Kinda'. If you asked on a SQL board they would say do this;

SELECT * FROM table WHERE keyword IN ($expression1, $expression2)

IN is the shorthand for multiple OR conditions.

  






--
Postgresql & php tutorials
http://www.designmagick.com/

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



Re: [PHP] Mysql Rows

2006-03-06 Thread Chris



Barry:

I realize that relational dB's are out if one does this -- and -- I 
fully understand why.


That's the reason when I started this thread I made it clear that I was 
NOT talking about a relational dB but rather a simple flat file.


What I find interesting in all of this exchange -- however -- is that 
everyone agree's renumbering the "id" of a dB is something you don't do, 
but no one can come up with a concrete (other than relational) reason why.


I haven't finished reading this thread but here's why.

It's because those id's could be used as foreign keys.

I'll set up an example:

create table author (authorid int, authorname varchar(200));
insert into author(authorid, authorname) values(1, 'Chris 1');
insert into author(authorid, authorname) values(2, 'Chris 2');

create table news(newsid int, newstitle varchar(200), authorid int);

insert into news(newsid, newstitle, authorid) values (1, 'News by first 
author', 1);
insert into news(newsid, newstitle, authorid) values (1, 'News by second 
author', 2);



If you delete author '1' and then renumber, you have to go through every 
other table in the database to see if anything relates to authorid '1' 
and update it.



Extremely time consuming and extremely error prone.

--
Postgresql & php tutorials
http://www.designmagick.com/

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



[PHP] Re: create xml root-element with xmlns and xsd link (using DOM)

2006-03-06 Thread Andreas Korthaus

Rob wrote:
That's how namespaced attributes, which is nothing more than you are 
creating, are supposed to be created in DOM.


OK, thank you!

best regards
Andreas

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



Re: [PHP] Regexp matching in SQL

2006-03-06 Thread Brian Anderson
"IN ( exp1, exp2)" didn't seem to work for me. I've seen that used 
before for including a subquery, but somehow it didn't like the comma 
separated list.


I think this below is doing it for me.

  $separated = implode("|", (explode(" ", 
(AddSlashes($_REQUEST['terms']);


   if($_REQUEST['c'] == "and"){
   $conditional = 'AND';
   }else{
   $conditional = 'OR';
   }
  
   $delim = " WHERE Keyword REGEXP '$separated' $conditional 
ItemDescription REGEXP '$separated'";



I'm still curious about the IN() keyword and how it works.

-Brian


[EMAIL PROTECTED] wrote:

[snip]
I am trying to simplify an SQL query that is pretty much like below:

$sql = "SELECT * FROM table WHERE keyword RLIKE '$expression1' OR 
keyword RLIKE '$expression2' ";


The different terms '$expression1' and '$expression1' come from  an
array.

Is there any way to within one regular expression to say either term1 or

term 2? Something like this where the OR condition would be basically 
built into the regular expression:


$sql = "SELECT * FROM table WHERE keyword RLIKE '$expression'";   // the

$expression would have to signify either a or b.

Does that make sense?

[/snip]

Kinda'. If you asked on a SQL board they would say do this;

SELECT * FROM table WHERE keyword IN ($expression1, $expression2)

IN is the shorthand for multiple OR conditions.

  


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



RE: [PHP] Re: PHP4 with MYSQL5

2006-03-06 Thread jblanchard
[snip]
I receive aa answer by e-mail in order this telling me that i must upgrade
my php4 to php5.

It means that a php4 server don't works fine with mysql5 server?
[/snip]

http://www.php.net/mysqli is designed to work with versions of MySQL 4.1.n and 
above. It requires PHP5

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



[PHP] Re: PHP4 with MYSQL5

2006-03-06 Thread João Cândido de Souza Neto
I receive aa answer by e-mail in order this telling me that i must upgrade
my php4 to php5.

It means that a php4 server don't works fine with mysql5 server?

João Cândido de Souza Neto wrote:

> Hello everyone.
> 
> I'm trying to use my php4 conecting to a mysql5 server, and then executing
> some command lines to create a stored procedure but it's not working.
> 
> When a tried to execute "delimiter |", my php gets de follow error:
> 
> You have an error in your SQL syntax; check the manual that corresponds to
> your MySQL server version for the right syntax to use near 'delimiter |'
> at line 1
> 
> If I connect to server as local and try to execute the above command, it
> works fine.
> 
> Could anyone help me about this? I'll be pleased by any tips.
> 
> Thanks.

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



[PHP] PHP4 with MYSQL5

2006-03-06 Thread João Cândido de Souza Neto
Hello everyone.

I'm trying to use my php4 conecting to a mysql5 server, and then executing
some command lines to create a stored procedure but it's not working.

When a tried to execute "delimiter |", my php gets de follow error:

You have an error in your SQL syntax; check the manual that corresponds to
your MySQL server version for the right syntax to use near 'delimiter |' at
line 1

If I connect to server as local and try to execute the above command, it
works fine.

Could anyone help me about this? I'll be pleased by any tips.

Thanks.

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



RE: [PHP] Regexp matching in SQL

2006-03-06 Thread jblanchard
[snip]
I am trying to simplify an SQL query that is pretty much like below:

$sql = "SELECT * FROM table WHERE keyword RLIKE '$expression1' OR 
keyword RLIKE '$expression2' ";

The different terms '$expression1' and '$expression1' come from  an
array.

Is there any way to within one regular expression to say either term1 or

term 2? Something like this where the OR condition would be basically 
built into the regular expression:

$sql = "SELECT * FROM table WHERE keyword RLIKE '$expression'";   // the

$expression would have to signify either a or b.

Does that make sense?

[/snip]

Kinda'. If you asked on a SQL board they would say do this;

SELECT * FROM table WHERE keyword IN ($expression1, $expression2)

IN is the shorthand for multiple OR conditions.

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



[PHP] Regexp matching in SQL

2006-03-06 Thread Brian Anderson

I am trying to simplify an SQL query that is pretty much like below:

$sql = "SELECT * FROM table WHERE keyword RLIKE '$expression1' OR 
keyword RLIKE '$expression2' ";


The different terms '$expression1' and '$expression1' come from  an array.

Is there any way to within one regular expression to say either term1 or 
term 2? Something like this where the OR condition would be basically 
built into the regular expression:


$sql = "SELECT * FROM table WHERE keyword RLIKE '$expression'";   // the 
$expression would have to signify either a or b.


Does that make sense?

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



Re: [PHP] Prepared statements

2006-03-06 Thread Julius Hacker
Curt Zirzow wrote:
>
> I assume your loop is something like:
>   while(condition) {
> $auction_parts['id'] = 'some value';
> $auction_parts['name'] = 'some value';
> ...
> $insert->execute();
>   }
>   
Yes, thats it.

> My first guess would be, if not aleady done, initialize
> $auction_parts before you do your bind_param() with something like:
>
>   $auction_parts = array('id' => null, 'name' => null, ...);
>   $insert->bind_param("issdsis", $auction_house["id"], ...);
>   
Unfortunately it helps nothing :-(
But I think also that it's something because of the declaration and
initalization of the variables because it works if I have the bind_param
in the loop after I gave the variables their values.
But to have the bind_param in the loop isn't the best solution I think.

-- 
Regards
Julius Hacker

http://www.julius-hacker.de
[EMAIL PROTECTED]

OpenPGP-Key-ID: 0x4B4A486E

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



Re: [PHP] Re: Is this possible with php

2006-03-06 Thread tg-php
Yeah, you can't do the local computer file moving and all that with the same 
script as your server side component, but if you'd rather not learn C# or 
another language like that, but you're comfortable with PHP, I'd highly 
recommend checking out Winbinder (http://www.winbinder.com).  Assuming your 
clients are all windows machines.

PHP is very powerful, it's just cumbersome to get a non-tech person to use a 
typically shell oriented language to do things on the client's machine.  
Winbinder provides a merging of PHP and Windows' native API.  Takes a little 
getting used to at first, but works great.

-TG

= = = Original message = = =

PHP can do this, but you'd need it set up on each of the client
computers and periodically run to check the temp folder and perform the
upload. That's what any other application that can do similar does.

Cheers,
Rob.

On Mon, 2006-03-06 at 15:30, Jo~o C~ndido de Souza Neto wrote:
> PHP don't do this.
> 
> The user must select a file to upload and then the PHP can work with this.
> 
> PHP has no access to local files, think with me, how can PHP discover which
> machine in internet he has to access to get files.
> 
> Mace Eliason wrote:
> 
> > 
> > Hi,
> > 
> > I really don't think this is possible from what I know of php, but I
> > thought I would as the experts.
> > 
> > Is it possible to have php create directories and move files on a local
> > machine. I have created a web portal for a client and now they would
> > like it to upload files to an server, no a problem. But they would like
> > it to also move temp files on the users computer to new directories and
> > then upload the file to the server with no user interation other than
> > clicking go.
> > 
> > I have thought of doing this in vb or c# but I have done very little
> > with these languages, and php just rocks.
> > 
> > Thanks
> > 
> > Scandog


___
Sent by ePrompter, the premier email notification software.
Free download at http://www.ePrompter.com.

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



Re: [PHP] Re: Is this possible with php

2006-03-06 Thread João Cândido de Souza Neto
Ok, but you're telling that the client will be doing upload to server. Not
the server doing a dounload from client. I was understood as a wrong way.
I'm sorry.

Robert Cummings wrote:

> PHP can do this, but you'd need it set up on each of the client
> computers and periodically run to check the temp folder and perform the
> upload. That's what any other application that can do similar does.
> 
> Cheers,
> Rob.
> 
> On Mon, 2006-03-06 at 15:30, João Cândido de Souza Neto wrote:
>> PHP don't do this.
>> 
>> The user must select a file to upload and then the PHP can work with
>> this.
>> 
>> PHP has no access to local files, think with me, how can PHP discover
>> which machine in internet he has to access to get files.
>> 
>> Mace Eliason wrote:
>> 
>> >

>> > Hi,
>> > 
>> > I really don't think this is possible from what I know of php, but I
>> > thought I would as the experts.
>> > 
>> > Is it possible to have php create directories and move files on a local
>> > machine. I have created a web portal for a client and now they would
>> > like it to upload files to an server, no a problem. But they would like
>> > it to also move temp files on the users computer to new directories and
>> > then upload the file to the server with no user interation other than
>> > clicking go.
>> > 
>> > I have thought of doing this in vb or c# but I have done very little
>> > with these languages, and php just rocks.
>> > 
>> > Thanks
>> > 
>> > Scandog

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



Re: [PHP] Re: Is this possible with php

2006-03-06 Thread Robert Cummings
PHP can do this, but you'd need it set up on each of the client
computers and periodically run to check the temp folder and perform the
upload. That's what any other application that can do similar does.

Cheers,
Rob.

On Mon, 2006-03-06 at 15:30, João Cândido de Souza Neto wrote:
> PHP don't do this.
> 
> The user must select a file to upload and then the PHP can work with this.
> 
> PHP has no access to local files, think with me, how can PHP discover which
> machine in internet he has to access to get files.
> 
> Mace Eliason wrote:
> 
> > 
> > Hi,
> > 
> > I really don't think this is possible from what I know of php, but I
> > thought I would as the experts.
> > 
> > Is it possible to have php create directories and move files on a local
> > machine. I have created a web portal for a client and now they would
> > like it to upload files to an server, no a problem. But they would like
> > it to also move temp files on the users computer to new directories and
> > then upload the file to the server with no user interation other than
> > clicking go.
> > 
> > I have thought of doing this in vb or c# but I have done very little
> > with these languages, and php just rocks.
> > 
> > Thanks
> > 
> > Scandog
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

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



[PHP] Re: Is this possible with php

2006-03-06 Thread João Cândido de Souza Neto
PHP don't do this.

The user must select a file to upload and then the PHP can work with this.

PHP has no access to local files, think with me, how can PHP discover which
machine in internet he has to access to get files.

Mace Eliason wrote:

> 
> Hi,
> 
> I really don't think this is possible from what I know of php, but I
> thought I would as the experts.
> 
> Is it possible to have php create directories and move files on a local
> machine. I have created a web portal for a client and now they would
> like it to upload files to an server, no a problem. But they would like
> it to also move temp files on the users computer to new directories and
> then upload the file to the server with no user interation other than
> clicking go.
> 
> I have thought of doing this in vb or c# but I have done very little
> with these languages, and php just rocks.
> 
> Thanks
> 
> Scandog

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



Re: [PHP] Re: Is this possible with php

2006-03-06 Thread Austin Denyer
(Re-sending as I accidentally sent my original post directly to Al)

Al wrote:
> Mace Eliason wrote:
> 
>> I really don't think this is possible from what I know of php, but I
>> thought I would as the experts.
>>
>> Is it possible to have php create directories and move files on a
>> local machine. I have created a web portal for a client and now they
>> would like it to upload files to an server, no a problem. But they
>> would like it to also move temp files on the users computer to new
>> directories and then upload the file to the server with no user
>> interation other than clicking go.
>>
>> I have thought of doing this in vb or c# but I have done very little
>> with these languages, and php just rocks.
> 
> php can only do things on its server and send stuff for rendering to the
> client.

It also sounds like a MAJOR security issue to me.  I sure don't want a
3rd party web site moving files around on MY system...

Regards,
Ozz.






signature.asc
Description: OpenPGP digital signature


Re: [PHP] Mysql Rows

2006-03-06 Thread Paul Novitski

At 08:57 AM 3/6/2006, tedd wrote:
What I find interesting in all of this exchange -- however -- is 
that everyone agree's renumbering the "id" of a dB is something you 
don't do, but no one can come up with a concrete (other than 
relational) reason why.



It's simply -- concretely -- inefficient & inelegant to modify on 
average half the records in a database simply in order to delete one 
record, when queries give us fast, simple, READ-ONLY methods for 
enumerating existing data.


Regards,
Paul 


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



[PHP] Backing up emails and then forwarding them

2006-03-06 Thread IG

Hi.

I want to have a script that when run backs up all emails in a pop3 
mailbox that are from email addresses not in a database. The person who 
has sent the email will receive an email that asks them to verify the 
email by clicking a link and then the email is sent.


I need to know how to resend the email from the database. I have backed 
up the full body and the full headers. How can I reconstitute the email 
and send it as an attached eml file?


Many thanks,

IG

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



Re: [PHP] Mysql Rows

2006-03-06 Thread Anthony Ettinger
On 3/6/06, Jim Moseby <[EMAIL PROTECTED]> wrote:
> >
> > What I find interesting in all of this exchange -- however -- is that
> > everyone agree's renumbering the "id" of a dB is something you don't
> > do, but no one can come up with a concrete (other than relational)
> > reason why.
>
>
>
> If you don't care that a given record may have a different, unpredictable
> record number each time its queried, and if you're sure no one is going to
> inherit this application and be stymied by your unorthodox approach, and if
> you know that in the future you will not need to access this data by a
> static record number, it doesn't matter.  Otherwise, my advice would be to
> add a timestamp column and sort by that instead.
>
> JM
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>


I think the main reason is fora more extensible design. Sure, you may
only have the 1 table now, and think you never will enhance your
functionality...but as soon as you do  comes up with a new scenario,
you'll have to change the current behavior...easier to plan for that
ahead of time. Technically, it works the way you want it...there's no
right or wrong way, just degrees of flexibility, and it so happens
this method seems inflexible from what I gather.

--
Anthony Ettinger
Signature: http://chovy.dyndns.org/hcard.html

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



RE: [PHP] Mysql Rows

2006-03-06 Thread Miles Thompson

At 10:56 AM 3/6/2006, tedd wrote:


As such, if you don't renumber, then the only thing left is to use a
timestamp, I guess.
[/snip]

No, if you have gaps you can still step through sequentially, like 14,
15, 18, 19, 20...


It's the gaps that are the problem.

I have no problem understanding why there are gaps in a dB and dealing 
with them. After all I've been juggling memory and bit-twiddling longer 
than I want to admit, so I understand "holes" in stuff. But what I am 
trying to solve is the simple thing of presenting records to a civilian 
such that there are no gaps in his record keeping.


I don't want to have to explain to my client why his dB has gaps in it. I 
don't want to listen to him asking why those gaps aren't filled. In fact, 
I don't want to raise the issue at all if I can get around it.


One way I found to get around this problem was to simply renumber the "id" 
filed in the table -- but, I received considerable advice against that 
from this list. I'm still not certain as to why that shouldn't be 
considered a "good" solution, but the "feelings" of the group are "don't 
do it".


So, I'm still trying to find a simple way around this problem. Either I 
renumber the "id" field OR provide an external counter to present to the 
user. I don't see any other solutions, does anyone?


Thanks.

tedd


Tedd,

Why does he even have to see gaps? Just present the info, unless he wants 
to see the ID.


If wonders why there are gaps, then just tell him that happens when someone 
is deleted.


If he wants the gaps "filled" - then keep a table of the "holes" and 
recycle those numbers when new members are added. But there will still be 
occasional gaps.


But if you renumber the ID field, you have seamless crap, because the 
number is absolutely meaningless. Today I'm 2345, tomorrow 2344 because one 
member's been deleted, next day I'm 2322 because a lot of people were 
deleted but the day after that 2367 because a lot of people signed up.


If the client wants the number of current people, then SELECT Count(*) ... 
gets it for you.


Why are we still chasing this thread?

Regards - Miles 



--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.1.375 / Virus Database: 268.1.2/274 - Release Date: 3/3/2006

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



[PHP] PHP4 with MYSQL5

2006-03-06 Thread João Cândido de Souza Neto
Hello everyone.

I'm trying to use my php4 conecting to a mysql5 server, and then executing
some command lines to create a stored procedure but it's not working.

When a tried to execute "delimiter |", my php gets de follow error:

You have an error in your SQL syntax; check the manual that corresponds to
your MySQL server version for the right syntax to use near 'delimiter |' at
line 1

If I connect to server as local and try to execute the above command, it
works fine.

Could anyone help me about this? I'll be pleased by any tips.

Thanks.

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



RE: [PHP] Mysql Rows

2006-03-06 Thread Jim Moseby
> 
> What I find interesting in all of this exchange -- however -- is that 
> everyone agree's renumbering the "id" of a dB is something you don't 
> do, but no one can come up with a concrete (other than relational) 
> reason why.



If you don't care that a given record may have a different, unpredictable
record number each time its queried, and if you're sure no one is going to
inherit this application and be stymied by your unorthodox approach, and if
you know that in the future you will not need to access this data by a
static record number, it doesn't matter.  Otherwise, my advice would be to
add a timestamp column and sort by that instead.

JM

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



[PHP] Re: Converting HTML to BBCode

2006-03-06 Thread J_K9
Hi Al,

Thank you for your reply. I have changed my code to the following:

---CODE---
';

$translate_array = array(
'' => '[b]',
'' => '[/b]',
'' => '[b]',
'' => '[/b]',
'' => '[i]',
'' => '[/i]',
'' => '[i]',
'' => '[/i]',
'' => '[u]',
'' => '[/u]',
' '[img]',
' border="0" />' => '[/img]',
'' => '',
'' => '',
'' => '[list]',
'' => '[/list]'
);

$find_array= array_keys($translate_array);

$replace_array= array_values($translate_array);

$text= preg_replace($find_array, $replace_array, $text); // Line 41


echo '' . "$text" . '';

?>
---/CODE---

However, I get the following error appearing in between the two 
textareas:

---ERROR---
Warning: preg_replace() [function.preg-replace]: No ending matching 
delimiter '>' found in /var/www/htdocs/file.php on line 41

Warning: preg_replace() [function.preg-replace]: No ending matching 
delimiter '>' found in /var/www/htdocs/file.php on line 41

Warning: preg_replace() [function.preg-replace]: Delimiter must not be 
alphanumeric or backslash in /var/www/htdocs/file.php on line 41
---/ERROR---

Thanks for your help so far! It'd be great if this works out ;)

Cheers,

J_K9

> Here is an example for you.
> First make an array like this:
> 
> $translate_array= array(
> ' & ' => ' & ',
> '"&"' => '"&"',
> 'W&OD'=> 'W&OD',
> '&O'  => '&O',
> 'M&F' => 'M&F',
> );
> 
> Then use:
> 
> $find_array= array_keys($translate_array);
> 
> $replace_array= array_values($translate_array);
> 
> $text= preg_replace($find_array, $replace_array, $text);
> //with preg_replace you can make the $find stuff case insensitive
> 
> OR simply:
> 
> $text= strtr($text, $translate_array);
> 
> 
> 
> 

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



[PHP] Re: Is this possible with php

2006-03-06 Thread Al

Mace Eliason wrote:


Hi,

I really don't think this is possible from what I know of php, but I 
thought I would as the experts.


Is it possible to have php create directories and move files on a local 
machine. I have created a web portal for a client and now they would 
like it to upload files to an server, no a problem. But they would like 
it to also move temp files on the users computer to new directories and 
then upload the file to the server with no user interation other than 
clicking go.


I have thought of doing this in vb or c# but I have done very little 
with these languages, and php just rocks.


Thanks

Scandog


php can only do things on its server and send stuff for rendering to the client.

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



[PHP] Re: Converting HTML to BBCode

2006-03-06 Thread Al

Here is an example for you.
First make an array like this:

$translate_array= array(
' & '   => ' & ',
'"&"' => '"&"',
'W&OD'  => 'W&OD',
'&O'=> '&O',
'M&F'   => 'M&F',
);

Then use:

$find_array= array_keys($translate_array);

$replace_array= array_values($translate_array);

$text= preg_replace($find_array, $replace_array, $text);
//with preg_replace you can make the $find stuff case insensitive

OR simply:

$text= strtr($text, $translate_array);




J_K9 wrote:

Hi,

I'm trying to code a PHP app to convert my inputted HTML code (into a 
textarea) into BBCode, for use on a forum. I have tried to code it, 
but have had little success so far. Here is the code I wrote (sorry, 
I'm still learning):


---CODE---


Convert from HTML to BBCode



Body:  


';

// Declare HTML tags to find, and BBCode tags to replace them with

$linkStartFind = '' . "$text" . '';

?>


---/CODE---

Now, most of this doesn't work. Here is the test code I put into the 
first textarea:


---TESTCODE---
Testing bold code

Testing italics

http://link.com";>Testing link

http://image.com/img.jpg"; border="0" />

http://image.com/img2.jpg"; style="padding-right: 5px;" 
border="0" />

---/TESTCODE---

And here's what I got out:

---RESULT---
[/b]Testing bold code[/b]

[i]Testing italics[/i]

http://link.com\";>Testing link[/url]

http://image.com/img.jpg\"; border=\"0\" />

http://image.com/img2.jpg\"; style=\"padding-right: 5px;\" 
border=\"0\" />

---/RESULT---

As you can see, the bold, italic, and ending hyperlink tag 
replacements worked, but the rest didn't. Backslashes have been added 
where there are "", and if there were anything between an img 
tag's 'src="{image}"' and ' border="0" />' that wouldn't be removed, 
and therefore provide me with a faulty link.


Just to clarify the BBCode tags, they are:

[url=http://link.com]Click this link[/url]
[img]http://imagesite.com/image.jpg[/img]
[b]_BOLD_[/b]
[i]italicised[/i]
[u]underlined[/i]

I would really like to get this working, as it'll not only help me 
improve my PHP skills but also aid my tutorial conversions - it takes 
ages to do this by hand ;)


Any help would be appreciated. Thanks in advance,

J_K9


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



Re: [PHP] Mysql Rows

2006-03-06 Thread Anthony Ettinger
On 3/6/06, Dusty Bin <[EMAIL PROTECTED]> wrote:
> Another point to consider, is that Tedds method of renumbering the rows,
> *may* not preserve the original sequence.  I have not checked the mysql
> source, but if some delete activity has occurred in the table, then
> there will be holes in the data, in some circumstances, inserting
> further records to the table, some may go on the end, and some may fill
> the holes.  I suspect that using Tedd's method of dropping the column,
> and then re-adding the column, the auto increment, will either be added
> in the physical sequence of the table, or added in the order of any
> index that may be traversed in this process.  As an extreme example, if
> one had a table with 5 million rows, and then deleted the first 4.5
> million rows, where will the next insert go?  One of the benefits of a
> relational database, is that you do not need to consider how the data is
> physically stored.
>
> Best regards... Dusty
>
> [EMAIL PROTECTED] wrote:
> > [snip]
> > That's the reason when I started this thread I made it clear that I
> > was NOT talking about a relational dB but rather a simple flat file.
> >
> > What I find interesting in all of this exchange -- however -- is that
> > everyone agree's renumbering the "id" of a dB is something you don't
> > do, but no one can come up with a concrete (other than relational)
> > reason why.
> >
> > [/snip]
> >
> > Tedd, several here, including me, have said that if you have only a
> > single table database that renumbering is OK, just not a preferred
> > practice. (BTW, you never answered my question about this being a flat
> > file database or single table, although I have figured it out now.)
> > Renumber to your heart's content. If your users are allowed delete
> > privileges (ACK!) and you don't want to confuse them, go ahead and
> > renumber.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>

Not to mention adding other tables which references those numbers as a
foreign key. Seems like the wrong way to do it in my opinion. Business
logic should be abstracted from the database layer and handled in the
source code, rather than relying on re-factoring the database
everytime you want a count.

--
Anthony Ettinger
Signature: http://chovy.dyndns.org/hcard.html

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



Re: [PHP] Mysql Rows

2006-03-06 Thread Dusty Bin
Another point to consider, is that Tedds method of renumbering the rows,
*may* not preserve the original sequence.  I have not checked the mysql
source, but if some delete activity has occurred in the table, then
there will be holes in the data, in some circumstances, inserting
further records to the table, some may go on the end, and some may fill
the holes.  I suspect that using Tedd's method of dropping the column,
and then re-adding the column, the auto increment, will either be added
in the physical sequence of the table, or added in the order of any
index that may be traversed in this process.  As an extreme example, if
one had a table with 5 million rows, and then deleted the first 4.5
million rows, where will the next insert go?  One of the benefits of a
relational database, is that you do not need to consider how the data is
physically stored.

Best regards... Dusty

[EMAIL PROTECTED] wrote:
> [snip]
> That's the reason when I started this thread I made it clear that I 
> was NOT talking about a relational dB but rather a simple flat file.
> 
> What I find interesting in all of this exchange -- however -- is that 
> everyone agree's renumbering the "id" of a dB is something you don't 
> do, but no one can come up with a concrete (other than relational) 
> reason why.
> 
> [/snip]
> 
> Tedd, several here, including me, have said that if you have only a
> single table database that renumbering is OK, just not a preferred
> practice. (BTW, you never answered my question about this being a flat
> file database or single table, although I have figured it out now.)
> Renumber to your heart's content. If your users are allowed delete
> privileges (ACK!) and you don't want to confuse them, go ahead and
> renumber. 

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



[PHP] X Tiger 10.4.5 + phpBB2 + MySQL 5 + Can't Connect Issue! - SOLVED!

2006-03-06 Thread m i l e s

Hi,

Figured it out:

Apple wiped out the location of the socket.

they wanted '/var/mysql/mysql.sock'

it should be: '/tmp/mysql.sock'

Problem solved.

M i l e s.

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



Re: [PHP] Convert all named entities into numeric character references

2006-03-06 Thread tedd

Jacob Friis Saxberg wrote:


Does anyone know of a Php funtion that can do this:
http://golem.ph.utexas.edu/~distler/blog/NumericEntities.html



http://se.php.net/manual/en/function.htmlentities.php



htmlentities converts to named entitites. I want it to numeric entities.


Yes; 'tis true.  However, in looking at the manual page further, I
see at least one "user submitted" entry that looks like what you
may be desiring, not too far down the page.

Kevin Kinsey


Yes, 'tis true -- sort of.

The remaining "user submitted" entries skirt the subject, but don't 
provide a complete translation.


I estimate about 245 named entities (w3c approved), which can be found here:

http://www.roborg.co.uk/html_entities/

If all of those were pumped through some of those "user submitted" 
functions, then I think that would provide Jacob's solution.


Unfortunately, I don't know of any current php functions that do 
that. I'm sure you realize that they (Jacob's link above) are simply 
taking a small set of entities to their to their Unicode equivalents, 
which are in HEX.


For example a euro-glyph code point in Unicode is 20AC, which is of 
course HEX for 8364 DEC.


The problem is that unfortunately most browsers do not yet support 
Unicode characters, so one must either use "&euro" or it's decimal 
equivalent in the form of €.


So, at the moment, we are in transition. It might be a nice and a 
somewhat simple project for someone to convert all named entities 
into numeric equivalents.


If I find some spare time (other than writing post to this list), 
perhaps I'll do it.


tedd

--

http://sperling.com

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



Re: [PHP] Mysql Rows

2006-03-06 Thread Jochem Maas

tedd wrote:

Well it seems you output it via PHP so count it extern in PHP.
And changing ID values is a "no-go!"
You will never have any relation possibilities if you alter the ID 
fields.


In short. You mess everthing up with it.

There are count functions in MySQL that gives you the counted rows or 
output it counted.


You can look at the manuals in mysql.com

Good luck
Barry



Barry:

I realize that relational dB's are out if one does this -- and -- I 
fully understand why.


That's the reason when I started this thread I made it clear that I was 
NOT talking about a relational dB but rather a simple flat file.


What I find interesting in all of this exchange -- however -- is that 
everyone agree's renumbering the "id" of a dB is something you don't do, 
but no one can come up with a concrete (other than relational) reason why.


it's a unique identifier in time and space. changing it means potentially
losing referential information (that may exist on seperate systems and/or 
outside
of the DB).

if 123 refers to product X today you should be able to rely on refering to
product X next week. the the product 123 refers to changes over time the id is
at the very least alot less value as an identifier (because identifier are
used to refer to specific things and/or related 2 or more entities - that is 
only of
value when ids are immutable)

one of the few reasons you would want to renumber is because,as is the case here
I believe, one would like to use the id values for something other than what 
they were
designed for - i.e. using them as optential wincodes in a sweepstake type 
wotsit
[primary]keyfields are meant to uniquely identify an entity (row) and nothing 
else.



But your suggestion to look-up the MySQL count function, is a good one, 
thank you.


tedd



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



Re: [PHP] Detect where someone comes from

2006-03-06 Thread Benjamin Adams

Got it Thanks!!
Ben

On Mar 6, 2006, at 12:13 PM, Stut wrote:


Benjamin Adams wrote:


Currently I have
an ini file that has the list of banner websites
I can make it count
problem is:
$_SERVER['REFERER'] will give me the full link
http://www.domain.com/dir/location/file.php
where I just want the
http://www.domain.com/


Look at http://php.net/parse_url

-Stut



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



Re: [PHP] Detect where someone comes from

2006-03-06 Thread Stut

Benjamin Adams wrote:


Currently I have
an ini file that has the list of banner websites
I can make it count
problem is:
$_SERVER['REFERER'] will give me the full link
http://www.domain.com/dir/location/file.php
where I just want the
http://www.domain.com/


Look at http://php.net/parse_url

-Stut

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



RE: [PHP] Mysql Rows

2006-03-06 Thread jblanchard
[snip]
That's the reason when I started this thread I made it clear that I 
was NOT talking about a relational dB but rather a simple flat file.

What I find interesting in all of this exchange -- however -- is that 
everyone agree's renumbering the "id" of a dB is something you don't 
do, but no one can come up with a concrete (other than relational) 
reason why.

[/snip]

Tedd, several here, including me, have said that if you have only a
single table database that renumbering is OK, just not a preferred
practice. (BTW, you never answered my question about this being a flat
file database or single table, although I have figured it out now.)
Renumber to your heart's content. If your users are allowed delete
privileges (ACK!) and you don't want to confuse them, go ahead and
renumber. 

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



Re: [PHP] Mysql Rows [and whats the difference between Navigational and Relational DBs]

2006-03-06 Thread Jochem Maas

Miles Thompson wrote:

I hope the following will be helpful, and it is a bit of a rant ..



thank god someone ranted on this already :-)
I wasn't feeling up to it but it's also one of those cases that you can't
help but speak out. ;-)

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



[PHP] X Tiger 10.4.5 + phpBB2 + MySQL 5 + Can't Connect Issue!

2006-03-06 Thread m i l e s

Hi,

Im getting the following: Warning: mysql_connect(): Can't connect to  
local MySQL server through socket...etc.


NOTES:

1.) MySQL 5 is running fine.
2.) Im able to connect to it via Navicat.
3.) I run Lasso on the same host, I know that I can pull and post  
data to and from MySQL. So its NOT mysql. Its PHP.


I ran across a few postings from Apple and others that had SIMILAR  
problems, however those solutions are for MySQL 4 not MySQL 5. Seems  
to be bit of confusion about how to solve this problem. I tried what  
apple suggested...and that FAILED:


http://docs.info.apple.com/article.html?artnum=301457

So now Im asking you good people. Im at whits end and I need to get  
this up and running.


All I did was update from 10.4.4 to 10.4.5 and now PHP will not talk  
to MySQL at all. Ok...so what's the solution folks ? Anyone ?  
Buehler ? Buehler 


Thanks ahead of time

M i l e s.

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



Re: [PHP] Detect where someone comes from

2006-03-06 Thread Benjamin Adams

Currently I have
an ini file that has the list of banner websites
I can make it count
problem is:
$_SERVER['REFERER'] will give me the full link
http://www.domain.com/dir/location/file.php
where I just want the
http://www.domain.com/
Ben

On Mar 6, 2006, at 11:39 AM, Benjamin Adams wrote:


I have banners on other websites.
I'm trying to detect who is clicking on what banners.
I can have the company that has the banners throw a ? 
bannercompany='companyname'
and do a query on that but I would like to do it just by auto  
detecting

Ben

On Mar 6, 2006, at 11:21 AM, <[EMAIL PROTECTED]>  
<[EMAIL PROTECTED]> wrote:



[snip]
I was wondering if there was a way I can see where people are linking
to me from.  Can I find this in php?
[/snip]

HTTP_REFERRER is good to see where people are coming from, if it  
is set.
Are you wanting to see if people have links to your site? If so,  
you're

going to need a spider.



--
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



Re: [PHP] Mysql Rows

2006-03-06 Thread tedd

Well it seems you output it via PHP so count it extern in PHP.
And changing ID values is a "no-go!"
You will never have any relation possibilities if you alter the ID fields.

In short. You mess everthing up with it.

There are count functions in MySQL that gives you the counted rows 
or output it counted.


You can look at the manuals in mysql.com

Good luck
Barry


Barry:

I realize that relational dB's are out if one does this -- and -- I 
fully understand why.


That's the reason when I started this thread I made it clear that I 
was NOT talking about a relational dB but rather a simple flat file.


What I find interesting in all of this exchange -- however -- is that 
everyone agree's renumbering the "id" of a dB is something you don't 
do, but no one can come up with a concrete (other than relational) 
reason why.


But your suggestion to look-up the MySQL count function, is a good 
one, thank you.


tedd

--

http://sperling.com

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



[PHP] Is this possible with php

2006-03-06 Thread Mace Eliason


Hi,

I really don't think this is possible from what I know of php, but I 
thought I would as the experts.


Is it possible to have php create directories and move files on a local 
machine. I have created a web portal for a client and now they would 
like it to upload files to an server, no a problem. But they would like 
it to also move temp files on the users computer to new directories and 
then upload the file to the server with no user interation other than 
clicking go.


I have thought of doing this in vb or c# but I have done very little 
with these languages, and php just rocks.


Thanks

Scandog

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



Re: [PHP] Detect where someone comes from

2006-03-06 Thread Benjamin Adams

I have banners on other websites.
I'm trying to detect who is clicking on what banners.
I can have the company that has the banners throw a ? 
bannercompany='companyname'

and do a query on that but I would like to do it just by auto detecting
Ben

On Mar 6, 2006, at 11:21 AM, <[EMAIL PROTECTED]>  
<[EMAIL PROTECTED]> wrote:



[snip]
I was wondering if there was a way I can see where people are linking
to me from.  Can I find this in php?
[/snip]

HTTP_REFERRER is good to see where people are coming from, if it is  
set.
Are you wanting to see if people have links to your site? If so,  
you're

going to need a spider.



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



Re: [PHP] Re: Detect where someone comes from

2006-03-06 Thread Russell Jones
If you want to find out who is actually linking to you altogether (such as
for search engine optimization, etc.) you are going to want to use the
following search query in Yahoo...

linksite:yoursite.com -site:yoursite.com

This will tell you everyone who is linking to you minus the links coming
from your site. Google only shows a subset of the links pointing to you, and
it is difficult to exclude your own domain from those results. MSN doesn't
have a deep enough spider to really give you an accurate response, so Yahoo
is the best.

There are some more tricks if you are interested, shoot me an email.

Russ Jones
CTO Virante, Inc.


On 3/6/06, Barry <[EMAIL PROTECTED]> wrote:
>
> Benjamin Adams wrote:
> > I was wondering if there was a way I can see where people are linking
> > to me from.  Can I find this in php?
> > --Ben
> $_SERVER["HTTP_REFERER"];
>
> It's an Apache server variable.
>
> --
> Smileys rule (cX.x)C --o(^_^o)
> Dance for me! ^(^_^)o (o^_^)o o(^_^)^ o(^_^o)
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


RE: [PHP] Detect where someone comes from

2006-03-06 Thread jblanchard
[snip]
I was wondering if there was a way I can see where people are linking  
to me from.  Can I find this in php?
[/snip]

HTTP_REFERRER is good to see where people are coming from, if it is set.
Are you wanting to see if people have links to your site? If so, you're
going to need a spider.

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



[PHP] Re: Detect where someone comes from

2006-03-06 Thread Barry

Benjamin Adams wrote:
I was wondering if there was a way I can see where people are linking  
to me from.  Can I find this in php?

--Ben

$_SERVER["HTTP_REFERER"];

It's an Apache server variable.

--
Smileys rule (cX.x)C --o(^_^o)
Dance for me! ^(^_^)o (o^_^)o o(^_^)^ o(^_^o)

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



[PHP] Detect where someone comes from

2006-03-06 Thread Benjamin Adams
I was wondering if there was a way I can see where people are linking  
to me from.  Can I find this in php?

--Ben

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



Re: [PHP] Convert all named entities into numeric character references

2006-03-06 Thread Kevin Kinsey

Jacob Friis Saxberg wrote:


Does anyone know of a Php funtion that can do this:
http://golem.ph.utexas.edu/~distler/blog/NumericEntities.html
 


Hi there!

http://se.php.net/manual/en/function.htmlentities.php

?
   



htmlentities converts to named entitites. I want it to numeric entities.

 



Yes; 'tis true.  However, in looking at the manual page further, I
see at least one "user submitted" entry that looks like what you
may be desiring, not too far down the page.

HTH,

Kevin Kinsey

--
When the only tool you have is a hammer, every problem starts to look
like a nail.

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



Re: [PHP] Mailto members..?

2006-03-06 Thread Leif Gregory
Hello John,

Wednesday, March 1, 2006, 11:38:15 AM, you wrote:
> Outside of being a major spam flag, and possibly reaching the limits
> of your smtp server.

Agreed... Sending mass mail via BCC is going to be nothing but
headaches. I've been down that road a number of times.


-- 
  TBUDL/BETA/DEV/TECH Lists Moderator / PGP 0x6C0AB16B
 __       Geocaching:http://gps.PCWize.com
(  )  ( ___)(_  _)( ___)  TBUDP Wiki Site:  http://www.PCWize.com/thebat/tbudp
 )(__  )__)  _)(_  )__)   Roguemoticons & Smileys:http://PCWize.com/thebat
()()()(__)PHP Tutorials and snippets:http://www.DevTek.org

For people who like peace and quiet:  a phoneless cord.

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



Re: [PHP] Convert all named entities into numeric character references

2006-03-06 Thread Jacob Friis Saxberg
> > Does anyone know of a Php funtion that can do this:
> > http://golem.ph.utexas.edu/~distler/blog/NumericEntities.html
> Hi there!
>
> http://se.php.net/manual/en/function.htmlentities.php
>
> ?

htmlentities converts to named entitites. I want it to numeric entities.

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



[PHP] Re: PHP4, domxml and xpath with Namespaces

2006-03-06 Thread Markus Fischer
Thanks Rob, that's it!

I really appreciate your help, because I know that my initial question
had very little to do with PHP but with XML ..

again, thank you!

- Markus

Rob wrote:
> Markus Fischer wrote:
>> Hi,
>>
>> I haven't yet worked with namespaces in XML before when it comes to DOM
>> related methods. My source is an Office 2003 Excel XML and it contains
>> XML like:
>>
>> 
>> 
>> >  xmlns:o="urn:schemas-microsoft-com:office:office"
>>  xmlns:x="urn:schemas-microsoft-com:office:excel"
>>  xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"
>>  xmlns:html="http://www.w3.org/TR/REC-html40";>
>>  
>>  
>>   > x:FullColumns="1"
>>x:FullRows="1" ss:DefaultColumnWidth="60">
>>
>>
>>
>> How can I use an xpath expression to find e.g. all rows in Worksheet
>> "Sheet1" ?
>>
>> My problem here is that the name of the Worksheet is in a namespace
>> attribute and I don't know how to express this as an xpath expression.
>>
>> The following doesn't work, always returns an empty nodeset to me:
>> [EMAIL PROTECTED]:Name='Sheet1']
>>
>> Can someone give me a push into the right direction?
> 
> You need to register the namespace and a prefix (prefix can be anything
> you want to use) with xpath and don't forget what the elements are
> within a default namespace coming from the
> xmlns="urn:schemas-microsoft-com:office:spreadsheet" namespace
> declaration on the Workbook element.
> 
> xpath_register_ns($xpath,"ss",
> "urn:schemas-microsoft-com:office:spreadsheet");
> 
> $nodeset = xpath_eval($xpath,"ss:[EMAIL PROTECTED]:Name='Sheet1']");
> 
> both the element and attribute are within the same namespace so the
> namespace and prefix are registered once and the prefix is used to
> identify both in the xpath expression.
> 
> Rob

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



[PHP] Re: PHP4, domxml and xpath with Namespaces

2006-03-06 Thread Rob

Markus Fischer wrote:

Hi,

I haven't yet worked with namespaces in XML before when it comes to DOM
related methods. My source is an Office 2003 Excel XML and it contains
XML like:



http://www.w3.org/TR/REC-html40";>
 
 
  
   
   

How can I use an xpath expression to find e.g. all rows in Worksheet
"Sheet1" ?

My problem here is that the name of the Worksheet is in a namespace
attribute and I don't know how to express this as an xpath expression.

The following doesn't work, always returns an empty nodeset to me:
[EMAIL PROTECTED]:Name='Sheet1']

Can someone give me a push into the right direction?


You need to register the namespace and a prefix (prefix can be anything 
you want to use) with xpath and don't forget what the elements are 
within a default namespace coming from the 
xmlns="urn:schemas-microsoft-com:office:spreadsheet" namespace 
declaration on the Workbook element.


xpath_register_ns($xpath,"ss", 
"urn:schemas-microsoft-com:office:spreadsheet");


$nodeset = xpath_eval($xpath,"ss:[EMAIL PROTECTED]:Name='Sheet1']");

both the element and attribute are within the same namespace so the 
namespace and prefix are registered once and the prefix is used to 
identify both in the xpath expression.


Rob

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



Re: [PHP] Mysql Rows

2006-03-06 Thread Barry

tedd wrote:

As such, if you don't renumber, then the only thing left is to use a
timestamp, I guess.
[/snip]

No, if you have gaps you can still step through sequentially, like 14,
15, 18, 19, 20...



It's the gaps that are the problem.

I have no problem understanding why there are gaps in a dB and dealing 
with them. After all I've been juggling memory and bit-twiddling longer 
than I want to admit, so I understand "holes" in stuff. But what I am 
trying to solve is the simple thing of presenting records to a civilian 
such that there are no gaps in his record keeping.


I don't want to have to explain to my client why his dB has gaps in it. 
I don't want to listen to him asking why those gaps aren't filled. In 
fact, I don't want to raise the issue at all if I can get around it.


One way I found to get around this problem was to simply renumber the 
"id" filed in the table -- but, I received considerable advice against 
that from this list. I'm still not certain as to why that shouldn't be 
considered a "good" solution, but the "feelings" of the group are "don't 
do it".


So, I'm still trying to find a simple way around this problem. Either I 
renumber the "id" field OR provide an external counter to present to the 
user. I don't see any other solutions, does anyone?


Thanks.

tedd


Well it seems you output it via PHP so count it extern in PHP.
And changing ID values is a "no-go!"
You will never have any relation possibilities if you alter the ID fields.

In short. You mess everthing up with it.

There are count functions in MySQL that gives you the counted rows or 
output it counted.


You can look at the manuals in mysql.com

Good luck
Barry
--
Smileys rule (cX.x)C --o(^_^o)
Dance for me! ^(^_^)o (o^_^)o o(^_^)^ o(^_^o)

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



Re: [PHP] Mysql Rows

2006-03-06 Thread Ray Hauge
On Monday 06 March 2006 07:56, tedd wrote:
> So, I'm still trying to find a simple way around this problem. Either
> I renumber the "id" field OR provide an external counter to present
> to the user. I don't see any other solutions, does anyone?
>
> Thanks.
>
> tedd

I haven't followed this thread very closely, so pardon me if I'm just 
repeating what's already been said.  In order to have gaps in the DB, you 
have to delete records out of the DB.  What if you do not allow people to 
actually remove records from the DB, but rather have a "deleted" or "removed" 
column.  That way all the IDs are still valid, but you also have a way of 
knowing what's current and what is not.  Just a thought.  

-- 
Ray Hauge
Programmer/Systems Administrator
American Student Loan Services
http://www.americanstudentloan.com
1.800.575.1099

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



RE: [PHP] Mysql Rows

2006-03-06 Thread tedd

As such, if you don't renumber, then the only thing left is to use a
timestamp, I guess.
[/snip]

No, if you have gaps you can still step through sequentially, like 14,
15, 18, 19, 20...


It's the gaps that are the problem.

I have no problem understanding why there are gaps in a dB and 
dealing with them. After all I've been juggling memory and 
bit-twiddling longer than I want to admit, so I understand "holes" in 
stuff. But what I am trying to solve is the simple thing of 
presenting records to a civilian such that there are no gaps in his 
record keeping.


I don't want to have to explain to my client why his dB has gaps in 
it. I don't want to listen to him asking why those gaps aren't 
filled. In fact, I don't want to raise the issue at all if I can get 
around it.


One way I found to get around this problem was to simply renumber the 
"id" filed in the table -- but, I received considerable advice 
against that from this list. I'm still not certain as to why that 
shouldn't be considered a "good" solution, but the "feelings" of the 
group are "don't do it".


So, I'm still trying to find a simple way around this problem. Either 
I renumber the "id" field OR provide an external counter to present 
to the user. I don't see any other solutions, does anyone?


Thanks.

tedd

--

http://sperling.com

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



Re: [PHP] help with this error message please

2006-03-06 Thread Angelo Zanetti

Mark wrote:

Can anyone tell me why i am getting this message when trying to login to the
admin section, i am running the script off my local machine.

Warning: session_register() [function.session-register]: Cannot send session
cookie - headers already sent by (output started at
C:\VertrigoServ\_htdocs\mytipperV4.1\settings.php:2) in
C:\VertrigoServ\_htdocs\mytipperV4.1\checkadmin.php on line 44




your code is outputting something before a redirect, check for echo statements 
or blank spaces

Post your code and we can have a look at it.

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



[PHP] PHP4, domxml and xpath with Namespaces

2006-03-06 Thread Markus Fischer
Hi,

I haven't yet worked with namespaces in XML before when it comes to DOM
related methods. My source is an Office 2003 Excel XML and it contains
XML like:



http://www.w3.org/TR/REC-html40";>
 
 
  
   
   

How can I use an xpath expression to find e.g. all rows in Worksheet
"Sheet1" ?

My problem here is that the name of the Worksheet is in a namespace
attribute and I don't know how to express this as an xpath expression.

The following doesn't work, always returns an empty nodeset to me:
[EMAIL PROTECTED]:Name='Sheet1']

Can someone give me a push into the right direction?

thanks,
- Markus

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



RE: [PHP] Mysql Rows

2006-03-06 Thread jblanchard
[snip]
>You must have a column that is sequential in some way. An
>auto-incremented column, timestamp, or some other device that will
allow
>you to step through regardless of gaps in sequence. If you do not have
>such a column then you could add one.

You see, now that's the problem. If you have a field that has 
auto-increment and then delete a record, auto-increment does not go 
back and fill up the gaps.

As such, if you don't renumber, then the only thing left is to use a 
timestamp, I guess.
[/snip]

No, if you have gaps you can still step through sequentially, like 14,
15, 18, 19, 20...

[snip]

>The simplest example (most recent to oldest):
>
>select * from table order by datefield desc;
>
>
>To get them in the order they were entered:
>
>select * from table order by id asc;
>
>
>To get them in reverse order:
>
>select * from table order by id desc;

Which I could be used in such a way that you also provide a counter 
outside of mysql to show the user a number as they step through the 
records. However, the next time they want to review record xxx, it 
may not be in the same position because of deletions.
[/snip]

But if you never change the record number it will always have the same
record number. If someone searches for a particular record and it is not
there it has been deleted. Renumbering makes this far worse, because if
I am searching for record xxx and the table has been renumbered it may
now be record yyI'd have no way of knowing.

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



[PHP] Re: create xml root-element with xmlns and xsd link (using DOM)

2006-03-06 Thread Rob

Andreas Korthaus wrote:

Hi!

The XML-Code I have to create (http://news.php.net/php.general/231486), 
needs a root-element, with xmlns and XML schema link, something like that:


http://example.com/test";
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
  xsi:schemaLocation="http://example.com/test
  test.xsd">

Does DOM provide any means to add a XML schema link to the doc?

Now I'm doing it this way (which seems to work):

appendChild(new DOMElement('root', NULL,
  'http://example.com/test'));
$root->setAttributeNS('http://www.w3.org/2001/XMLSchema-instance',
  'xsi:schemaLocation', 'http://example.com/test test.xsd');
echo $doc->savexml();
?>

Does DOM provide nothing else?
Does anybody see any problems with this approach?


That's how namespaced attributes, which is nothing more than you are 
creating, are supposed to be created in DOM.


Rob

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



[PHP] Re: simplify DOM api

2006-03-06 Thread Rob Richards

Andreas Korthaus wrote:


I think this should be OK, or shouldn't I do it this way?
Both ways are perfectly acceptable and all up to personal preference. In 
fact, to support the way you are doing it was one of the reasons why DOM 
classes were allowed to be extended.


Perhaps you have seen that I've used a "xml_entity_encode()" function. 
This function works like htmlspecialchars(), but replaces ' with 
' and not '. Or do all of you use htmlspecialchars()? Does 
it work with Unicode strings?
I typically use htmlspecialchars() and remember that you are going to 
have to work with UTF-8, which is compatible with htmlspecialchars(), 
when editing a tree.
You can also look at using xmlwriter, when creating serialized trees, 
that automatically does escaping for you.


Rob

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



Re: [PHP] output Today's date

2006-03-06 Thread Barry

[EMAIL PROTECTED] wrote:

On Sat, Mar 04, 2006 at 07:01:55PM -0700, Paul Goepfert wrote:


Hi all,

ls there anyway I can set the date to the timezone of the clients
timezone?  For example, if a person opens the web page at 3/6 12:01
EST and another person opens the same page at 3/5 10:01 MST I would
like the date to be the above days on the client computers.  I know
everyone knows this but the way I described this the two people
accessed the webpage at the same time but I want the


correct date for


the client computer to be outputted.


There are some tools that you can detect where the person is
located and and you would be able to use the timezone from
that information. One site I found from a quick google search:

http://www.ip2location.com/


The cheapest and simpliest method would be to use some
javascript to detect the timezone. Or let the user specify
which one he wants to use.


Hi,

Javascripts' Date object has a getTimezoneOffset() method, which returns
the difference between local time and universal time in
minutes.

Jared

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




Hi there!

Yes, Javascript may have a such function, BUT think of the reliability...
It's not sure, that user has the Javascript-functionality turned on, what
happens then?

Best regards
Gustav Wiberg

The IP to location is the best way.
I am not quite sure but is in the HTTP GET header or the headers 
following then not the timezone included?


I am talking about the Headers the Browser sends.

Greets Barry

--
Smileys rule (cX.x)C --o(^_^o)
Dance for me! ^(^_^)o (o^_^)o o(^_^)^ o(^_^o)

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



RE: [PHP] output Today's date

2006-03-06 Thread gustav
>
>> On Sat, Mar 04, 2006 at 07:01:55PM -0700, Paul Goepfert wrote:
>> > Hi all,
>> >
>> > ls there anyway I can set the date to the timezone of the clients
>> > timezone?  For example, if a person opens the web page at 3/6 12:01
>> > EST and another person opens the same page at 3/5 10:01 MST I would
>> > like the date to be the above days on the client computers.  I know
>> > everyone knows this but the way I described this the two people
>> > accessed the webpage at the same time but I want the
>> correct date for
>> > the client computer to be outputted.
>>
>> There are some tools that you can detect where the person is
>> located and and you would be able to use the timezone from
>> that information. One site I found from a quick google search:
>>
>>  http://www.ip2location.com/
>>
>>
>> The cheapest and simpliest method would be to use some
>> javascript to detect the timezone. Or let the user specify
>> which one he wants to use.
>
> Hi,
>
> Javascripts' Date object has a getTimezoneOffset() method, which returns
> the difference between local time and universal time in
> minutes.
>
> Jared
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
Hi there!

Yes, Javascript may have a such function, BUT think of the reliability...
It's not sure, that user has the Javascript-functionality turned on, what
happens then?

Best regards
Gustav Wiberg

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



Re: [PHP] Convert all named entities into numeric character references

2006-03-06 Thread gustav
Hi there!

http://se.php.net/manual/en/function.htmlentities.php

?

Best regards
Gustav Wiberg

> Does anyone know of a Php funtion that can do this:
> http://golem.ph.utexas.edu/~distler/blog/NumericEntities.html
>
>
> Thanks,
> Jacob
>
> --
> 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] Convert all named entities into numeric character references

2006-03-06 Thread Jacob Friis Saxberg
Does anyone know of a Php funtion that can do this:
http://golem.ph.utexas.edu/~distler/blog/NumericEntities.html


Thanks,
Jacob

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



RE: [PHP] output Today's date

2006-03-06 Thread Jared Williams

> On Sat, Mar 04, 2006 at 07:01:55PM -0700, Paul Goepfert wrote:
> > Hi all,
> > 
> > ls there anyway I can set the date to the timezone of the clients 
> > timezone?  For example, if a person opens the web page at 3/6 12:01 
> > EST and another person opens the same page at 3/5 10:01 MST I would 
> > like the date to be the above days on the client computers.  I know 
> > everyone knows this but the way I described this the two people 
> > accessed the webpage at the same time but I want the 
> correct date for 
> > the client computer to be outputted.
> 
> There are some tools that you can detect where the person is 
> located and and you would be able to use the timezone from 
> that information. One site I found from a quick google search:
> 
>  http://www.ip2location.com/
> 
> 
> The cheapest and simpliest method would be to use some 
> javascript to detect the timezone. Or let the user specify 
> which one he wants to use.

Hi,

Javascripts' Date object has a getTimezoneOffset() method, which returns the 
difference between local time and universal time in
minutes.

Jared

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



RE: [PHP] highlight_string()

2006-03-06 Thread Weber Sites LTD
I was afraid of that...
I need to do HTML manipulations on the text that is outside the .
After I run highlight_string the original text is messed up.
If I run the manipulations before then they will look like HTML 
And not act as HTML...

Any ideas?

-Original Message-
From: chris smith [mailto:[EMAIL PROTECTED] 
Sent: Monday, March 06, 2006 11:59 AM
To: Weber Sites LTD
Cc: php-general@lists.php.net
Subject: Re: [PHP] highlight_string()

On 3/6/06, Weber Sites LTD <[EMAIL PROTECTED]> wrote:
> The only way I could work around this was to put empty  at the 
> Beginning of the text and now highlight_string() highlights only what 
> Is inside 
>
> You can see an example of the problematic text in the example Area of 
> this page : http://www.weberdev.com/get_example-4345.html
>
> Notice the empty  at the beginning of the example.
> Without them, all of the example, including the text and HTML Part 
> will be painted by highlight_string().
>
> Is this a bug?

No. It will highlight html as well.

You can give the illusion of it not highlighting the html by using:

ini_set('highlight.html', '#00');

--
Postgresql & php tutorials
http://www.designmagick.com/

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



RE: [PHP] highlight_string()

2006-03-06 Thread gustav
> The only way I could work around this was to put empty  at the
> Beginning of the text and now highlight_string() highlights only what
> Is inside 
>
> You can see an example of the problematic text in the example
> Area of this page : http://www.weberdev.com/get_example-4345.html
>
> Notice the empty  at the beginning of the example.
> Without them, all of the example, including the text and HTML
> Part will be painted by highlight_string().
>
> Is this a bug?
>
> -Original Message-
> From: Weber Sites LTD [mailto:[EMAIL PROTECTED]
> Sent: Monday, March 06, 2006 11:29 AM
> To: php-general@lists.php.net
> Subject: [PHP] highlight_string()
>
> Hi
>
> From what I see, highlight_string() should only change text between  ?>.
> Any idea why it highlights all of the text I send to it (even text outside
>  ?
>
> Thanks
>
> berber
>
> --
> 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
>
>
Hi guys!

Maybe you could take a look at this code:
http://aidanlister.com/repos/v/PHP_Highlight.php

Best regards
/Gustav Wiberg

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



Re: [PHP] highlight_string()

2006-03-06 Thread chris smith
On 3/6/06, Weber Sites LTD <[EMAIL PROTECTED]> wrote:
> The only way I could work around this was to put empty  at the
> Beginning of the text and now highlight_string() highlights only what
> Is inside 
>
> You can see an example of the problematic text in the example
> Area of this page : http://www.weberdev.com/get_example-4345.html
>
> Notice the empty  at the beginning of the example.
> Without them, all of the example, including the text and HTML
> Part will be painted by highlight_string().
>
> Is this a bug?

No. It will highlight html as well.

You can give the illusion of it not highlighting the html by using:

ini_set('highlight.html', '#00');

--
Postgresql & php tutorials
http://www.designmagick.com/

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



RE: [PHP] highlight_string()

2006-03-06 Thread Weber Sites LTD
The only way I could work around this was to put empty  at the 
Beginning of the text and now highlight_string() highlights only what
Is inside 

You can see an example of the problematic text in the example
Area of this page : http://www.weberdev.com/get_example-4345.html

Notice the empty  at the beginning of the example.
Without them, all of the example, including the text and HTML
Part will be painted by highlight_string().

Is this a bug?

-Original Message-
From: Weber Sites LTD [mailto:[EMAIL PROTECTED] 
Sent: Monday, March 06, 2006 11:29 AM
To: php-general@lists.php.net
Subject: [PHP] highlight_string()

Hi

>From what I see, highlight_string() should only change text between .
Any idea why it highlights all of the text I send to it (even text outside
 ?

Thanks

berber

--
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] highlight_string()

2006-03-06 Thread Weber Sites LTD
Hi

>From what I see, highlight_string() should only change text between .
Any idea why it highlights all of the text I send to it (even text outside
 ?

Thanks

berber

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



[PHP] Re: How can I tell if an output stream is finished?

2006-03-06 Thread Barry

Al wrote:

I have a page that resizes an image to be included in a html page, using:

echo "\n";

unlink($rel_mapfile);

I need the other html stuff on the page so I need to fetch a file from 
the server to include in the page.


So, I resized the image and saved it as a file.  That works fine.

After sending the temporary resized file I want to delete it.

Obviously, an unlink($rel_mapfile) is executed before the echo "src=\"$rel_mapfile\" ... is finished.


Thanks

Use flush();

--
Smileys rule (cX.x)C --o(^_^o)
Dance for me! ^(^_^)o (o^_^)o o(^_^)^ o(^_^o)

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