[PHP] Best way to get mysql table metadata

2004-05-06 Thread daniel
Hi there, I am trying to upgrade my db class, so I can tell if what table
type of the table being queried is. More specifically i need to work out if
the table is an innodb transaction table, if so I would like to start the
transaction and commit and rollback when needed.

Let me know.

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



[PHP] setting php_admin_value 2

2004-05-06 Thread Tim Traver
David and all,

I apologize for not posting properly. I did not realize that headers were 
keeping track of the threads of this mailing list. I will make sure I don't 
do it again.

I am actually simply using the Host header to make a dynamic path to its 
data location in my apache module.

Unfortunately, the mod_php4 modules is rather cryptic in how it does 
things, and it looks like it doesn't do any of the variable setups on a 
per-request basis, so it would be difficult to track where it puts that 
information, but I guess its the only place for me to look unless you or 
anyone else has a better idea of where I can tap in to make those kind of 
changes on the fly...

In case no one else got my message due to my fopaux, I have included a copy 
of my original message below.

To clarify, the goal is to set up some security variables like open_basedir...

Thanks,

Tim.

Hi all,

ok, I am writing an apache module that dynamically figures out virtual host
variables for data locations for my users.
I need to be able to set the php_admin_values for each request so that
those values get passed through to php and take effect for each request.
Normally, this would be static inside the apache conf file using the
php_admin_value directive.
Does anyone here know how I could set these variables dynamically ? Do I
have to load the apache configuration tables and change it manually ? or
can I set a particular environment variable that gets read by php ?
Thanks,

Tim.

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


Re: [PHP] Socket

2004-05-06 Thread Petr U.
On Fri, 7 May 2004 00:59:03 -0300 (ART)
"Juan Pablo Herrera" <[EMAIL PROTECTED]> wrote:

 > Please, i need a tutorial about socket. I read php.net but the examples is
 > lost.

I think you should check it again ;)
http://www.php.net/manual/en/ref.sockets.php

-- 
Petr U.

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



[PHP] PHP Research

2004-05-06 Thread Trevor Nesbit
Hi

I am in the process of conducting a research project that is looking at
what PHP skills we should be teaching to our students.

If you would be prepared to complete this questionnaire, please reply
to this email and I will send you the questionnaire

Kind regards

Trevor Nesbit


Trevor Nesbit
MBS BSc BCom CA PGDipBusAdmin
Degree Leader for Bachelor of ICT
Programme Leader for Graduate Diploma in eCommerce
School of Computing - www.cpit.ac.nz/computing
School of Business
Christchurch Polytechnic Institute of Technology

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



[PHP] Socket

2004-05-06 Thread Juan Pablo Herrera
Hi!
Please, i need a tutorial about socket. I read php.net but the examples is
lost.
Regards,
Juan Pablo

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



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

2004-05-06 Thread Ma Siva Kumar
===
This message is for the benefit of new 
subscribers and those new to PHP.  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://phpeditors.linuxbackup.co.uk/ 
(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]


Hope you have a good time programming with 
PHP.
-- 
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



Re: [PHP] Re: strip comments from HTML?

2004-05-06 Thread Paul Chvostek
On Thu, May 06, 2004 at 07:11:55PM +, Curt Zirzow wrote:
> > 
> >  $text="one ", "",$text);
> 
> Because your missing a -
> $text="one  two\n";

/me applies mallet to head

 % php -r '$text="one  two\n"; print 
ereg_replace("", "",$text);'
 one  two

whee, it works!  :)

-- 
  Paul Chvostek <[EMAIL PROTECTED]>
  it.canadahttp://www.it.ca/
  Free PHP web hosting!http://www.it.ca/web/

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



Re: [PHP] Returning an object

2004-05-06 Thread John W. Holmes
Aidan Lister wrote:

Please don't reply if you really, really don't know what you are talking
about.
Okay, I won't reply.

--
---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] Looking for Advanced PHP Developers

2004-05-06 Thread Curt Zirzow
* Thus wrote Stephen Allen ([EMAIL PROTECTED]):
> On Thu, May 06, 2004 at 01:15:17AM +0200 or thereabouts, Richard Harb wrote:
> > ... and onsite would be where ?
> 
> Amman, Jordan I think. I wouldn't want to be a Caucasian over there working, at this
> point in time.

I'd be more weary that the OP was from a @yahoo.com account for a
site that has its own domain :/


Curt
-- 
"I used to think I was indecisive, but now I'm not so sure."

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



Re: [PHP] Returning an object

2004-05-06 Thread Curt Zirzow
* Thus wrote Aidan Lister ([EMAIL PROTECTED]):
> How _should_ this be done? In terms of "best practice".
> 
>  function foobar ()
> {
> return new SomeObject;
> }
> ?>
> 
> Or:
> 
>  function barfoo ()
> {
> $tempvar = new SomeObject;
> return $tempvar
> }
> ?>

I'm not exactly sure what your looking for, this is like asking
what is better:

  $a = 'foo';
  echo $a;

  or 
  echo 'foo';

if tou want my opinion it should be written like this:
 Please don't reply if you really, really don't know what you are talking
> about.

What kind of requirement is this? Anyone can reply your email and
they will do so if they feel like it.


Curt
-- 
"I used to think I was indecisive, but now I'm not so sure."

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



Re: [PHP] Re: strip comments from HTML?

2004-05-06 Thread John W. Holmes
Justin French wrote:

$text = preg_replace('//su','',$text);
Did not work (was too greedy, matched multiple comments)
Just for the record, it should be a capital 'U' for ungreedy. Lowercase 
'u' is something else. :)

--
---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] Returning an object

2004-05-06 Thread Petr U.
On Fri, 7 May 2004 11:35:24 +1000
"Aidan Lister" <[EMAIL PROTECTED]> wrote:

 > How _should_ this be done? In terms of "best practice".

I'd choose this way:

function &foo()
{
return new Object;
}

-- 
Petr U.

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



Re: [PHP] Re: strip comments from HTML?

2004-05-06 Thread Justin French
Thanks to everyone who's replied... appears to be quite a tricky one!!

$text = preg_replace('//su','',$text);
Did not work (was too greedy, matched multiple comments)
$text = preg_replace('//','',$text);
Did not work (needed multiple lines)
$text = preg_replace('//su','',$text);
Does work so far, finger's crossed.
Thanks again to John, Paul, Rob, Tom, et al.

---
Justin French
http://indent.com.au
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Returning an object

2004-05-06 Thread Aidan Lister
How _should_ this be done? In terms of "best practice".



Or:



Please don't reply if you really, really don't know what you are talking
about.

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



Re: [PHP] setting php_admin_value

2004-05-06 Thread David T-G
Tim --

You have started a new thread by taking an existing message and replying
to it while merely changing the Subject: line.

That is bad, because it breaks threading.  When you reply to a message,
your mail client generates a "References:" header that tells everyone to
which posting(s) your posting refers.  A good mail client uses this
information to build a "thread tree" of the postings so that it is easy
to see just how they relate to each other.

With your posting style you successfully torpedoed this useful feature;
your posting shows up within an existing thread even though it is
completely unrelated.

Always do a fresh post when you want to start a new thread.  That means
that you do not select any sort of "Reply" when you start your message.
You can save the list address in your address book (or equivalent) for
convenience.

...and then Tim Traver said...
% 
% Hi all,
% 
% ok, I am writing an apache module that dynamically figures out virtual host 
% variables for data locations for my users.

Interesting.  Where does it get its info?  Probably from a database or
config file or such?  [Just to make sure I have the picture right...  The
other option would be from Apache, but I think you're saying that you're
setting apache vars rather than reading them.]


% 
% I need to be able to set the php_admin_values for each request so that 
% those values get passed through to php and take effect for each request.
% 
% Normally, this would be static inside the apache conf file using the 
% php_admin_value directive.

Right.  The PHP manual backs that up, too:

  There are two differences between the Admin values and the non admin
  values:
  
* Admin values (or flags) can only appear in the server-wide Apache
  configuration files (e.g., httpd.conf).
* Standard values (or flags) cannot control certain PHP directives,
  for example: safe mode (if you could override safe mode settings
  in .htaccess files, it would defeat safe mode's purpose). In
  contrast, Admin values can modify the value of any PHP directive.

So no setting these from the PHP side.


% 
% Does anyone here know how I could set these variables dynamically ? Do I 
% have to load the apache configuration tables and change it manually ? or 
% can I set a particular environment variable that gets read by php ?

The only thing that occurs to me -- and it would be none too easy to
secure, mind you -- is having your script write to some /path/to/file
which is included by the main httpd.conf file and then reload httpd.
Very ugly.

Since you're writing a module, though, you could probably look into the
mod_php4 source and see how it gets its settings; surely the httpd.conf
file structure, after parsing, is just a data structure that is read as
needed, and you could thus probably intercept that call.


% 
% Thanks,
% 
% Tim.


HTH & HAND

:-D
-- 
David T-G
[EMAIL PROTECTED]
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!



pgp0.pgp
Description: PGP signature


[PHP] setting php_admin_value

2004-05-06 Thread Tim Traver
Hi all,

ok, I am writing an apache module that dynamically figures out virtual host 
variables for data locations for my users.

I need to be able to set the php_admin_values for each request so that 
those values get passed through to php and take effect for each request.

Normally, this would be static inside the apache conf file using the 
php_admin_value directive.

Does anyone here know how I could set these variables dynamically ? Do I 
have to load the apache configuration tables and change it manually ? or 
can I set a particular environment variable that gets read by php ?

Thanks,

Tim.

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


RE: [PHP] Class Help Extended

2004-05-06 Thread PHP Email List
Ummm, Yeah that was a "joke".

Didn't matter that the syntax was wrong. Thanks for discecting that though
for me!  :)

Had I written it and tested it my parse error would have showed me what I
did wrong. Wow you guys play serious! LOL

Anywho, thanks again...
Wolf  >:-P

> -Original Message-
> From: Curt Zirzow [mailto:[EMAIL PROTECTED]
> Sent: Thursday, May 06, 2004 2:13 PM
> To: [EMAIL PROTECTED]
> Subject: Re: [PHP] Class Help Extended
>
>
> * Thus wrote Rob Adams ([EMAIL PROTECTED]):
> >
> > "Php Email List" <[EMAIL PROTECTED]> wrote in message
> > news:[EMAIL PROTECTED]
> > > $smiley = ":)";
> > > include_once(evil_laugh.php);
> > > echo $laugh $smiley;
> > > //Echo'd: Muuuhahahahahah :)
> >
> > You're syntax is a little off here.  You need to use:
> >
> > echo $laugh . $smiley;
> > or
> > echo "$laugh $smiley";
>
> or
> echo $laugh, $smiley;
>
> Curt
> --
> "I used to think I was indecisive, but now I'm not so sure."
>
> --
> 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] I need to hire someone to secure script

2004-05-06 Thread David T-G
Doug --

...and then doug_hastings said...
% 
% Hello,
% I wrote a script for my site which has been compromised repeatedly. I would
% like to hire someone to fix it for me. The script is about 120 lines,
...
% Thanks,

I would be more than happy to be of service if you are still in need.
Please feel free to drop me a line to discuss it if you wish.


% 
% Sorry if this not an appropriate request in a forum like this.

That's an age-old problem, and I think it's as good here as anywhere :-)


% 
% Doug


HTH & HAND & Good luck!

:-D
-- 
David T-G
[EMAIL PROTECTED]
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!



pgp0.pgp
Description: PGP signature


Re: [PHP] Re: strip comments from HTML?

2004-05-06 Thread David T-G
Michael, et al --

...and then Michael Sims said...
% 
% David T-G wrote:
% >
% > Am I missing something painfully obvious?
% 
% www.perldoc.com appears to be unavailable at the moment, but if you have "perldoc"
% installed, here's an excerpt from the "perlre" man page:

I do, but I looked in the php manual and didn't see this behavior.
[Petr, as you'll note, has rectified that matter.]  I know that some
of the PHP PCRE implementation strays from Perl's, so I just stuck
with that.


Thanks & HAND

:-D
-- 
David T-G
[EMAIL PROTECTED]
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!



pgp0.pgp
Description: PGP signature


Re: [PHP] Re: strip comments from HTML?

2004-05-06 Thread David T-G
Petr, et al --

...and then Petr U. said...
% 
% On Thu, 6 May 2004 11:57:45 -0400
% David T-G <[EMAIL PROTECTED]> wrote:
% 
%  > Am I missing something painfully obvious?
% 
% >From http://www.php.net/manual/en/pcre.pattern.syntax.php 
% 
% However, if a quantifier is followed by a question mark, then it ceases to be
% greedy, and instead matches the minimum number of times possible, so the
% pattern /\*.*?\*/  does the right thing with the C comments.

Gee, I guess I was :-)  Thanks!


% 
% --
% Petr U.


HAND

:-D
-- 
David T-G
[EMAIL PROTECTED]
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!



pgp0.pgp
Description: PGP signature


Re: [PHP] gifs, icons etc

2004-05-06 Thread David T-G
Brent, et al --

...and then Brent Clark said...
% 
% Hi all

Hi!


% 
% I would like to know if any body has a url for free some icons and, or small
% pics that can be used in a site \ page
% development.

They're not entirely free, but they're available for personal use as well
as in your own development (or for a fee if used commercially).  Surf
over to Dotty's Diner at

  http://www.dottysdiner.com/

and see all of the backgrounds she has available, plus more in her ring.

Disclaimer: I had never heard of Dotty until my wife stumbled over her
images, am in no way related to her, and receive no compensation for
telling anyone about her work.  Nyah nyah :-)


HTH & HAND

:-D
-- 
David T-G
[EMAIL PROTECTED]
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!



pgp0.pgp
Description: PGP signature


Re: [PHP] Header() and POST data

2004-05-06 Thread Daniel Clark
Yes I agree, SESSION variables would be a pretty good way to pass info to
the next page.

> Daniel -
>
> What is the best way to "go to another page"?
>
> header("location: . $new_page);  
>
> Todd
>
> Daniel Clark wrote:
>
>> No I don't think so.
>>
>>
>>>I need to go to another page and I use the
>>>
>>>header("location: " . $the_url_to_the_page);
>>>
>>>Is it possible to use this method with POST so that the info does not
>>>show in the URL?

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



Re: [PHP] Header() and POST data

2004-05-06 Thread Curt Zirzow
* Thus wrote Todd Cary ([EMAIL PROTECTED]):
> I need to go to another page and I use the
> 
> header("location: " . $the_url_to_the_page);
> 
> Is it possible to use this method with POST so that the info does not 
> show in the URL?

No.

You can use session's to pass data without the user knowing about
it. And is probably a better method than using GET/POST.

$_SESSION['var_to_pass'] = 'its value';
header("location: " . $the_url_to_the_page);

Then $the_url_to_the_page can read the session data.


Curt
-- 
"I used to think I was indecisive, but now I'm not so sure."

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



[PHP] I need to hire someone to secure script

2004-05-06 Thread doug_hastings
Hello,
I wrote a script for my site which has been compromised repeatedly. I would
like to hire someone to fix it for me. The script is about 120 lines,
nothing fancy. It needs at least an escapeshellcmd() and I am open to
suggestions for security fixes.

I lack advanced understanding of PHP and do not have time to learn right
now.

Anyone interested? I'll pay whatever seems fair?

Thanks,

Sorry if this not an appropriate request in a forum like this.

Doug

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



Re: [PHP] Header() and POST data

2004-05-06 Thread Todd Cary
Daniel -

What is the best way to "go to another page"?

header("location: . $new_page);  

Todd

Daniel Clark wrote:

No I don't think so.


I need to go to another page and I use the

header("location: " . $the_url_to_the_page);

Is it possible to use this method with POST so that the info does not
show in the URL?
Todd
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] include from another URL

2004-05-06 Thread Nik
Hi there,
I'm new to these groups so forgive me if I'm asking at the wrong place (tell me where 
then :)

Ok,
I'm not PHP guru but I need to create a simple script that would do this:

Include a content from another URL into the current output. I have done something like
this:

-- code start
http://myotherurl.com:8080';
?>
-- code end

and it seems to work with one exception: it produces a warning message saying 
something like
 "Warning: main(): stream does not support seeking in .../web-root/index.php on line 9"
where line #9 is: include 'http://myotherurl.com:8080'; from above code.
It then shows a message from 'http://myotherurl.com:8080'

Thanks!!!
Nik


Re: [PHP] Header() and POST data

2004-05-06 Thread Daniel Clark
You could create a new  with hidden variable. And have an automatic
submit onload, going to the next location.


> I need to go to another page and I use the
>
> header("location: " . $the_url_to_the_page);
>
> Is it possible to use this method with POST so that the info does not
> show in the URL?
>
> Todd

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



Re: [PHP] Header() and POST data

2004-05-06 Thread Daniel Clark
No I don't think so.

> I need to go to another page and I use the
>
> header("location: " . $the_url_to_the_page);
>
> Is it possible to use this method with POST so that the info does not
> show in the URL?
>
> Todd

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



[PHP] Header() and POST data

2004-05-06 Thread Todd Cary
I need to go to another page and I use the

header("location: " . $the_url_to_the_page);

Is it possible to use this method with POST so that the info does not 
show in the URL?

Todd

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


Re: [PHP] Login page

2004-05-06 Thread Curt Zirzow
* Thus wrote Jay Blanchard ([EMAIL PROTECTED]):
> [snip]
> # login.php??
> [/snip]
> 
> 
> If that is in fact line 1 then the # sign is the problem. Use either //
> or /* */ style comments.

btw, # is a valid comment.

Curt
-- 
"I used to think I was indecisive, but now I'm not so sure."

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



Re: [PHP] Include from another URL?

2004-05-06 Thread Curt Zirzow
* Thus wrote Nik ([EMAIL PROTECTED]):
> Include a content from another URL into the current output. I have done
> something like
> this:
> 
> -- code start
>   include 'http://myotherurl.com:8080';
> ?>
> -- code end

You want to use readfile() instead.
  http://php.net/readfile

Curt
-- 
"I used to think I was indecisive, but now I'm not so sure."

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



Re: [PHP] Include from another URL?

2004-05-06 Thread Nik
Great!
Worked as expected. Thanks.
Now it is time to ask how do I handle form (HTTP POST request) data into the
URL.
Can the same fopen() work as well?

Thanks,
Nik

"Chris Boget" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> > Include a content from another URL into the current output. I have done
> > something like this:
>
> Look into the fopen() function.  I also believe that the file() function
can
> also take a URL, but I'm not sure.
>
> Chris

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



[PHP] Re: gifs, icons etc

2004-05-06 Thread Kim Steinhaug
At sourceforge you will find several icon paks available under different
licenses. However if your software is proprietary you will have trouble
using any of theese (Atleast the ones worth using).

I myself have been searching the net for such but ended up doing the
work myself. Atleast thats how my story went, :)

-- 
-- 
Kim Steinhaug
--
There are 10 types of people when it comes to binary numbers:
those who understand them, and those who don't.
--
www.steinhaug.com - www.easywebshop.no - www.webkitpro.com
--



"Brent Clark" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi all
>
> I would like to know if any body has a url for free some icons and, or
small
> pics that can be used in a site \ page
> development.
>
> I was looking at a project call dotproject.
> And I noticed a lot of kewl small pics.
>
> I dont want to infringe on any licenses etc
>
> Kind Regards
> Brent Clark

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



[PHP] Re: Include from another URL?

2004-05-06 Thread Kim Steinhaug
You could always use this :

 $text = "";
 $fd=fopen($url,"r");
 while ($line=fgets($fd,1000)) { $text.=$line; } fclose ($fd);
 echo $text;

-- 
-- 
Kim Steinhaug
--
There are 10 types of people when it comes to binary numbers:
those who understand them, and those who don't.
--
www.steinhaug.com - www.easywebshop.no - www.webkitpro.com
--


"Nik" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi there,
> I'm new to these groups so forgive me if I'm asking at the wrong place
(tell
> me where then :)
>
> Ok,
> I'm not PHP guru but I need to create a simple script that would do this:
>
> Include a content from another URL into the current output. I have done
> something like
> this:
>
> -- code start
>   include 'http://myotherurl.com:8080';
> ?>
> -- code end
>
> and it seems to work with one exception: it produces a warning message
> saying something like
>  "Warning: main(): stream does not support seeking in
.../web-root/index.php
> on line 9"
> where line #9 is: include 'http://myotherurl.com:8080'; from above code.
> It then shows a message from 'http://myotherurl.com:8080'
>
> Thanks!!!
> Nik

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



[PHP] Re: Calendar math .... how to count in week days....?

2004-05-06 Thread Torsten Roehr
"Anthony" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> I've run into a bit of a problem, that I know has been dealt with before,
> but I don't know how to deal with it.  Very simple, I have an application
> that needs to do calendar math and do it specifically on business days.  I
> need to be able to add and subtract a number of days to only Monday though
> Friday.  Seems simple enough, but I can't figure out how to do it.  The
only
> think I've come up with so far is to build a function that counts every
day
> and checks to see if it's a weekend or not.  This wouldn't be all that
hard
> to do, but I'm wondering if there is a better way to do it?  Anyone have a
> really efficient function to do this, I need to figure out a LOT of dates
in
> this app.
>
> - Anthony

Hi Anthony,

take a look at PEAR's Calendar package:
http://pear.php.net/package/Calendar

There is a simple example for building a calendar. Maybe you can adapt it by
ignoring weekends:
http://pear.php.net/manual/en/package.datetime.calendar.intro-inahurry.php

Regards, Torsten

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



Re: [PHP] Include from another URL?

2004-05-06 Thread Chris Boget
> Include a content from another URL into the current output. I have done
> something like this:

Look into the fopen() function.  I also believe that the file() function can
also take a URL, but I'm not sure.

Chris

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



[PHP] Calendar math .... how to count in week days....?

2004-05-06 Thread Anthony
I've run into a bit of a problem, that I know has been dealt with before,
but I don't know how to deal with it.  Very simple, I have an application
that needs to do calendar math and do it specifically on business days.  I
need to be able to add and subtract a number of days to only Monday though
Friday.  Seems simple enough, but I can't figure out how to do it.  The only
think I've come up with so far is to build a function that counts every day
and checks to see if it's a weekend or not.  This wouldn't be all that hard
to do, but I'm wondering if there is a better way to do it?  Anyone have a
really efficient function to do this, I need to figure out a LOT of dates in
this app.

- Anthony

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



[PHP] Include from another URL?

2004-05-06 Thread Nik
Hi there,
I'm new to these groups so forgive me if I'm asking at the wrong place (tell
me where then :)

Ok,
I'm not PHP guru but I need to create a simple script that would do this:

Include a content from another URL into the current output. I have done
something like
this:

-- code start
http://myotherurl.com:8080';
?>
-- code end

and it seems to work with one exception: it produces a warning message
saying something like
 "Warning: main(): stream does not support seeking in .../web-root/index.php
on line 9"
where line #9 is: include 'http://myotherurl.com:8080'; from above code.
It then shows a message from 'http://myotherurl.com:8080'

Thanks!!!
Nik

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



Re: [PHP] problem with a while loop

2004-05-06 Thread John W. Holmes
From: "John Nichel" <[EMAIL PROTECTED]>

> > Same thing, really. It's a little more efficient than keeping a count,
but
> > not the cause of any of the problems. :)
> >
> > ---John Holmes...
>
> Chris!  John is picking on me!

I thought we agreed that Chris is the one that cannot be trusted??

---John Holmes...

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



Re: [PHP] problem with a while loop

2004-05-06 Thread John Nichel
John W. Holmes wrote:

Same thing, really. It's a little more efficient than keeping a count, but
not the cause of any of the problems. :)
---John Holmes...
Chris!  John is picking on me!
;)
--
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] problem with a while loop

2004-05-06 Thread John W. Holmes
From: "John Nichel" <[EMAIL PROTECTED]>

> >   $i =0;
> >
> >   while ($i < $num_results)   {
> >
> > $row = mysql_fetch_array($result);
> >
> >  $producer = $row["PRODUCE"];
> 
>
> Try changing the above from
>
> while ($i < $num_results)   {
>
>  $row = mysql_fetch_array($result);
>
> To
>
> while ( $row = mysql_fetch_array($result) ) {

Same thing, really. It's a little more efficient than keeping a count, but
not the cause of any of the problems. :)

---John Holmes...

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



Re: [PHP] problem with a while loop

2004-05-06 Thread John W. Holmes
From: "Jessica Mays" <[EMAIL PROTECTED]>
> I am new to php (and mySQL) and I am working on a php page that links
> up to a mySQL database.  My current code works up to a point, BUT what
> happens is that I try to have a while loop and check a variable with an
> inner while loop but it only catches after the first complete cycle.
>
>while ($i < $num_results)   {
>
> $row = mysql_fetch_array($result);
>
>   $producer = $row["PRODUCE"];
[snip]
> while (  $producer == $row["PRODUCE"]) {
>
> $row = mysql_fetch_array($result);
[snip]
> ++$i;
> }
>
> ++$i;
>}

You posted too much code to go through easily. It took me a while to figure
out what you were doing. The code above is what it really could have been
condensed to...

Anyhow, the first time through, you're inner while() loop is always going to
execute and keep executing until you pull a new "produce" value from the
result set. At that time, the new "produce" row is currently in $row, the
inner while() loop fails and control passes back to your outer loop.
However, at that time you call mysql_fetch_array() again in your outer loop
and you just lost the row that cause the inner loop to teminate.

What you want, if I can read right, is to only display the part in your
outer while() loop when "produce" changes.

$producer = '';
while($row = mysql_fetch_array($result))
{
  if($row['produce'] != $producer)
  {
//display outer while() loop HTML here
$producer = $row['produce'];
  }
  //display inner while() loop HTML here.
}

Hope that helps.

---John Holmes...

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



Re: [PHP] Class Help Extended

2004-05-06 Thread Curt Zirzow
* Thus wrote Rob Adams ([EMAIL PROTECTED]):
> 
> "Php Email List" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> > $smiley = ":)";
> > include_once(evil_laugh.php);
> > echo $laugh $smiley;
> > //Echo'd: Muuuhahahahahah :)
> 
> You're syntax is a little off here.  You need to use:
> 
> echo $laugh . $smiley;
> or
> echo "$laugh $smiley";

or 
echo $laugh, $smiley;

Curt
-- 
"I used to think I was indecisive, but now I'm not so sure."

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



Re: [PHP] Re: strip comments from HTML?

2004-05-06 Thread Curt Zirzow
* Thus wrote Paul Chvostek ([EMAIL PROTECTED]):
> On Thu, May 06, 2004 at 11:26:34AM -0400, Rob Ellis wrote:
> > >   
> > > $text = ereg_replace("","",$text);
> > 
> > you can make the .* less greedy...
> > 
> >   $text = preg_replace('//', '', $text);
> 
> Interestingly, from a shell:
> 
>  $ text='one  two\nthree four\n'
>  $ printf "$text" | sed -E 's///g'
>  one  two
>  three four
> 
> which is the same behaviour as PHP.  But that still doesn't cover
> multi-line.  PHP's ereg support is supposed to, but doesn't work with
> this particular substitution:
> 
>  $text="one ", "",$text);

Because your missing a -
$text="one  two\n";
   ^^^
Curt
-- 
"I used to think I was indecisive, but now I'm not so sure."

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



Re: [PHP] problem with a while loop

2004-05-06 Thread John Nichel
Jessica Mays wrote:
From:   [EMAIL PROTECTED]
Subject: problem with a while loop
Date: May 6, 2004 11:25:28 AM EDT
To:   [EMAIL PROTECTED]
Hey everybody!
I am new to php (and mySQL) and I am working on a php page that links up 
to a mySQL database.  My current code works up to a point, BUT what 
happens is that I try to have a while loop and check a variable with an 
inner while loop but it only catches after the first complete cycle.

Basically, some producers will only call up one row, but you always get 
2 at the minimum with this code below.  I have tried lots of different 
things which all lead to the second row endlessly repeating or the page 
not loading at all.

Any ideas?  Please email me directly since I am on the digest. Thanks
Jessica
(Also, I am new to this list and if this email is in the wrong format I 
apologize.)

CODE :

  $query = "select * from wine where REGION like 'California' order by 
PRODUCE,DESCRIPT,VINTAGE";

  $result = mysql_query($query);
  $num_results = mysql_num_rows($result);
  echo "Number of wines found: ".$num_results."";
  $i =0;
  while ($i < $num_results)   {
$row = mysql_fetch_array($result);
 $producer = $row["PRODUCE"];

Try changing the above from
while ($i < $num_results)   {
$row = mysql_fetch_array($result);
To
while ( $row = mysql_fetch_array($result) ) {
--
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] Php and curl, url not shown in an https request

2004-05-06 Thread Lizet Peña de Sola
 Hi all, I'm trying to  use the curl library to request a page through
POST. The page
is requested fine, the parameters are passed but the url
that is shown in the browser is the url of the previous page, the page
that is making the request and not the page that is shown in the
redirection. 
ie:
  $ch= curl_init();
   curl_setopt($ch, CURLOPT_URL, 
"https://www.foo.com";);
   $arg= Array();
   $arg['desc']='something here';
   $arg['cartId']='more here';
   $arg['submit']="Yes, I want to pay";
   $header[]="Location: https://www.foo.com";;
   curl_setopt($ch,CURLOPT_POST, 1);
   curl_setopt($ch,CURLOPT_POSTFIELDS, $arg);
   curl_setopt($ch, CURLOPT_FOLLOWLOCATION,1);
   curl_setopt ($ch, CURLOPT_HTTPHEADER, $header);
   curl_exec ($ch);
   curl_close ($ch);

the "https://www.foo.com"; is requested fine, the
parameters are passed alright but the browswer shows
the address of the previous page so the lock image of
the secure connection isn't shown on the status bar,
not to mention all the relative uri now point to the
domain of the script that made the request and not to
the new page's domain, so it's a mess.

thanks a lot for looking at this!
Lizet

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



[PHP] problem with a while loop

2004-05-06 Thread Jessica Mays
From: [EMAIL PROTECTED]
Subject:problem with a while loop
Date:   May 6, 2004 11:25:28 AM EDT
To:   [EMAIL PROTECTED]
Hey everybody!
I am new to php (and mySQL) and I am working on a php page that links 
up to a mySQL database.  My current code works up to a point, BUT what 
happens is that I try to have a while loop and check a variable with an 
inner while loop but it only catches after the first complete cycle.

Basically, some producers will only call up one row, but you always get 
2 at the minimum with this code below.  I have tried lots of different 
things which all lead to the second row endlessly repeating or the page 
not loading at all.

Any ideas?  Please email me directly since I am on the digest. Thanks
Jessica
(Also, I am new to this list and if this email is in the wrong format I 
apologize.)

CODE :

  $query = "select * from wine where REGION like 'California' order by 
PRODUCE,DESCRIPT,VINTAGE";

  $result = mysql_query($query);
  $num_results = mysql_num_rows($result);
  echo "Number of wines found: ".$num_results."";
  $i =0;
  while ($i < $num_results)   {
$row = mysql_fetch_array($result);
$producer = $row["PRODUCE"];
		echo "";
 	echo stripslashes($row["PRODUCE"]);
		echo "";
		
		$color = "#cc";
		echo "";

// id number
echo stripslashes($row["INVID"]);
echo "";
// vintage
 echo stripslashes($row["VINTAGE"]);
 echo " ";

// description
echo stripslashes($row["DESCRIPT"]);
echo " ";
// bottle size
if ($row["BOTSIZE"] != "750ml"){
echo "";
echo stripslashes($row["BOTSIZE"]);
echo "";
}

if ($row["NOTES"] != ""){
echo "";
echo stripslashes($row["NOTES"]);
echo "";
}

echo "";

// list price
echo "";
 echo stripslashes($row["WINENUM"]);
 echo "";

// sale price
echo "";
 echo stripslashes($row["SALEPRICE"]);
echo "";


while (  $producer == $row["PRODUCE"]) {

if ($color == "#ccdd99")
$color = "#cc";
else
$color = "#ccdd99";

$row = mysql_fetch_array($result);

echo "";

// id number
echo stripslashes($row["INVID"]);
echo "";

// vintage
 echo stripslashes($row["VINTAGE"]);
 echo " ";

// description
echo stripslashes($row["DESCRIPT"]);
echo " ";
// bottle size
if ($row["BOTSIZE"] != "750ml"){
echo "";
echo stripslashes($row["BOTSIZE"]);
echo "";
}

if ($row["NOTES"] != ""){
echo "";
echo stripslashes($row["NOTES"]);
echo "";
}

echo "";

// list price
echo "";
 echo stripslashes($row["WINENUM"]);
 echo "";

// sale price
echo "";
 echo stripslashes($row["SALEPRICE"]);
echo "";

++$i;
}

echo " ";
++$i;
  }


?>


Re: [PHP] Re: strip comments from HTML?

2004-05-06 Thread Rob Ellis
On Thu, May 06, 2004 at 12:47:10PM -0400, Paul Chvostek wrote:
> On Thu, May 06, 2004 at 11:26:34AM -0400, Rob Ellis wrote:
> > >   
> > > $text = ereg_replace("","",$text);
> > 
> > you can make the .* less greedy...
> > 
> >   $text = preg_replace('//', '', $text);
> 
> Interesting to know.  My preg-foo is limited; I came at PHP from a
> background of awk and sed, so when I regexp, I'm a little more
> traditional about it.
> 
> Interestingly, from a shell:
> 
>  $ text='one  two\nthree four\n'
>  $ printf "$text" | sed -E 's///g'
>  one  two
>  three four
> 
> which is the same behaviour as PHP.  But that still doesn't cover
> multi-line.  PHP's ereg support is supposed to, but doesn't work with
> this particular substitution:
> 
>  $text="one ", "",$text);
> 
> returns
> 
>  one /s', '', $text);

- rob

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



Re: [PHP] html form elements as php arrays

2004-05-06 Thread John Nichel
Matthew Oatham wrote:
Hi,
I am retrieving data from a database and displaying results on a html so the user can edit them, I am sending the html form back to the server as an array, i.e on my html for I might have 10 name fields so in the html code all name fields are named name[] then I can iterate through the array on the server. My problem isn't strictly php but more html / javascript. if I have a load of form field elements all named name[] how do I access them to do javascript validation? i.e document.form.name[].value doesn't work! 

Cheers
Matt
Please wrap your lines.
document.form.elements['name[]'].value
--
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] Class Help Extended

2004-05-06 Thread Rob Adams

"Php Email List" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> $smiley = ":)";
> include_once(evil_laugh.php);
> echo $laugh $smiley;
> //Echo'd: Muuuhahahahahah :)

You're syntax is a little off here.  You need to use:

echo $laugh . $smiley;
or
echo "$laugh $smiley";

  -- Rob

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



[PHP] html form elements as php arrays

2004-05-06 Thread Matthew Oatham
Hi,

I am retrieving data from a database and displaying results on a html so the user can 
edit them, I am sending the html form back to the server as an array, i.e on my html 
for I might have 10 name fields so in the html code all name fields are named name[] 
then I can iterate through the array on the server. My problem isn't strictly php but 
more html / javascript. if I have a load of form field elements all named name[] how 
do I access them to do javascript validation? i.e document.form.name[].value doesn't 
work! 

Cheers

Matt

Re: [PHP] Re: strip comments from HTML?

2004-05-06 Thread Paul Chvostek
On Thu, May 06, 2004 at 11:26:34AM -0400, Rob Ellis wrote:
> >   
> > $text = ereg_replace("","",$text);
> 
> you can make the .* less greedy...
> 
>   $text = preg_replace('//', '', $text);

Interesting to know.  My preg-foo is limited; I came at PHP from a
background of awk and sed, so when I regexp, I'm a little more
traditional about it.

Interestingly, from a shell:

 $ text='one  two\nthree four\n'
 $ printf "$text" | sed -E 's///g'
 one  two
 three four

which is the same behaviour as PHP.  But that still doesn't cover
multi-line.  PHP's ereg support is supposed to, but doesn't work with
this particular substitution:

 $text="one ", "",$text);

returns

 one 

Re: [PHP] Re: strip comments from HTML?

2004-05-06 Thread Petr U.
On Thu, 6 May 2004 11:57:45 -0400
David T-G <[EMAIL PROTECTED]> wrote:

 > 
 > Am I missing something painfully obvious?

>From http://www.php.net/manual/en/pcre.pattern.syntax.php 

However, if a quantifier is followed by a question mark, then it ceases to be
greedy, and instead matches the minimum number of times possible, so the
pattern /\*.*?\*/  does the right thing with the C comments.

--
Petr U.

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



RE: [PHP] Re: strip comments from HTML?

2004-05-06 Thread Michael Sims
David T-G wrote:
> % you can make the .* less greedy...
> %
> %   $text = preg_replace('//', '', $text);
>
> How does that make it ungreedy?  The only thing I see relating
> question marks and greediness is that a question mark makes part of a
> regexp with a /U modifier (otherwise not greedy) back into a greedy
> portion.
>
> Am I missing something painfully obvious?

www.perldoc.com appears to be unavailable at the moment, but if you have "perldoc"
installed, here's an excerpt from the "perlre" man page:

   By default, a quantified subpattern is "greedy", that is,
   it will match as many times as possible (given a particu-
   lar starting location) while still allowing the rest of
   the pattern to match.  If you want it to match the minimum
   number of times possible, follow the quantifier with a
   "?".

There are other useful examples in that man page.  The "U" modifier is something
that PHP added, it is not part of perl's regex syntax.  It basically reverses the
greedy tendency, so that ALL of the quantifiers in a particular regex are ungreedy,
and the "?" makes them greedy.  Without the "U", the normal (and perl compatible)
behavior of "?" following a quantifier is to make it ungreedy.

HTH

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



Re: [PHP] Sending Mail with PHP

2004-05-06 Thread Jordi Canals
Justin @ Dreaming in TO wrote:
However, the page it redirects to is blank, except for the background 
image that is referenced in the CSS stylesheet. Feel free to test it as 
many times as you would like.

mail($mailto, $subject, $messageproper, "From: \"$name\" 
<$email>\nReply-To: \"$name\" <$email>\nX-Mailer: FunctionJunkie 
WebMailer" );
exit ;
?>
You are doing _nothing_ after sending the e-mail ... You are just 
exiting the script. So, no page is loaded.

Try something like that:
if (mail()) {
header("Location: $thankyouurl");
} else {
header("Location: $errorurl");
}
Regards,
Jordi.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Re: strip comments from HTML?

2004-05-06 Thread David T-G
Rob, et al --

...and then Rob Ellis said...
% 
...
% you can make the .* less greedy...
% 
%   $text = preg_replace('//', '', $text);

How does that make it ungreedy?  The only thing I see relating question
marks and greediness is that a question mark makes part of a regexp with
a /U modifier (otherwise not greedy) back into a greedy portion.

Am I missing something painfully obvious?


% 
% - rob


TIA & HAND

:-D
-- 
David T-G
[EMAIL PROTECTED]
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!



pgpR4LqMxbiLk.pgp
Description: PGP signature


Re: [PHP] Sending Mail with PHP

2004-05-06 Thread John W. Holmes
From: "Justin @ Dreaming in TO" <[EMAIL PROTECTED]>
> If you go to http://www.functionjunkie.org/contactform/contactform.php
> and fill out the form, it sends the email ok, but its supposed to
> redirect to a preset page, which it does.
>
> However, the page it redirects to is blank, except for the background
> image that is referenced in the CSS stylesheet. Feel free to test it as
> many times as you would like.
[snip]
> mail($mailto, $subject, $messageproper, "From: \"$name\"
> <$email>\nReply-To: \"$name\" <$email>\nX-Mailer: FunctionJunkie
> WebMailer" );
>  exit ;

1. I don't see where you're redirecting anywhere after you send the mail().

2. You have output on line 7 of feedback.php, which means your header()
redirects will fail, anyhow.

3. This script is vulnerable to mail header injection attacks because you do
not check the user-supplied data for newlines. A maliciously formed $name or
$email value could lead to header injection.

4. You should use \r\n between your additional mail headers.

---John Holmes...

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



Re: [PHP] Re: strip comments from HTML?

2004-05-06 Thread John W. Holmes
From: "Rob Ellis" <[EMAIL PROTECTED]>
> you can make the .* less greedy...
>
>   $text = preg_replace('//', '', $text);

You still need an 's' modifier if you want to match multi-line comments. The
dot character won't match newlines unless you use an 's' modifier.

---John Holmes...

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



[PHP] Sending Mail with PHP

2004-05-06 Thread Justin @ Dreaming in TO
Hey Everyone,
I've got a problem with a mail program I'm using.
If you go to http://www.functionjunkie.org/contactform/contactform.php 
and fill out the form, it sends the email ok, but its supposed to 
redirect to a preset page, which it does.

However, the page it redirects to is blank, except for the background 
image that is referenced in the CSS stylesheet. Feel free to test it as 
many times as you would like.

I'm missing something here, but I cannot figure out what.
Here's the code on feedback.php, which does the processing of the form 
on the contactform.php page.


// $mailto - sets the email address the form
// sents email to, eg
// $mailto  = "[EMAIL PROTECTED]" ;
$mailto = '[EMAIL PROTECTED]' ;
// $subject - sets the Subject line of the email, eg
//$subject  = "Feedback Form" ;
$subject = "feedback from functionjunkie.org" ;
// any pages that need to be displayed for form processing reasons, eg
//$formurl  = "http://www.example.com/feedback.html"; ;
//$errorurl = "http://www.example.com/error.html"; ;
//$thankyouurl  = "http://www.example.com/thankyou.html"; ;
$formurl = "http://www.functionjunkie.org/contactform/contactform.php"; ;
$errorurl = "http://www.functionjunkie.org/contactform/error.php"; ;
$thankyouurl = "http://www.functionjunkie.org/contactform/thanks.php"; ;
$name = $_POST['name'] ;
$email = $_POST['email'] ;
$comments = $_POST['comments'] ;
$http_referer = getenv( "HTTP_REFERER" );
$http_user_agent = getenv( "HTTP_USER_AGENT" );
$remote_host = getenv( "REMOTE_HOST" );
if (!isset($_POST['email'])) {
header( "Location: $thankyouurl" );
exit ;
}
if (empty($name) || empty($email) || empty($comments)) {
   header( "Location: $errorurl" );
   exit ;
}
$messageproper = // this is what the recipient will see when they 
receive the email

"Hi Justin:\n
$comments\n
--
Details of the message sent:\n
Name: $name
Email: $email
From: $http_referer
Using: $http_user_agent
Remote Host: $remote_host .
"" ;
	
	mail($mailto, $subject, $messageproper, "From: \"$name\" 
<$email>\nReply-To: \"$name\" <$email>\nX-Mailer: FunctionJunkie 
WebMailer" );
exit ;
?>

Any suggestions would be appreciated.
Thanks in Advance,
--
Justin Kozuch -
Team Macromedia Volunteer for Dreamweaver MX 2004
http://www.macromedia.com/support/forums/team_macromedia/index.html
CommunityMX Partner - http://www.communitymx.com
Dreaming in TO, Founder - http://www.dreaminginto.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] converting movies

2004-05-06 Thread David T-G
Arthur --

You have started a new thread by taking an existing message and replying
to it while merely changing the Subject: line.

That is bad, because it breaks threading.  When you reply to a message,
your mail client generates a "References:" header that tells everyone to
which posting(s) your posting refers.  A good mail client uses this
information to build a "thread tree" of the postings so that it is easy
to see just how they relate to each other.

With your posting style you successfully torpedoed this useful feature;
your posting shows up within an existing thread even though it is
completely unrelated.

Always do a fresh post when you want to start a new thread.  That means
that you do not select any sort of "Reply" when you start your message.
You can save the list address in your address book (or equivalent) for
convenience.

...and then Arthur Radulescu said...
% 
% Hello!

Hi!


% 
% Does anyone know how I can convert movies from a format to another or how I
% could get a screenshot of the movie (the first scene) using PHP or at least
% something running on a linux system.

I would use ImageMagick.


% 
% 
% Thanks,
% Arthur


HTH & HAND

:-D
-- 
David T-G
[EMAIL PROTECTED]
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!



pgphnzzbZxrrf.pgp
Description: PGP signature


Re: [PHP] Re: strip comments from HTML?

2004-05-06 Thread Rob Ellis
On Thu, May 06, 2004 at 11:10:17AM -0400, Paul Chvostek wrote:
> On Thu, May 06, 2004 at 03:02:16PM +1000, Justin French wrote:
> > 
> > This isn't working:
> > $text = preg_replace('//','',$text);
> > 
> > Can someone advise what characters I need to escape, or whatever to get 
> > it going?
> 
> It's not a matter of escaping.  You're matching too much with the ".*".
> 
> If you're sure you won't have any right-point-brackets inside comments,
> you can use something like:
>   
> $text = ereg_replace("","",$text);
> 
> Accurately matching comments in an extended regular expression is tricky
> though.  The only thing you can really *negate* in an ereg is a range,
> not an atom.  And the close of the comment can't be prepresented as a
> range, since it's multiple characters.
> 
> Not to say it can't be done.  I just can't think of how at the moment.
> 

you can make the .* less greedy...

  $text = preg_replace('//', '', $text);

- rob

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



[PHP] Re: strip comments from HTML?

2004-05-06 Thread Paul Chvostek
On Thu, May 06, 2004 at 03:02:16PM +1000, Justin French wrote:
> 
> This isn't working:
> $text = preg_replace('//','',$text);
> 
> Can someone advise what characters I need to escape, or whatever to get 
> it going?

It's not a matter of escaping.  You're matching too much with the ".*".

If you're sure you won't have any right-point-brackets inside comments,
you can use something like:
  
$text = ereg_replace("","",$text);

Accurately matching comments in an extended regular expression is tricky
though.  The only thing you can really *negate* in an ereg is a range,
not an atom.  And the close of the comment can't be prepresented as a
range, since it's multiple characters.

Not to say it can't be done.  I just can't think of how at the moment.

:)

-- 
  Paul Chvostek <[EMAIL PROTECTED]>
  it.canadahttp://www.it.ca/
  Free PHP web hosting!http://www.it.ca/web/

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



[PHP] converting movies

2004-05-06 Thread Arthur Radulescu
Hello!

Does anyone know how I can convert movies from a format to another or how I
could get a screenshot of the movie (the first scene) using PHP or at least
something running on a linux system.


Thanks,
Arthur

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



Re: [PHP] Looking for Advanced PHP Developers

2004-05-06 Thread John W. Holmes
From: "Ammar Ibrahim" <[EMAIL PROTECTED]>

> I don't understand what you mean.

Please take any further discussion off-list. I can handle off topic posts,
but the "safety of caucasians in Jordan" is too much of a stretch, I think.
:)

---John Holmes...

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



Re: [PHP] Looking for Advanced PHP Developers

2004-05-06 Thread Stephen Allen
On Thu, May 06, 2004 at 05:14:37PM +0200 or thereabouts, Ammar Ibrahim wrote:
> Stephen Allen wrote:
> >On Thu, May 06, 2004 at 01:15:17AM +0200 or thereabouts, Richard Harb 
> >wrote:
> >
> >>... and onsite would be where ?
> >
> >
> >Amman, Jordan I think. I wouldn't want to be a Caucasian over there 
> >working, at this
> >point in time.
> >
> 
> I don't understand what you mean. Jordan is the one of the safest 
> countries i have ever known. even when Iraq was being bombed, out life 
> didn't change not even a bit. I have never been robbed. It's the safest 
> and most secure country in the region.

Hello Ammar:

I didn't mean any offence, but I'm simply following the news, and the reports
that some terrorists are threatening Caucasian foreigners in Jordan. Jordan does
have a high transient population, many of whom seem to be sympathetic to the
Palestinian/Alkeida cause. Being a visible westerner in Jordan, isn't desirable
during this time. Just like Saudi Arabia, being that both support the so called
'war on terror' and both are seen as strong allies to the U.S. makes the danger
obvious.

Didn't Jordan have a terrorist incident just a couple weeks ago? Something about
a chemical bomb threat, that was uncovered by Jordon's special forces, during a
raid? It was all over the TV here.

One does need to be pragmatic, where personal security and that of one's family
is concerned. I'm not being political, just being upfront.

My apologies for being off-topic, but you seemed to be obfuscating where the job
opportunity was initially. Usually a recruiter indicates the country where the
position is, initially.

Regards,
-- 
S.Allen
---
barnyard  Thursday May 06 2004 10:20:01 AM EDT
---
There never was a good war or a bad peace.
-- B. Franklin


pgpXpuCifP3mH.pgp
Description: PGP signature


Re: [PHP] Looking for Advanced PHP Developers

2004-05-06 Thread Ammar Ibrahim
Stephen Allen wrote:
On Thu, May 06, 2004 at 01:15:17AM +0200 or thereabouts, Richard Harb wrote:
... and onsite would be where ?

Amman, Jordan I think. I wouldn't want to be a Caucasian over there working, at this
point in time.
I don't understand what you mean. Jordan is the one of the safest 
countries i have ever known. even when Iraq was being bombed, out life 
didn't change not even a bit. I have never been robbed. It's the safest 
and most secure country in the region.

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


[PHP] How to compile PHP so to allow XML and XSLT ?

2004-05-06 Thread gayard
Hi all. 

My PHP is compiled with these options: 

./configure --with-mysql=/usr --with-gettext 
--with-apxs2=/usr/local/apache2/bin/apxs  --prefix=/usr/local/php5 
--enable-cli --with-xml --enable-xslt --with-xslt-sablot 

It compiled just fine ! Not a single complaint about any library ! 

I have just written this little script to try out XML and XSLT: 

 

However, PHP does not seem to accept the functions: 

Fatal error: Call to undefined function xslt_create() in 
/home/leonel/public_html/testeXLST.php on line 2 

I am using PHP5.0.0RC2. 

Is everything all right ? 

Thanks 
Leonel 

_
Voce quer um iGMail protegido contra vírus e spams? 
Clique aqui: http://www.igmailseguro.ig.com.br


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

Re: [PHP] Login page

2004-05-06 Thread Petr U.
On Thu, 6 May 2004 03:42:48 -0700
"Erik Gjertsen" <[EMAIL PROTECTED]> wrote:

 > I have made a login page but I got an error on line 1.

Where did you defined $dbc? Nowhere. 
>From "mysql_select_db($database_innlogging, $innlogging);" I guessing, that
you shuld use:

  global $innlogging;
  ...
  return mysql_real_escape_string($data, $innlogging);

--
Petr

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



Re: [PHP] HTTP_REFERER ... ?

2004-05-06 Thread John Nichel
Curt Zirzow wrote:
I guess soon firewall's are going to be pouring you cups of coffee
when it gets empty.
Curt
I hope they offer a Mt. Dew patch. ;)
--
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: Login page

2004-05-06 Thread Jay Blanchard
[snip]
Warning: mysql_real_escape_string() expects parameter 2 to be resource,
null
given in /home2/erik/gjertsen-www/Skole22/Loggin/login.php on line 28

>   1 return mysql_real_escape_string($data, $dbc);
[/snip]

Please post only the relevant code.

mysql_real_escape_string is expecting that $dbc would be your database
connection. $dbc is not the connection. Please see

http://www.php.net/mysql_real_escape_string

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



RE: [PHP] Re: Login page

2004-05-06 Thread Angelo Zanetti
did you try comment out # login.php

like this:

//login.php

or what would you use login.php for?
angelo

-Original Message-
From: Erik Gjertsen [mailto:[EMAIL PROTECTED]
Sent: Thursday, May 06, 2004 2:54 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Re: Login page


I forgot the error messages:
Warning: mysql_real_escape_string() expects parameter 2 to be resource, null
given in /home2/erik/gjertsen-www/Skole22/Loggin/login.php on line 28

Warning: mysql_real_escape_string() expects parameter 2 to be resource, null
given in /home2/erik/gjertsen-www/Skole22/Loggin/login.php on line 28

and 1.. is line 28 there error massages com.

thanks
Erik Gjertsen.
"Erik Gjertsen" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> I have made a login page but I got an error on line 1.
>
> Can some one please help me to solve the problem
>
>
>  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
> http://www.w3.org/1999/xhtml";>
> 
> LoggInn
> 
> 
>
> 
>  # login.php
> if (isset($_POST['submit'])) { // Handel the form.
>  require_once('../../../Connections/innlogging.php');
>
>  mysql_select_db($database_innlogging, $innlogging);
>  $query_logginn = "SELECT usrid, username, password1 FROM users";
>  $logginn = mysql_query($query_logginn, $innlogging) or
die(mysql_error());
>  $row_logginn = mysql_fetch_assoc($logginn);
>  $totalRows_logginn = mysql_num_rows($logginn);
>
>
> // Crating a function for  escaping the data.
> function escape_data ($data) {
>   global $dbc; //meed the connection
>   if (ini_get('magic_quotes_gpc')) {
>$data = stripslashes($data);
>}
>   1 return mysql_real_escape_string($data, $dbc);
>   } // end of function
>
>   $message = NULL; // Create an enpty new variable
>   // Check for a username
>  if (empty($_POST['username'])) {
>   $username = FALSE;
>   $message .= 'You forgot to enter your username!';
>  } else {
>   $username = escape_data($_POST['username']);
>  }
>  // Check for a Password
>  if (empty($_POST['password1'])) {
>   $password1 = FALSE;
>   $message .= 'You forgot to enter your password!';
>  } else {
>   $password1 = escape_data($_POST['password1']);
>  }
>  if ($username && $password1) { //if everything's ok.
>  //Retrieve the user_id an name for that username and password
combination.
>  $query = "SELECT usrid name FROM users WHERE username='$username' AND
> password1=PASSWORD('$password1')";
>  $result = @mysql_query ($query); //Run the query
>  $row = mysql_fetch_array ($result, MYSQL_NUM); //Return a record, if
> applicable.
>  if ($row) { //A record was pulled from the database.
>   //Set the cookies & redirect.
>   setcookie ('name', $row[1]);
>   setcookie ('usrid', $row[1]);
>   header ("Location: http://"; . $_SERVER['HTTP_HOST'] .
> dirname($_SERVER['PHP_SELF']) . "/Loggedin.php");
>   exit(); //Quit the script
>  } else { // No record matched the query.
>   $message = 'The username and password entered do not match on
> file.';
>  }
>  mysql_close(); // Close the databaseconection.
> } else {
>  $message = 'Please try again.';
>  }
> } // End of themail submitconditional.
>
> //Print the error message if ther is one
> if (isset($message)) {
>  echo '', $message, '';
> }
>
> ?>
>
> 
> Enter your information in the form below:
> User Name:  maxlength="20" value=" (isset($_POST['username'])) echo $_POST['username']; ?>" />
>
> Password:  maxlength="20" />
>  />
> 
> 
> 
> 
>
>
> Thanks
> Erik Gjertsen

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


Disclaimer 
This e-mail transmission contains confidential information,
which is the property of the sender.
The information in this e-mail or attachments thereto is 
intended for the attention and use only of the addressee. 
Should you have received this e-mail in error, please delete 
and destroy it and any attachments thereto immediately. 
Under no circumstances will the Cape Technikon or the sender 
of this e-mail be liable to any party for any direct, indirect, 
special or other consequential damages for any use of this e-mail.
For the detailed e-mail disclaimer please refer to 
http://www.ctech.ac.za/polic or call +27 (0)21 460 3911

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



php-general Digest 6 May 2004 13:06:59 -0000 Issue 2747

2004-05-06 Thread php-general-digest-help

php-general Digest 6 May 2004 13:06:59 - Issue 2747

Topics (messages 185491 through 185521):

Class Help
185491 by: PHP Email List
185494 by: Curt Zirzow

Re: remove soap header
185492 by: Chhai T

Re: HTTP_REFERER ... ?
185493 by: David Robley
185509 by: Tristan.Pretty.risk.sungard.com

Re: Regular Expression
185495 by: Tumurbaatar S.

strip comments from HTML?
185496 by: Justin French
185501 by: Marius Dascalu
185505 by: David T-G
185506 by: David T-G
185510 by: Marius Dascalu
185516 by: Tom Rogers
185518 by: John W. Holmes

Class Help Extended
185497 by: PHP Email List
185498 by: Richard Harb
185500 by: PHP Email List
185502 by: Torsten Roehr

Re: how does PHP handle kerberos authentication?
185499 by: Burhan Khalid

I can't make session work, but cookie can, why?
185503 by: TOld
185504 by: Torsten Roehr

Login page
185507 by: Erik Gjertsen
185511 by: Jay Blanchard
185513 by: Angelo Zanetti
185514 by: Jay Blanchard
185520 by: Erik Gjertsen

File management.
185508 by: Carles Xavier Munyoz Baldó
185512 by: Jay Blanchard

Way OT MySql Update
185515 by: Dave Carrera
185519 by: John W. Holmes
185521 by: Angelo Zanetti

gifs, icons etc
185517 by: Brent Clark

Administrivia:

To subscribe to the digest, e-mail:
[EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
[EMAIL PROTECTED]

To post to the list, e-mail:
[EMAIL PROTECTED]


--
--- Begin Message ---
Why is it in a class, so important for you to initialize your $variables?

In the following example, I have my class started and then took out or
atleast commented my "var $variable" and the code still does what it should.
So why is it so important that you initialize these variables this way?

[:::CODE:::]
z = 250;
return $this->z;
}

function test1($a,$b){
$this->tested = $a + $b;
return $this->tested;
}

function test2($c,$d,$e,$f){
$this->test2 = $c + $d;
$this->test3 = $this->test1($e,$f) + $this->test2 + $this->z();
return $this->test3;
}

}
$whynot = new test();
echo $whynot->test2(10,10,10,20);
?>
[:::/CODE:::]

I don't have any real use for this code to work after this point, I'm just
trying to generate somesort of script that makes sense to me. As my previous
attempt at jumping feet first into classes failed miserably.

I guess I'm just confused on why you would want to initialize a variable and
not assign a value to it if you know what it is? Like in my Database class,
I made my username, pass, localhost, etc variables initiated with their
values, but kept getting errors from mysql that I didn't have a "Valid"
mysql resource. I guess after reading this in 4 books and on php.net, they
all do this but none of them go into WHY it's so important.

Part of my concern is that I'm being told, or atleast reading that you
initialize them for the class, but if the class structure is already in
place for the variables inside each method to be local to that class, I
don't see the relevance for initialization. Man this sounds dumb cuz I just
know there's a reason, I just can't find it. Any help would be appreciated.
Thanks.

Wolf
--- End Message ---
--- Begin Message ---
* Thus wrote PHP Email List ([EMAIL PROTECTED]):
> Why is it in a class, so important for you to initialize your $variables?
> 
> In the following example, I have my class started and then took out or
> atleast commented my "var $variable" and the code still does what it should.
> So why is it so important that you initialize these variables this way?
> 
> [:::CODE:::]
>  class test {
> 
>   //var $z;   <--This is the part I don't see
>   the relevance in doing as here this is
>   commented out and the class works as expected.
> ...
> 
> I guess I'm just confused on why you would want to initialize a variable and
> not assign a value to it if you know what it is? Like in my Database class,
> I made my username, pass, localhost, etc variables initiated with their
> values, but kept getting errors from mysql that I didn't have a "Valid"
> mysql resource. I guess after reading this in 4 books and on php.net, they
> all do this but none of them go into WHY it's so important.

Defining a variable in a class using 'var $z', keeps some sort of
structure for the class.  PHP has always kept the creation of
variables simple for the programmer and classes arn't an exception.
You will find, however, that most classes you'll see will have the
variables defined.

PHP5 actuall expands on the declaration of variables, it adds a
few new ways to define va

RE: [PHP] Way OT MySql Update

2004-05-06 Thread Angelo Zanetti
tried the mysql manual??? its got the date_Add function

DATE_ADD(date,INTERVAL expr type)

from manual:

mysql> SELECT DATE_ADD("1999-01-01", INTERVAL 1 DAY);
   -> 1999-01-02
mysql> SELECT DATE_ADD("1999-01-01", INTERVAL 1 HOUR);
   -> 1999-01-01 01:00:00

If you use really incorrect dates, the result is NULL. If you add MONTH,
YEAR_MONTH, or YEAR and the resulting date has a day that is larger than the
maximum day for the new month, the day is adjusted to the maximum days in
the new month:

mysql> SELECT DATE_ADD('1998-01-30', INTERVAL 1 MONTH);
-> 1998-02-28
hope this helps
Angelo

-Original Message-
From: John W. Holmes [mailto:[EMAIL PROTECTED]
Sent: Thursday, May 06, 2004 2:22 PM
To: Dave Carrera; [EMAIL PROTECTED]
Subject: Re: [PHP] Way OT MySql Update


From: "Dave Carrera" <[EMAIL PROTECTED]>
> I have a date column and have added a datenew column and want to do a
table
> wide update to make datenew 1 year more that date.

UPDATE yourtable SET datenew = dateorig + INTERVAL 1 YEAR;

Although... if "datenew" is always one year more than "dateorig", why would
you need another column?

SELECT dateorig, dateorig + INTERVAL 1 YEAR AS datenew, ... FROM ...

??

---John Holmes...

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


Disclaimer 
This e-mail transmission contains confidential information,
which is the property of the sender.
The information in this e-mail or attachments thereto is 
intended for the attention and use only of the addressee. 
Should you have received this e-mail in error, please delete 
and destroy it and any attachments thereto immediately. 
Under no circumstances will the Cape Technikon or the sender 
of this e-mail be liable to any party for any direct, indirect, 
special or other consequential damages for any use of this e-mail.
For the detailed e-mail disclaimer please refer to 
http://www.ctech.ac.za/polic or call +27 (0)21 460 3911

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



[PHP] Re: Login page

2004-05-06 Thread Erik Gjertsen
I forgot the error messages:
Warning: mysql_real_escape_string() expects parameter 2 to be resource, null
given in /home2/erik/gjertsen-www/Skole22/Loggin/login.php on line 28

Warning: mysql_real_escape_string() expects parameter 2 to be resource, null
given in /home2/erik/gjertsen-www/Skole22/Loggin/login.php on line 28

and 1.. is line 28 there error massages com.

thanks
Erik Gjertsen.
"Erik Gjertsen" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> I have made a login page but I got an error on line 1.
>
> Can some one please help me to solve the problem
>
>
>  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
> http://www.w3.org/1999/xhtml";>
> 
> LoggInn
> 
> 
>
> 
>  # login.php
> if (isset($_POST['submit'])) { // Handel the form.
>  require_once('../../../Connections/innlogging.php');
>
>  mysql_select_db($database_innlogging, $innlogging);
>  $query_logginn = "SELECT usrid, username, password1 FROM users";
>  $logginn = mysql_query($query_logginn, $innlogging) or
die(mysql_error());
>  $row_logginn = mysql_fetch_assoc($logginn);
>  $totalRows_logginn = mysql_num_rows($logginn);
>
>
> // Crating a function for  escaping the data.
> function escape_data ($data) {
>   global $dbc; //meed the connection
>   if (ini_get('magic_quotes_gpc')) {
>$data = stripslashes($data);
>}
>   1 return mysql_real_escape_string($data, $dbc);
>   } // end of function
>
>   $message = NULL; // Create an enpty new variable
>   // Check for a username
>  if (empty($_POST['username'])) {
>   $username = FALSE;
>   $message .= 'You forgot to enter your username!';
>  } else {
>   $username = escape_data($_POST['username']);
>  }
>  // Check for a Password
>  if (empty($_POST['password1'])) {
>   $password1 = FALSE;
>   $message .= 'You forgot to enter your password!';
>  } else {
>   $password1 = escape_data($_POST['password1']);
>  }
>  if ($username && $password1) { //if everything's ok.
>  //Retrieve the user_id an name for that username and password
combination.
>  $query = "SELECT usrid name FROM users WHERE username='$username' AND
> password1=PASSWORD('$password1')";
>  $result = @mysql_query ($query); //Run the query
>  $row = mysql_fetch_array ($result, MYSQL_NUM); //Return a record, if
> applicable.
>  if ($row) { //A record was pulled from the database.
>   //Set the cookies & redirect.
>   setcookie ('name', $row[1]);
>   setcookie ('usrid', $row[1]);
>   header ("Location: http://"; . $_SERVER['HTTP_HOST'] .
> dirname($_SERVER['PHP_SELF']) . "/Loggedin.php");
>   exit(); //Quit the script
>  } else { // No record matched the query.
>   $message = 'The username and password entered do not match on
> file.';
>  }
>  mysql_close(); // Close the databaseconection.
> } else {
>  $message = 'Please try again.';
>  }
> } // End of themail submitconditional.
>
> //Print the error message if ther is one
> if (isset($message)) {
>  echo '', $message, '';
> }
>
> ?>
>
> 
> Enter your information in the form below:
> User Name:  maxlength="20" value=" (isset($_POST['username'])) echo $_POST['username']; ?>" />
>
> Password:  maxlength="20" />
>  />
> 
> 
> 
> 
>
>
> Thanks
> Erik Gjertsen

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



Re: [PHP] Way OT MySql Update

2004-05-06 Thread John W. Holmes
From: "Dave Carrera" <[EMAIL PROTECTED]>
> I have a date column and have added a datenew column and want to do a
table
> wide update to make datenew 1 year more that date.

UPDATE yourtable SET datenew = dateorig + INTERVAL 1 YEAR;

Although... if "datenew" is always one year more than "dateorig", why would
you need another column?

SELECT dateorig, dateorig + INTERVAL 1 YEAR AS datenew, ... FROM ...

??

---John Holmes...

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



Re: [PHP] strip comments from HTML?

2004-05-06 Thread John W. Holmes
From: "Justin French" <[EMAIL PROTECTED]>

> This isn't working:
> $text = preg_replace('//','',$text);
>
> Can someone advise what characters I need to escape, or whatever to get
> it going?

$text = preg_replace('//su','',$text);

The 's' modifier will allow the expression to pick up multi-line comments by
allowing the dot character to match newlines and the 'u' modifier makes it
'ungreedy', so that if you have


HTML example


only the comments themselves are matched and not everything from the first
"".

---John Holmes...

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



[PHP] gifs, icons etc

2004-05-06 Thread Brent Clark
Hi all

I would like to know if any body has a url for free some icons and, or small
pics that can be used in a site \ page
development.

I was looking at a project call dotproject.
And I noticed a lot of kewl small pics.

I dont want to infringe on any licenses etc

Kind Regards
Brent Clark

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



Re: [PHP] strip comments from HTML?

2004-05-06 Thread Tom Rogers
Hi,

Thursday, May 6, 2004, 3:02:16 PM, you wrote:
JF> Hi,

JF> This isn't working:
JF> $text = preg_replace('//','',$text);

JF> Can someone advise what characters I need to escape, or whatever to get
JF> it going?

JF> TIA

JF> ---
JF> Justin French
JF> http://indent.com.au


you may need '//s' if your comment spans lines

-- 
regards,
Tom

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



[PHP] Way OT MySql Update

2004-05-06 Thread Dave Carrera
Hi List,

Sorry for this being way off topic but I need some help with a MySql sql
update.

I have a date column and have added a datenew column and want to do a table
wide update to make datenew 1 year more that date.

So:

Date = 2003-05-06
Datenew should be 2004-05-06

Each row should update the datenew for 1 year more that date col value.

Thank you for any help you may give and once again sorry for being ot.

Dave Carrera


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.677 / Virus Database: 439 - Release Date: 04/05/2004
 

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



RE: [PHP] Login page

2004-05-06 Thread Jay Blanchard
[snip]
# login.php??
[/snip]


If that is in fact line 1 then the # sign is the problem. Use either //
or /* */ style comments.

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



RE: [PHP] Login page

2004-05-06 Thread Angelo Zanetti
# login.php??

-Original Message-
From: Erik Gjertsen [mailto:[EMAIL PROTECTED]
Sent: Thursday, May 06, 2004 12:43 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Login page 


I have made a login page but I got an error on line 1.

Can some one please help me to solve the problem


http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
http://www.w3.org/1999/xhtml";>

LoggInn




You forgot to enter your username!';
 } else {
  $username = escape_data($_POST['username']);
 }
 // Check for a Password
 if (empty($_POST['password1'])) {
  $password1 = FALSE;
  $message .= 'You forgot to enter your password!';
 } else {
  $password1 = escape_data($_POST['password1']);
 }
 if ($username && $password1) { //if everything's ok.
 //Retrieve the user_id an name for that username and password combination.
 $query = "SELECT usrid name FROM users WHERE username='$username' AND
password1=PASSWORD('$password1')";
 $result = @mysql_query ($query); //Run the query
 $row = mysql_fetch_array ($result, MYSQL_NUM); //Return a record, if
applicable.
 if ($row) { //A record was pulled from the database.
  //Set the cookies & redirect.
  setcookie ('name', $row[1]);
  setcookie ('usrid', $row[1]);
  header ("Location: http://"; . $_SERVER['HTTP_HOST'] .
dirname($_SERVER['PHP_SELF']) . "/Loggedin.php");
  exit(); //Quit the script
 } else { // No record matched the query.
  $message = 'The username and password entered do not match on
file.';
 }
 mysql_close(); // Close the databaseconection.
} else {
 $message = 'Please try again.';
 }
} // End of themail submitconditional.

//Print the error message if ther is one
if (isset($message)) {
 echo '', $message, '';
}

?>


Enter your information in the form below:
User Name: 

Password: 







Thanks
Erik Gjertsen

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


Disclaimer 
This e-mail transmission contains confidential information,
which is the property of the sender.
The information in this e-mail or attachments thereto is 
intended for the attention and use only of the addressee. 
Should you have received this e-mail in error, please delete 
and destroy it and any attachments thereto immediately. 
Under no circumstances will the Cape Technikon or the sender 
of this e-mail be liable to any party for any direct, indirect, 
special or other consequential damages for any use of this e-mail.
For the detailed e-mail disclaimer please refer to 
http://www.ctech.ac.za/polic or call +27 (0)21 460 3911

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



RE: [PHP] File management.

2004-05-06 Thread Jay Blanchard
[snip]
Is there any php set for file management ?
The only thing I want is a set of PHP functions that allows me add and remove 
lines from a file.
Is there any thing done ?
[/snip]

See http://www.php.net/fopen

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



RE: [PHP] Login page

2004-05-06 Thread Jay Blanchard
[snip]
I have made a login page but I got an error on line 1.
[/snip]

What is line 1? and what error do you get?

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



Re: [PHP] strip comments from HTML?

2004-05-06 Thread Marius Dascalu

--- David T-G <[EMAIL PROTECTED]> wrote:
> Marius, et al --
> 
> ...and then Marius Dascalu said...
> % 
> % --- Justin French <[EMAIL PROTECTED]> wrote:
> % > 
> % > This isn't working:
> % > $text = preg_replace('//','',$text);
> ...
> % 
> % Hi, 
> 
> Hello!
> 
> 
> % 
> % You must escape "-" (minus sign) because is a
> % meta-character for regular expressions. See 
> 
> What?  No.
> 
> 
> %
>
http://www.php.net/manual/en/pcre.pattern.syntax.php.
> 
> From that same link:
> 
>   Part of a pattern that is in square brackets is
> called a "character  
>   class". In a character class the only
> meta-characters are:   
> 
>   
>   \ 
>   
>  general escape character   
>   
> 
>   
>   ^ 
>   
>  negate the class, but only if the first
> character 
> 
>   
>   - 
>   
>  indicates character range  
>   
> 
>   
>   ] 
>   
>  terminates the character class
> 
> So you only have to worry about a minus if you're in
> a [a-z] range, and
> even then you can put a minus in without having to
> resort to backslashes.
> 
> 
> % Your line of code might be:
> % 
> % 
> % $text =
> preg_replace('//','',$text);
> % 
> 
> Then, again, it might not ;-)
> 
> 
> % 
> % This line of code, if you are parsing HTML file
> row by
> % row, strips only "one line" comments. Comments
> spanned
> % on multiple lines are unaffected.
> 
> Agreed.  Let's leave that to the student to work
> out, shall we? :-)
> 
> 
> %  
> % HTH
> % 
> % Marius
> 
> 
> HTH & HAND
> 
> :-D
> -- 
> David T-G
> [EMAIL PROTECTED]
> http://justpickone.org/davidtg/  Shpx gur
> Pbzzhavpngvbaf Qrprapl Npg!
> 
> 

> ATTACHMENT part 2 application/pgp-signature 

K, my fault (but the script is functional in both
variants - tested in SciTE).
That is 2nd faulty response sended by me to list. At
the 3rd I will unsubscribe :-)

HAND




__
Do you Yahoo!?
Win a $20,000 Career Makeover at Yahoo! HotJobs  
http://hotjobs.sweepstakes.yahoo.com/careermakeover 

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



Re: [PHP] Re: HTTP_REFERER ... ?

2004-05-06 Thread Tristan . Pretty
I echoed it, and got a blank variable...
We ahve full admin rights on my server, and the one we're checking the 
referer from...

Basically, our system has an exsiting user database, and we wanna allow 
users to loging as per usual, and but allow them (and only them) to veiw 
pages on the new server...
I just thought that htt_referer was the easiest way to do that, as I only 
wanna let people in, who have signed in on the first server first..

Am I making any snece?





David Robley <[EMAIL PROTECTED]> 
06/05/2004 02:46

To
[EMAIL PROTECTED]
cc

Subject
[PHP] Re: HTTP_REFERER ... ?






[EMAIL PROTECTED] (Tristan Pretty) wrote in 
news:OF19FCC4A7.F49C9B83-ON80256E8B.00544E7D-
[EMAIL PROTECTED]:

> if ($_SERVER['HTTP_REFERER'] == 'http://www.mysite.com/') {
> // Stuff
> }
> 
> Now why does this not work?
> I wanna asign varibales based on certain referers...
> but this is not working?
> 
> Any ideas why?

HTTP_REFERER is empty because the page was not called from a link? Or 
HTTP_REFERER is empty because the browser doesn't supply the value?

Echo the variable and see what you get.

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





*
The information contained in this e-mail message is intended only for 
the personal and confidential use of the recipient(s) named above.  
If the reader of this message is not the intended recipient or an agent
responsible for delivering it to the intended recipient, you are hereby 
notified that you have received this document in error and that any
review, dissemination, distribution, or copying of this message is 
strictly prohibited. If you have received this communication in error, 
please notify us immediately by e-mail, and delete the original message.
***

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



[PHP] File management.

2004-05-06 Thread Carles Xavier Munyoz Baldó
Hi
Is there any php set for file management ?
The only thing I want is a set of PHP functions that allows me add and remove 
lines from a file.
Is there any thing done ?

Greetings.
---
Carles Xavier Munyoz Baldó
[EMAIL PROTECTED]
http://www.unlimitedmail.net/
---

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



[PHP] Login page

2004-05-06 Thread Erik Gjertsen
I have made a login page but I got an error on line 1.

Can some one please help me to solve the problem


http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
http://www.w3.org/1999/xhtml";>

LoggInn




You forgot to enter your username!';
 } else {
  $username = escape_data($_POST['username']);
 }
 // Check for a Password
 if (empty($_POST['password1'])) {
  $password1 = FALSE;
  $message .= 'You forgot to enter your password!';
 } else {
  $password1 = escape_data($_POST['password1']);
 }
 if ($username && $password1) { //if everything's ok.
 //Retrieve the user_id an name for that username and password combination.
 $query = "SELECT usrid name FROM users WHERE username='$username' AND
password1=PASSWORD('$password1')";
 $result = @mysql_query ($query); //Run the query
 $row = mysql_fetch_array ($result, MYSQL_NUM); //Return a record, if
applicable.
 if ($row) { //A record was pulled from the database.
  //Set the cookies & redirect.
  setcookie ('name', $row[1]);
  setcookie ('usrid', $row[1]);
  header ("Location: http://"; . $_SERVER['HTTP_HOST'] .
dirname($_SERVER['PHP_SELF']) . "/Loggedin.php");
  exit(); //Quit the script
 } else { // No record matched the query.
  $message = 'The username and password entered do not match on
file.';
 }
 mysql_close(); // Close the databaseconection.
} else {
 $message = 'Please try again.';
 }
} // End of themail submitconditional.

//Print the error message if ther is one
if (isset($message)) {
 echo '', $message, '';
}

?>


Enter your information in the form below:
User Name: 

Password: 







Thanks
Erik Gjertsen

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



Re: [PHP] strip comments from HTML?

2004-05-06 Thread David T-G
Marius, et al --

...and then Marius Dascalu said...
% 
% --- Justin French <[EMAIL PROTECTED]> wrote:
% > 
% > This isn't working:
% > $text = preg_replace('//','',$text);
...
% 
% Hi, 

Hello!


% 
% You must escape "-" (minus sign) because is a
% meta-character for regular expressions. See 

What?  No.


% http://www.php.net/manual/en/pcre.pattern.syntax.php.

From that same link:

  Part of a pattern that is in square brackets is called a "character  
  class". In a character class the only meta-characters are:   
   
  \
 general escape character  
   
  ^
 negate the class, but only if the first character 
   
  -
 indicates character range 
   
  ]
 terminates the character class

So you only have to worry about a minus if you're in a [a-z] range, and
even then you can put a minus in without having to resort to backslashes.


% Your line of code might be:
% 
% 
% $text = preg_replace('//','',$text);
% 

Then, again, it might not ;-)


% 
% This line of code, if you are parsing HTML file row by
% row, strips only "one line" comments. Comments spanned
% on multiple lines are unaffected.

Agreed.  Let's leave that to the student to work out, shall we? :-)


%  
% HTH
% 
% Marius


HTH & HAND

:-D
-- 
David T-G
[EMAIL PROTECTED]
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!



pgpAVyM41dMQO.pgp
Description: PGP signature


Re: [PHP] strip comments from HTML?

2004-05-06 Thread David T-G
Justin --

...and then Justin French said...
% 
% Hi,

Hi!


% 
% This isn't working:
% $text = preg_replace('//','',$text);
% 
% Can someone advise what characters I need to escape, or whatever to get 
% it going?

Well, what do you want it to do?  On my system that properly replaces the
entire commented string with nothing.  An example which puts something
else there instead:

  \nHi\n\n" ;
  $text = preg_replace('//','blah',$text) ;
  print "text is .$text.\n";

  ?>

This yields

  text is .
  Hi
  blah
  .

as expected.

Note that since you're just replacing the entire comment with '' you
needn't bother with the () around whatever may be in the middle, too.


% 
% TIA
% 
% ---
% Justin French
% http://indent.com.au


HTH & HAND

:-D
-- 
David T-G
[EMAIL PROTECTED]
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!



pgpVphnFfsLba.pgp
Description: PGP signature


[PHP] Re: I can't make session work, but cookie can, why?

2004-05-06 Thread Torsten Roehr
"Told" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> I can't make session work if I set "session.use_trans_sid = 0", or I must
> append SID to the URI to get session work.
> And, the cookie works OK.
>
> Here is my test code:
>
>  session_start();
>
> if (!isset($_SESSION['test'])) {   // First time you call it.
> echo "No session found - starting a session now.";
> $_SESSION['test'] = "welcome back!";
>
> } else {   // Subsequent times you call it
> echo "Session found - ".$_SESSION['test'];
> echo "Sessions are working correctly";
> }
>
> file://not work
> echo "Reload this page 1";
> echo "Reload this
> page 2";
> echo "Reload
> this page 3";
>
> file://only this URL works OK.
> echo "Reload this page 4";
> ?>

If this works, where's your problem?

Regards, Torsten

>
> My system:
> system: Windows 2000  Apache 1.3.29(and also tested under Apache 2.0.43)
> PHP 4.3.5(SAPI)
>
> php.ini settings:
> Directive   Value
> 
> session.auto_start  Off
> session.bug_compat_42  Off
> session.bug_compat_warn  On
> session.cache_expire  180
> session.cache_limiter  nocache
> session.cookie_domain  no value
> session.cookie_lifetime  3600
> session.cookie_path  c:\cookie
> session.cookie_secure  Off
> session.entropy_file  no value
> session.entropy_length  0
> session.gc_divisor  1000
> session.gc_maxlifetime  1440
> session.gc_probability  1
> session.name PHPSESSID  PHPSESSID
> session.referer_check  no value
> session.save_handler  files
> session.save_path  c:\cookie
> session.serialize_handler php
> session.use_cookies  On
> session.use_only_cookies Off
> session.use_trans_sid  Off
>
>
> Thanks for any advice.

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



[PHP] I can't make session work, but cookie can, why?

2004-05-06 Thread TooooOld
I can't make session work if I set "session.use_trans_sid = 0", or I must
append SID to the URI to get session work.
And, the cookie works OK.

Here is my test code:

No session found - starting a session now.";
$_SESSION['test'] = "welcome back!";

} else {   // Subsequent times you call it
echo "Session found - ".$_SESSION['test'];
echo "Sessions are working correctly";
}

//not work
echo "Reload this page 1";
echo "Reload this
page 2";
echo "Reload
this page 3";

//only this URL works OK.
echo "Reload this page 4";
?>

My system:
system: Windows 2000  Apache 1.3.29(and also tested under Apache 2.0.43)
PHP 4.3.5(SAPI)

php.ini settings:
Directive   Value

session.auto_start  Off
session.bug_compat_42  Off
session.bug_compat_warn  On
session.cache_expire  180
session.cache_limiter  nocache
session.cookie_domain  no value
session.cookie_lifetime  3600
session.cookie_path  c:\cookie
session.cookie_secure  Off
session.entropy_file  no value
session.entropy_length  0
session.gc_divisor  1000
session.gc_maxlifetime  1440
session.gc_probability  1
session.name PHPSESSID  PHPSESSID
session.referer_check  no value
session.save_handler  files
session.save_path  c:\cookie
session.serialize_handler php
session.use_cookies  On
session.use_only_cookies Off
session.use_trans_sid  Off


Thanks for any advice.

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



Re: [PHP] Class Help Extended

2004-05-06 Thread Torsten Roehr
"Richard Harb" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> More often than not it's a good thing to assign 'default' values to
> class variables like that.
>
> In this case though I've observed that common practice is to get the
> user/pass values from a config file and pass them along as variables
> when creating an instance of the class.

I'm defining things like DB access values as constants in my config file
rather than as global variables. This way I can make absolutely sure that
they are not accidently changed anywhere in my application. As constants are
globally available you don't need to pass them to every class method that is
using them.



Regards, Torsten

>
> Classes are most beneficial if you can take your class include file
> from one project to the next and just pass along different parameters
> and they work. Including user/pass would force you to edit/change
> those values on every project you use that class in.
>
> HTH
> Richard

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



Re: [PHP] strip comments from HTML?

2004-05-06 Thread Marius Dascalu

--- Justin French <[EMAIL PROTECTED]> wrote:
> Hi,
> 
> This isn't working:
> $text = preg_replace('//','',$text);
> 
> Can someone advise what characters I need to escape,
> or whatever to get 
> it going?
> 
> TIA
> 
> ---
> Justin French
> http://indent.com.au
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

Hi, 

You must escape "-" (minus sign) because is a
meta-character for regular expressions. See 
http://www.php.net/manual/en/pcre.pattern.syntax.php.
Your line of code might be:


$text = preg_replace('//','',$text);


This line of code, if you are parsing HTML file row by
row, strips only "one line" comments. Comments spanned
on multiple lines are unaffected.
 
HTH

Marius




__
Do you Yahoo!?
Win a $20,000 Career Makeover at Yahoo! HotJobs  
http://hotjobs.sweepstakes.yahoo.com/careermakeover 

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



RE: [PHP] Class Help Extended

2004-05-06 Thread PHP Email List
> More often than not it's a good thing to assign 'default' values to
> class variables like that.
>
> In this case though I've observed that common practice is to get the
> user/pass values from a config file and pass them along as variables
> when creating an instance of the class.
>
> Classes are most beneficial if you can take your class include file
> from one project to the next and just pass along different parameters
> and they work. Including user/pass would force you to edit/change
> those values on every project you use that class in.
>
> HTH
> Richard

True, I do realize that classes are "suppose" to be as portable as possible.
I just wasn't sure from a security stand point that if the dbconfig file is
in with the dbclass file, if it really made a difference since they are both
off of the webtree and being "included" if you will.  :)

I much appreciate the feed back. Thanks for your time.

Man PHP ROCKS!! However I only feel that I've only begun to scratch the
surface of it's power. I still haven't done file uploads and directory
listings yet, soon Danielson.soon.

And the sad part is...sigh, I've just finished a b.e.a.utiful login script
for one of my client's and now I need to rewrite it so that it's a class,
cuz heck I want it for my site too.

$smiley = ":)";
include_once(evil_laugh.php);
echo $laugh $smiley;
//Echo'd: Muuuhahahahahah :)

Thanks again. :}
Wolf

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