[PHP] [Newbie Guide] For the benefit of new members

2004-07-08 Thread Ma Siva Kumar
===
Please feel free to add more points and send 
to the list.
===

1. If you have any queries/problems about PHP 
try http://www.php.net/manual/en first. You 
can download a copy and use it offline also. 

Please also try 
http://www.php.net/manual/faq.php 
for answers to frequently answered questions 
about PHP (added by Christophe Chisogne).

2. Try http://www.google.com next. Searching 
for "php YOUR QUERY" may fetch you relevant 
information within the first 10 results.

3. There is a searchable archive of the 
mailing list discussion at 
http://phparch.com/mailinglists. Many of the 
common topics are discussed repeatedly, and 
you may get answer to your query from the 
earlier discussions. 

For example: One of the repeatedly discussed 
question in the list is "Best PHP editor". 
Everyone has his/her favourite editor. 
You can get all the opinions by going through 
the list archives. If you want a chosen list 
try this link : 
http://www.thelinuxconsultancy.co.uk/phpeditors/
(contributed by Christophe Chisogne).

4. Not sure if PHP is working or you want 
find out what extensions are available to 
you?

Just put the following code into a file with 
a .php extension and access it through your 
webserver:

 

If PHP is installed you will see a page with 
a lot of information on it. If PHP is not 
installed (or not working correctly) your 
browser will try to download the file.

(contributed by Teren and reworded by Chris W 
Parker)

5. If you are stuck with a script and do not 
understand what is wrong, instead of posting 
the whole script, try doing some research 
yourself. One useful trick is to print 
the variable/sql query using print or echo 
command and check whether you get what you 
expected. 

After diagnosing the problem, send the 
details of your efforts (following steps 1, 
2 & 3) and ask for help.

6. PHP is a server side scripting language. 
Whatever processing PHP does takes place 
BEFORE the output reaches the client. 
Therefore, it is not possible to access 
users' computer related information (OS, 
screen size etc) using PHP. Nor can you 
modify any the user side settings. You need 
to go for JavaScript and ask the question in 
a JavaScript list.

On the other hand, you can access the 
information that is SENT by the user's 
browser when a client requests a page from 
your server. You can find details about 
browser, OS etc as reported by 
this request. - contributed by Wouter van 
Vliet and reworded by Chris W Parker.

7. Provide a clear descriptive subject line. 
Avoid general subjects like "Help!!", "A 
Question" etc. Especially avoid blank 
subjects. 

8. When you want to start a new topic, open a 
new mail composer and enter the mailing list 
address [EMAIL PROTECTED] instead of 
replying to an existing thread and replacing 
the subject and body with your message.

9. It's always a good idea to post back to 
the list once you've solved your problem. 
People usually add [SOLVED] to the subject 
line of their email when posting solutions. 
By posting your solution you're helping the 
next person with the same question. 
[contribued by Chris W Parker]

10. Ask smart questions 
http://catb.org/~esr/faqs/smart-questions.html
[contributed by Jay Blanchard)

11. Do not send your email to the list with 
attachments. If you don't have a place to 
upload your code, try the many pastebin 
websites (such as www.pastebin.com).
[contributed by Burhan Khalid]


-- 
Integrated Management Tools for leather 
industry
--
http://www.leatherlink.net

Ma Siva Kumar,
BSG LeatherLink (P) Ltd,
Chennai - 600106

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



[PHP] Re: Storing website templates in sessions

2004-07-08 Thread rush
"Joe Harman" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hey everyone...
>
> I was curious if anyone out there has some pros and cons to storing a
> website template that is extracted from a mysql db and stored in a
> session... is this an efficient way to do it?
>
> also... does anyone know what the size limitations for a session would
> be?

I guess you could stuck them there if you really wanted to, but there is
some broken feeling about that. Like keeping your motorcycle in dining room,
you can do it, but it is a bit odd.

Keep templates in files, or if you are using Smarty or TemplateTamer in
generated php code.

rush
--
http://www.templatetamer.com/

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



Re: [PHP] binary data over UDP with PHP?

2004-07-08 Thread Aidan Lister
If you're receiving binary data back, this function may interest you:

http://aidan.dotgeek.org/lib/?file=function.hexdump.php

Also, why are you messing with chr etc?
$string = "\x00\x01\xFF";
etc.


"Coder_1024" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Thanks for the feedback.  As it turns out, the reason I was getting zero
> data bytes in my UDP packet was that I had declared the packet variable
> outside the function in which I was using it.
>
> $packet = chr(0x01).chr(0x1d) etc
>
> function doSomething($x)
> {
> // using $packet in here gives you an empty variable.
> }
>
> So I guess it was a very basic PHP language thing I was running into.
Guess
> I've done too much Perl and assumed the variables were accessible in the
> function. :-)
>
>
> "Keith Greene" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> > I use the following without problem:
> >
> >  $fp = fsockopen("udp://www.server.com", 24250, &$errno,
&$errstr,
> .2);
> > if (!$fp) {
> >   $status = "Server not available";
> > } else {
> >  $trigger =
> > chr(hexdec('FF')).chr(hexdec('FF')).chr(hexdec('01')).chr(hexdec('00'));
> >  fwrite($fp,$trigger);   # Send trigger to the
> > status server
> >  $junk = fread($fp, 4);  # discard echoed
command
> > from status server
> > }
> >
> > Keith
> >
> > At 04:23 PM 7/7/2004, coder_1024 wrote:
> > >I'm trying to send some binary data to a UDP server using PHP.  The
> examples
> > >I've been able to find show sending binary data over TCP, or they show
> > >sending text over UDP.
> > >
> > >I'm constructing the messages using the below:
> > >
> > >   $text_msg = "Hello, World\r\n";
> > >   $binary_msg = chr(0x01).chr(0x02).chr(0x00).chr(0xAD);
> > >   $binary_msg_size = 4;
> > >
> > >I've tried a couple methods of sending the data:
> > >
> > >   $fp = fsockopen("udp://" . $host,$port,);
> > >   fwrite($fp,$binary_msg,$binary_msg_size);
> > >
> > >and
> > >
> > >   $sock = socket_create(AF_INET,SOCK_DGRAM,SOL_UDP);
> > >   socket_sendto($sock,$binary_msg,$binary_msg_size,0,$host,$port);
> > >
> > >In either case, a UDP packet is sent, but with a zero data size.  If I
> > >instead send the $text_msg, it works as expected.  For some reason
> sending
> > >the binary data doesn't work.
> > >
> > >Does anyone have insight into how to send binary data over UDP using
PHP?
> > >
> > >--
> > >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] Re: Client IP

2004-07-08 Thread Aidan Lister
I use the following script:

http://aidan.dotgeek.org/lib/?file=Visitor.php

As you've been told about 400 times, there's no reliable way to get the
information.

The above script checks if the client connected using a proxy, then falls
back to what the webserver sends.


"Rosen" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi,
> How can I get remote IP adress of client?
> I use the fillow script::
>
> $ip=getenv('HTTP_X_FORWARDED_FOR');
> if (!$ip)
> {
> $ip = getenv('REMOTE_ADDR');
> }
>
>
> But sometime it return me "unknown" sa IP adress.
>
> Can someone help me ?
>
> Thanks in advance!

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



[PHP] How to specify compiler options on Win32

2004-07-08 Thread Richard Davey
Hi,

Using the guide on the Zend site
(http://www.zend.com/manual/install.windows.php#install.windows.build)
I have successfully compiled and built the Win32 version of PHP using
Visual C++. For now I am building the CLI version - and it works just
great, but I have what is probably a very basic question - how do you
add the compile time options when building it?

For example I want to build the CLI version with --enable-memory-limit
so I can use the memory_get_usage() function - but I am simply not
sure where to specify this before building the project. I'm guessing
it lurks somewhere in the Project Settings for php4ts_cli?

Best regards,

Richard Davey
-- 
 http://www.launchcode.co.uk - PHP Development Services
 "I am not young enough to know everything." - Oscar Wilde

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



Re: [PHP] $_SERVER[HTTP_REFERER]

2004-07-08 Thread Shaun

"Gerard Samuel" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> On Wednesday 07 July 2004 05:43 pm, Shaun wrote:
> > Hi,
> >
> > Can someone tell me why
> >
> > echo '$_SERVER[HTTP_REFERER] = '.$_SERVER[HTTP_REFERER].'';
> >
> > Produces
> >
> > $_SERVER[HTTP_REFERER] =
> >
> > Is this a problem with my server configuration, if so is there a SERVER
> > variable I can use instead?
> >
>
> It could be the server.  I never fully investigated this, but IIS 5/5.1
> doesn't report an HTTP REFERER
> The last time I checked this out, was on w2k/iis5 and winxp/iis5.1 (pre
sp1)
> maybe over a year ago.
> Could someone verify/deny this, so I know that Im not crazy ;)

Thanks for your replies,

after lots of investigation it appears that it is just my laptop that won't
disply the variable, maybe because I am using Norton Firewall? Whatever the
reason, is there an alternative server variable?

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



Re: [PHP] How to specify compiler options on Win32

2004-07-08 Thread Tom Rogers
Hi,

Thursday, July 8, 2004, 6:56:17 PM, you wrote:
RD> Hi,

RD> Using the guide on the Zend site
RD> (http://www.zend.com/manual/install.windows.php#install.windows.build)
RD> I have successfully compiled and built the Win32 version of PHP using
RD> Visual C++. For now I am building the CLI version - and it works just
RD> great, but I have what is probably a very basic question - how do you
RD> add the compile time options when building it?

RD> For example I want to build the CLI version with --enable-memory-limit
RD> so I can use the memory_get_usage() function - but I am simply not
RD> sure where to specify this before building the project. I'm guessing
RD> it lurks somewhere in the Project Settings for php4ts_cli?

RD> Best regards,

RD> Richard Davey
RD> -- 
RD>  http://www.launchcode.co.uk - PHP Development Services
RD>  "I am not young enough to know everything." - Oscar Wilde


php-x.x.x/main/config_w32.h is where they are set, but I don't think
--enable-memory-limit will work in windows (at least I couldn't get
it to report anything meaningfull :)

-- 
regards,
Tom


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



Re[2]: [PHP] How to specify compiler options on Win32

2004-07-08 Thread Richard Davey
Hello Tom,

Thursday, July 8, 2004, 10:27:20 AM, you wrote:

TR> php-x.x.x/main/config_w32.h is where they are set, but I don't think
TR> --enable-memory-limit will work in windows (at least I couldn't get
TR> it to report anything meaningfull :)

I have to admit I did look in there, but couldn't see anything
relating to it (or how to specify it). But if it doesn't work on
Windows anyway then I guess it's not much use! :)

Best regards,

Richard Davey
-- 
 http://www.launchcode.co.uk - PHP Development Services
 "I am not young enough to know everything." - Oscar Wilde

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



Re: [PHP] $_SERVER[HTTP_REFERER]

2004-07-08 Thread Christophe Chisogne
Shaun a écrit :
after lots of investigation it appears that it is just my laptop that won't
disply the variable, maybe because I am using Norton Firewall? 
Possible. The REFERER HTTP field is OPTIONAL
-- See http1.1 spec (rfc2616) or this list archives.
So it's not a field anyone should rely upon.
More and more software (firewall, proxies, privacy tools)
just dont send it, or send it modified
(same thing for the UserAgent field, which can even
 be modified on several browsers)
reason, is there an alternative server variable?
No. It can be empty or even (easily) faked.
Christophe
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: sending attachments

2004-07-08 Thread Manuel Lemos
Hello,
On 07/07/2004 08:04 AM, Curlys wrote:
can some body help me to send an email attachment ( a log file ) from php ?
Actaually i need a real guide plz
You need to compose a multipart/mixed message with a text part that is 
your message and the attached part with is your file.

You may want to try this class that simplifies composing complex 
messages. It also comes with examples and extensive documentation that 
explain how compose the messages properly without much work.

http://www.phpclasses.org/mimemessage
--
Regards,
Manuel Lemos
PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/
PHP Reviews - Reviews of PHP books and other products
http://www.phpclasses.org/reviews/
Metastorage - Data object relational mapping layer generator
http://www.meta-language.net/metastorage.html
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: post without

2004-07-08 Thread Manuel Lemos
Hello,
On 07/07/2004 10:49 AM, Josh Close wrote:
How can I post data without having it submitted from within a form?
With get I can just add it to the url. Is there a php function for this?
If you mean emulating POST form submission to a site of a given URL, you 
may want to try this HTTP client class that makes it easy to do that and 
comes with an example:

http://www.phpclasses.org/httpclient
--
Regards,
Manuel Lemos
PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/
PHP Reviews - Reviews of PHP books and other products
http://www.phpclasses.org/reviews/
Metastorage - Data object relational mapping layer generator
http://www.meta-language.net/metastorage.html
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Does anyone have PHP compiled with --enable-memory-limit?

2004-07-08 Thread Richard Davey
Hi all,

Does anyone here have a version of PHP with --enable-memory-limit
compiled into it and a couple of minutes to spare? All I need is for
you to run a very simple script a couple of times and send me the
output. If you've got a PayPal account I'll even throw a few dollars
your way for the trouble if you want. Please contact me off-list.

Best regards,

Richard Davey
-- 
 http://www.launchcode.co.uk - PHP Development Services
 "I am not young enough to know everything." - Oscar Wilde

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



Re: [PHP] Client IP

2004-07-08 Thread John Nichel
John W. Holmes wrote:
Trust me.
Riggtt.  Like we're going to trust the likes of you. 
 I guess the cheque's in the mail too, eh?  ;)

--
By-Tor.com
It's all about the Rush
http://www.by-tor.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Common MySQL database function class

2004-07-08 Thread Keith Lawrence
Hi there,

I'm a web-developer and I work with PHP as often as I can (it's infinitely
preferable to ASP) and as a result of this I end up coding in lots of
different environments. Our local dev server is a windows machine which acts
differently to the multitude of *nix boxes which our clients run. Some have
safe-mode enabled (apparently a good safety measure for a shared-hosting
solution), some run with magic_quotes on, some with magic_quotes off,
register globals on/off, etc etc ad nauseum. Usually this isn't much of a
problem as I tend to only work on one major project at a time and I can set
up our local windows box to emulate the live server, but it would be very
useful to me if I could ask for your collective knowledge on building an
include file (or class) of common database functions. This class would take
into account whether the server has magic_quotes enabled and cater for it,
different login strings depending on the environment variables (for dev and
live environments) as well as catering for any other strange
platform-dependent niggles that I've left out. It'd also have methods to
fetch:
* just one specific value from the database 
* an array of rows from the database
* run an arbitrary query (insert/update/delete) and return success/failure
and optionally populate the identity id/error message/etc.

I hasten to add that I'm not asking for someone to build this for me, but
rather asking for any pointers/tips for things I should watch out for or
links that might help. I've searched extensively for something like this but
haven't found one that does exactly what I want. Am I re-inventing the wheel
here? Does anyone else who works on multiple platforms have these problems?

Many thanks (in advance) for any help,

Regards,
Keith
 
  

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



Re[3]: [PHP] How to specify compiler options on Win32

2004-07-08 Thread Tom Rogers
Hi,

Thursday, July 8, 2004, 7:38:49 PM, you wrote:
RD> Hello Tom,

RD> I have to admit I did look in there, but couldn't see anything
RD> relating to it (or how to specify it). But if it doesn't work on
RD> Windows anyway then I guess it's not much use! :)

RD> Best regards,

RD> Richard Davey
RD> -- 
RD>  http://www.launchcode.co.uk - PHP Development Services
RD>  "I am not young enough to know everything." - Oscar Wilde


You could try adding

#define MEMORY_LIMIT 1

-- 
regards,
Tom

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



[PHP] Worried about PECL

2004-07-08 Thread Peter Clarke
Currently the online manual for php is great.
My concern is that the documentation for PECL extensions is almost 
non-existent. Since some php extensions are being moved/replaced by PECL 
extensions are we going to get non-existent documentation?

For example:
www.php.net/mime-magic
"This extension has been deprecated as the PECL extension fileinfo 
provides the same functionality (and more) in a much cleaner way."
http://pecl.php.net/package/Fileinfo provides no documentation so what 
these extra functions are, I have no idea. Worse, I now have no idea how 
to do mime_content_type().

www.php.net/mcal
"Note: This extension has been removed as of PHP 5 and moved to the PECL 
repository."
There is no mention of mcal on the pecl website.

I appreciate that PECL will more relevant to PHP5, but PHP5 is close is 
the documentation close too?

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


[PHP] Re: Slideshow using PHP

2004-07-08 Thread Todd Cary
I do have a JavaScript based "SlideShow", however, I would like to use 
PHP rather than JavaScript.  Is there a way to "loop" with PHP and 
"display" an image without re-displaying the whole page?

Todd
Alex Shi wrote:
Search google for javascript slideshow script. Javascript slideshow need 
an array of image names, this can be done by php and mysql when dynamically
generate the page.

Alex Shi

I would like to have images displayed automatically using PHP with a 
Database and/or an array of images.  Is there any sample code available 
for doing that?

Can that be done with Flash and PHP?
Todd
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Malicious SQL

2004-07-08 Thread Reuben D. Budiardja
On Wednesday 07 July 2004 12:05, Keith Greene wrote:

> on the contrary:
> sql = mysql_query("select * from users where name='".$name."'");
>
> will simply look for a user with a name of "Jim; delete from users;" and
> return no results found.

But I can also enter:
jim'; delete from users

You need to catch if there's a quote in the $name too, and escape that.

RDB

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



[PHP] MySQL Database Connection Question

2004-07-08 Thread Harlequin
I have a user registration form that asks new users to register. However, Do
I post the MySQLconnection string in the page they are completing or in the
later page that the data is posted to, or both...?

-- 
-
 Michael Mason
 Arras People
 www.arraspeople.co.uk
-

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



[PHP] User Redirection if login fails

2004-07-08 Thread Harlequin
Hi again.

My code simply asks for a username and password but even if they insert
incorrect details the called page is displayed.

How can I get them to be redirected to another page if their login
information is incorrect...?

  echo "registerd users login here please...";
  echo "";
  echo "UserID:\t\t";
  echo "";
  echo "Password:\t\t";
  echo "";
  echo "\t\t";
  echo "";



-- 
-
 Michael Mason
 Arras People
 www.arraspeople.co.uk
-

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



Re: [PHP] MySQL Database Connection Question

2004-07-08 Thread James E Hicks III
On Thursday 08 July 2004 09:59 am, Harlequin wrote:
> I have a user registration form that asks new users to register. However,
> Do I post the MySQLconnection string in the page they are completing or in
> the later page that the data is posted to, or both...?

I don't think I understand your question, but let me take a stab at it anyway. 
There should be no reason to pass along the mysql connection ID in a form as 
it will be quite useless when the page is submitted because these connections 
are dropped when your PHP program ends execution. You will need to make a new 
connection to the database in order to store the entered values from a form 
submission.

If I didn't get your question right, please be more clear about what you mean 
when you say MySQLconnection string.

James Hicks

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



Re: [PHP] MySQL Database Connection Question

2004-07-08 Thread John Nichel
Harlequin wrote:
I have a user registration form that asks new users to register. However, Do
I post the MySQLconnection string in the page they are completing or in the
later page that the data is posted to, or both...?
Not sure I follow what you're asking, but you only need to open a 
connection to the MySQL server when you want to run queries (select, 
insert, update, etc.) against it.  If the page with the form on it 
doesn't need any mysql data for other parts of the page, then you don't 
have to open it there.  If you plan on putting the form results into a 
db after the user posts it, then you need a connection on that page.

--
John C. Nichel
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] User Redirection if login fails

2004-07-08 Thread John Nichel
Harlequin wrote:
Hi again.
My code simply asks for a username and password but even if they insert
incorrect details the called page is displayed.
How can I get them to be redirected to another page if their login
information is incorrect...?
How are you checking the result?  From a db?  If so, run your query 
before any output to the browser on the page where your form is posted 
too (ex. SELECT * FROM users WHERE name = '$name' && 
password='$password').  If your query returns no results, redirect them 
with the header() function.

--
John C. Nichel
KegWorks.com
716.856.9675
[EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: MySQL Database Connection Question

2004-07-08 Thread Daniel Kullik
Harlequin wrote:
I have a user registration form that asks new users to register. However, Do
I post the MySQLconnection string in the page they are completing or in the
later page that the data is posted to, or both...?
You ought to tell your registration-page to redirect to itself right 
after the visitor hit the submit-button of your form.

This should to the trick:
[code]

[/code]

Therefore your script will have to check if something has been posted.
[code]
if (!empty($_POST) && isset($_POST['button_name'])) {
// perform validation, insert record into database, etc
}
[/code]
.. might do, while 'button_name' is the name of your form's submit-button.
Note: You should checkout the thread 'Form Submission' started on July 
6th since this is appearently not the best way to check if the user hit 
the submit-button.

Daniel
--
WWE e-commerce IT GmbH
Eiffestrasse 462, D-20537 Hamburg
Tel.: +49-40-2530659-0, Fax: +49-40-2530659-50
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Re: MySQL Database Connection Question

2004-07-08 Thread Afan Pasalic
July 6th? What are you talking about? Can you please give me more info 
about that?

afan

Daniel Kullik wrote:
Note: You should checkout the thread 'Form Submission' started on July 
6th since this is appearently not the best way to check if the user 
hit the submit-button.

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


Re: [PHP] Re: MySQL Database Connection Question

2004-07-08 Thread John Nichel
Afan Pasalic wrote:
Daniel Kullik wrote:
Note: You should checkout the thread 'Form Submission' started on July 
6th since this is appearently not the best way to check if the user 
hit the submit-button.

Daniel
July 6th? What are you talking about? Can you please give me more info 
about that?

afan
He's saying RTFA.
http://marc.theaimsgroup.com/?l=php-general&m=108910994407822&w=2
--
John C. Nichel
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] Re: MySQL Database Connection Question

2004-07-08 Thread Daniel Kullik
Afan Pasalic wrote:
July 6th? What are you talking about? Can you please give me more info 
about that?

afan

Daniel Kullik wrote:
Note: You should checkout the thread 'Form Submission' started on July 
6th since this is appearently not the best way to check if the user 
hit the submit-button.

Daniel
Hello Afan.
On July 6th 2004 (or 2004-06-07 if you prefer ISO-dates) 
[EMAIL PROTECTED] started a thread named 'Form Submission'.
That's all.

Daniel
--
WWE e-commerce IT GmbH
Eiffestrasse 462, D-20537 Hamburg
Tel.: +49-40-2530659-0, Fax: +49-40-2530659-50
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] php mls and realtor.com

2004-07-08 Thread Edward Peloke
I have a site where the user currently enters their data into a local db,
then goes to another site and enters it for the state mls, then uses
realtor.com to enter it for that mls, they want one form where they can
enter the date and have it go to all three.  Has anyone worked with
interfacing with other mls databases?  This will be done through php.

Thanks,
Eddie

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



Re: [PHP] Re: MySQL Database Connection Question

2004-07-08 Thread Daniel Kullik
John Nichel wrote:
Afan Pasalic wrote:
Daniel Kullik wrote:
Note: You should checkout the thread 'Form Submission' started on 
July 6th since this is appearently not the best way to check if the 
user hit the submit-button.

Daniel

July 6th? What are you talking about? Can you please give me more info 
about that?

afan
He's saying RTFA.
http://marc.theaimsgroup.com/?l=php-general&m=108910994407822&w=2
Thanks for that URL, John.
Eventually CVS come to Afan's mind when he read "checkout" and "thread". 
Sorry for the confusion.

Daniel
--
WWE e-commerce IT GmbH
Eiffestrasse 462, D-20537 Hamburg
Tel.: +49-40-2530659-0, Fax: +49-40-2530659-50
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Re: MySQL Database Connection Question

2004-07-08 Thread Afan Pasalic
Oh!
:-)
Thanks...

John Nichel wrote:
Afan Pasalic wrote:
Daniel Kullik wrote:
Note: You should checkout the thread 'Form Submission' started on 
July 6th since this is appearently not the best way to check if the 
user hit the submit-button.

Daniel

July 6th? What are you talking about? Can you please give me more 
info about that?

afan
He's saying RTFA.
http://marc.theaimsgroup.com/?l=php-general&m=108910994407822&w=2
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: Common MySQL database function class

2004-07-08 Thread Torsten Roehr
"Keith Lawrence" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi there,
>
> I'm a web-developer and I work with PHP as often as I can (it's infinitely
> preferable to ASP) and as a result of this I end up coding in lots of
> different environments. Our local dev server is a windows machine which
acts
> differently to the multitude of *nix boxes which our clients run. Some
have
> safe-mode enabled (apparently a good safety measure for a shared-hosting
> solution), some run with magic_quotes on, some with magic_quotes off,
> register globals on/off, etc etc ad nauseum. Usually this isn't much of a
> problem as I tend to only work on one major project at a time and I can
set
> up our local windows box to emulate the live server, but it would be very
> useful to me if I could ask for your collective knowledge on building an
> include file (or class) of common database functions. This class would
take
> into account whether the server has magic_quotes enabled and cater for it,
> different login strings depending on the environment variables (for dev
and
> live environments) as well as catering for any other strange
> platform-dependent niggles that I've left out. It'd also have methods to
> fetch:
> * just one specific value from the database
> * an array of rows from the database
> * run an arbitrary query (insert/update/delete) and return success/failure
> and optionally populate the identity id/error message/etc.
>
> I hasten to add that I'm not asking for someone to build this for me, but
> rather asking for any pointers/tips for things I should watch out for or
> links that might help. I've searched extensively for something like this
but
> haven't found one that does exactly what I want. Am I re-inventing the
wheel
> here? Does anyone else who works on multiple platforms have these
problems?
>
> Many thanks (in advance) for any help,
>
> Regards,
> Keith

Hi Keith,

using a database abstraction layer would be a good start. There are some
good ones in PEAR:
http://pear.php.net/packages.php?catpid=7&catname=Database

Namely PEAR::DB, PEAR::MDB and PEAR::MDB2. They offer the features you are
looking for.

Regards, Torsten Roehr

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



Re: [PHP] call_user_func and call-time pass-by-reference

2004-07-08 Thread Andrew S. Nagy
Great, i must have done something wrong, it works for me now.
Thanks for all your help :)
Andrew
Tom Rogers wrote:
Hi,
Thursday, July 8, 2004, 3:38:41 AM, you wrote:
AN> Hmm ... this still echos 0 and not 1.  I am using 4.3.7 with all 
AN> warnings on.

AN> Does anyone know how to use this function or anything similiar with
AN> passing by refernce.  Since the call-time pass by reference is 
AN> deprecated, this practice is no longer valid, but there must be a work
AN> around?

AN> Thanks for any assistance
AN> Andrew
Strange as it works for me (http://fred.kwikin.com/user.php) with this
code exactly:
";
call_user_func_array("fun", array(&$var));
echo "After:$var";
?>
What version of PHP are you using?
 

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


Re: [PHP] User Redirection if login fails

2004-07-08 Thread Matthew Sims
> Hi again.
>
> My code simply asks for a username and password but even if they insert
> incorrect details the called page is displayed.
>
> How can I get them to be redirected to another page if their login
> information is incorrect...?
>
>   echo "registerd users login here please...";
>   echo "";
>   echo "UserID:\t\t";
>   echo "";
>   echo "Password:\t\t 'TXT_UserPassword'>";
>   echo "";
>   echo "\t\t";
>   echo "";
>
> -
>  Michael Mason

What I usually do is set the form action to the same page as the above
code is applied to. Then I add an if statement at the top that checks the
login and redirects you to another page if login is successful. I think
you might want to give a name to your submit button as well, something
easy like name='submit'.

Then something like this at the top of the page:

if (isset($_POST["submit"])) {
  ...get user's password from database...
  if ($_POST["password"] == $db["password"]) {
 header("Location:members/index.php");
 exit;
  }
}

So if the login fails, they'll still be sitting at the login page. The
above code needs to be set before any HTML code, else the redirect won't
work.

http://us4.php.net/manual/en/function.header.php

--Matthew Sims
--

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



Re: [PHP] Re: Slideshow using PHP

2004-07-08 Thread Matthew Sims
> I do have a JavaScript based "SlideShow", however, I would like to use
> PHP rather than JavaScript.  Is there a way to "loop" with PHP and
> "display" an image without re-displaying the whole page?
>
> Todd

To get a good slideshow you'll need to use client side instructions, aka
javascript. You're probably not going to get it to work so well using PHP
which is server side instructions.

Part of getting the slideshow to work is making the browser switch to the
next image and well, PHP doesn't really make the browser do anything.

--Matthew Sims
--

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



Re: [PHP] Re: Slideshow using PHP

2004-07-08 Thread raditha dissanayake
The best way to do a slide show in my opinion is with SMIL, even though 
you need a plug in to view it.. SMIL is what's used in MMS.
you can generate you SMIL with MMS - as we have done in our MMS composer.

--
Raditha Dissanayake.
-
http://www.raditha.com/megaupload/upload.php
Sneak past the PHP file upload limits.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Malicious SQL

2004-07-08 Thread Philip Olson

> > on the contrary:
> > sql = mysql_query("select * from users where name='".$name."'");
> >
> > will simply look for a user with a name of "Jim; delete from users;" and
> > return no results found.
> 
> But I can also enter:
> jim'; delete from users
> 
> You need to catch if there's a quote in the $name too, and escape that.

One thing to remember is mysql_query() will execute just one (the first)
query so use of ; won't do anything in the above except break the
query.  Still though the point is well taken, be sure to add slashes
(once) and put single quotes around the criteria ($name) and life will be
grand.  Quotes around numerical values won't hurt (such as id = '$id')
although it's not required.  If you choose not to do that then be sure
it's numerical before use (like cast it as an int, or check 
is_numeric(), etc. ...).  Some people check for ';' in the request
variable and if found yell at the user, that can be fun.  bugs.php.net
does this.

In regards to the controversial magic_quotes_gpc PHP directive, I feel it
should remain on by default but if you know what you're doing then set it
yourself.  Scripts that work everywhere should of course work perfectly
with it on or off.  php.ini-dist (the default php.ini) has it on while the
php.ini-recommended has it off.  You must know what you're doing to use
the 'recommended' version of php.ini.  PHP is a newbie friendly language
and newbies are for the most part clueless and don't know what strings or
integers are, or why data should be escaped, or what data validation is or
why it's important.  This is why magical quotes exist as without them
just think how many people would keep getting "malicious SQL" in their
code and blame PHP, or how seemingly random SQL syntax errors would crop
up.  For these reasons dealing with "Why do I get \' everywhere" type
questions is worth it, and why magic_quotes_gpc exists as a php.ini 
directive.

Regards,
Philip

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



[PHP] How can I write/read encoded numbers into/from a file?

2004-07-08 Thread Julio Sergio Santana
I'm just starting with PHP, and I've been browsing the whole manual to 
find how to solve the following problem:

1. An integer number is internally represented in 4 bytes. Say, for 
instance, number 65 is represented by 0x0041, that is the string 
"\0\0\0\0x41", and not the string "65".
2. How can I write this representation into a file and then read back it 
from the file?

Do you have any idea about this?
Thank you,
Sergio.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] How can I write/read encoded numbers into/from a file?

2004-07-08 Thread deseavers
http://us4.php.net/manual/en/function.base64-decode.php


-Original Message-
From: Julio Sergio Santana <[EMAIL PROTECTED]>
Sent: Jul 8, 2004 9:44 AM
To: [EMAIL PROTECTED]
Subject: [PHP] How can I write/read encoded numbers into/from a file?

I'm just starting with PHP, and I've been browsing the whole manual to 
find how to solve the following problem:

1. An integer number is internally represented in 4 bytes. Say, for 
instance, number 65 is represented by 0x0041, that is the string 
"\0\0\0\0x41", and not the string "65".
2. How can I write this representation into a file and then read back it 
from the file?

Do you have any idea about this?

Thank you,


Sergio.

-- 
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] $_SERVER[HTTP_REFERER]

2004-07-08 Thread Justin Patrin
On Thu, 08 Jul 2004 11:49:24 +0200, Christophe Chisogne
<[EMAIL PROTECTED]> wrote:
> Shaun a écrit :
> > after lots of investigation it appears that it is just my laptop that won't
> > disply the variable, maybe because I am using Norton Firewall?
> 
> Possible. The REFERER HTTP field is OPTIONAL
> -- See http1.1 spec (rfc2616) or this list archives.
> So it's not a field anyone should rely upon.
> More and more software (firewall, proxies, privacy tools)
> just dont send it, or send it modified
> (same thing for the UserAgent field, which can even
>   be modified on several browsers)
> 
> > reason, is there an alternative server variable?
> 
> No. It can be empty or even (easily) faked.
> 

This is a variable that the client send you explicitly. Some firewall
software blocks sending it. You can even send a fake value. Basically,
you can't rely on it.

-- 
DB_DataObject_FormBuilder - The database at your fingertips
http://pear.php.net/package/DB_DataObject_FormBuilder

paperCrane --Justin Patrin--

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



Re: [PHP] How can I write/read encoded numbers into/from a file?

2004-07-08 Thread Chris
Are you trying read the string '\0\0\0\0x41' from a file? or are you 
trying to read these 4 bytes from a file: 0041 ?

If the latter:
The pack and unpack functions are designed to do this (and more). You 
could also manually do it yourself with something like this:

$sBuff = "\0\0\0\0x41"; // Read the data into a var
$iAnswer =  ord($sBuff{0}) | ord($sBuff{1}) << 8 | ord($sBuff{2}) << 16 
| ord($sBuff{3}) << 24;
// Get the numerical value of each byte, then shift the bytes to get the 
4 byte number. (Little Endian)

Chris
Julio Sergio Santana wrote:
I'm just starting with PHP, and I've been browsing the whole manual to 
find how to solve the following problem:

1. An integer number is internally represented in 4 bytes. Say, for 
instance, number 65 is represented by 0x0041, that is the string 
"\0\0\0\0x41", and not the string "65".
2. How can I write this representation into a file and then read back 
it from the file?

Do you have any idea about this?
Thank you,
Sergio.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] How can I write/read encoded numbers into/from a file?

2004-07-08 Thread Julio Sergio Santana
I tried the following and it didn't work:

X-Powered-By: PHP/4.1.2
Content-type: text/html
**
It was supposed to output:
***65***
[EMAIL PROTECTED] wrote:
http://us4.php.net/manual/en/function.base64-decode.php
-Original Message-
From: Julio Sergio Santana <[EMAIL PROTECTED]>
Sent: Jul 8, 2004 9:44 AM
To: [EMAIL PROTECTED]
Subject: [PHP] How can I write/read encoded numbers into/from a file?
I'm just starting with PHP, and I've been browsing the whole manual to 
find how to solve the following problem:

1. An integer number is internally represented in 4 bytes. Say, for 
instance, number 65 is represented by 0x0041, that is the string 
"\0\0\0\0x41", and not the string "65".
2. How can I write this representation into a file and then read back it 
from the file?

Do you have any idea about this?
Thank you,
Sergio.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] How can I write/read encoded numbers into/from a file?

2004-07-08 Thread Julio Sergio Santana
Thank you Chris. I finally got the solution to my problem using the 
pack/unpack functions as you adviced me. The solution is:


X-Powered-By: PHP/4.1.2
Content-type: text/html
4
***A*** // This is "\0\0\0A"

Chris wrote:
Are you trying read the string '\0\0\0\0x41' from a file? or are you 
trying to read these 4 bytes from a file: 0041 ?

If the latter:
The pack and unpack functions are designed to do this (and more). You 
could also manually do it yourself with something like this:

$sBuff = "\0\0\0\0x41"; // Read the data into a var
$iAnswer =  ord($sBuff{0}) | ord($sBuff{1}) << 8 | ord($sBuff{2}) << 16 
| ord($sBuff{3}) << 24;
// Get the numerical value of each byte, then shift the bytes to get the 
4 byte number. (Little Endian)

Chris
Julio Sergio Santana wrote:
I'm just starting with PHP, and I've been browsing the whole manual to 
find how to solve the following problem:

1. An integer number is internally represented in 4 bytes. Say, for 
instance, number 65 is represented by 0x0041, that is the string 
"\0\0\0\0x41", and not the string "65".
2. How can I write this representation into a file and then read back 
it from the file?

Do you have any idea about this?
Thank you,
Sergio.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Link only active letters in alphabetical search

2004-07-08 Thread barophobia
hello.

in an effort to more easily find products in the cart i'm building
i've given the ability to the user to click a letter from the alphabet
to search for all products whose product id starts with that letter.

currently each letter is hyper linked but i'd like to only link the
letters that have an occurrence in the database. in other words, if
there are no products in the database that start with the letter 'Z'
then i don't want it to have a hyper link.

i'm writing to the list to share my solution to this problem and
hopefully find a better way to do it (if one exists).

here is my solution:

1. pull a list of products from the database
2. truncate each product id down to it's first letter
3. remove all the duplicates
4. use this list to build the links.

as i loop through the alphabet i will only write a link for those
letters that occur in modified list. everything else will just be a
non-linked letter.

it's a pretty easy solution (concerning the logic behind it) but i
don't know if it's the best one and i haven't been able to come up
with anything else.


thanks,
chris.

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



Re: [PHP] Link only active letters in alphabetical search

2004-07-08 Thread deseavers
I doubt this function is going to make your script more efficient, but you could also 
make use of the array_intersect () function.


-Original Message-
From: barophobia <[EMAIL PROTECTED]>
Sent: Jul 8, 2004 10:47 AM
To: php-general <[EMAIL PROTECTED]>
Subject: [PHP] Link only active letters in alphabetical search

hello.

in an effort to more easily find products in the cart i'm building
i've given the ability to the user to click a letter from the alphabet
to search for all products whose product id starts with that letter.

currently each letter is hyper linked but i'd like to only link the
letters that have an occurrence in the database. in other words, if
there are no products in the database that start with the letter 'Z'
then i don't want it to have a hyper link.

i'm writing to the list to share my solution to this problem and
hopefully find a better way to do it (if one exists).

here is my solution:

1. pull a list of products from the database
2. truncate each product id down to it's first letter
3. remove all the duplicates
4. use this list to build the links.

as i loop through the alphabet i will only write a link for those
letters that occur in modified list. everything else will just be a
non-linked letter.

it's a pretty easy solution (concerning the logic behind it) but i
don't know if it's the best one and i haven't been able to come up
with anything else.


thanks,
chris.

-- 
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] Link only active letters in alphabetical search

2004-07-08 Thread Jay Blanchard
[snip]
currently each letter is hyper linked but i'd like to only link the
letters that have an occurrence in the database. in other words, if
there are no products in the database that start with the letter 'Z'
then i don't want it to have a hyper link.
[/snip]

Do it with SQL

SELECT DISTINCT(SUBSTRING(`productName`, 1, 1)) FROM `productTable`

will give you only one of each of the starting letters that actually
occur in your database.

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



Re: [PHP] Link only active letters in alphabetical search

2004-07-08 Thread Matt M.
> 1. pull a list of products from the database
> 2. truncate each product id down to it's first letter
> 3. remove all the duplicates
> 4. use this list to build the links.

I would let sql do some of the work.

select count(*) from products where product_name like 'A%'

if count does not return 0 you have products that start with A

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



[PHP] Authentification Help

2004-07-08 Thread Mike Tuller
I have created a script that authenticates to an Active Directory 
server. This script works when I try to login, but the problem is that 
I have to bind to be able to get "my" dn to be able to authenticate, 
but I need authenticate first to be able to get "my" dn. Chicken before 
the egg problem.

In the ldap_bind(), I have entered "my" dn to be able to authenticate 
for now, but with this I am the only person that would be able to 
login.

I could bind to the server twice, once to get an individuals "dn" , set 
the variable, and then once I have the "user's" dn I could bind again 
as that user, but this seems like it would cause a lot of overhead. 
Does anyone have a better way to do this than bind twice?

 $dn = "OU=Anoka-Hennepin,DC=ah,DC=isd11";
$filter = "(samaccountname=" . $username . "*)";
$ad = ldap_connect("ldap://172.22.1.20";)
  or die("Couldn't connect to AD!");
$bd = ldap_bind($ad, "CN=Tuller\, 
Mike,OU=Staff,OU=LCDC,OU=Anoka-Hennepin,DC=ah,DC=isd11",$password)
  or die("Couldn't bind to AD!");

$result = ldap_search($ad, $dn, $filter);
$entries = ldap_get_entries($ad, $result);
for ($i=0; $i<$entries["count"]; $i++)
{
echo $entries[$i]["dn"];
}
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Link only active letters in alphabetical search

2004-07-08 Thread barophobia
On Thu, 8 Jul 2004 13:14:50 -0500, Jay Blanchard
<[EMAIL PROTECTED]> wrote:
> Do it with SQL
> 
> SELECT DISTINCT(SUBSTRING(`productName`, 1, 1)) FROM `productTable`
> 
> will give you only one of each of the starting letters that actually
> occur in your database.

good job. that works great. it's *much* faster now.

thanks!
chris.

p.s. do you use backticks in all your qeuries?

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



RE: [PHP] Link only active letters in alphabetical search

2004-07-08 Thread Jay Blanchard
[snip]
p.s. do you use backticks in all your qeuries?
[/snip]

It's just a good habit! :)

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



Re: [PHP] Re: Slideshow using PHP

2004-07-08 Thread Todd Cary
Matthew -
<<<
Part of getting the slideshow to work is making the browser switch to the
next image and well, PHP doesn't really make the browser do anything.
>>>
As I was thinking about it before posting this thread, that was my 
impression.  The problem with my javaScript app is the fact that it 
needs to load all of the images.

I am hoping there is some way to load the iamges one-at-a-time; as needed.
Someone told me that there is a way to use Flash and PHP.
Todd
Matthew Sims wrote:
I do have a JavaScript based "SlideShow", however, I would like to use
PHP rather than JavaScript.  Is there a way to "loop" with PHP and
"display" an image without re-displaying the whole page?
Todd

To get a good slideshow you'll need to use client side instructions, aka
javascript. You're probably not going to get it to work so well using PHP
which is server side instructions.
Part of getting the slideshow to work is making the browser switch to the
next image and well, PHP doesn't really make the browser do anything.
--Matthew Sims
--
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Socket Tutorial

2004-07-08 Thread René Fournier
Hi Andrew,
This one helped me a lot:
http://www.devshed.com/c/a/PHP/Socket-Programming-With-PHP/
This isn't a tutorial, but good sample code for a multi-client chat 
server:
http://dave.dapond.com/socketselect.phps

...Rene
On Monday, July 5, 2004, at 12:39 PM, Andrew wrote:
Hi guys,
Can somebody provide a good PHP Socket Programming tutorial. I'm 
working on
a chat server application. The client is XMLsocket based Flash movie.

Thanks, Andrew
--
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] Malicious SQL

2004-07-08 Thread Tim Van Wassenhove
In article <[EMAIL PROTECTED]>, Philip Olson wrote:
> One thing to remember is mysql_query() will execute just one (the first)
> query so use of ; won't do anything in the above except break the
> query.  

If i'm not mistaken, newer versions of mysql do allow multiple queries. 

> (once) and put single quotes around the criteria ($name) and life will be
> grand.  Quotes around numerical values won't hurt (such as id = '$id')
> although it's not required.  If you choose not to do that then be sure
> it's numerical before use (like cast it as an int, or check 
> is_numeric(), etc. ...).  Some people check for ';' in the request
> variable and if found yell at the user, that can be fun.  bugs.php.net
> does this.

Or use prepared statements with mysqli


-- 
Tim Van Wassenhove 

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



Re: [PHP] Malicious SQL

2004-07-08 Thread Matthew Sims
> In article <[EMAIL PROTECTED]>,
> Philip Olson wrote:
>> One thing to remember is mysql_query() will execute just one (the first)
>> query so use of ; won't do anything in the above except break the
>> query.
>
> If i'm not mistaken, newer versions of mysql do allow multiple queries.

I've heard the same thing, regarding MySQL 4. But someone else mentioned
that this only applies to the command line of MySQL only. True? False?

--Matthew Sims
--

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



[PHP] Interactive Voice Response (IVR)

2004-07-08 Thread René Fournier
Hi,
I am looking for an IVR system that would allow a person to call a 
number (via telephone), and then using the keypad to send commands that 
are processed by a PHP script which—after hitting a mySQL database a 
few times—responds with a value (success/failure) which then is played 
back to the person on the telephone. In other words:

1. Customer calls (telephone) a number.
2. Computer voice modem answers, IVR app says "Welcome to _", 
"Press 1 for, 2 for, 3 for", etc.
3. Customer presses 3.
4. IVR app executes a PHP command/script, returns with a result.

I know there are commercial Windows apps that allow you to build voice 
menu trees... But what I need is to integrate that (the IVR portion) 
with my backend PHP/MySQL code.

NO THANK YOU: A closed, Windows-only commercial IVR application.
YES, PLEASE: an opensource IVR project that I could run on Mac OSX (my 
environment) and integrate into my PHP scripts. Sadly, sourceforge.net 
does not show anything like this in progress. (What projects are 
listed, such as CallXML, appear dead in the water.)

Has anyone here had any experience with IVR apps insofar as they work 
with PHP applications?

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


Re: [PHP] Client IP

2004-07-08 Thread Tim Van Wassenhove
In article <[EMAIL PROTECTED]>, Rosen wrote:
>:)
> Ok - then how linux server communicate with client - the server must have IP
> adress to whitch to send data.

>> Rosen wrote:
>>
>> > IP adress not send ?!? And how server communicate with client ?

For example people on a lan (with let's say ip addresses in the
192.168.X.Y range) that use a proxy. You'll see the address of the
proxy in $_SERVER['REMOTE_ADDR']. And i doubt that is what you were
looking for :)

-- 
Tim Van Wassenhove 

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



RE: [PHP] Re: Slideshow using PHP

2004-07-08 Thread Vail, Warren
Check out http://ming.sourceforge.net/

Ming is a C library for generating SWF ("Flash") format movies, plus a set
of wrappers for using the library from C++ and popular scripting languages
like PHP, Perl, Python, and Ruby.

There is also a book out on PHP and multimedia that has a chapter or two
devoted to Ming.

http://www.amazon.com/exec/obidos/tg/detail/-/1861007647/002-7787324-9752066
?v=glance 

Warren Vail


-Original Message-
From: Todd Cary [mailto:[EMAIL PROTECTED] 
Sent: Thursday, July 08, 2004 1:35 PM
To: Matthew Sims
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] Re: Slideshow using PHP


Matthew -

<<<
Part of getting the slideshow to work is making the browser switch to the
next image and well, PHP doesn't really make the browser do anything.  >>>
As I was thinking about it before posting this thread, that was my 
impression.  The problem with my javaScript app is the fact that it 
needs to load all of the images.

I am hoping there is some way to load the iamges one-at-a-time; as needed.

Someone told me that there is a way to use Flash and PHP.

Todd

Matthew Sims wrote:
>>I do have a JavaScript based "SlideShow", however, I would like to use 
>>PHP rather than JavaScript.  Is there a way to "loop" with PHP and 
>>"display" an image without re-displaying the whole page?
>>
>>Todd
> 
> 
> To get a good slideshow you'll need to use client side instructions, 
> aka javascript. You're probably not going to get it to work so well 
> using PHP which is server side instructions.
> 
> Part of getting the slideshow to work is making the browser switch to 
> the next image and well, PHP doesn't really make the browser do 
> anything.
> 
> --Matthew Sims
> --

-- 
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] Malicious SQL

2004-07-08 Thread John W. Holmes
Philip Olson wrote:
on the contrary:
sql = mysql_query("select * from users where name='".$name."'");
will simply look for a user with a name of "Jim; delete from users;" and
return no results found.
But I can also enter:
jim'; delete from users
You need to catch if there's a quote in the $name too, and escape that.

One thing to remember is mysql_query() will execute just one (the first)
query so use of ; won't do anything in the above except break the
query.  
One should note that this isn't always the case for other databases, 
though. You can execute more than one query at a time with SQLite, for 
example. MySQL 4.1 allows more than one query at a time if you open the 
connection with a certain flag (in the C API at least), yet for 
"security" reasons, this flag wasn't included in the MySQLi extension. 
There is a multi_query() function/method, though. Hopefully you know 
what you're doing if you decide to use that function/method, though.

PHP is a newbie friendly language
and newbies are for the most part clueless and don't know what strings or
integers are, or why data should be escaped, or what data validation is or
why it's important.  
Yeah and we should turn register_globals back on by default, too!! ;)
--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
php|architect: The Magazine for PHP Professionals – www.phparch.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] Slideshow using PHP

2004-07-08 Thread David Bevan
The only way I can think of to create a slide show with PHP, not that
you would need to use the PHP engine at all would be to use a meta
refresh in/on each page to move to the next slide and possibly provide
the user with a button/link they could click on to advance the slides.
Your other idea about using Flash might be the way to go as there is
already a template if you choose File>New From Template within Flash,
but I'm not sure why you would want to weigh an app like that down with
constant communication to the server.

My 2c at least.

Regards,
David Bevan

GetAnyIdeas Web Design
P. 416.452.9410
F. 416.570.4529
E. [EMAIL PROTECTED]
W. http://www.getanyideas.com



-Original Message-
From: Todd Cary [mailto:[EMAIL PROTECTED] 
Sent: July 7, 2004 6:19 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Slideshow using PHP


I would like to have images displayed automatically using PHP with a 
Database and/or an array of images.  Is there any sample code available 
for doing that?

Can that be done with Flash and PHP?

Todd

-- 
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] Running php scripts stored in mysql

2004-07-08 Thread Martin Bálint
Hello,

is this possible?

I have a script stored in mysql database. For simplicity let's say:


 is stored in db.

Is it somehow possible to include this script to a running php process for
execution? Some analogy to include(file); but for a mysql stored script?

Thanks
Martin

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



[PHP] [help!] Apache won't start, 'cause... libpng.so.2: cannot open shared object file

2004-07-08 Thread dr.Freud \(Jacopo\)
Hello.
I just installed PHP 4.3.7 with PNG, ZLIB and JPEG support. All (after some
troubles) goes well.
But, when I try to start apache I get the following error:

Syntax error on line 261 of /etc/httpd/conf/httpd.conf:
Cannot load /etc/httpd/modules/libphp4.so into server: libpng.so.2: cannot
open shared object file: No such file or directory

I'm using Apache 1.3.23, GD... mmm... the lastest version, updated zlib and
png...

Anyone can help me?

Thanks,
Jacopo

--
- - -
« Homo homini Deus est » [L. Feuerbach, "L'essenza del Cristianesimo"]
-
Jacopo Agnesina - [EMAIL PROTECTED]
-
> Portale Filosofia » http://www.portalefilosofia.com
> Il Forum Filosofico » http://www.filosofia.eu.org
> Vattimo e il Pensiero Debole » http://www.giannivattimo.eu.org
- - -

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



Re: [PHP] Client IP

2004-07-08 Thread Rosen
Ok - thie is enought for me - to see the adres of proxy server. :)

"Tim Van Wassenhove" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> In article <[EMAIL PROTECTED]>, Rosen wrote:
> >:)
> > Ok - then how linux server communicate with client - the server must
have IP
> > adress to whitch to send data.
>
> >> Rosen wrote:
> >>
> >> > IP adress not send ?!? And how server communicate with client ?
>
> For example people on a lan (with let's say ip addresses in the
> 192.168.X.Y range) that use a proxy. You'll see the address of the
> proxy in $_SERVER['REMOTE_ADDR']. And i doubt that is what you were
> looking for :)
>
> -- 
> Tim Van Wassenhove 

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



Re: [PHP] Client IP

2004-07-08 Thread Rosen
I don't understand  :)

"John Nichel" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> John W. Holmes wrote:
> > Trust me.
>
> Riggtt.  Like we're going to trust the likes of you.
>   I guess the cheque's in the mail too, eh?  ;)
>
> -- 
> By-Tor.com
> It's all about the Rush
> http://www.by-tor.com

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



RE: [PHP] Slideshow using PHP

2004-07-08 Thread Vail, Warren
There is a sample flash slideshow at this site, complete with Ming code, see
if it's what you were looking for.

http://www16.brinkster.com/gazb/ming/index.html

Warren Vail


-Original Message-
From: David Bevan [mailto:[EMAIL PROTECTED] 
Sent: Thursday, July 08, 2004 3:30 PM
To: [EMAIL PROTECTED]
Cc: 'Todd Cary'
Subject: RE: [PHP] Slideshow using PHP


The only way I can think of to create a slide show with PHP, not that you
would need to use the PHP engine at all would be to use a meta refresh in/on
each page to move to the next slide and possibly provide the user with a
button/link they could click on to advance the slides. Your other idea about
using Flash might be the way to go as there is already a template if you
choose File>New From Template within Flash, but I'm not sure why you would
want to weigh an app like that down with constant communication to the
server.

My 2c at least.

Regards,
David Bevan

GetAnyIdeas Web Design
P. 416.452.9410
F. 416.570.4529
E. [EMAIL PROTECTED]
W. http://www.getanyideas.com



-Original Message-
From: Todd Cary [mailto:[EMAIL PROTECTED] 
Sent: July 7, 2004 6:19 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Slideshow using PHP


I would like to have images displayed automatically using PHP with a 
Database and/or an array of images.  Is there any sample code available 
for doing that?

Can that be done with Flash and PHP?

Todd

-- 
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 General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: Running php scripts stored in mysql

2004-07-08 Thread Rosen
Try with eval() function.



"Martin Bálint" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hello,
>
> is this possible?
>
> I have a script stored in mysql database. For simplicity let's say:
>
>  phpinfo();
> ?>
>  is stored in db.
>
> Is it somehow possible to include this script to a running php process for
> execution? Some analogy to include(file); but for a mysql stored script?
>
> Thanks
> Martin

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



[PHP] Creating Rows and Columns Using for() Loops

2004-07-08 Thread php-list
Hello Everyone,

I have an HTML table with 7 columns and 32 rows, not including table headers
and footers. I want to create a tabular data table that spans 7 columns and
32 rows. I get my info from MySQL and use for() loops to loop through two
types of arrays. An array containing the dates (the columns) and a table
containing first and last names. The names will go underneath whichever date
it is associated with, with a maximum of 32 names per column (hence the 32
rows). I am using patTemplate to create the table. Here is what I have so
far:

for ($i = 0; $i < count($num_days); $i++) {
$template->addVar("date_column", "DAY", $num_days[$i]['day_text']);
$template->addVar("date_column", "DATE", $num_days[$i]['month_text'].'
'.$num_days[$i]['date']);
$template->parseTemplate("date_column", "a");

$template->addVar("sort_row", "SORT_FNAME", 'fname');
$template->addVar("sort_row", "SORT_LNAME", 'lname');
$template->addVar("sort_row", "SORT_RATE", 'rate');
$template->parseTemplate("sort_row", "a");

for ($j = 0; $j < 32; $j++) {
$template->addVar("guest_NameRate", "GUEST_NAME", 'BOB RICHIE');
$template->addVar("guest_NameRate", "GUEST_ID", 'fname');
$template->addVar("guest_NameRate", "CLASS_GUEST", 'fname');
$template->addVar("guest_NameRate", "ROOM_RATE", '49.95');
}
$template->parseTemplate("guest_NameRate", "a");
$template->addVar("room_num", "ROOM_NUM", '101');
$template->addVar("room_type", "ROOM_TYPE", 'NQQ');
$template->parseTemplate("guest_row", "a");
}

I populated the guest's name statically so I can see how the loop works. The
looping is wrong and it only yields 7 rows. In the first row it has 1 column
of data, the second row has two columns of data, the third one has three
columns of data, and so on. How do I fix it to where each date column has
exactly 32 rows of guest names?

I hope this makes sense. Any help will be appreciated.

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



[PHP] fread error

2004-07-08 Thread Don
Hi,

Using a a flat text file based calendar script.
Started getting this error after upgrading PHP:

Warning: fread(): Length parameter must be greater than 0

Function it is occurring in is:

function read_str($fp)
   {
   $strlen = $this->bin2dec(fread($fp,4),4);
   return fread($fp, $strlen);
   }

Any ideas?

Thanks,
Don

[PHP] Re: fread error

2004-07-08 Thread Lars Torben Wilson
Don wrote:
Hi,
Using a a flat text file based calendar script.
Started getting this error after upgrading PHP:
Warning: fread(): Length parameter must be greater than 0
Function it is occurring in is:
function read_str($fp)
   {
   $strlen = $this->bin2dec(fread($fp,4),4);
   return fread($fp, $strlen);
   }
Any ideas?
Thanks,
Don
It's hard to say without knowing what you're trying to do, but it
looks like you're first reading a length value from the file, then
reading that number of bytes? In which case if the first fread()
fails or returns 0, and assuming $this->bin2dec() is doing its job
correctly, you might want to skip trying the second fread():
function read_str($fp)
{
if ($strlen = $this->bin2dec(fread($fp, 4), 4))
{
return fread($fp, $strlen);
}
}
...this will return NULL if there is nothing to read (i.e. the first
fread() returns 0 or false).
Essentially, the error is occurring because fread() doesn't want a 0
in the length argument, but there is no check in the code to ensure
that this doesn't happen. The above is just one way to possibly get
around it.
Hope this helps,
Torben
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Creating Rows and Columns Using for() Loops

2004-07-08 Thread barophobia
On Thu, 8 Jul 2004 18:17:25 -0500, [EMAIL PROTECTED]
<[EMAIL PROTECTED]> wrote:

> for ($i = 0; $i < count($num_days); $i++) {
[snip]
> for ($j = 0; $j < 32; $j++) {
[snip]
> }
[snip]
> }

> How do I fix it to where each date column has
> exactly 32 rows of guest names?

it looks like you need to set up your loops the other way around.
right now your code is like this:

for (columns)
{
  for (rows)
  {
  }
}

you want:

for (rows)
{
  for (columns)
  {
  }
}

explained in english: you need to handle one row/person at a time and
not one column/date at a time.

on the other hand i'm not sure i totally understand your desired
output, so maybe a quick ascii table would help me/us?


chris.

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



[PHP] Emulating sprintf???

2004-07-08 Thread Gerard Samuel
Im trying to do something like sprintf() because I would like to 
have control over placeholders.
The code I've posted works for the most part, but when I introduce content 
that has the same characters as my placeholders (%s and %i), it breaks to 
hell...
Anyone got any ideas on how to fix, or tell me Im barking up the wrong tree...
Thanks

'; var_dump($data); echo '';

foreach($data as $key => $chunk)
{
switch( $matches[ $key ] )
{
case '%i':
$chunk = (int)$chunk;
break;

case '%s':
$chunk = "'" . (string)$chunk . "'";
break;

default:
continue;
}

$pos = strpos($sql, $matches[$key][0], $matches[$key][1]);

$sql = substr_replace($sql, $chunk, strpos($sql, $matches[$key]), 2);
}

echo '';
var_dump($sql);

?>

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



RE: [PHP] Creating Rows and Columns Using for() Loops

2004-07-08 Thread php-list
Chris,

It's a little difficult to do in ascii, but here's an attempt. This is a
simple hotel/motel log of who's staying in certain rooms. The 7 columns are
the 7 days in the week and guest names fall under whichever date they
checked in. So, let's see if I can give you a visual representation of this.
I will only include two columns and a few rows, for now. You may have to fix
your viewing window to allow this table to expand horizontally...

 
|--|--|-
-|
  |MON JUL 5 |TUE JUL 6 | etc...
|
-||--|--|---
---||-|
Rm # |Rm Type |  First Name | Last Name  |  First Name | Last Name  | etc...
|Rm Type |Rm # |
-||--|--|---
---||-|
101  | NQQ| Isaac Newton | (empty room) | etc...
| NQQ|101  |
-||--|--|---
---||-|
102  | NK | Alexander Flemming   | Alexander Flemming   | etc...
| NK |102  |
-||--|--|---
---||-|
103  | K  | Charles Darwin   | Robert Kennedy   | etc...
| K  |103  |
-||--|--|---
---||-|
104  | QQ | Roger Rabbit | (empty room) | etc...
| QQ |104  |
-||--|--|---
---||-|
...  | ...| ... etc  | ... etc  | etc...
| ...|...  |
-||--|--|---
---||-|


Thanks...


-Original Message-
From: barophobia [mailto:[EMAIL PROTECTED] 
Sent: Thursday, July 08, 2004 6:54 PM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] Creating Rows and Columns Using for() Loops

On Thu, 8 Jul 2004 18:17:25 -0500, [EMAIL PROTECTED]
<[EMAIL PROTECTED]> wrote:

> for ($i = 0; $i < count($num_days); $i++) {
[snip]
> for ($j = 0; $j < 32; $j++) {
[snip]
> }
[snip]
> }

> How do I fix it to where each date column has
> exactly 32 rows of guest names?

it looks like you need to set up your loops the other way around.
right now your code is like this:

for (columns)
{
  for (rows)
  {
  }
}

you want:

for (rows)
{
  for (columns)
  {
  }
}

explained in english: you need to handle one row/person at a time and
not one column/date at a time.

on the other hand i'm not sure i totally understand your desired
output, so maybe a quick ascii table would help me/us?


chris.

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



RE: [PHP] Creating Rows and Columns Using for() Loops

2004-07-08 Thread php-list
I wrote this in plain text. I hope it came out well...

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: Thursday, July 08, 2004 9:02 PM
To: [EMAIL PROTECTED]
Subject: RE: [PHP] Creating Rows and Columns Using for() Loops

Chris,

It's a little difficult to do in ascii, but here's an attempt. This is a
simple hotel/motel log of who's staying in certain rooms. The 7 columns are
the 7 days in the week and guest names fall under whichever date they
checked in. So, let's see if I can give you a visual representation of this.
I will only include two columns and a few rows, for now. You may have to fix
your viewing window to allow this table to expand horizontally...

 
|--|--|-
-|
  |MON JUL 5 |TUE JUL 6 | etc...
|
-||--|--|---
---||-|
Rm # |Rm Type |  First Name | Last Name  |  First Name | Last Name  | etc...
|Rm Type |Rm # |
-||--|--|---
---||-|
101  | NQQ| Isaac Newton | (empty room) | etc...
| NQQ|101  |
-||--|--|---
---||-|
102  | NK | Alexander Flemming   | Alexander Flemming   | etc...
| NK |102  |
-||--|--|---
---||-|
103  | K  | Charles Darwin   | Robert Kennedy   | etc...
| K  |103  |
-||--|--|---
---||-|
104  | QQ | Roger Rabbit | (empty room) | etc...
| QQ |104  |
-||--|--|---
---||-|
...  | ...| ... etc  | ... etc  | etc...
| ...|...  |
-||--|--|---
---||-|


Thanks...


-Original Message-
From: barophobia [mailto:[EMAIL PROTECTED] 
Sent: Thursday, July 08, 2004 6:54 PM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] Creating Rows and Columns Using for() Loops

On Thu, 8 Jul 2004 18:17:25 -0500, [EMAIL PROTECTED]
<[EMAIL PROTECTED]> wrote:

> for ($i = 0; $i < count($num_days); $i++) {
[snip]
> for ($j = 0; $j < 32; $j++) {
[snip]
> }
[snip]
> }

> How do I fix it to where each date column has
> exactly 32 rows of guest names?

it looks like you need to set up your loops the other way around.
right now your code is like this:

for (columns)
{
  for (rows)
  {
  }
}

you want:

for (rows)
{
  for (columns)
  {
  }
}

explained in english: you need to handle one row/person at a time and
not one column/date at a time.

on the other hand i'm not sure i totally understand your desired
output, so maybe a quick ascii table would help me/us?


chris.

-- 
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] Emulating sprintf???

2004-07-08 Thread Michal Migurski
> Im trying to do something like sprintf() because I would like to have
> control over placeholders. The code I've posted works for the most part,
> but when I introduce content that has the same characters as my
> placeholders (%s and %i), it breaks to hell... Anyone got any ideas on
> how to fix, or tell me Im barking up the wrong tree...

After the first call to substr_replace, you swap in some replacement text
that contains an '%s'. Subsequent calls to substr_replace use your
replacement text as the key, because it's no longer possible to uniquely
determine what was part of the original string, and what was swapped in.

Recommendation: don't use preg_match. You can try using preg_replace with
arrays as arguments, but you may come closer to sprintf's correct behavior
if you instead consume the pattern string ($sql) character by character,
generating an output string made up of characters from the pattern string,
and elements array_shifted off of $data as you encounter placeholders.
Don't forget to add a placeholder that allows you to use '%' in that
string -- sprintf uses '%%'.

Much easier recommendation: use provided sprintf, but parse out any
unwanted placeholders first, using preg_replace.

-
michal migurski- contact info and pgp key:
sf/cahttp://mike.teczno.com/contact.html

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



[PHP] onchange drop down list and text field

2004-07-08 Thread Curlys
hi , 

 I would like to ask another help from u all , 
I have an data submitable form . There is some fields. It is connected with mysql 
database. so I want to put to these fields as drop down list as well as text input 
area.
say , if when i adding data , if it is in the database there should be possibility to 
select from the drop down list . and if it is not there data should allow to enter . 
can u all help me on this matter ?

Thanx in advance
curlys 

Re: [PHP] onchange drop down list and text field

2004-07-08 Thread Jason Wong
On Friday 09 July 2004 10:41, Curlys wrote:

>  I would like to ask another help from u all ,
> I have an data submitable form . There is some fields. It is connected with
> mysql database. so I want to put to these fields as drop down list as well
> as text input area. say , if when i adding data , if it is in the database
> there should be possibility to select from the drop down list . and if it
> is not there data should allow to enter . can u all help me on this matter
> ?

What exactly is the problem you're having? Assuming you know how to pull the 
data out of the DB then it's simply a matter of wrapping  and 
 tags around them.

-- 
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
--
/*
Try the Moo Shu Pork.  It is especially good today.
*/

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



[PHP] PHP Sessions Question

2004-07-08 Thread Ed Lazor
What kind of problems could be happening server-side that would result in
PHP sessions randomly disappearing?  And, is there a way to log or track
this information?  Oh, and best of all, any recommendations on solutions?

 

I have a PHP / MySQL application that's been running at a host provider for
almost a year now.  PHP sessions are used to track logged in users, For
example, $_SESSION["UserID"].  If the UserID isn't stored as a session
variable, the user must not be logged in, so prompt them with a login
screen.

 

Most recent updates were made last week and everything has been working fine
until this afternoon.  Session data is somehow being lost.  It seems random.
A person will be logged in and navigating through the site when they
suddenly get a login screen.  They'll log back in and continue navigating
for a little while when it will happen again - sometimes within seconds and
othertimes within minutes.  Sometimes it won't even happen for 30 minutes
and then it suddenly begins to occur again.

 

Thanks in advance for any ideas or recommendations that I can forward to my
hosting provider on how to fix the problem.

 

-Ed

 

 



Re: [PHP] PHP Sessions Question

2004-07-08 Thread Tim Traver
It could be a case that your provider is load balancing across several 
machines. If they are, and they aren't storing the session data in a 
central location, then that might account for the issue.

That would explain the intermittent failure. The user might be making 
keepalive requests to the same box and being ok, and then get bounced once 
it hits a machine that doesn't have the session data...

You might ask them about it...
Tim.

At 09:43 PM 7/8/2004, Ed Lazor wrote:
What kind of problems could be happening server-side that would result in
PHP sessions randomly disappearing?  And, is there a way to log or track
this information?  Oh, and best of all, any recommendations on solutions?

I have a PHP / MySQL application that's been running at a host provider for
almost a year now.  PHP sessions are used to track logged in users, For
example, $_SESSION["UserID"].  If the UserID isn't stored as a session
variable, the user must not be logged in, so prompt them with a login
screen.

Most recent updates were made last week and everything has been working fine
until this afternoon.  Session data is somehow being lost.  It seems random.
A person will be logged in and navigating through the site when they
suddenly get a login screen.  They'll log back in and continue navigating
for a little while when it will happen again - sometimes within seconds and
othertimes within minutes.  Sometimes it won't even happen for 30 minutes
and then it suddenly begins to occur again.

Thanks in advance for any ideas or recommendations that I can forward to my
hosting provider on how to fix the problem.

-Ed



SimpleNet's Back !
http://www.simplenet.com


Re: [PHP] onchange drop down list and text field

2004-07-08 Thread Dennis Seavers
I'm not sure, but I think he meant he wanted both (1) a  list based
on elements in a database and (2) a  element where the client
would enter something that does not appear in the  list.

If so, you could use a script that uses the records in your database and
has a final  for "Other".  For instance, on a MySQL database:









$q3[color]";
}

?>
Other







You'd want to change the form according to your needs, and you may think of
a better way of doing it.  But, that might give you an idea of how to go
about your project, assuming that I understood what you meant.


> [Original Message]
> From: Jason Wong <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Date: 07/08/2004 8:00:38 PM
> Subject: Re: [PHP] onchange drop down list and text field
>
> On Friday 09 July 2004 10:41, Curlys wrote:
>
> >  I would like to ask another help from u all ,
> > I have an data submitable form . There is some fields. It is connected
with
> > mysql database. so I want to put to these fields as drop down list as
well
> > as text input area. say , if when i adding data , if it is in the
database
> > there should be possibility to select from the drop down list . and if
it
> > is not there data should allow to enter . can u all help me on this
matter
> > ?
>
> What exactly is the problem you're having? Assuming you know how to pull
the 
> data out of the DB then it's simply a matter of wrapping  and 
>  tags around them.
>
> -- 
> 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
> --
> /*
> Try the Moo Shu Pork.  It is especially good today.
> */
>
> -- 
> 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] Re: Worried about PECL

2004-07-08 Thread Lars Torben Wilson
Peter Clarke wrote:
Currently the online manual for php is great.
My concern is that the documentation for PECL extensions is almost 
non-existent. Since some php extensions are being moved/replaced by PECL 
extensions are we going to get non-existent documentation?
Hi there,
You might want to get onto one of the PECL lists if you intend to use it.
  http://pecl.php.net/support.php
Someone there would be better able to help you. However, the short answer
to your question is:
"The docs will be written when somebody decides to sit down and write them."
The glib answer is just to give you the checkout information for the docs
source tree. ;) A huge percentage of the current manual was written by
people who realized there was no documentation, and decided to remedy
the problem.
In fact, it's how I learned about PHP's internals, and about a great deal
of what makes it tick on the inside. Reading the source and translating it
into documentation is a wonderful learning tool.
For now, you're probably just safest sticking with mime_content_type(). If
you're worried about it becoming obsolete (read: being moved fully to
PECL from one version to the next), then wrap mime_content_type() in a
function or class, and stick it in its own include file. When you have
the information you need to move on to the PECL replacement, just write
another copy of that same function, but have it access Fileinfo instead of
mime_content_type(). Assuming that you've written both versions of the
function to take the same (or similar) argument lists and return the
same thing, then all you need to do to change from one to the other
is replace the old include file with the new one.
Hope this helps,
Torben Wilson <[EMAIL PROTECTED]>

For example:
www.php.net/mime-magic
"This extension has been deprecated as the PECL extension fileinfo 
provides the same functionality (and more) in a much cleaner way."
http://pecl.php.net/package/Fileinfo provides no documentation so what 
these extra functions are, I have no idea. Worse, I now have no idea how 
to do mime_content_type().

www.php.net/mcal
"Note: This extension has been removed as of PHP 5 and moved to the PECL 
repository."
There is no mention of mcal on the pecl website.

I appreciate that PECL will more relevant to PHP5, but PHP5 is close is 
the documentation close too?

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


[PHP] fopen with login credentials being an email address

2004-07-08 Thread Gunter Sammet
Hi all:
Tried to use fopen like this:

fopen([EMAIL PROTECTED]:[EMAIL PROTECTED]);

Didn't work and I couldn't find anything out on the search engines.

Any suggestions how to get this working?

TIA

Gunter

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



[PHP] Re: PHP Sessions Question

2004-07-08 Thread Jason Barnett
Ed Lazor wrote:
What kind of problems could be happening server-side that would result in
PHP sessions randomly disappearing?  And, is there a way to log or track
this information?  Oh, and best of all, any recommendations on solutions?
To try logging this, you probably need to make your own session handler. 
 Most importantly you would want to write to the log during the open 
and destroy functions.
http://www.php.net/session_set_save_handler

Most recent updates were made last week and everything has been working fine
until this afternoon.  Session data is somehow being lost.  It seems random.
As the other guy said, load balancing seems likely.  It might also be 
that php.ini settings for garbage collection and session/cookie 
lifetimes have changed.  Garbage collection can seem random.

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


[PHP] PHP Hosting

2004-07-08 Thread Ed Lazor
Hey, does anyone have experience hosting PHP / MySQL apps on EV1servers.net,
ServerBeach.net, or CIhost.com?  I'm looking for value, reliability, and
quality support.  Any other recommendations are also greatly appreciated.

 

-Ed

 

 



Re: [PHP] Creating Rows and Columns Using for() Loops

2004-07-08 Thread Jason Barnett

I populated the guest's name statically so I can see how the loop works. The
looping is wrong and it only yields 7 rows. In the first row it has 1 column
of data, the second row has two columns of data, the third one has three
columns of data, and so on. How do I fix it to where each date column has
exactly 32 rows of guest names?
Create the headers, use foreach for the guests and then foreach for the 
days.  It is in the days elements where you need to put the results of 
your MySQL queries.  An example:


DayDate ... 







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


RE: [PHP] Re: PHP Sessions Question

2004-07-08 Thread Ed Lazor
Thanks Jason, I'll keep the information handy for creating my own session
handler in case other options I'm exploring right now don't work.

On garbage collection, it happens sometimes within seconds and sometimes
within minutes.  It tends to occur in batches with lulls of 20 to 30
minutes.  So, for example, I can login, navigate through 11 different pages
to generate the problem, navigate 2 pages to generate the problem, and then
not see the problem again for another 5 minutes.  Does that fall in line
with what you're thinking?

-Ed
 


> -Original Message-
> To try logging this, you probably need to make your own session handler.
>   Most importantly you would want to write to the log during the open
> and destroy functions.
> http://www.php.net/session_set_save_handler
> 
> >
> > Most recent updates were made last week and everything has been working
> fine
> > until this afternoon.  Session data is somehow being lost.  It seems
> random.
> 
> As the other guy said, load balancing seems likely.  It might also be
> that php.ini settings for garbage collection and session/cookie
> lifetimes have changed.  Garbage collection can seem random.

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



Re: [PHP] fopen with login credentials being an email address

2004-07-08 Thread Curt Zirzow
* Thus wrote Gunter Sammet:
> Hi all:
> Tried to use fopen like this:
> 
> fopen([EMAIL PROTECTED]:[EMAIL PROTECTED]);

I hope you have some sort of quotes around that.

> 
> Didn't work and I couldn't find anything out on the search engines.

You simply cant have @ or : in the username, it violates the URL
specifications. A quick reading of your fopen would tell me to:

open a connection to 'mydomain.com' on port
'[EMAIL PROTECTED]', and send the username
'myname'.


Curt
-- 
First, let me assure you that this is not one of those shady pyramid schemes
you've been hearing about.  No, sir.  Our model is the trapezoid!

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



Re: [PHP] PHP Hosting

2004-07-08 Thread Curt Zirzow
* Thus wrote Ed Lazor:
> Hey, does anyone have experience hosting PHP / MySQL apps on EV1servers.net,
> ServerBeach.net, or CIhost.com?  I'm looking for value, reliability, and
> quality support.  Any other recommendations are also greatly appreciated.

Out of 1000's of solutions I'd probably suggest:

pair.com

They operate on the *proper* OS :)

Curt
-- 
First, let me assure you that this is not one of those shady pyramid schemes
you've been hearing about.  No, sir.  Our model is the trapezoid!

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



Re: [PHP] Re: PHP Sessions Question

2004-07-08 Thread Jason Barnett
On garbage collection, it happens sometimes within seconds and sometimes
within minutes.  It tends to occur in batches with lulls of 20 to 30
minutes.  So, for example, I can login, navigate through 11 different pages
to generate the problem, navigate 2 pages to generate the problem, and then
not see the problem again for another 5 minutes.  Does that fall in line
with what you're thinking?
Actually, no.  Garbage collection would destroy the sessions, so if 
they're only "temporarily" disappearing then load balancing seems even 
more likely.

I'm going to assume not, but are you using a non-default session 
handler?  If for instance you were storing sessions in another database, 
or simply on a different machine then connections can fail.  This would 
most likely only be set up through the set_session_handler directive I 
mentioned before... but you should also check your php.ini values for 
session.save_handler and session.save_path

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


[PHP] Re: php mls and realtor.com

2004-07-08 Thread Jason Barnett
Edward Peloke wrote:
I have a site where the user currently enters their data into a local db,
then goes to another site and enters it for the state mls, then uses
realtor.com to enter it for that mls, they want one form where they can
enter the date and have it go to all three.  Has anyone worked with
interfacing with other mls databases?  This will be done through php.
Thanks,
Eddie
There are several ways that you can send information you've collected on 
to another web site... but you mention that you want to send it to 
another database.  Do you mean a remote connection straight to the other 
databases?  Or do you just want to post information to the other web sites?

Please explain your problem more clearly, and we'll see what we can do :)
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Re: PHP Sessions Question

2004-07-08 Thread Curt Zirzow
* Thus wrote Jason Barnett:
> >On garbage collection, it happens sometimes within seconds and sometimes
> >within minutes.  It tends to occur in batches with lulls of 20 to 30
> >minutes.  So, for example, I can login, navigate through 11 different pages
> >to generate the problem, navigate 2 pages to generate the problem, and then
> >not see the problem again for another 5 minutes.  Does that fall in line
> >with what you're thinking?
> >
> 
> Actually, no.  Garbage collection would destroy the sessions, so if 
> they're only "temporarily" disappearing then load balancing seems even 
> more likely.
> 
> I'm going to assume not, but are you using a non-default session 
> handler?  If for instance you were storing sessions in another database, 

or using the default handler, and the /tmp dir is full.

Garabage Collection cleans up things so it works for a while until 
it fills up again, then breaks again (possibly saving a session or
two with the minimal disk) till GC decides to kick in again.


df -ih /tmp/

Check Avail and ifree.


Curt
-- 
First, let me assure you that this is not one of those shady pyramid schemes
you've been hearing about.  No, sir.  Our model is the trapezoid!

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



Re: [PHP] Re: PHP Sessions Question

2004-07-08 Thread Curt Zirzow
* Thus wrote My Self:
> 
> or using the default handler, and the /tmp dir is full.

where /tmp being the local value for your session.save_path ini
setting.

Curt
-- 
First, let me assure you that this is not one of those shady pyramid schemes
you've been hearing about.  No, sir.  Our model is the trapezoid!

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



RE: [PHP] Re: PHP Sessions Question

2004-07-08 Thread Warren Vail
I have a suggestion that would allow you to take charge of what is going on
with your sessions.  Install your own session handler routines, storing your
own session data in your own database table.  These functions would need to
be loaded on each page before you execute the session_start() function on
each page.

http://www.php.net/manual/en/function.session-set-save-handler.php

Since the Garbage Cleanup and session read function is now under your
control, you can establish the session expiration that is appropriate for
your application, independent from the PHP default for the site.  Be
careful, however for the parameters that control the life of the cookie in
the browser, they can also cause the session to be lost if not set properly.

http://www.php.net/manual/en/function.session-set-cookie-params.php

This may sometimes seem intermittent, since the cookie will expire from the
time first established in the browser, and if you are only aware of the time
from the last page, and the cookie goes away, the session will appear to
have been destroyed.

good luck,

Warren Vail
[EMAIL PROTECTED]


-Original Message-
From: Jason Barnett [mailto:[EMAIL PROTECTED]
Sent: Thursday, July 08, 2004 11:23 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] Re: PHP Sessions Question


> On garbage collection, it happens sometimes within seconds and sometimes
> within minutes.  It tends to occur in batches with lulls of 20 to 30
> minutes.  So, for example, I can login, navigate through 11 different
pages
> to generate the problem, navigate 2 pages to generate the problem, and
then
> not see the problem again for another 5 minutes.  Does that fall in line
> with what you're thinking?
>

Actually, no.  Garbage collection would destroy the sessions, so if
they're only "temporarily" disappearing then load balancing seems even
more likely.

I'm going to assume not, but are you using a non-default session
handler?  If for instance you were storing sessions in another database,
or simply on a different machine then connections can fail.  This would
most likely only be set up through the set_session_handler directive I
mentioned before... but you should also check your php.ini values for
session.save_handler and session.save_path

--
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] PHP Hosting

2004-07-08 Thread Louie Miranda
check out http://www.webhostingtalk.com



On Fri, 9 Jul 2004 06:34:00 +, Curt Zirzow
<[EMAIL PROTECTED]> wrote:
> * Thus wrote Ed Lazor:
> 
> 
> > Hey, does anyone have experience hosting PHP / MySQL apps on EV1servers.net,
> > ServerBeach.net, or CIhost.com?  I'm looking for value, reliability, and
> > quality support.  Any other recommendations are also greatly appreciated.
> 
> Out of 1000's of solutions I'd probably suggest:
> 
> pair.com
> 
> They operate on the *proper* OS :)
> 
> Curt
> --
> First, let me assure you that this is not one of those shady pyramid schemes
> you've been hearing about.  No, sir.  Our model is the trapezoid!
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 


-- 
Louie Miranda
http://www.axishift.com

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