[PHP] Re: Smarty and PEAR DB

2005-04-12 Thread Lester Caine
Matthew Weier O'Phinney wrote:
As you can see I need the COUNT value but I not know how get it from =
query using PEAR. Some body can help me?
You'll need to do two different queries, one that counts the number of
total results for the criteria, and one that pulls the set with a LIMIT
statement.
Of cause the way to get round the performance hit is to keep some of the 
key counts actually in the database, populated by triggers. But that 
depends on which database engine you are using ;)

In many cases you will get away with a 'lots' for large count, but it is 
difficult to know if the count is going to be 10's and you only display 
10 at a time, or 1000's and you need to indicate that they will have a 
lot of pages unless they tighten the 'filter'. In my case I run the 
count as soon as a filter is applied, but keep the table totals in the 
database - along with a few useful other totals.

--
Lester Caine
-
L.S.Caine Electronic Services
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] How get words on a webpage

2005-04-12 Thread issin
Dear all,

 

   I want get words include today ** tonight on
www.XXX.com/index.html, and then show on my webpage.

   Please advise, thanks!

 

issin



 Information from NOD32 
This message was checked by NOD32 Antivirus System for Linux Mail Server.
http://www.nod32.com


[PHP] How get words on a webpage

2005-04-12 Thread Ken
On Apr 12, 2005 9:07 AM, issin [EMAIL PROTECTED] wrote:
 Dear all,

I want get words include today ** tonight on
 www.XXX.com/index.html, and then show on my webpage.

Please advise, thanks!

 issin

  Information from NOD32 
 This message was checked by NOD32 Antivirus System for Linux Mail Server.
 http://www.nod32.com



Man

one thing: RTFM

http://www.php.net/echo/
http://www.php.net/printf/

Ken

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



Re: [PHP] Is there any other place to start php module?

2005-04-12 Thread Joe Wollard
You might also look towards the bottom of httpd.conf for any additional 
conf files that are to be read. As I recall OSX will look for an 
additional conf file by default which may be trying to load the same module.

Prathaban Mookiah wrote:
Might be under apache conf dir/modules.d/
Prathap
-- Original Message ---
From: Teng Wang [EMAIL PROTECTED]
To: php-general@lists.php.net
Sent: Mon, 11 Apr 2005 20:57:58 -0400
Subject: [PHP] Is there any other place to start php module?
 

I can't find any line in httpd.conf to load libphp4.so, so I
added such a line to load it. But systems says
[warn] module php4_module is already loaded, skipping
So I guess there is some other place to start php4 already.
Where can I find it?
Thanks!
   eruisi
   04/11/2005
   20:55:49
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
   

--- End of Original Message ---
 



[PHP] sql groups

2005-04-12 Thread William Stokes
Know any good sql discussion groups for mysql?

Thanks
-Will 

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



Re: [PHP] sql groups

2005-04-12 Thread Davy Obdam
Have a look here: http://lists.mysql.com/
Best regards,
Davy
William Stokes wrote:
Know any good sql discussion groups for mysql?
Thanks
-Will 

 

--
Davy Obdam
mailto:[EMAIL PROTECTED]
web: http://www.davyobdam.com
Discordianism: Where reality is a figment of your imagination
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] sql groups

2005-04-12 Thread Prathaban Mookiah
Try,

http://forums.mysql.com/list.php?10

Prathap

-- Original Message ---
From: William Stokes [EMAIL PROTECTED]
To: php-general@lists.php.net
Sent: Tue, 12 Apr 2005 10:51:44 +0300
Subject: [PHP] sql groups

 Know any good sql discussion groups for mysql?
 
 Thanks
 -Will
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
--- End of Original Message ---

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



[PHP] Apache2 html/php dir-where..?

2005-04-12 Thread Mark Sargent
Hi All,
I've gone and uninstalled the pre-installed httpd/php via yum on Fedora3 
and re-installed Apache/PHP via source. Apache is now installed at 
/usr/local/apache2. I want to know, where is the dir for html/php files. 
B4 it was /var/www/html. What is it now..? Cheers.

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


Re: [PHP] Apache2 html/php dir-where..?

2005-04-12 Thread Jason Wong
On Tuesday 12 April 2005 16:09, Mark Sargent wrote:

 I've gone and uninstalled the pre-installed httpd/php via yum on
 Fedora3 and re-installed Apache/PHP via source. Apache is now installed
 at /usr/local/apache2. I want to know, where is the dir for html/php
 files. B4 it was /var/www/html. What is it now..? Cheers.

Look in /usr/local/apache2/conf/httpd.conf for DocumentRoot.

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
New Year Resolution: Ignore top posted posts

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



Re: [PHP] Apache2 html/php dir-where..?

2005-04-12 Thread Mark Sargent
Jason Wong wrote:
On Tuesday 12 April 2005 16:09, Mark Sargent wrote:
 

I've gone and uninstalled the pre-installed httpd/php via yum on
Fedora3 and re-installed Apache/PHP via source. Apache is now installed
at /usr/local/apache2. I want to know, where is the dir for html/php
files. B4 it was /var/www/html. What is it now..? Cheers.
   

Look in /usr/local/apache2/conf/httpd.conf for DocumentRoot.
 

Hi All,
ok, that's all cool now..changed to the dir where my files are. Cheers.
Mark Sargent.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Why does PHP have __toString() and not just toString()

2005-04-12 Thread Tim Burgan
Hello,
I'm a University student studying Java, but I also do some freelance web 
design - so naturally I do a fair bit of PHP which seems to be very 
similar to Java.

Usually I just code PHP as I need it, but down the track get REALLY 
annoyed when I need to edit or update my code. It's hard to follow and 
doesn't really have any order.

Then it came to me - why don't I code PHP with classes and plan my PHP 
like I do with Java. So today I looked into the PHP manual to find out 
about classes and objects in PHP.

I'm wondering, why does the toString() of classes have two underscored 
preceding it [e.g. __toString()], as opposed to Java's normal toString()?

What's the purpose of the two underscores in PHP's classes?
Thanks
Tim
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Installation problem of PhP5.0.4 on Fedora 2

2005-04-12 Thread Andy Pieters
On Tuesday 12 April 2005 00:28, Richard Lynch wrote:
 If your httpd.conf has a line loading PHP4 in it, comment that out.

Actually it might be inside a conf file in the conf.d subdirectory

cd /etc/httpd/conf.d

for a in *.conf; do echo File $a; grep php $a; done

Will point you in the right direction.

Andy
-- 
Registered Linux User Number 379093
-- ---BEGIN GEEK CODE BLOCK-
Version: 3.12
GAT/O/CM d- s:+ a- C UL P+ L+++ E--- W+++ N++ o+ K w--- O+++ M- V
PS+ PE++ Y+ PGP+++ t+ 5-- X R !tv b DI+++ D++ G e-- h+ r--- y+
-- ---END GEEK CODE BLOCK--

Check out these few php utilities that I released
 under the GPL2 and that are meant for use with a 
 php cli binary:
 
 http://www.vlaamse-kern.com/sas/
--

--

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



Re: [PHP] Why does PHP have __toString() and not just toString()

2005-04-12 Thread Richard Davey
Hello Tim,

Tuesday, April 12, 2005, 10:07:44 AM, you wrote:

TB I'm wondering, why does the toString() of classes have two underscored
TB preceding it [e.g. __toString()], as opposed to Java's normal toString()?

TB What's the purpose of the two underscores in PHP's classes?

The short answer: Because PHP isn't Java.

The long answer: Two underscores denote what PHP refers to as a magic
method. You shouldn't have your own functions with the same names
(unless you require that magical functionality). Have a look in the
PHP manual under the Magic Methods section for more info / examples.

Best regards,

Richard Davey
-- 
 http://www.launchcode.co.uk - PHP Development Services
 I do not fear computers. I fear the lack of them. - Isaac Asimov

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



[PHP] PHPMaker - your opinions...

2005-04-12 Thread Chris Ramsay
Hello all,

I'm curious - has anyone on the list ever used PHPMaker? I apologise
in advance if this is heresy; the reason I am asking is that I am in
the position of arguing my corner against the use of PHPMaker for
someone actually bothering to code by hand. I can't believe that
PHPMaker could possibly write code as well founded, compliant to
standards (subjective, I know), or secure as a reasonable developer
with several year's experience in PHP - or maybe I'm wrong and we'll
all soon be losing our jobs to non-programmers who can point and click
a bit...

I'd appreciate your opinions...

Regards

Chris

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



[PHP] Mail problem with PEAR

2005-04-12 Thread marc serra
Hi, i want to send an email with an attached file using PEAR classes. I 
succeed to do it with one recipients and more.

I use an external SMTP to send it. My problem is that when i want to 
send an email with for example 4 recipients and 1 attached file, the 
mail is send 4 times to the SMTP server. Is it possible to use PEAR mail 
function to send it 1 time to SMTP server and after that SMTP server 
send it to the 4 recipients ?

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


[PHP] Regular expressions

2005-04-12 Thread jem777
Php docs are quite messy about what works with what function...
This is my problem; I want to strip out spaces from my tags:

$word = [ / quote ];
$word = eregi_replace([[[:blank:]]*quote[[:blank:]]*], [quote], $word);
$word = eregi_replace([[[:blank:]]*\/[[:blank:]]*quote[[:blank:]]*],
[/quote], $word);

I would expect the result to be: [/quote] but it is [ /[quote].
It seems the first replace actually do the replace, but the how does it
match the slash / ???

Thanks,
Camillo

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



Re: [PHP] Regular expressions

2005-04-12 Thread Jason Wong
On Tuesday 12 April 2005 18:30, jem777 wrote:
 Php docs are quite messy about what works with what function...
 This is my problem; I want to strip out spaces from my tags:

 $word = [ / quote ];
 $word = eregi_replace([[[:blank:]]*quote[[:blank:]]*], [quote],
 $word); $word =
 eregi_replace([[[:blank:]]*\/[[:blank:]]*quote[[:blank:]]*],
 [/quote], $word);

 I would expect the result to be: [/quote] but it is [ /[quote].
 It seems the first replace actually do the replace, but the how does it
 match the slash / ???

  preg_replace('|\[\s*/\s*quote\s*]|', '[/quote]', $word);

You might want to spice it up with some ungreedy modifiers.

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
New Year Resolution: Ignore top posted posts

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



Re: [PHP] Why does PHP have __toString() and not just toString()

2005-04-12 Thread Rory Browne
I was wondering that as well. While I was at it, I wondered why not
use __to_str(), as per the PHP coding guidelines.

While I'm at it, why is grass green, and milk white?

On Apr 12, 2005 10:27 AM, Richard Davey [EMAIL PROTECTED] wrote:
 Hello Tim,
 
 Tuesday, April 12, 2005, 10:07:44 AM, you wrote:
 
 TB I'm wondering, why does the toString() of classes have two underscored
 TB preceding it [e.g. __toString()], as opposed to Java's normal toString()?
 
 TB What's the purpose of the two underscores in PHP's classes?
 
 The short answer: Because PHP isn't Java.
 
 The long answer: Two underscores denote what PHP refers to as a magic
 method. You shouldn't have your own functions with the same names
 (unless you require that magical functionality). Have a look in the
 PHP manual under the Magic Methods section for more info / examples.
 
 Best regards,
 
 Richard Davey
 --
 http://www.launchcode.co.uk - PHP Development Services
 I do not fear computers. I fear the lack of them. - Isaac Asimov
 
 --
 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] Storing password in cookie

2005-04-12 Thread trlists
On 11 Apr 2005 Richard Lynch wrote:

  Well, just because I'm not sure it is worth the effort.  What is the
  point of storing a hash code as a proxy (in the colloquial sense of the
  word) for an encrypted password if knowing the hash code gets you the
  same access as knowing the password?
 
 Because the hash code will change VERY frequently.

Fair enough.

And I also take all the points about plaintext passwords.  I don't 
think anyone was talking about that (I certainly was not).

 You have to assume the user of the PW has been stupid and set the PW
 to the *same* PW as their bank account. 

Fair enough.  The approach I was talking about does not protect against 
that and that is a flaw.  The random token approach does a much better 
job.

  Just as an FYI, I'm partly playing devil's advocate here.  I've never
  written anything that stored the encrypted PW in a cookie (though I
  have stored encrypted user IDs that way for a remember me feature).
  I'm just reacting to the sense that there is One True Way to handle
  this issue.  In software development there are most often many good
  options.

 *WHY* would you not store some kind of hash of the user ID?!

Because in that particular system no one considered the user ID to be 
valuable.  It is a little more complex to store and look up a hash, but 
not dramatically so.

  A digression to a related issue (where I did take the conservative
  approach):  A system I'm working on now was originally set up with
  password hashes in the database -- the PW itself was never stored.  But
  the client wanted an email me my password feature so we had to
  encrypt and store the PW.  Of course if someone had access to the
  database they'd get a lot of other stuff probably more useful than PWs
  so I don't worry about this too much.  But I would rather have used the
  hash.
 
 Please tell me what URL that is.  I want to BLOCK it so I never ever ever
 visit it.  Thank you.
 
 Even my lowest-level stupidest password for the 10,000 sites I don't care
 about shouldn't be stored in clear-text !

Who said anything about *storing* the PW in clear text??  For the 
record, it is stored encrypted, though I know this is weak protection 
since access to the server gets you access to the decryption key.  For 
the web portion of this there is no visibility to the password at all.  
For the email portion, of course there is as the password has to be 
sent in clear text as it is useless otherwise.  I personally would 
prefer to use a Reset my password approach and display the new PW 
over an HTTPS connection, but that does not meet my client's needs.  
And Email me my password features are widespread -- used most often 
on web-based discussion boards and the web-based interfaces for mailing 
list software.  Are you saying they are all wrong and no one should 
develop or implement them, or just that you personally would never use 
that feature?

On the general issue -- there are sites with login security practices 
that are excellent, good, mediocre, poor, or nonexistent.  What's 
bugging me here is not the idea that we should know about and use good 
practices, and from being willing to put forward my own questions I've 
learned a lot about that in this discussion.  What's bugging me is that 
there is a tone suggesting that everyone should be using the highest-
level security practices for all data no matter how unimportant.  I 
have always learned that you match the security practices to the value 
of the assets protected and the level of threat.  A shed in my back 
yard should be locked but it does not need an alarm system tied to the 
local police.  My house might.  The local bank should do way better 
than that.  Etc.  Web site security has the added problem that we do 
allow people to use the same key for the bike shed and the bank, but 
beyond that there are still tradeoffs and decisions to be made and not 
everything requires the same degree of protection.

Also I think it is easy to forget about the difference in the level of 
threat posed by a routine vs. rarely or randomly used feature.  If an 
encrypted password is stored in a cookie every user of the site is 
vulnerable and the entire universe of user accounts is open to attack 
if someone can figure out how to decrypt it.  On the other hand an 
email me my password feature is only open to attack when used and for 
the people who use it.  The number of systems or events which it 
produces for attack is much smaller.  That doesn't make it secure but 
it is likely less of a threat than practices which create 
vunerabilities automatically on every system which connects to the 
site.  This kind of discrimination seems to often be absent in the 
discussions here, but when implementing seurity in a real system I 
contend you have to do it.

--
Tom

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



Re: [PHP] Why does PHP have __toString() and not just toString()

2005-04-12 Thread M. Sokolewicz
Rory Browne wrote:
I was wondering that as well. While I was at it, I wondered why not
use __to_str(), as per the PHP coding guidelines.
because that's *against* php coding guidelines :)
You should have a look at the guidelines for METHOD-naming, which is 
part of the OOP part. It states that for method names, the camelcaps 
convention is used (aka studly caps)

- tul
While I'm at it, why is grass green, and milk white?
On Apr 12, 2005 10:27 AM, Richard Davey [EMAIL PROTECTED] wrote:
Hello Tim,
Tuesday, April 12, 2005, 10:07:44 AM, you wrote:
TB I'm wondering, why does the toString() of classes have two underscored
TB preceding it [e.g. __toString()], as opposed to Java's normal toString()?
TB What's the purpose of the two underscores in PHP's classes?
The short answer: Because PHP isn't Java.
The long answer: Two underscores denote what PHP refers to as a magic
method. You shouldn't have your own functions with the same names
(unless you require that magical functionality). Have a look in the
PHP manual under the Magic Methods section for more info / examples.
Best regards,
Richard Davey
--
http://www.launchcode.co.uk - PHP Development Services
I do not fear computers. I fear the lack of them. - Isaac Asimov
--
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] In need of help, plz

2005-04-12 Thread Siegfried
I've been working on a script to contain a monthly/weekly schema. The 
script is only starting from the start and stop unix timestamps for 
every task.

Now I'm having the problem of displaying the tasks properly.
For the time being, all tasks on a specific day gets its own column, but 
I want them to only appear in a new column if they collide with another 
task.

Example:   (example viewn with Courier New)
  (Now)  (Should be)
||   ||
|11  |   ||
||   ||
|  22|   ||
|  22  44|   ||
|  44|   ||
|3344|   ||
|  44|   ||
|  44|   ||
||   ||
Im using div tags and absolute positions, Here is my current 
collision script:
#The $printTask is built up as follows
#$printTask[day_of_week][unique_task_id] = settings_for_this
#unique_task_id is allways different
#settings_for_this contains:
# sx = starting y position
# sy = starting x position
# ey = ending y position
# id = says wich task the settings are made for, different from 
unique_task_id
##_BEGIN_CODE_##
		if(is_array($printTask)) ksort($printTask);
		foreach($printTask as $id_1 = $day){
			if(is_array($printTask[$id_3])) ksort($printTask[$id_3]);
			ksort($day);
			print n();
			foreach($day as $id_2 = $task){
$width = 100;
$collides = array();
foreach($day as $id_3 = $task2){
	if($id_3 != $id_2){
		if($task['sy'] = $task2['sy']  $task['ey'] = ($task2['ey'] + 
$task2['sy'])){
			if(is_array($printTask[$id_1][$id_3]['c'])  
in_array(c_data_.$task['id'],$printTask[$id_1][$id_3]['c'])){
$printTask[$id_1][$id_2]['l'][] = c_data_.$task2['id'];
			}else{
$printTask[$id_1][$id_2]['c'][] = c_data_.$task2['id'];
			}
		}elseif($task['sy'] = $task2['sy']  $task['ey'] = 
($task2['ey'] + $task2['sy'])){
			if(is_array($printTask[$id_1][$id_3]['c'])  
in_array(c_data_.$task['id'],$printTask[$id_1][$id_3]['c'])){
$printTask[$id_1][$id_2]['l'][] = c_data_.$task2['id'];
			}else{
$printTask[$id_1][$id_2]['c'][] = c_data_.$task2['id'];
			}
		}
	}
}
			}
		}
		#drawarray($printTask);
		$fe['max'] = arrayMax($fe['tasks']);
		foreach($printTask as $id_1 = $day){
			foreach($day as $id_2 = $task){
$w = 0; $l = 0; $c = 0;
if(isset($task['c'])){
	$w+= count($task['c']);
	$c = count($task['c']);
}
if(isset($task['l'])){
	$w+= count($task['l']);
	$l = count($task['l']);
}
$width = 100;
if($w  0) $width = (int)(100 / ($w + 1))+($w == $l?$l:0);
$left = 67 + ($id_1 * 101);
if($l  0) $left+= (int)((100 / ($w + 1)) * $l) - $l;
printDiv($left, $task['sy'], makeColor($fe['max'] + 1, $task['id']), 
$task['ey'], $width, $task['id'], 0, 0, $task['cf'], $task['cb']);
			}
		}

##_END_CODE_##

I hope you will be able to help me, I've gotten gray hairs over this one
//SIEGFRIED
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: PHPMaker - your opinions...

2005-04-12 Thread Satyam
Considering that we all fall into more or less into the same kind of code, 
and that a good chunk of all we program is quite basic, I don't see why this 
can be automated.  Does it cover everything? I am sure it can't, but I know 
that a good percentage of my active pages look quite alike, and those can 
easily be automated.

Satyam

Chris Ramsay [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
 Hello all,

 I'm curious - has anyone on the list ever used PHPMaker? I apologise
 in advance if this is heresy; the reason I am asking is that I am in
 the position of arguing my corner against the use of PHPMaker for
 someone actually bothering to code by hand. I can't believe that
 PHPMaker could possibly write code as well founded, compliant to
 standards (subjective, I know), or secure as a reasonable developer
 with several year's experience in PHP - or maybe I'm wrong and we'll
 all soon be losing our jobs to non-programmers who can point and click
 a bit...

 I'd appreciate your opinions...

 Regards

 Chris 

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



Re: [PHP] shared library in php

2005-04-12 Thread Josip Dzolonga
On , 2005-04-11 at 19:34 -0300, ngelo A. Camargo wrote:
  If you have NONE of those, you probably are trying to violate some kind of
  license.  Don't do that. :-v

Do not pay, to some reverse engineering :-)

Josip Dzolonga
http://josip.dotgeek.org

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



Re: [PHP] Is there any other place to start php module?

2005-04-12 Thread Josip Dzolonga
On , 2005-04-11 at 20:57 -0400, Teng Wang wrote:
 So I guess there is some other place to start php4 already.
 Where can I find it?

PHP is probably installed as a static module. For disabling PHP support
I think you'll need to recompile Apache.

Hope this helps,
Josip Dzolonga
http://josip.dotgeek.org

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



[PHP] Fulltext search engine

2005-04-12 Thread Roman Duriancik
I need in my own web server with mysql database and php script some free 
fulltext engine.
But i need search in slovak language (all data in database in slovak).
Can yopu help me where i can find some free fulltext engine ?
roman

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


Re: [PHP] Mail problem with PEAR

2005-04-12 Thread Josip Dzolonga
On , 2005-04-12 at 12:15 +0200, marc serra wrote:
 Hi, i want to send an email with an attached file using PEAR classes. I 
 succeed to do it with one recipients and more.
 
 I use an external SMTP to send it. My problem is that when i want to 
 send an email with for example 4 recipients and 1 attached file, the 
 mail is send 4 times to the SMTP server. Is it possible to use PEAR mail 
 function to send it 1 time to SMTP server and after that SMTP server 
 send it to the 4 recipients ?

Yes, set mail headers for CC and BCC. I'm not very familiar with PEAR's
package for sending mail, but I'm more than sure that it has feature to
set headers. Looking at the manual ( www.php.net/mail ) would be also an
excellent idea, since there are this kind of code examples.

Hope this helps,
Josip Dzolonga
http://josip.dotgeek.org

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



Re: [PHP] shared library in php

2005-04-12 Thread Josip Dzolonga
On , 2005-04-12 at 14:37 +0200, Josip Dzolonga wrote:
 On , 2005-04-11 at 19:34 -0300, ngelo A. Camargo wrote:
   If you have NONE of those, you probably are trying to violate some kind of
   license.  Don't do that. :-v
 
 Do not pay, to some reverse engineering :-)

s/to/do , damn keyboard :)

Josip Dzolonga
http://josip.dotgeek.org

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



[PHP] Re: call_user_func_array and mysqli_stmt_bind_result

2005-04-12 Thread Patrick
I ran into the same problem doing it oo style like this:

call_user_func_array(array($stmt, 'bind_result'),$rr);

Still don't understand why. Any input on this is very much welcome.

I could work around using eval:
$obj=$stmt; $mthd='bind_result'; $args[0]=''; $args[1]='';
eval(\$rval=\$obj-\$mthd($args););

The $args is primitive but only for testing purposes. The reason why I want
to use this is because of variable arglist and don't want to work with
switch.

cheers,
Pat



Patrick [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Hi,

 This is working (as a packet of crackers):

 ...

 mysqli_stmt_bind_result ($stmt, $arr[1], $arr[2]);

 ...

 This I cannot get to work:

 ...

 $arr[0]=$stmt; $arr[1]=''; $arr[2]='';

 call_user_func_array ('mysqli_stmt_bind_result',$arr);

 ...

 I'm not sure if what I try to do is possible in any way?

 Btw, this is Win PHP v5.0.3 , Apache v2.0.53, Mysql v5.0.2-alpha-nt.

 cheers and thanks,

 Patrick from Belgium (Brussels)

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



[PHP] Re: call_user_func_array and mysqli_stmt_bind_result

2005-04-12 Thread Patrick
correction:
I made $args as this: $args='$rr[0],$rr[1]';


Patrick [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 I ran into the same problem doing it oo style like this:

 call_user_func_array(array($stmt, 'bind_result'),$rr);

 Still don't understand why. Any input on this is very much welcome.

 I could work around using eval:
 $obj=$stmt; $mthd='bind_result'; $args[0]=''; $args[1]='';
 eval(\$rval=\$obj-\$mthd($args););

 The $args is primitive but only for testing purposes. The reason why I
want
 to use this is because of variable arglist and don't want to work with
 switch.

 cheers,
 Pat



 Patrick [EMAIL PROTECTED] wrote in message
 news:[EMAIL PROTECTED]
  Hi,
 
  This is working (as a packet of crackers):
 
  ...
 
  mysqli_stmt_bind_result ($stmt, $arr[1], $arr[2]);
 
  ...
 
  This I cannot get to work:
 
  ...
 
  $arr[0]=$stmt; $arr[1]=''; $arr[2]='';
 
  call_user_func_array ('mysqli_stmt_bind_result',$arr);
 
  ...
 
  I'm not sure if what I try to do is possible in any way?
 
  Btw, this is Win PHP v5.0.3 , Apache v2.0.53, Mysql v5.0.2-alpha-nt.
 
  cheers and thanks,
 
  Patrick from Belgium (Brussels)

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



Re: [PHP] Regular expressions

2005-04-12 Thread jem777
ok for this 2:

$body = preg_replace('|\[\s*quote\s*\]|', '[quote]', $body);
$body = preg_replace('|\[\s*/\s*quote\s*\]|', '[/quote]', $body);

but have these next instructions the same result?

$body = eregi_replace(\[ *quote *\], [quote], $body);
$body = eregi_replace(\[ */ *quote *\], [/quote], $body);



Jason Wong [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 On Tuesday 12 April 2005 18:30, jem777 wrote:
  Php docs are quite messy about what works with what function...
  This is my problem; I want to strip out spaces from my tags:
 
  $word = [ / quote ];
  $word = eregi_replace([[[:blank:]]*quote[[:blank:]]*], [quote],
  $word); $word =
  eregi_replace([[[:blank:]]*\/[[:blank:]]*quote[[:blank:]]*],
  [/quote], $word);
 
  I would expect the result to be: [/quote] but it is [ /[quote].
  It seems the first replace actually do the replace, but the how does it
  match the slash / ???

   preg_replace('|\[\s*/\s*quote\s*]|', '[/quote]', $word);

 You might want to spice it up with some ungreedy modifiers.

 -- 
 Jason Wong - Gremlins Associates - www.gremlins.biz
 Open Source Software Systems Integrators
 * Web Design  Hosting * Internet  Intranet Applications Development *
 --
 Search the list archives before you post
 http://marc.theaimsgroup.com/?l=php-general
 --
 New Year Resolution: Ignore top posted posts

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



[PHP] collect2: ld returned 1 exit status, make: *** [sapi/cli/php] Error 1

2005-04-12 Thread Mark Sargent
Hi All,
keep getting this error with make on Fedora 3, home machine. 
Successfully installed on work FC3 machine earlier today. I did make 
twice, to no avail, and then redid the configure then another make, with 
the same results.

collect2: ld returned 1 exit status
make: *** [sapi/cli/php] Error 1
Let me know if you need me to post more info from the make. Cheers.
php=5.0.3
apache=2.0.53 (apache installed fine)
Mark Sargent.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: Update XML

2005-04-12 Thread Jason Barnett
Stefan wrote:
 Hi NG!
 I've a problem in updating an XML-Node value.
 How can I change the value of an XML node?

 Thanks in Advance
 Stefan

AFAIK the sane way to do this is through the DOM API.  Or if it's a
one-off replacement you could use preg_match() and / or preg_replace()

--
Teach a man to fish...

NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-generalw=2
STFM | http://php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY |
http://mycroft.mozdev.org/download.html?name=PHPsubmitform=Find+search+plugins


signature.asc
Description: OpenPGP digital signature


[PHP] Re: class calling script

2005-04-12 Thread Jason Barnett
[EMAIL PROTECTED] wrote:
 Hi there, I have been testing a possible solution to reduce the ammount of
 interface calling scriptsto my class files. Currently each class has a 
 calling script. I am

For PHP5 you can try __autoload().  It provides for you a last-chance /
just in time loading of a class file.  The main drawback of using this
is that there is (currently) only one __autoload() function allowed, but
this limitation should be removed once PHP5.1.0 gets rolled out.

 thinking of setting up a url like /currentdir/packagename/classname, mind you 
 this is only a test but is it a
 good or bad bad idea ?I have run into troubles getting get queries because 
 its calling the
 classname in the query alreadyso /packagename/classname?test=1 doesnt work.


Using rewrite rules would be another way you could do it.  Or you could
have one main include file that would set some variable (call it
$base_dir) that points to the filesystem folder that is your root
directory.  I.e.

?php

/** main include file */
$base_dir = dirname(__FILE__) . '/';

/** now include some other global classes relative to this $base_dir */
include_once ($base_dir . 'path/from/docroot/to/class.php');

?

?php

/** some other script loads main config file */
require_once '/path/to/main.php';

/** now get your required classes */
require_once $base_dir . 'path/to/some/class.php';

?

--
Teach a man to fish...

NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-generalw=2
STFM | http://php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY |
http://mycroft.mozdev.org/download.html?name=PHPsubmitform=Find+search+plugins


signature.asc
Description: OpenPGP digital signature


[PHP] Is the syntax correct?

2005-04-12 Thread Labunski
Is the syntax correct? (in connection with $order) :


switch ($page) {
case news:
$order = DESC
break;
case articles:
$order = ASC
break;
}
mysql_query( SELECT * FROM data ORDER BY id $order );


Sorry for my bad english,
Lab. 

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



[PHP] Re: Is the syntax correct?

2005-04-12 Thread Ben Ramsey
Labunski wrote:
Is the syntax correct? (in connection with $order) :
Nope. You need some semicolons (;). So, these would become:
$order = DESC;
$order = ASC;
switch ($page) {
case news:
$order = DESC
break;
case articles:
$order = ASC
break;
}
mysql_query( SELECT * FROM data ORDER BY id $order );
The rest of it looks fine to me.
--
Ben Ramsey
http://benramsey.com/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Is the syntax correct?

2005-04-12 Thread Richard Davey
Hello Labunski,

Tuesday, April 12, 2005, 3:09:43 PM, you wrote:

L Is the syntax correct? (in connection with $order) :

Nope. You need ; after the $order = lines.

L switch ($page) {
L case news:
L $order = DESC
L break;
L case articles:
L $order = ASC
L break;
L }

I.e.: $order = DESC;

Best regards,

Richard Davey
-- 
 http://www.launchcode.co.uk - PHP Development Services
 I do not fear computers. I fear the lack of them. - Isaac Asimov

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



Re: [PHP] shared library in php

2005-04-12 Thread Ben Ramsey
Josip Dzolonga wrote:
If you have NONE of those, you probably are trying to violate some kind of
license.  Don't do that. :-v
Do not pay, to some reverse engineering :-)
s/to/do , damn keyboard :)
Which is obviously illegal if the shared library has a license that 
states he cannot do that. We don't want to promote illegal activities on 
this mailing list. :-)

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


[PHP] mod_rewrite and getting url variables

2005-04-12 Thread Ospinto
I used mod_rewrite to change http://www.mysite.com/page/1 to
http://www.mysite.com/page.php?id=1 to enable a search friendly url.
Everything works fine, except that when I try to get the URL variable ($id)
by using $_GET, it doesn't return anything. With
http://www.mysite.com/page.php?id=1 it gets $id just fine. I thought the
mod_rewrite would keep the url variables??? If not, I know the alternative
would be to get the whole url as a string and change it to an array by using
the / as the delimiter and obtain $id from that. But I'd rather go that
way if there's no other alternative.
The .htaccess file has the following commands:

RewriteEngine On
RewriteRule ^page/([0-9]+)/?$ page.php?id=$1 [L]

Any help would be greatly appreciated.
Thanks.

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



[PHP] Re: call_user_func_array and mysqli_stmt_bind_result

2005-04-12 Thread Skrol29
Hello,
mysqli_stmt_bind_result() is a special function that takes parameters by 
reference after the first one.

When you code:
  mysqli_stmt_bind_result ($stmt, $arr[1], $arr[2]);
Then $arr[1] and $arr[2] can be passed by reference.
But when you code:
  $arr[0]=$stmt; $arr[1]=''; $arr[2]='';
  call_user_func_array ('mysqli_stmt_bind_result',$arr);
Then '' and '' cannot be passed by reference.
It should be:
  $prmlst = array($stmt,$arr[1],$arr[2]);
  call_user_func_array ('mysqli_stmt_bind_result',$prmlst);
Enjoy,
-
Skrol29
www.tinybutstrong.com
-
Patrick a écrit :
Hi,
This is working (as a packet of crackers):
...
mysqli_stmt_bind_result ($stmt, $arr[1], $arr[2]);
...
This I cannot get to work:
...
$arr[0]=$stmt; $arr[1]=''; $arr[2]='';
call_user_func_array ('mysqli_stmt_bind_result',$arr);
...
I'm not sure if what I try to do is possible in any way?
Btw, this is Win PHP v5.0.3 , Apache v2.0.53, Mysql v5.0.2-alpha-nt.
cheers and thanks,
Patrick from Belgium (Brussels)
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] collect2: ld returned 1 exit status, make: *** [sapi/cli/php] Error 1

2005-04-12 Thread Mark Sargent
Mark Sargent wrote:
Hi All,
keep getting this error with make on Fedora 3, home machine. 
Successfully installed on work FC3 machine earlier today. I did make 
twice, to no avail, and then redid the configure then another make, 
with the same results.

collect2: ld returned 1 exit status
make: *** [sapi/cli/php] Error 1
Let me know if you need me to post more info from the make. Cheers.
php=5.0.3
apache=2.0.53 (apache installed fine)
Mark Sargent.
Hi All,
php-5.0.4 installed without a hitch..oh well, can't really complain
about that, now can I..? cheers.
Mark Sargent.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Cant find ClearModuleList in httpd.conf anywhere

2005-04-12 Thread Mark Sargent
Hi All,
what line number is the following on,
And in the AddModule section of httpd.conf, somewhere under the
   ClearModuleList, add this:
   
   For PHP 4:
   
 AddModule mod_php4.c
 
   For PHP 5:
   

 AddModule mod_php5.c
Hell, I've scrolled up/down numerous times, and can't find 
ClearModuleList anywhere. Cheers.

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


Re: [PHP] Cant find ClearModuleList in httpd.conf anywhere

2005-04-12 Thread Chris
If you're using Apache 2, then you haven't got a ClearModule (or an 
AddModule for that matter either). Just set the LoadModule directive.

If it's Apache 1, towards the top of httpd.conf there should be  A whole 
bunch of LoadModules, then a little bit farther down, a whole bunch of 
AddModules, put it at the bottom of that list.

Chris
Mark Sargent wrote:
Hi All,
what line number is the following on,
And in the AddModule section of httpd.conf, somewhere under the
   ClearModuleList, add this:
  For PHP 4:
AddModule mod_php4.c
For PHP 5:
  

 AddModule mod_php5.c
Hell, I've scrolled up/down numerous times, and can't find 
ClearModuleList anywhere. Cheers.

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


[PHP] Simple Problem

2005-04-12 Thread PartyPosters
I can't figure out what I am doing wrong,
this sql string seems to filter out the information I want but it duplicates 
the all info, as 'num_rows' is total of rows in the table and not the correct 
value of the filtered information?

$sql=SELECT products.productID, products.title, products.number_per_box, 
products.stock_level, products.image, users.username, users.email, users.userID 
FROM users, products  WHERE products.userID = $userID;
$mysql_result=mysql_query($sql,$connection);
$num_rows=mysql_num_rows($mysql_result);


this is the old sql statement which works fine - 
$sql=SELECT productID, title, number_per_box, stock_level, image, userID FROM 
products WHERE userID = '$userID';
$mysql_result=mysql_query($sql,$connection);
$num_rows=mysql_num_rows($mysql_result);

what I am I doing wrong.

Thanks
Kaan.




[PHP] Re: mod_rewrite and getting url variables

2005-04-12 Thread Matthew Weier O'Phinney
* Ospinto [EMAIL PROTECTED]:
 I used mod_rewrite to change http://www.mysite.com/page/1 to
 http://www.mysite.com/page.php?id=1 to enable a search friendly url.
 Everything works fine, except that when I try to get the URL variable ($id)
 by using $_GET, it doesn't return anything. With
 http://www.mysite.com/page.php?id=1 it gets $id just fine. I thought the
 mod_rewrite would keep the url variables??? If not, I know the alternative
 would be to get the whole url as a string and change it to an array by using
 the / as the delimiter and obtain $id from that. But I'd rather go that
 way if there's no other alternative.
 The .htaccess file has the following commands:

 RewriteEngine On
 RewriteRule ^page/([0-9]+)/?$ page.php?id=$1 [L]

Try [PT] instead of [L]. [PT] does a Pass-Through -- i.e., passes it on
to the appropriate handler once the rewrite has been performed. Without
this, the page will not be processed as a CGI.

-- 
Matthew Weier O'Phinney   | WEBSITES:
Webmaster and IT Specialist   | http://www.garden.org
National Gardening Association| http://www.kidsgardening.com
802-863-5251 x156 | http://nationalgardenmonth.org
mailto:[EMAIL PROTECTED] | http://vermontbotanical.org

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



Re: [PHP] Simple Problem

2005-04-12 Thread John Nichel
PartyPosters wrote:
I can't figure out what I am doing wrong,
this sql string seems to filter out the information I want but it duplicates 
the all info, as 'num_rows' is total of rows in the table and not the correct 
value of the filtered information?
$sql=SELECT products.productID, products.title, products.number_per_box, 
products.stock_level, products.image, users.username, users.email, users.userID FROM 
users, products  WHERE products.userID = $userID;
$mysql_result=mysql_query($sql,$connection);
$num_rows=mysql_num_rows($mysql_result);
this is the old sql statement which works fine - 
$sql=SELECT productID, title, number_per_box, stock_level, image, userID FROM products WHERE userID = '$userID';
$mysql_result=mysql_query($sql,$connection);
$num_rows=mysql_num_rows($mysql_result);
http://lists.mysql.com
--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
[EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] Simple Problem

2005-04-12 Thread Pablo Gosse
snip
I can't figure out what I am doing wrong,
this sql string seems to filter out the information I want but it
duplicates the all info, as 'num_rows' is total of rows in the table and
not the correct value of the filtered information?

$sql=SELECT products.productID, products.title,
products.number_per_box, products.stock_level, products.image,
users.username, users.email, users.userID FROM users, products  WHERE
products.userID = $userID; $mysql_result=mysql_query($sql,$connection);
$num_rows=mysql_num_rows($mysql_result);


this is the old sql statement which works fine - 
$sql=SELECT productID, title, number_per_box, stock_level, image,
userID FROM products WHERE userID = '$userID';
$mysql_result=mysql_query($sql,$connection);
$num_rows=mysql_num_rows($mysql_result);

what I am I doing wrong.
/snip

In the old query you're jut pulling records from one table.  In the
second, you're joining two tables, but you're still using the same WHERE
clause, products.userID = $userID.

This is causing multiple records to be returned, since there is nothing
specifying how you are joining the users and products table so it
correctly returns a match for every row in the user table.

Change the where clause to:

WHERE products.userID = $userID
AND users.userID = $userID

and this will force the query to limit results to those records in
products that have a matching record in the users table.

HTH.

Pablo

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



[PHP] Re: Simple Problem

2005-04-12 Thread Labunski
I'm not sure, but I just know that if you need to select the information
from two tables (and not just from one),
you should use JOIN syntax ( http://dev.mysql.com/doc/mysql/en/join.html )

Hope this helps,
Lab.

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



[PHP] Re: Simple Problem

2005-04-12 Thread Labunski
I'm not sure, but I just know that if you need to select the information
from two tables (and not just from one),
you should use JOIN syntax ( http://dev.mysql.com/doc/mysql/en/join.html )

Hope this helps,
Lab.

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



Re: [PHP] Simple Problem

2005-04-12 Thread Richard Davey
Hello PartyPosters,

Tuesday, April 12, 2005, 4:24:34 PM, you wrote:

P I can't figure out what I am doing wrong, this sql string seems to
P filter out the information I want but it duplicates the all info,
P as 'num_rows' is total of rows in the table and not the correct
P value of the filtered information?

P $sql=SELECT products.productID, products.title,
P products.number_per_box, products.stock_level, products.image,
P users.username, users.email, users.userID FROM users, products 
P WHERE products.userID = $userID;
P $mysql_result=mysql_query($sql,$connection);
P $num_rows=mysql_num_rows($mysql_result);

Your query should probably be performing a join. As it stands you're
selecting all of the products where userID = $userID, but you're also
selecting all of your users regardless (SELECT blah FROM users).

What relationship does the Users table have to the Products table? You
may need something more along the lines of:

SELECT blah FROM products LEFT JOIN users ON users.UserID =
products.UserID WHERE users.UserID = $userID

But that's just a best-guess based on what you've given so far.

Best regards,

Richard Davey
-- 
 http://www.launchcode.co.uk - PHP Development Services
 I do not fear computers. I fear the lack of them. - Isaac Asimov

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



Re: [PHP] Cant find ClearModuleList in httpd.conf anywhere

2005-04-12 Thread Mark Sargent
Chris wrote:
If you're using Apache 2, then you haven't got a ClearModule (or an 
AddModule for that matter either). Just set the LoadModule directive.

If it's Apache 1, towards the top of httpd.conf there should be  A 
whole bunch of LoadModules, then a little bit farther down, a whole 
bunch of AddModules, put it at the bottom of that list.

Chris
Mark Sargent wrote:
Hi All,
what line number is the following on,
And in the AddModule section of httpd.conf, somewhere under the
   ClearModuleList, add this:
  For PHP 4:
AddModule mod_php4.c
For PHP 5:
 
 AddModule mod_php5.c

Hell, I've scrolled up/down numerous times, and can't find 
ClearModuleList anywhere. Cheers.

Mark Sargent.

Hi All,
ah, shikes, yep, missed that...all's well..cheers.
Mark sargent.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] PHP Wire Ready

2005-04-12 Thread Joe Harman
Hello,

Curious if anyone out there has any experience using PHP with Wire
Ready??? We've taken over a site that uses the wire ready service...
which is all done in ASP and needs to be converted over to PHP??

does anyone have or know of any pre-made classes or functions for
dealing with this service?

Thanks,
Joe

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



[PHP] Re: Simple Problem

2005-04-12 Thread Skrol29
That's a SQL problem, nothing to do with PHP.
You've forgotten a JOIN clause.
-
Skrol29
www.tinybutstrong.com
-
PartyPosters a écrit :
I can't figure out what I am doing wrong,
this sql string seems to filter out the information I want but it duplicates 
the all info, as 'num_rows' is total of rows in the table and not the correct 
value of the filtered information?
$sql=SELECT products.productID, products.title, products.number_per_box, 
products.stock_level, products.image, users.username, users.email, users.userID FROM 
users, products  WHERE products.userID = $userID;
$mysql_result=mysql_query($sql,$connection);
$num_rows=mysql_num_rows($mysql_result);
this is the old sql statement which works fine - 
$sql=SELECT productID, title, number_per_box, stock_level, image, userID FROM products WHERE userID = '$userID';
$mysql_result=mysql_query($sql,$connection);
$num_rows=mysql_num_rows($mysql_result);

what I am I doing wrong.
Thanks
Kaan.

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


RE: [PHP] mod_rewrite and getting url variables

2005-04-12 Thread Chris W. Parker
Ospinto mailto:[EMAIL PROTECTED]
on Tuesday, April 12, 2005 10:32 AM said:

 I used mod_rewrite to change http://www.mysite.com/page/1 to
 http://www.mysite.com/page.php?id=1 to enable a search friendly url.

Ok I'm with you.

 Everything works fine, except that when I try to get the URL variable
 ($id) by using $_GET, it doesn't return anything. With
 http://www.mysite.com/page.php?id=1 it gets $id just fine.

Now you've lost me. Those two statements seem to be in opposition to one
another. You can't get $id with $_GET but
http://www.mysite.com/page.php?id=1 works just fine? The URL is a GET
URL since it has a querystring.



Chris.

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



Re: [PHP] Simple Problem

2005-04-12 Thread Duncan Hill
On Tuesday 12 April 2005 16:24, PartyPosters typed:
 $sql=SELECT products.productID, products.title, products.number_per_box,
 products.stock_level, products.image, users.username, users.email,
 users.userID FROM users, products WHERE products.userID = $userID;
 $mysql_result=mysql_query($sql,$connection);
 $num_rows=mysql_num_rows($mysql_result);

You don't specify how the query should join the tables users and products.

WHERE products.userID = users.userID and users.userID = $userID

I'll assume you do validation on the userID ahead of time to ensure that it's 
the right format.

-- 
My mind not only wanders, it sometimes leaves completely.

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



[PHP] Carriage Return problem!

2005-04-12 Thread Dipesh Khakhkhar
Hi,

I am using php to generate and xml output file from another xml file using xsl.

The file is getting created properly and the xml instruction element is at 1st 
line.

I am using ant to get the output remotely but it is adding one extra line i.e. 
carriage return. I checked everything in my xsl, tried xsl:strip-space, no 
indent etc but as i said file is properly created. I have checked my echo's and 
print statments but there is none.

If somebody has tried to direct the output of browser through ant (or some 
other tool) and came across the same situation and tackled it please inform me. 
Does the php interpreter enters a carriage return by default as i tried to 
remome the xml contents and print one normal line of output it still gave me 
carriage return in the first line.

Any help will be highly appreciated.
Thanks!


RE: [PHP] php and javascript

2005-04-12 Thread Ford, Mike
 -Original Message-
 From: Richard Lynch
 To: Marek Kilimajer
 
 On Sun, April 10, 2005 4:32 pm, Marek Kilimajer said:
  Assuming your form is named Selection, you will have a javascript
  array document.forms['Selection'].elements['distID[]'] available. You
  can try:
 
  alert(document.forms['Selection'].elements['distID[]'][0].value);
 
 I can GUARANTEE this will *NOT* work.
 
 You *CANNOT* use [] as part of a 'name' in JavaScript.

That's completely untrue -- I've done it many times with complete success.
The above can even be written more concisely as

  alert(document['Selection']['distID[]'][0].value);

Cheers!

Mike


To view the terms under which this email is distributed, please go to 
http://disclaimer.leedsmet.ac.uk/email.htm

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



Re: [PHP] mcrypt_generic_init(): Iv size incorrect

2005-04-12 Thread Mike Hummel
Do you do this on the encryption or the decryption section or both?
Tom Rogers wrote:
Hi,
Saturday, April 9, 2005, 3:35:21 AM, you wrote:
MH I have an odd php issue with mcrypt.
MH I'm getting a lot of this type of error, but only sometimes:
MH mcrypt_generic_init(): Iv size incorrect; supplied length: 0, needed: 32
MH (note, the supplied length: 0 is not always the same.  sometimes it is
MH 1, 16, etc).
MH It doesn't seem to affect the decoding of the file, but it is throwing a
MH notice in to my error log. I've tried doing this:
MH @mcrypt_generic_init($this-td, $key, $iv)
MH but that doesn't stop it from throwing an error.
MH The only thing I can think is that I have
MH mcrypt_module_close($this-td) 
MH commented out because my code was dying with it...

MH System:
MH Linux w/ Apache 1.3.31
MH PHP Version 4.3.4
MH libmcrypt version 2.5.7
MH Suggestions?
I do this to set a zero iv
$td = mcrypt_module_open(MCRYPT_TripleDES, , MCRYPT_MODE_ECB, );
$key = substr($secret, 0, mcrypt_enc_get_key_size ($td));
$iv = pack(a.mcrypt_enc_get_iv_size($td),$iv);
mcrypt_generic_init ($td, $key, $iv);
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] mcrypt_generic_init(): Iv size incorrect

2005-04-12 Thread Mike Hummel
I get the following error when I try your suggestion:
Unknown error type: [8] Undefined variable:  iv
Code:
$key = md5($this-_cypherkey);
$key = substr($key, 0, mcrypt_enc_get_key_size($this-td));
$iv_size = mcrypt_enc_get_iv_size($this-td);
#$iv = mcrypt_create_iv($iv_size, MCRYPT_RAND);
$iv = pack(a.$iv_size,$iv);
Tom Rogers wrote:
Hi,
Saturday, April 9, 2005, 3:35:21 AM, you wrote:
MH I have an odd php issue with mcrypt.
MH I'm getting a lot of this type of error, but only sometimes:
MH mcrypt_generic_init(): Iv size incorrect; supplied length: 0, needed: 32
MH (note, the supplied length: 0 is not always the same.  sometimes it is
MH 1, 16, etc).
MH It doesn't seem to affect the decoding of the file, but it is throwing a
MH notice in to my error log. I've tried doing this:
MH @mcrypt_generic_init($this-td, $key, $iv)
MH but that doesn't stop it from throwing an error.
MH The only thing I can think is that I have
MH mcrypt_module_close($this-td) 
MH commented out because my code was dying with it...

MH System:
MH Linux w/ Apache 1.3.31
MH PHP Version 4.3.4
MH libmcrypt version 2.5.7
MH Suggestions?
I do this to set a zero iv
$td = mcrypt_module_open(MCRYPT_TripleDES, , MCRYPT_MODE_ECB, );
$key = substr($secret, 0, mcrypt_enc_get_key_size ($td));
$iv = pack(a.mcrypt_enc_get_iv_size($td),$iv);
mcrypt_generic_init ($td, $key, $iv);
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Creating a Directory

2005-04-12 Thread PartyPosters
Hello, I am using the following script to upload files to my server. Is there 
anyway I can create a directory (on the fly) for the new image to go, as I want 
people to be able to upload files with the same name.


Thanks

$uploadDir = 'uploads/';
$uploadFile = $uploadDir . $_FILES['form_data']['name'];
print pre;
if (move_uploaded_file($_FILES['form_data']['tmp_name'], $uploadFile))
{
print File is valid, and was successfully uploaded. ;
   # print Here's some more debugging info:\n;
#print_r($_FILES);
}
else
{
 print File is invalid. ;
   # print Possible file upload attack!  Here's some debugging info:\n;
 #   print_r($_FILES);
}
print /pre;


Re: [PHP] Carriage Return problem!

2005-04-12 Thread Brandon Ryan
Make sure there are no extra characters (including linefeeds) after the 
closing ? in your php source file.
 Brandon Ryan
 On 12 Apr 2005 19:42:17 -, Dipesh Khakhkhar 
[EMAIL PROTECTED] wrote: 
 
 Hi,
 
 I am using php to generate and xml output file from another xml file using 
 xsl.
 
 The file is getting created properly and the xml instruction element is at 
 1st line.
 
 I am using ant to get the output remotely but it is adding one extra line 
 i.e. carriage return. I checked everything in my xsl, tried 
 xsl:strip-space, no indent etc but as i said file is properly created. I 
 have checked my echo's and print statments but there is none.
 
 If somebody has tried to direct the output of browser through ant (or some 
 other tool) and came across the same situation and tackled it please inform 
 me. Does the php interpreter enters a carriage return by default as i tried 
 to remome the xml contents and print one normal line of output it still gave 
 me carriage return in the first line.
 
 Any help will be highly appreciated.
 Thanks!
 



Re: [PHP] Storing password in cookie

2005-04-12 Thread Joe Wollard
 On a shared server, every other PHP scripter can read your session data,
 if they work at it a little bit.
If you're on a shared server I think a good option for you might be to 
store the sessions in your database. At least then you know that as long 
as long as your db server doesn't have any security issues your session 
data should be safe.

See http://us2.php.net/manual/en/function.session-set-save-handler.php 
for more details on building a custom session handler.

Chris Shiflett wrote:
Richard Lynch wrote:
On a shared server, every other PHP scripter can read your session data,
if they work at it a little bit.

You should mention that this is assuming a default configuration. 
There are ways to avoid this.

For truly sensitive stuff like a CC#, do *NOT* put that in session data.
Write your script to get the CC# via SSL, process it, and throw it away,
all in one single PHP script.

This is good advice, but if there is a business need to store the 
credit card number (for whatever reason), it's not necessarily always 
best to avoid storing it in the session.

Performance considerations can require that you couple its retrieval 
with other session data rather than incur the extra expense. It's just 
one of those things that is a little bit application-specific.

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


[PHP] Re: mod_rewrite from .htaccess

2005-04-12 Thread Matthew Weier O'Phinney
* Amir Mohammad Saied [EMAIL PROTECTED]:
 I want to use mod_rewrite patterns, but i have not access to the 
 httpd.conf so i think i should use .htaccess, but the patterns don't 
 work properly there, have my admin should set any settings in the 
 httpd.conf?

I use mod_rewrite from .htaccess all the time; just make sure that you
have the 'RewriteEngine on' directive in your .htaccess file before your
rewrite rules. 

It's entirely possible, however, that the server admin has denied
permission for that action in the global httpd.conf, though. If you
simply cannot get rules to work -- rules that you know work on another
machine, for instance, that would be the next step to try.

-- 
Matthew Weier O'Phinney   | WEBSITES:
Webmaster and IT Specialist   | http://www.garden.org
National Gardening Association| http://www.kidsgardening.com
802-863-5251 x156 | http://nationalgardenmonth.org
mailto:[EMAIL PROTECTED] | http://vermontbotanical.org

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



[PHP] Re: Limiting Cpu usage

2005-04-12 Thread zini10
Yeahh! i have made it
i can slow down a php script , as i edited the zend engine source to usleep 
every 1000 low-level instructions
now, is there a way to determine to check my cpu load and adjust it by that 
so if nothing (or very low cpu usage) is running on the system he'll get 
extra power? 

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



[PHP] OT Where is a good place to post PHP job opportunities

2005-04-12 Thread Joey
Hi Guys,
 
Sorry to post this here, but I don't know if the list has a jobs section
etc. or if there is a good place where I can post job opportunities for php
programmers?
 
Thanks,

Joey
 

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



[PHP] Finding records within 15 minutes from now?

2005-04-12 Thread J J
I'm struggling with the php or mysql query to find
records within my database that are within 15 minutes
from now and prior.

Example:
It's 2:30pm on 4/12/05

I need to find all records with a RecordTime of 2:45pm
and previous.

So it should find:
rec1 time: 2:45 date: 4/12/05
rec2 time: 2:00 date: 4/12/05
rec3 time: 1:30 date: 4/8/05
etc.

It would not find:
rec4 time: 3:15 date: 4/12/05
rec5 time: 4:00 date: 4/23/05


Make sense?

I'm reviewing the manuals for datediff, curdate and
other functions but nothing seems to be making sense
for what I need.

Any ideas?  Thank you in advance!



__ 
Do you Yahoo!? 
Yahoo! Small Business - Try our new resources site!
http://smallbusiness.yahoo.com/resources/ 

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



RE: [PHP] Creating a Directory

2005-04-12 Thread Jay Blanchard
[snip]
Hello, I am using the following script to upload files to my server. Is
there anyway I can create a directory (on the fly) for the new image to
go, as I want people to be able to upload files with the same name.
[/snip]

You know that manual thingie? It's awersome! http://us3.php.net/mkdir

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



Re: [PHP] Storing password in cookie

2005-04-12 Thread Greg Donald
On Apr 12, 2005 12:05 PM, Joe Wollard [EMAIL PROTECTED] wrote:
 See http://us2.php.net/manual/en/function.session-set-save-handler.php
 for more details on building a custom session handler.

http://destiney.com/pub/Destiney_db_sessions_0.1.0.tar.bz2
Provides simple database driven PHP sessions. 

ADOdb provides encrypted and bzip'd database driven PHP sessions if
you need that:
http://adodb.sf.net

-- 
Greg Donald
Zend Certified Engineer
http://destiney.com/

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



[PHP] mod_rewrite from .htaccess

2005-04-12 Thread Amir Mohammad Saied
I want to use mod_rewrite patterns, but i have not access to the 
httpd.conf so i think i should use .htaccess, but the patterns don't 
work properly there, have my admin should set any settings in the 
httpd.conf?

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


Re: [PHP] Fulltext search engine

2005-04-12 Thread Marek Kilimajer
Roman Duriancik wrote:
I need in my own web server with mysql database and php script some free 
fulltext engine.
But i need search in slovak language (all data in database in slovak).
Can yopu help me where i can find some free fulltext engine ?
roman

http://dev.mysql.com/doc/mysql/en/fulltext-search.html
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] OT Where is a good place to post PHP job opportunities

2005-04-12 Thread Chris Shiflett
Joey wrote:
Sorry to post this here, but I don't know if the list has a jobs section
etc. or if there is a good place where I can post job opportunities for php
programmers?
This list is fine.
Chris
--
Chris Shiflett
Brain Bulb, The PHP Consultancy
http://brainbulb.com/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] mod_rewrite and getting url variables

2005-04-12 Thread Matthew Weier O'Phinney
* Chris W. Parker [EMAIL PROTECTED]:
 Ospinto mailto:[EMAIL PROTECTED]
 on Tuesday, April 12, 2005 10:32 AM said:

 I used mod_rewrite to change http://www.mysite.com/page/1 to
 http://www.mysite.com/page.php?id=1 to enable a search friendly url.

 Ok I'm with you.

 Everything works fine, except that when I try to get the URL variable
 ($id) by using $_GET, it doesn't return anything. With
 http://www.mysite.com/page.php?id=1 it gets $id just fine.

 Now you've lost me. Those two statements seem to be in opposition to one
 another. You can't get $id with $_GET but
 http://www.mysite.com/page.php?id=1 works just fine? The URL is a GET
 URL since it has a querystring.

When using mod_rewrite, if the rewrite rule does not include a
pass-through, then the query string is not passed on to the script in
question. So, if you request the page directly with:

http://www.mysite.com/page.php?id=1

it will process correctly, but if you have a rewrite rule that doesn't
have the pass-through flag, then when the URL is _rewritten_ to the above,
the page is requested _without_ the query string -- even though the rule
rewrites the URL with a query string.

A rule that would (probably) work would look something like this:

RewriteRule page/(.*) /page.php?id=$1 [L,PT]

-- 
Matthew Weier O'Phinney   | WEBSITES:
Webmaster and IT Specialist   | http://www.garden.org
National Gardening Association| http://www.kidsgardening.com
802-863-5251 x156 | http://nationalgardenmonth.org
mailto:[EMAIL PROTECTED] | http://vermontbotanical.org

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



Re: [PHP] Finding records within 15 minutes from now?

2005-04-12 Thread Greg Donald
On Apr 12, 2005 2:33 PM, J J [EMAIL PROTECTED] wrote:
 I'm struggling with the php or mysql query to find
 records within my database that are within 15 minutes
 from now and prior.

 select NOW(), DATE_ADD( NOW(), INTERVAL 15 MINUTE );
+-+---+
| NOW()   | DATE_ADD( NOW(), INTERVAL 15 MINUTE ) |
+-+---+
| 2005-04-12 17:02:33 | 2005-04-12 17:17:33   |
+-+---+
1 row in set (0.00 sec)


-- 
Greg Donald
Zend Certified Engineer
http://destiney.com/

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



Re: [PHP] Finding records within 15 minutes from now?

2005-04-12 Thread Philip Hallstrom
Are you saying you want all records whose timestamp is less than now plus 
15 minutes?

If so...
SELECT ... WHERE ts_col = CURRENT_TIMESTAMP  + INTERVAL 15 MINUTES;
should do it I'd think.
see here for more (the DATE_ADD function)
http://dev.mysql.com/doc/mysql/en/date-and-time-functions.html
On Tue, 12 Apr 2005, J J wrote:
I'm struggling with the php or mysql query to find
records within my database that are within 15 minutes
from now and prior.
Example:
It's 2:30pm on 4/12/05
I need to find all records with a RecordTime of 2:45pm
and previous.
So it should find:
rec1 time: 2:45 date: 4/12/05
rec2 time: 2:00 date: 4/12/05
rec3 time: 1:30 date: 4/8/05
etc.
It would not find:
rec4 time: 3:15 date: 4/12/05
rec5 time: 4:00 date: 4/23/05
Make sense?
I'm reviewing the manuals for datediff, curdate and
other functions but nothing seems to be making sense
for what I need.
Any ideas?  Thank you in advance!

__
Do you Yahoo!?
Yahoo! Small Business - Try our new resources site!
http://smallbusiness.yahoo.com/resources/
--
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] Finding records within 15 minutes from now?

2005-04-12 Thread Richard Davey
Hello,

Tuesday, April 12, 2005, 8:33:08 PM, you wrote:

JJ I'm struggling with the php or mysql query to find records within
JJ my database that are within 15 minutes from now and prior.

Assuming MySQL:

SELECT * FROM blah WHERE RecordTime  DATE_SUB(now(), interval
15 min)

(something like that, going from memory here)

Best regards,

Richard Davey
-- 
 http://www.launchcode.co.uk - PHP Development Services
 I do not fear computers. I fear the lack of them. - Isaac Asimov

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



[PHP] show the directory and folders an web page

2005-04-12 Thread Tomás Rodriguez Orta
Hello friends.
I want to do an applicattion for show all folder and file to send by
ftp(the folder and file that I select) for my isp, ok?
but I don't know how can I do this?, somebody Can help me?, what function I
need if I want to show this?.dir();


best regards TOMAS


-
Este correo fue escaneado en busca de virus con el MDaemon Antivirus 2.27
en el dominio de correo angerona.cult.cu  y no se encontro ninguna coincidencia.

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



[PHP] PHP Programmer Needed in Miami

2005-04-12 Thread Joey
You or someone you know maybe interested in the programming position we have
available.
We have the need for a part time / possibly contract PHP programmer.
We are looking for people that can work in our Miami office (even
contractors), so please do not try and sell us your services if the location
is a problem.
 
Our development environment is Linux, apache, PHP, mysql.
Knowledge of the smarty template system and Pear:DB are also required.
 
We are looking for a self managed person who is organized and detailed in
following through a project from start to finish, and completing it within
reasonable time limits.
Experience developing relational DB's and not just simple lookups of a DB is
required, classes, functions and oops are part of the expected knowledge.
 
Please send your resume, links to your work with an explanation of how much
of the project you were responsible for and contact information ( phone 
email ) to Joey at web56.net.
 
Thanks
 
Joey

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



[PHP] header script: cannot use target=_blank

2005-04-12 Thread Marty
Hello,

 

I cannot open a new window from a popup when a user logs into their account.
How would I go about adding target=_blank  after successful login.

 

Your help would be greatly appreciated.

Best Regards,
Martin

 

 

 

?php

error_reporting(E_ALL ^ E_NOTICE);

//Here we check if any field was missed / left empty and act accordingly

if ('domain'  $_POST['username']  $_POST['pass']  !($_GET['failed'] ==
1))

{

switch ($login_option)

{

case 2095:$port = 2095;

$protocol = http://;;

break;

case 2096:$port = 2096;

$protocol = https://;;

break;

}



$redirectlocation =
$protocol.$_POST['domain'].:.$port./login/?user=.$_POST['username'].pa
ss=.$_POST['pass'].failurl=.$_POST['failurl'];

 header (Location: .$redirectlocation);

}

else

{

$error = 1;

header (Location: .$_POST['failurl']);

}

?

 

 

 

 

 



Re: [PHP] Finding records within 15 minutes from now?

2005-04-12 Thread Marek Kilimajer
J J wrote:
I'm struggling with the php or mysql query to find
records within my database that are within 15 minutes
from now and prior.
Example:
It's 2:30pm on 4/12/05
I need to find all records with a RecordTime of 2:45pm
and previous.
So it should find:
rec1 time: 2:45 date: 4/12/05
rec2 time: 2:00 date: 4/12/05
rec3 time: 1:30 date: 4/8/05
etc.
It would not find:
rec4 time: 3:15 date: 4/12/05
rec5 time: 4:00 date: 4/23/05
Make sense?
I'm reviewing the manuals for datediff, curdate and
other functions but nothing seems to be making sense
for what I need.
Any ideas?  Thank you in advance!

CURRENT_TIME()  RecordTime + INTERVAL 15 MINUTE
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Re: class calling script

2005-04-12 Thread Bruno B B Magalhães
Well,
I have a framework class witch loads and stores all classes in it.
I can´t post the all code, but some I cam:
Loading a core class like a database class:
 
---
	function loadcore($handler, $class_name = '')
	{
		if($class_name != '')
		{
			if(is_object($this-_crs-$class_name))
			{
$handler = $this-_crs-$class_name;
return true;
			}
			elseif(file_exists($this-core_dir.$class_name.$this- 
core_sfx.$this-php_sfx))
			{
require_once($this-core_dir.$class_name.$this-core_sfx.$this- 
php_sfx);

if(class_exists($class_name))
{
	$handler = new $class_name($this);
	$this-_crs-$class_name = $handler;
	return true;
}
else
{
	$handler = false;
	return false;
}
			}
			else
			{
$handler = false;
return false;
			}
		}
		else
		{
			$handler = false;
			return false;
		}
	}
 
---

Loading a module class:
 
---
	function loadmodule($module_name = 'default_module', $module_method =  
'default_method', $method_vars = null)
	{
		if($module_name != '')
		{
			if(is_object($this-_mdl-$module_name))
			{
if(method_exists($this-_mdl-$module_name, $module_method))
{
	$this-_mdl-$module_name-$module_method($method_vars);
	return true;
}
			}
			elseif(file_exists($this-module_dir.$module_name.$this- 
module_sfx.$this-php_sfx))
			{
require_once($this-module_dir.$module_name.$this- 
module_sfx.$this-php_sfx);

if(class_exists($module_name))
{
	$this-_mdl-$module_name = new $module_name($this);
	
	if(method_exists($this-_mdl-$module_name, $module_method))
	{
		$this-_mdl-$module_name-$module_method($method_vars);
		return true;
	}
	return true;
}
else
{
	return $this-_mdl-$module_name = false;
	return false;
}
			}
			else
			{
return $this-_mdl-$module_name = false;
return false;
			}
		}
		else
		{
			return $this-_mdl-$module_name = false;
			return false;
		}
	}
 
---

I hope it will help you out.
Best Regards,
Bruno B B Magalhaes
On Apr 12, 2005, at 11:09 AM, Jason Barnett wrote:
[EMAIL PROTECTED] wrote:
Hi there, I have been testing a possible solution to reduce the  
ammount of
interface calling scriptsto my class files. Currently each class has  
a calling script. I am
For PHP5 you can try __autoload().  It provides for you a last-chance /
just in time loading of a class file.  The main drawback of using this
is that there is (currently) only one __autoload() function allowed,  
but
this limitation should be removed once PHP5.1.0 gets rolled out.

thinking of setting up a url like /currentdir/packagename/classname,  
mind you this is only a test but is it a
good or bad bad idea ?I have run into troubles getting get queries  
because its calling the
classname in the query alreadyso /packagename/classname?test=1 doesnt  
work.

Using rewrite rules would be another way you could do it.  Or you could
have one main include file that would set some variable (call it
$base_dir) that points to the filesystem folder that is your root
directory.  I.e.
?php
/** main include file */
$base_dir = dirname(__FILE__) . '/';
/** now include some other global classes relative to this $base_dir */
include_once ($base_dir . 'path/from/docroot/to/class.php');
?
?php
/** some other script loads main config file */
require_once '/path/to/main.php';
/** now get your required classes */
require_once $base_dir . 'path/to/some/class.php';
?
--
Teach a man to fish...
NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-generalw=2
STFM | http://php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY |
http://mycroft.mozdev.org/download.html? 
name=PHPsubmitform=Find+search+plugins
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] validating input

2005-04-12 Thread blackwater dev
I want to check a string for only numbers and letters but am banging
my head with regex:

$good = joh_';

// Let's check the good e-mail
if (preg_match(/[a-z0-9]/, $good)) {
echo Good;
} else {
echo Bad;
}

This returns Good, why?

Thanks!

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



Re: [PHP] mod_rewrite from .htaccess

2005-04-12 Thread Greg Donald
On 4/12/05, Amir Mohammad Saied [EMAIL PROTECTED] wrote:
 I want to use mod_rewrite patterns, but i have not access to the
 httpd.conf so i think i should use .htaccess, but the patterns don't
 work properly there, have my admin should set any settings in the
 httpd.conf?

AllowOverrides must be On for .htaccess files to work.


-- 
Greg Donald
Zend Certified Engineer
http://destiney.com/

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



Re[2]: [PHP] mcrypt_generic_init(): Iv size incorrect

2005-04-12 Thread Tom Rogers
Hi,

Wednesday, April 13, 2005, 5:14:25 AM, you wrote:
MH Do you do this on the encryption or the decryption section or both?

I do it on both, here is a class I use that may help:


class encryptClass{
  var $secret;
  function encryptClass(){
$this-secret = 'put secret here';
  }
  Function encode($id){
$eid = $iv = 0;
$len = strlen($id);
$id = $len.'-'.$id;
$td = mcrypt_module_open(MCRYPT_TripleDES, , MCRYPT_MODE_ECB, );
$key = substr($this-secret, 0, mcrypt_enc_get_key_size ($td));
$iv = pack(a.mcrypt_enc_get_iv_size($td),$iv);
mcrypt_generic_init ($td, $key, $iv);
$eid = base64_encode(mcrypt_generic ($td, $id));
mcrypt_generic_deinit($td);
return $eid;
  }
  Function decode($eid){
$id = $iv = 0;
$td = mcrypt_module_open (MCRYPT_TripleDES, , MCRYPT_MODE_ECB, );
$key = substr($this-secret, 0, mcrypt_enc_get_key_size ($td));
$iv = pack(a.mcrypt_enc_get_iv_size($td),$iv);
mcrypt_generic_init ($td, $key, $iv);
$id = mdecrypt_generic ($td, base64_decode($eid));
$len = strtok($id,'-');
$id = substr($id,(strlen($len)+1),$len);
mcrypt_generic_deinit($td);
return $id;
  }
}


( I encode the length of the original string so I can trim the extra
rubbish that deinit leaves behind as packing)

-- 
regards,
Tom

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



RE: [PHP] mod_rewrite and getting url variables

2005-04-12 Thread Chris W. Parker
Matthew Weier O'Phinney mailto:[EMAIL PROTECTED]
on Tuesday, April 12, 2005 9:42 AM said:

 When using mod_rewrite, if the rewrite rule does not include a
 pass-through, then the query string is not passed on to the script in
 question. So, if you request the page directly with:
 
 http://www.mysite.com/page.php?id=1
 
 it will process correctly, but if you have a rewrite rule that doesn't
 have the pass-through flag, then when the URL is _rewritten_ to the
 above, the page is requested _without_ the query string -- even
 though the rule rewrites the URL with a query string.

Hmm.. I guess I'll have to try it out to understand what's going on.
I've never run across the problem myself.


Thanks,
Chris.

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



Re[2]: [PHP] mcrypt_generic_init(): Iv size incorrect

2005-04-12 Thread Tom Rogers
Hi,

Wednesday, April 13, 2005, 6:04:05 AM, you wrote:
MH I get the following error when I try your suggestion:

MH Unknown error type: [8] Undefined variable:  iv

MH Code:

$key = md5($this-_cypherkey);
MH $key = substr($key, 0, mcrypt_enc_get_key_size($this-td));
MH $iv_size = mcrypt_enc_get_iv_size($this-td);
MH #$iv = mcrypt_create_iv($iv_size, MCRYPT_RAND);
MH $iv = pack(a.$iv_size,$iv);

Yes I forgot to put $iv = 0; before that line.
-- 
regards,
Tom

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



Re: [PHP] Re: Limiting Cpu usage

2005-04-12 Thread Tom Rogers
Hi,

Wednesday, April 13, 2005, 8:20:46 AM, you wrote:
z Yeahh! i have made it
z i can slow down a php script , as i edited the zend engine source to usleep
z every 1000 low-level instructions
z now, is there a way to determine to check my cpu load and adjust it by that
z so if nothing (or very low cpu usage) is running on the system he'll get
z extra power? 


On Linux you can cat /proc/loadavg to get the current load (3rd number
in)

-- 
regards,
Tom

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



[PHP] scripting workflow

2005-04-12 Thread DuSTiN KRySaK
I just have a few questions regarding workflow when producing scripts.
First off, do people prefer to have all their code in one file? Or 
multiple separate files? I know functions and classes are good to keep 
in separate files, but i am talking about say for example a news 
system, etc.

Next off, how about when actually assembling the files? Do you produce 
all of your html output, then say build all of your functions - then 
say build the logic?

Does that make sense?
I had in the past use DW for building php apps, and as an exercise to 
myself I am forcing myself to hand code to learn better. But I do 
however want to increase my productivity.

If anyone has any pointers on this type of stuff - it would be much 
appreciated!

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


[PHP] Re: scripting workflow

2005-04-12 Thread Skrol 29
Hi,
I don't have your problems because I use a Template Engine.
I usually have one main PHP script for the application, which doesn't deal
with HTML directly. Other PHP scripts are libraries or special objects
like the Template Engine itself.
This also enables me to work WYSIWYG with user interfaces (templates).
---
Skrol 29
www.tinybutstrong.com
---
DuSTiN KRySaK [EMAIL PROTECTED] a écrit dans le message
de news: [EMAIL PROTECTED]
I just have a few questions regarding workflow when producing scripts.
First off, do people prefer to have all their code in one file? Or
multiple separate files? I know functions and classes are good to keep in
separate files, but i am talking about say for example a news system, etc.
Next off, how about when actually assembling the files? Do you produce all
of your html output, then say build all of your functions - then say build
the logic?
Does that make sense?
I had in the past use DW for building php apps, and as an exercise to
myself I am forcing myself to hand code to learn better. But I do however
want to increase my productivity.
If anyone has any pointers on this type of stuff - it would be much
appreciated!
Thanks!
d
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] scripting workflow

2005-04-12 Thread Mike
 First off, do people prefer to have all their code in one 
 file? Or multiple separate files? I know functions and 
 classes are good to keep in separate files, but i am talking 
 about say for example a news system, etc.

For me, this largely depends on project size and the types of
functions/classes I'm making. If it's a huge project, I may make a few files
with the functions/classes that are similar so I only have to include the
fewest amount (hopefully one) per function of the script. If the script
itself is small (say, under 500 lines) I'll probably just write it all in
one file if the script itself has one main purpose. But really, this will
depend from project to project.

 Next off, how about when actually assembling the files? Do 
 you produce all of your html output, then say build all of 
 your functions - then say build the logic?

I typically make a header and a footer file and include those when
necessary. The script itself produces the content and just fills in the
middle between the header and footer. 

Other people will likely use templating engines (Smarty being a popular
choice) for larger projects where a good separation of content and design
are needed.

 I had in the past use DW for building php apps, and as an 
 exercise to myself I am forcing myself to hand code to learn 
 better. But I do however want to increase my productivity.
 If anyone has any pointers on this type of stuff - it would 
 be much appreciated!

Personally, I think the most important aspect of productivity is knowing how
to identify and use the right tool for the job. And as such, getting a lot
of exposure to the different tools and options you have available is the
most important factor in knowing what tools are at your disposal. 

Other people with stronger opinions of specific tools will likely have a lot
to say about those methods, but I prefer versatility to knowing one or two
tools/utils/apps very well.

Just my $.02.

-M

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



Re: [PHP] validating input

2005-04-12 Thread Chris Shiflett
blackwater dev wrote:
I want to check a string for only numbers and letters but am banging
my head with regex:
ctype_alnum()
Chris
--
Chris Shiflett
Brain Bulb, The PHP Consultancy
http://brainbulb.com/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Storing password in cookie

2005-04-12 Thread D. Wokan
Richard Lynch wrote:
On Sat, April 9, 2005 11:51 am, [EMAIL PROTECTED] said:
*WHY* would you not store some kind of hash of the user ID?!
setcookie('remember_me', md5($username));
.
.
.
select username from users where md5(username) = $_SESSION['remember_me']
Is that really any harder?
It's very hard on the database.  With no other where clauses to restrict 
the results set, the database will have to run the md5 routines on every 
username in the table.

For better performance, you should also store something like a record id 
that you can use...

select username from users where recid = $_SESSION['userid'] and 
md5(username) = $_SESSION['remember_me']

Any query optimizer worth its salt will first filter based on the record 
ID and then only apply the md5 function to the remaining (1 in this 
case) usernames.
--
D. Wokan

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


[PHP] Defined constant in mysql_query - Question.

2005-04-12 Thread Labunski
Hi,
Can I use Constant in mysql query like this:


define(LANG, eng);
mysql_query(SELECT * FROM data WHERE col = 'articles' ORDER BY 
subjectLANG);


Thanks a LOT,
Lab. 

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



Re: [PHP] Simple Problem

2005-04-12 Thread Joseph Connolly
I think what you mean/need is:
$sql=SELECT products.productID, products.title, 
products.number_per_box, products.stock_level, products.image, 
users.username, users.email, users.userID FROM users, products  WHERE 
products.userID = users.userID  AND userID = $userID;


John Nichel wrote:
PartyPosters wrote:
I can't figure out what I am doing wrong,
this sql string seems to filter out the information I want but it 
duplicates the all info, as 'num_rows' is total of rows in the table 
and not the correct value of the filtered information?

$sql=SELECT products.productID, products.title, 
products.number_per_box, products.stock_level, products.image, 
users.username, users.email, users.userID FROM users, products  WHERE 
products.userID = $userID;
$mysql_result=mysql_query($sql,$connection);
$num_rows=mysql_num_rows($mysql_result);

this is the old sql statement which works fine - $sql=SELECT 
productID, title, number_per_box, stock_level, image, userID FROM 
products WHERE userID = '$userID';
$mysql_result=mysql_query($sql,$connection);
$num_rows=mysql_num_rows($mysql_result);

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


[PHP] Re: Creating a Directory

2005-04-12 Thread Labunski
I think you could use php function mkdir() to do this.

mkdir(/path/to/my/upload_dir, 0777);

But unfortunately there is big BUT aka Safe_mode.
To use this mkdir() function, you have to disable the Safe_mode on the 
server :(

Note: When safe mode is enabled,
PHP checks whether the directory in which you are about to
operate has the same UID (owner) as the script that is being executed.

You can read more about mkdir() here: 
http://lv2.php.net/manual/en/function.mkdir.php
and about chmod values here: http://lv2.php.net/manual/en/function.chmod.php

Hope this helps,
Lab. 

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



Re: [PHP] validating input

2005-04-12 Thread trlists
On 12 Apr 2005 blackwater dev wrote:

 $good = joh_';
 
 // Let's check the good e-mail
 if (preg_match(/[a-z0-9]/, $good)) {
 echo Good;
 } else {
 echo Bad;
 }
 
 This returns Good, why?

That regex matches any string which contains at least one (lowercase) 
letter or one number somewhere within it.  To match for only those 
elements and no others you probably want:

if (preg_match(/^[a-z0-9]*$/, $good)) {

which will match a string which contains nothing but a-z and 0-9, and 
will also match the empty string.  See 
http://www.php.net/manual/en/reference.pcre.pattern.syntax.php and look 
at the meanings of ^, $, *, and +.

Other variations for the regex:

/^[a-z0-9]+$/   as above but will not match empty string
/^[a-z0-9]*$/i  as above but matches upper case as well
/^[a-zA-Z0-9]*$/like previous line -- as above but matches upper
case as well

As Chris S. pointed out, a regex is not needed for this task, so the 
above is just academic.

--
Tom

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



[PHP] HELP!

2005-04-12 Thread
HI,

Any body give me any hinder I would be very appreciated!

I want to use a parameter of fist page in the second page, how can I realize
it.

For example, there is a segment in the first page:

 tr

  tdcom/tdtda
href='/cgi-bin/english/E_new_domain_list.cgi?domainType=1'? echo
$num_com;?/a/td

  tda href=autorenew.php?$result_id = 1? echo
$buy_com_num;?/a/td

/tr

But I wan  to use the parameter  $result_id in the second
page(autorenew.php) :

  switch($result_id){

  case 1 :

   ..;

   Break;

case 2 :

   ..;

   Break;

Can the parameter $result_id pass from fist page to second
page(autorenew.php)?

Sincerely yours,

justin

 E-mail/MSN: [EMAIL PROTECTED]

 



Re: [PHP] Storing password in cookie

2005-04-12 Thread trlists
On 11 Apr 2005 Chris Shiflett wrote:

   DO NOT STORE PASSWORDS ON USERS COMPUTER
  
  A couple of people have stated this but I think it is incorrect.
 
 Please refrain from such speculation, because it does nothing to improve 
 the state of security within our community. This idea of storing 
 passwords in cookies is absurd.

Hmmm, sorry, it wasn't speculation but an opinion in response to what I 
thought had moved from a practical into a theoretical discussion.  I 
agree, storing even an encrypted password in a cookie is a poor idea in 
most situations.  But to me development is about selecting the right 
tool and using it the right way for the job at hand, and as a matter of 
principle I'm not convinced that a password stored in some form in a 
cookie can never, ever be the right tool for any job -- even if it's 
the wrong tool for many or most.  As I said in other posts, there is a 
tendency here to declare certain practices as the one and only way, 
but I think development is almost always more complex and more of a 
balancing act than that.

If the discussion of that balance is beyond what the list is for and 
there is a need for a simple rule that everyone can follow then I 
certainly agree that don't store passwords on the user's computer is 
a far better rule and promotes better security practices than it 
depends.  But as I said I thought the discussion was more theoretical 
at that point, and that that was equally part of what's discussed here.

--
Tom

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



[PHP] HELP! HELP !

2005-04-12 Thread Justin Joe
 

 

HI,

Any body give me any hinder I would be very appreciated!

I want to use a parameter of the second page in the first page, how can I
realize it.

For example, there is a segment in the first page:

 tr

  tdcom/tdtda
href='/cgi-bin/english/E_new_domain_list.cgi?domainType=1'? echo
$num_com;?/a/td

  tda href=autorenew.php?$result_id = 1? echo
$buy_com_num;?/a/td

/tr

But I want to use the parameter  $result_id which in the second
page(autorenew.php) :

  switch($result_id){

  case 1 :

   ;

   Break;

case 2 :

   ;

   Break;

Can the parameter $result_id pass from the second page(autorennew.php) to
the first page?

Sincerely yours,

justin

 E-mail/MSN: [EMAIL PROTECTED]

 



Re: [PHP] HELP!

2005-04-12 Thread Stephen Johnson
Yes -- 

In your example - $result_id  would be accessed on page2 as

$result_id = $_GET['result_id'];

Then through out your script on page 2 you could access $result_id.

Hope that helps.


-- 
- $result_id 2

$result_id = $_get['result_id ' ];

2  $result_id



?php
/*

Stephen Johnson c | eh
The Lone Coder

http://www.thelonecoder.com
[EMAIL PROTECTED]

562.924.4454 (office)
562.924.4075 (fax) 

continuing the struggle against bad code

*/ 
?

 From:  [EMAIL PROTECTED]
 Date: Wed, 13 Apr 2005 11:00:36 +0800
 To: php-general@lists.php.net
 Subject: [PHP] HELP!
 
 HI,
 
 Any body give me any hinder I would be very appreciated!
 
 I want to use a parameter of fist page in the second page, how can I realize
 it.
 
 For example, there is a segment in the first page:
 
 tr
 
 tdcom/tdtda
 href='/cgi-bin/english/E_new_domain_list.cgi?domainType=1'? echo
 $num_com;?/a/td
 
 tda href=autorenew.php?$result_id = 1? echo
 $buy_com_num;?/a/td
 
 /tr
 
 But I wan  to use the parameter  $result_id in the second
 page(autorenew.php) :
 
 switch($result_id){
 
 case 1 :
 
  ..;
 
  Break;
 
 case 2 :
 
  ..;
 
  Break;
 
 Can the parameter $result_id pass from fist page to second
 page(autorenew.php)?
 
 Sincerely yours,
 
 justin
 
E-mail/MSN: [EMAIL PROTECTED]
 
 
 
 

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



[PHP] image display

2005-04-12 Thread Cima
hi,

what is the best way to display an image, that is stored in a database in
postgres, in a table form along with other fields that are in the same
table?

postgresql 8.0
e.g my_table(name varchar(15),sex character (1), picture_id oid)

in a table in php, i'd like to show all the rows in my_table with all the
fields including the picture.

thanx.

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



[PHP] error handling

2005-04-12 Thread Cima
hi,

im working with php 4 and postgresql 8 and i would like to know how to
handle certain errors generated. in postgresql,  i've written a stored
function that selects a record from a table and in case no record is found i
'raise an exception'. fine, now in my php script  i call that the stored
function which works properly when there is a record but when the record
doesnt exist, i would like to be able to place my own error message and not
e.g  'fatal error, .'. how do i capture(in php)  the exception i raised
in postgres so that i know the record doesnt exist?


thanx.

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



  1   2   >