Re: [PHP] login library

2002-03-27 Thread Andrey Hristov

For example use session_ids. This does not mean that use MUST use PHP session module. 
Store a unique string in the DB and set it as
cookie for the user. When someone logs generate a string, write it in the members 
table and old session is removed, so the user with
old session will be not able to access pages except if relogging and thus expiring 
second login.

Best regards,
Andrey


- Original Message -
From: "Michal Dvoracek" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, March 28, 2002 9:58 AM
Subject: [PHP] login library


> Hello,
>
> i want to write some application that requires users login.
>
> So i have question how i can check duplicity login (eg. browser crash,
> login from one computer using two browsers, ...). I need some idea
> (the best will be some example code :) ).
>
> Thank you.
>
> Michal Dvoracek  [EMAIL PROTECTED]
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


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




[PHP] login library

2002-03-27 Thread Michal Dvoracek

Hello,

i want to write some application that requires users login.

So i have question how i can check duplicity login (eg. browser crash,
login from one computer using two browsers, ...). I need some idea
(the best will be some example code :) ).

Thank you.

Michal Dvoracek  [EMAIL PROTECTED]


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




[PHP] Break up query into pages using PHP from MsSQL

2002-03-27 Thread Dean Householder

I'm trying to split results into different pages and number the pages
accordingly. I'm using PHP and accessing a MsSQL database. I've been able to
build a fairly intelligent page numbering system which knows which rows it
should pull (at least by numbering each row numerically) but I don't know
how to construct a SQL query to pull 10 results starting at a certain
number. I know MySQL has a function called offset. This combined with the
limit function would be great! But MsSQL doesn't seem to work in the same
way. Here's what I have so far:

SELECT count(id) FROM members WHERE bla bla bla

then load that into a variable called $total.

SELECT TOP 10 * FROM members WHERE bla bla bla

TOP is the function to only pull a certain number of records. (I had to
figure that out the hard way!) I was thinking of possibly making the WHERE
statement like

WHERE id >= $start AND id <= $start + 10

But that only works if my indexes are consistant. Which they aren't!  As I
see it, I either need to reindex the table, find a function in MsSQL that
works, or pull everything into a big PHP array and try to sort it out there.

Any hints or suggestions would be greatly appreciated!!!

Thanks,
Dean


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




[PHP] Re: PHP-CGI and script files not found

2002-03-27 Thread Donald

Hey,
I tried to open a php file on my server that dosn't exist and php gave me a
404 error.
I am running w2k, apache, php 4.1.2 as a module.

Try having them run the php as a mod. with apache (if possible).
-Donald
www.magentica.com





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




[PHP] does this newsserver work with office x entourage?

2002-03-27 Thread andy

Hi there,

I am trying to get the php news on my apple machine. The newsgroups are
listed and I can connect to the newsserver. Signing up for a newsgroup
works, too. But the trouble starts, when I try to read the news. I am
getting the message: can't find server

did anybody experiance the same prob? Other newsservers are running with
this software.

Thanx, Andy



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




Re: [PHP] How to write file containing shell script?

2002-03-27 Thread Dalton Hunter

"Miguel Cruz" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> On Thu, 28 Mar 2002, Miguel Cruz wrote:
> > Right. I think the "No such file or directory" message is because it's
> > failing to find an interpreter called "/bin/bash\r".
>
> Sorry, I mean "/bin/sh\r". Habit.
>
> miguel
>

Thanks miguel, that was the problem. The original PHP file was indeed being
saved in TextPad as "PC" thus adding that \r. I resaved it as "Unix" and the
shell script runs fine. :)


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.343 / Virus Database: 190 - Release Date: 3/22/02



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




Re: [PHP] How to write file containing shell script?

2002-03-27 Thread Miguel Cruz

On Thu, 28 Mar 2002, Miguel Cruz wrote:
> Right. I think the "No such file or directory" message is because it's 
> failing to find an interpreter called "/bin/bash\r".

Sorry, I mean "/bin/sh\r". Habit.

miguel


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




Re: [PHP] How to write file containing shell script?

2002-03-27 Thread Jason Wong

On Thursday 28 March 2002 15:03, Dalton Hunter wrote:

> them in Textpad afterward. For example the script contains ...
>
> 
> // BEGIN PHP SCRIPT THAT GENERATES SHELL SCRIPT
>
> $sbackup = "#!/bin/sh

Do you actually terminate each line of your shell script with \n?

ie shouldn't that be:

$sbackup = "#!/bin/sh\n ... 

??


> sh: ./shell_script: No such file or directory

Have you tried

  cat shell_script

to see whether it 'looks' ok?


-- 
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk

/*
Of course a platonic relationship is possible -- but only between
husband and wife.
*/

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




Re: [PHP] How to write file containing shell script?

2002-03-27 Thread Miguel Cruz

On Wed, 27 Mar 2002, Dalton Hunter wrote:
> "Miguel Cruz" <[EMAIL PROTECTED]> wrote:
>> Make sure you use unix-style line endings (just \n and no \r).
> 
> Hi, thanks for your reply. I should have been a little clearer. The file is
> created as a result of a PHP script not in TextPad. I am only comparing them
> in Textpad afterward. For example the script contains ...
> 
>  
> // BEGIN PHP SCRIPT THAT GENERATES SHELL SCRIPT
> 
> $sbackup = "#!/bin/sh
> ... multiple line shell script in here ...
> ";
>
> ... and it creates the file fine but when I go to execute the shell script
> it returns ...
> 
> sh: ./shell_script: No such file or directory

Right. I think the "No such file or directory" message is because it's 
failing to find an interpreter called "/bin/bash\r".

Assuming you're creating the PHP file in Textpad, save it with Unix line
endings rather than Windows line endings. This is a Textpad option (I'm
sitting at the OSX machine so I can't check exactly where it is at the
moment, but trust me, I've used it earlier today).

I think that when your string literal breaks onto the next line, PHP is 
obediently including your Windows-style line endings in $sbackup and thus 
the shell_script file.

> I tried to add a \n at the end of each line in the PHP script but no
> luck.

Windows line ending = \r\n
Unix line ending = \n

So adding a \n won't help. You need to get rid of the invisible \r, using 
the method described above.

miguel


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




Re: [PHP] How to write file containing shell script?

2002-03-27 Thread Dalton Hunter

"Miguel Cruz" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> On Wed, 27 Mar 2002, Dalton Hunter wrote:
> > Hi, I am trying to write a file that contains a shell script. The file
> > writes to the server but when I try to execute it it fails with a
> > command not found error. But if I copy and paste the files contents into
> > a new text file using Textpad on my PC and upload it to the same
> > directory it works?! It is not related to permissions as both files are
> > 777 and I am root? The only difference I could tell is when I compare
> > the files in Textpad although the contents are identical, the failed
> > file is slightly larger and has a file type of "Netscape" in the File
> > Properties while the other has a file type of "PC"? Any ideas?
>
> Make sure you use unix-style line endings (just \n and no \r).
>
> Textpad sort of transparently opens files with different line ending
> styles, though it does tell you in one of those little status boxes at the
> bottom - if it's showing DOS or Windows or whatever when you open it, then
> the shell probably won't execute it.
>
> An alternative would be to use text/ASCII (not binary) FTP to transfer it
> to the server. This will automatically fix the line endings.
>
> miguel
>

Hi, thanks for your reply. I should have been a little clearer. The file is
created as a result of a PHP script not in TextPad. I am only comparing them
in Textpad afterward. For example the script contains ...



... and it creates the file fine but when I go to execute the shell script
it returns ...

sh: ./shell_script: No such file or directory

eventhough it is there. If I copy the files contents into a new Texpad
document on my PC and upload to the server it works fine. I tried to add a
\n at the end of each line in the PHP script but no luck. I think it might
have something to do with the line endings.


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.343 / Virus Database: 190 - Release Date: 3/22/02



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




[PHP]:Remote mail access

2002-03-27 Thread Vimala

Hi,

Does anyone have php scripts/program that can be used to access PINE 
mails (LINUX) from Netscape browser?

Please help

Thank you in advance

vim



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




Re: [PHP] How to write file containing shell script?

2002-03-27 Thread Miguel Cruz

On Wed, 27 Mar 2002, Dalton Hunter wrote:
> Hi, I am trying to write a file that contains a shell script. The file
> writes to the server but when I try to execute it it fails with a
> command not found error. But if I copy and paste the files contents into
> a new text file using Textpad on my PC and upload it to the same
> directory it works?! It is not related to permissions as both files are
> 777 and I am root? The only difference I could tell is when I compare
> the files in Textpad although the contents are identical, the failed
> file is slightly larger and has a file type of "Netscape" in the File
> Properties while the other has a file type of "PC"? Any ideas?

Make sure you use unix-style line endings (just \n and no \r).

Textpad sort of transparently opens files with different line ending 
styles, though it does tell you in one of those little status boxes at the 
bottom - if it's showing DOS or Windows or whatever when you open it, then 
the shell probably won't execute it.

An alternative would be to use text/ASCII (not binary) FTP to transfer it 
to the server. This will automatically fix the line endings.

miguel


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




Re: [PHP] Get a specified amount of text?

2002-03-27 Thread Miguel Cruz

On Sat, 23 Mar 2002, Donald wrote:
> In Visual Basic there is a function called left.
> usage: left(string, len)
> It allows you to get the first 'len' characters of 'string'.
> 
> Is there a similar function in PHP?
> 
> I have a value:
> "3.405"
> That I just want to crop to "3.40"
> If I pass "3.405" to MySQL it adds it like this: "3.41"

In PHP there is something called the manual.

   http://www.php.net/substr

miguel


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




[PHP] How to write file containing shell script?

2002-03-27 Thread Dalton Hunter

Hi, I am trying to write a file that contains a shell script. The file
writes to the server but when I try to execute it it fails with a command
not found error. But if I copy and paste the files contents into a new text
file using Textpad on my PC and upload it to the same directory it works?!
It is not related to permissions as both files are 777 and I am root? The
only difference I could tell is when I compare the files in Textpad although
the contents are identical, the failed file is slightly larger and has a
file type of "Netscape" in the File Properties while the other has a file
type of "PC"? Any ideas?



---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.343 / Virus Database: 190 - Release Date: 3/22/02



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




[PHP] Get a specified amount of text?

2002-03-27 Thread Donald

In Visual Basic there is a function called left.
usage: left(string, len)
It allows you to get the first 'len' characters of 'string'.

Is there a similar function in PHP?

I have a value:
"3.405"
That I just want to crop to "3.40"
If I pass "3.405" to MySQL it adds it like this: "3.41"

Thanks
-Donald



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




Re: [PHP] while loop: detect next loop?

2002-03-27 Thread Jason Wong

On Thursday 28 March 2002 05:20, Erik Price wrote:
> On Wednesday, March 27, 2002, at 04:11  PM, Matt Friedman wrote:
> > When you have all your items in an array use implode to add a character
> > in between every item.
> >
> > $str = implode($yourArray, $separator);
> >
> > This will add the separator to the end of each string except the last
> > one.
>
> I like that idea, but I don't think it would work in this case -- for
> one thing, the array is a pointer to a mysql_fetch_assoc() result, so I
> am not sure how to implode that (not saying it can't be done), and for
> another, I would have to explode the array again and would lose the
> separator.
>
> Unless... unless I were to implode with say, a bogus separator AND a
> 'real' separator, and then explode using only the bogus separator
> (leaving the 'real' separator hanging onto the end of each element).
>
> This seems like it could work, but in a complex array like a
> mysql_fetch_assoc() result, I'm not sure how to implode.

All this imploding and exploding would probably eat lots of memory and CPU 
time if you have a large amount of data.

What I do is just remove the extra bits after the while loop has finished.


-- 
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk

/*
I base my fashion taste on what doesn't itch.
-- Gilda Radner
*/

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




Re: [PHP] Uploading big files

2002-03-27 Thread Rasmus Lerdorf

> Is it because of the memory_limit that it doesn't work ?

Yes

> Do I have a way to upload files (over 7M) on the server without increasing the
> memory_limit ?

Not until PHP 4.2

-Rasmus


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




Re: [PHP] regex

2002-03-27 Thread Matt Moreton

preg syntax is different to ereg (which you are using).  You also need to
provide an output variable.

This would work:

preg_match( "/[0-9]+/", $input, $output );

--
Matt

"Carl E Shmidt" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Now I'm looking to find 1 or more digits in an input:
>
> preg_match("[[:digit:]]",$valToEval);
>
> I'm passing the value "12" and this thing still returns 0.  What's going
on?
>
> Carl
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php


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




[PHP] Uploading big files

2002-03-27 Thread pierre . marcandella

Hi,
I need confirmation on this matter :

The scripts I use to upload files work fine until the file exceed 7 M.
No specific error message appears. 

The hidden input MAX_FILE_SIZE is included in the scripts.

My scripts are running on php 4.1.2.

The php.ini file is set up as follow :
max_execution_time = 1
memory_limit = 8388608
post_max_size = 30M
file_uploads = On
upload_tmp_dir =
upload_max_filesize = 30M

Is it because of the memory_limit that it doesn't work ?
Do I have a way to upload files (over 7M) on the server without increasing the 
memory_limit ?

Thanks for your help.

Pierre

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




Re: [PHP] Help! Recent PHP security patch => high server load?

2002-03-27 Thread Rasmus Lerdorf

I don't really see how that patch could cause that.  Any chance of an
truss or a gdb backtrace or something on one of these guys to give us a
clue?

-Rasmus

On Thu, 28 Mar 2002, Jason Murray wrote:

> Hi folks,
>
> Just curious to know if anyone has experienced a high server
> load since installing the recent security patch to PHP 4.0.6?
>
> Our Production team is reporting that the web servers running
> www.melbourneit.com.au are currently running at a load average
> of 30+, and this has been the case since the security patch
> was installed.
>
> These servers are Sun 420's running Solaris SunOS 7, 1 Gig
> RAM, Apache 1.3.19, Apache JServ 1.1.2, PHP 4.0.6 + patch so
> you can imagine how we're surprised at the high load on them...
>
> Has anyone else experienced this or similar?
>
> Jason
>
> --
> Jason Murray
> [EMAIL PROTECTED]
> Web Developer, Melbourne IT
> "Work now, freak later!"
>
> --
> 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] Can you use null?

2002-03-27 Thread Justin French

Hi,

Just do a test on the result of the image URL field, and if the field value
is "null" (or ""), change the field to a default image URL...

";

?>


Justin French

Creative Director
http://Indent.com.au




on 28/03/02 2:32 PM, Chuck "PUP" Payne ([EMAIL PROTECTED]) wrote:

> I am wanting to know if I can use null to call up an image? I am writing a
> page that talks to calls to a database for cars. There a field where calls
> on photo names, but if someone doesn't have a photo. Mysql puts null, I want
> to be able to use that null to call an image.
> 
> 
> 
> | Chuck Payne  |
> | Magi Design and Support  |
> | www.magidesign.com   |
> | [EMAIL PROTECTED]   |
> 
> 
> BeOS, Macintosh 68K, Classic, and OS X, Linux Support.
> Web Design you can afford.
> 
> "Never be bullied into silence. Never allow yourself to be made a victim.
> Accept no one's definition of your life; define yourself."- Harvey Fierstein
> 
> 


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




[PHP] Help! Recent PHP security patch => high server load?

2002-03-27 Thread Jason Murray

Hi folks,

Just curious to know if anyone has experienced a high server
load since installing the recent security patch to PHP 4.0.6?

Our Production team is reporting that the web servers running
www.melbourneit.com.au are currently running at a load average
of 30+, and this has been the case since the security patch 
was installed.

These servers are Sun 420's running Solaris SunOS 7, 1 Gig 
RAM, Apache 1.3.19, Apache JServ 1.1.2, PHP 4.0.6 + patch so 
you can imagine how we're surprised at the high load on them...

Has anyone else experienced this or similar? 

Jason

-- 
Jason Murray
[EMAIL PROTECTED]
Web Developer, Melbourne IT
"Work now, freak later!"

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




Re: [PHP] Sessions/Cookies and HTTP Auth

2002-03-27 Thread maxwello

When using cookies,  if you don't set an expiration time, the cookie is only
good until the session expires.  It doesn't get saved, and it disappears
when the user closes their browser.

Many browsers have different settings/preferences for session cookies, and
because they don't get saved to your disk, you may not be prompted.

This might also explain someone's question a little while back (not sure if
it got answered or not) about why they couldn't find the cookie on their
hdd.

Maxwell


- Original Message -
From: "David McInnis" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, March 27, 2002 7:10 PM
Subject: [PHP] Sessions/Cookies and HTTP Auth


>
> Here is the scenario.
>
> 1.  I set my browser to block all cookies.
> 2.  I access this script.
> 3.  I am thinking that I should get an error because I presume that
> session_start() will attempt to set a cookie (which it appears to do).
> (I tried setcookie() too and the cookie was accepted.)
>
> My question is this.
>
> When using httpauth, does httpauth override your cookie preferences?
>
> David
>
>
> *** my code **
>
>
>  require "/home/www/common/_ini/_main.ini.php";
>
> $auth = false; // Assume user is not authenticated
>
> if (isset( $PHP_AUTH_USER ) && isset($PHP_AUTH_PW)) {
>
> $sql = "SELECT * FROM staff WHERE
> username = '$PHP_AUTH_USER' AND
> password = '$PHP_AUTH_PW'";
>
> $result = @mysql_query($sql, $connection)
> or die ('Database Error - Could not select create data
> from projects.');
>
> // Get number of rows in $result.
>
> $numrows = mysql_num_rows( $result );
>
> if ( $numrows > 0 ) {
>
> // A matching row was found - the user is authenticated.
>
> $auth = true;
>
> }
>
> }
>
> if ( ! $auth ) {
>
> header( 'WWW-Authenticate: Basic realm="Private Extranet"' );
> header( 'HTTP/1.0 401 Unauthorized' );
> echo 'Authorization Required.';
> exit;
>
> } else {
> session_start();
> echo 'You are authorized!';
> phpinfo();
> }
>
> ?>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>



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




[PHP] HELP PLEASE!

2002-03-27 Thread GENESiS DESiGNS

Hello,

My problem is I have a form that submits it info to a mysql table, well then I 
have a page that calls it from the mysql table and displays whatever is in the 
mysql table. So, what script do I use to make it display multiple entrys?? Here 
is the code:

---



:: Rider 
Profiles ::



Add your profile



 First 
Name:



 Last 
Name:



 D.O.B:



 City:



 State:



 E-
mail:



 Dirt 
Bike:



 Class:



 Years 
Riding:



 Favorite 
Track:



 Sponsors:



 Injuries:



 Comments:






Add your profile





---
That will only display one entry... how do i make it display all the entrys?? 
Thanks!!


-Sean
Kennedy


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




RE: [PHP] raven & register & site_s & spafinder

2002-03-27 Thread Martin Towell

oops sorry for that - wrong address!

-Original Message-
From: Martin Towell [mailto:[EMAIL PROTECTED]]
Sent: Thursday, March 28, 2002 3:16 PM
To: '[EMAIL PROTECTED]'
Subject: [PHP] raven & register & site_s & spafinder
Importance: High


I have finally figured out why I get logged straight out of tabby as soon as
I log in.

When I log onto tabby (through cc.dev.syd.world.net), I get $SITE_S as
"wtb_tabby" (as it's meant to be) but when
register.syd.world.net/RSEARCH.html loads, it changes it to
"spafinder_trade".

Whoever is doing this - can you make sure the $SITE_S variable doesn't get
mangled as this logs people out of tabby as soon as they log in - NOT GOOD

Can you tell me when it's fixed so that I can continue on with my stuff.

Martin

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

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




[PHP] raven & register & site_s & spafinder

2002-03-27 Thread Martin Towell

I have finally figured out why I get logged straight out of tabby as soon as
I log in.

When I log onto tabby (through cc.dev.syd.world.net), I get $SITE_S as
"wtb_tabby" (as it's meant to be) but when
register.syd.world.net/RSEARCH.html loads, it changes it to
"spafinder_trade".

Whoever is doing this - can you make sure the $SITE_S variable doesn't get
mangled as this logs people out of tabby as soon as they log in - NOT GOOD

Can you tell me when it's fixed so that I can continue on with my stuff.

Martin

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




Re: [PHP] imap problems

2002-03-27 Thread gaukia 345

Hi Duncan,

Also working with IMAP because I'm writing a webmail. Haven't met this 
problem before but if I were you, I'd consider the following steps

1) Check if the IMAP daemon is running. Type "nmap localhost" at your shell 
to see if IMAP daemon (port 143, and it appears as imap2 on my server) is 
running. If it's not running AND you're using UWash IMAP server, type 
"chkconfig imap on" to run it. For Cyrus, I think the procedure is the same 
though I dare not confirm.

2) If your IMAP daemon is still not running, maybe someone who shared your 
server accidentally misconfigured some files. You can re-install IMAP 
server. I suggest using RPM instead of compiling source. Download from 
rpmfind.net. That's the easier and hassle-free way. I don't think you need 
to re-configure PHP after installing IMAP, provided the PHP-IMAP extension 
is intact since your last successful attempt.

Hope that helps.

Anyway, are you using UWash IMAP server?

Gaukia



_
Chat with friends online, try MSN Messenger: http://messenger.msn.com


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




[PHP] regex

2002-03-27 Thread Carl E Shmidt

Now I'm looking to find 1 or more digits in an input:

preg_match("[[:digit:]]",$valToEval);

I'm passing the value "12" and this thing still returns 0.  What's going on?

Carl



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




RE: [PHP] using return in fucntions

2002-03-27 Thread Martin Towell

How do you mean, it didn't work in other cases? Did the file(s) get
included? did they execute? did they execute properly?

I'm thinking, just by looking at it, that the answer to the last question is
"no". The reason why I say that can be shown in a very simple example:

main.php


other.inc
 $x\n";
?>

The value of $x wont get echoed out the second time because it's basically
in the function, while the first isn't.

If I've confused you, email me direct and I'll try to explain better

Martin


-Original Message-
From: Justin French [mailto:[EMAIL PROTECTED]]
Sent: Thursday, March 28, 2002 2:33 PM
To: php
Subject: [PHP] using return in fucntions


Hi all,

I've USED fucntions, i've MODIFIED functions, but to date I haven't written
much in the way of reuseable code/functions.  I'm at the point now where I
can identify what sort of code could better be controlled by a function
library, and want to get started on creating my own.

However, I'm getting snagged on the smallest things... but maybe i'm
expecting too much from PHP, or asking the wrong questions.  "return" seems
to stump me the most.  I've checked out the manual under "return" and
"returning-values", but i'm still a little blank.

I'm sure there are some tutorials out there, but can't really find any that
attack it from the angle I need, as yet.


Anyhoo, perhaps I can learn by example.  I find myself doing a lot of
include files, and have been writing this code:




I'm sure there's a better way, such as using or die("something");  ANYWAY,
the above code seems to me like a good candidate for a function...
something like safe_include('somedir/something.php');

So I had a go...



... and it worked in some instances, but did not in others (forgive me, it's
been a while since I tested it).  I'm sure return() should be used here, but
I'm not sure how/where/why to use it, or more importantly, the
purpose/reasoning behind it in comparison to "echo" etc etc.


Many many many thanks in advance, and apologies for the the long email!


Justin French

Creative Director
http://Indent.com.au



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

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




[PHP] Can you use null?

2002-03-27 Thread Chuck \"PUP\" Payne

I am wanting to know if I can use null to call up an image? I am writing a
page that talks to calls to a database for cars. There a field where calls
on photo names, but if someone doesn't have a photo. Mysql puts null, I want
to be able to use that null to call an image.


 
 | Chuck Payne  |
 | Magi Design and Support  |
 | www.magidesign.com   |
 | [EMAIL PROTECTED]   |
 

BeOS, Macintosh 68K, Classic, and OS X, Linux Support.
Web Design you can afford.

"Never be bullied into silence. Never allow yourself to be made a victim.
Accept no one's definition of your life; define yourself."- Harvey Fierstein



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




[PHP] using return in fucntions

2002-03-27 Thread Justin French

Hi all,

I've USED fucntions, i've MODIFIED functions, but to date I haven't written
much in the way of reuseable code/functions.  I'm at the point now where I
can identify what sort of code could better be controlled by a function
library, and want to get started on creating my own.

However, I'm getting snagged on the smallest things... but maybe i'm
expecting too much from PHP, or asking the wrong questions.  "return" seems
to stump me the most.  I've checked out the manual under "return" and
"returning-values", but i'm still a little blank.

I'm sure there are some tutorials out there, but can't really find any that
attack it from the angle I need, as yet.


Anyhoo, perhaps I can learn by example.  I find myself doing a lot of
include files, and have been writing this code:




I'm sure there's a better way, such as using or die("something");  ANYWAY,
the above code seems to me like a good candidate for a function...
something like safe_include('somedir/something.php');

So I had a go...



... and it worked in some instances, but did not in others (forgive me, it's
been a while since I tested it).  I'm sure return() should be used here, but
I'm not sure how/where/why to use it, or more importantly, the
purpose/reasoning behind it in comparison to "echo" etc etc.


Many many many thanks in advance, and apologies for the the long email!


Justin French

Creative Director
http://Indent.com.au



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




[PHP] Sessions/Cookies and HTTP Auth

2002-03-27 Thread David McInnis


Here is the scenario.

1.  I set my browser to block all cookies.
2.  I access this script.
3.  I am thinking that I should get an error because I presume that
session_start() will attempt to set a cookie (which it appears to do).  
(I tried setcookie() too and the cookie was accepted.)

My question is this.

When using httpauth, does httpauth override your cookie preferences?

David


*** my code **


 0 ) {

// A matching row was found - the user is authenticated.

$auth = true;

}

}

if ( ! $auth ) {

header( 'WWW-Authenticate: Basic realm="Private Extranet"' );
header( 'HTTP/1.0 401 Unauthorized' );
echo 'Authorization Required.';
exit;

} else {
session_start();
echo 'You are authorized!';
phpinfo();
}

?>



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




[PHP] Again my question about Building Libraries

2002-03-27 Thread Alexandre Soares

> Hi All,
>
>
> This is my first participation in this group, so my question is I
> write a function in c, but I need use this function and more joined in a
> library make using the command ar rc alexlib.a x.o, but this procedure
show
> a error when I use this in my browser, please anyone can help me.
>
> thanks
>
> example
>
> file x.c
>
> int function addvalue ( int *a )
> {
>  *a = *a + 1;
>  return (a);
> }
>
>
> gcc -c x.c
> ar rc alexlib.a x.o
>
>
> php
>
>
>   phpinclude ("alexlib.a");
>  $a = 1;
>  $b = addvalue ( $a );
>  print ( "Value = 4b ");
> ?>
>
>
>
>



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




Re: [PHP] db driven site on IIS

2002-03-27 Thread Ben Turner

In my experiances ASP didn't handle this task well.  I would suggest looking
at www.microsoft.com to see how they accomplish what you are attempting.  It
isn't as pretty as Apache handles it but their's works.  They accomplish it
by sending the files via querystring and then parsing out the querystring to
produce the pages.  If you have any experiance with Search engines you will
know that most engines don't like querystrings all that much and they won't
retain the querystrings in most cases.  MS does a detect to determine that
you are a user and then shuttles you along to a pretty page with everything
wrapped around the information.

The only thing I could figure out when I attempted this in ASP and tried to
do it the anti querystring method was to write a single file for each page
that made the call to the database.  These files where simple one liners
that called upon the DB to display the information.  They were also
autogenerated by the application that I wrote for users to input the data.

IMO Apache is far superior to IIS is setting this up (and to think I started
as an IIS/ASP buff).  Just make sure that you send the browser the correct
headers when creating these pages or the search engine will believe that it
is still receiving a 404 error.

Ben

- Original Message -
From: "olinux" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, March 27, 2002 7:20 PM
Subject: [PHP] db driven site on IIS


> Hi all,
>
> My company is considering a move from static to db
> driven site.
>
> I am looking for a solution to allow URL's to be
> structured in "search engine friendly" format [i.e.
> http://website.com/region/article/article_id ] as
> search engine traffic is very important.
>
> I have found some great resources for doing this on
> apache but nothing for IIS. I think there is a
> solution if php is ISAPI module, but I have heard that
> this is quite unstable.
>
> I would like to use mySQL as the db (majority of
> selects will be simple selects)
>
> Currently our site is on a windows server and with a
> recent (large) investment in an ASP/MSSQL db project
> they do not want to move from IIS. I'm not familiar
> with ASP so I'd rather not go that route.
>
> We are a news site with about 6000 articles and 15-20
> additions each day. 600,000 monthly page views growing
> by @ 40,000 per month.
>
> Thanks much,
> olinux
>
> __
> Do You Yahoo!?
> Yahoo! Movies - coverage of the 74th Academy Awards®
> http://movies.yahoo.com/
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

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




[PHP] Header - cache control depends of the server ?

2002-03-27 Thread pierre . marcandella

Hi I am using this to make sure a page is refreshed when the user uses the back 
button of his browser :



When I try on local (Win NT) it works. The page is refreshed.
When I try on an other server (UNIX) it doesn't work.

Is it normal ?
Any idea how I can solve this ?
Thanks for any assistance.

Pierre

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




[PHP] db driven site on IIS

2002-03-27 Thread olinux

Hi all,

My company is considering a move from static to db
driven site. 

I am looking for a solution to allow URL's to be
structured in "search engine friendly" format [i.e.
http://website.com/region/article/article_id ] as
search engine traffic is very important.

I have found some great resources for doing this on
apache but nothing for IIS. I think there is a
solution if php is ISAPI module, but I have heard that
this is quite unstable.

I would like to use mySQL as the db (majority of
selects will be simple selects)

Currently our site is on a windows server and with a
recent (large) investment in an ASP/MSSQL db project
they do not want to move from IIS. I'm not familiar
with ASP so I'd rather not go that route.

We are a news site with about 6000 articles and 15-20
additions each day. 600,000 monthly page views growing
by @ 40,000 per month.

Thanks much,
olinux

__
Do You Yahoo!?
Yahoo! Movies - coverage of the 74th Academy Awards®
http://movies.yahoo.com/

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




Re: [PHP] Any PHP equivalent of Macromedia ColdFusion's location tag?

2002-03-27 Thread webapprentice

I now recall that ColdFusion's location tag accepts no data parameters, so
you can't pass data to it.  It is essentially a redirect.  Thus, it may be
doing an HTTP header location under the hood.

In ColdFusion, I may have logic like so:
-

 

OK!




I don't get any errors, so I think it buffers the entire output first and
then throws away if it determines if it needs to go elsewhere.

In PHP, it would look something like this:



   


This will not run, because of the whitespace.  I presume PHP immediately
begins the http/html stream as soon as it sees non-php code.

In ColdFusion, it doesn't care about the whitespace.
In PHP, it does care about the whitespace.

That is what I discovered in my original problem.  I had a whitespace
between the php identifiers.  I simply closed off the whitespace, and I was
fine.

Thanks for clarifying all this.

Sincerely,
Stephen






- Original Message -
From: "Rasmus Lerdorf" <[EMAIL PROTECTED]>
To: "webapprentice" <[EMAIL PROTECTED]>
Cc: "James" <[EMAIL PROTECTED]>; "Jason Murray"
<[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Wednesday, March 27, 2002 12:24 AM
Subject: Re: [PHP] Any PHP equivalent of Macromedia ColdFusion's location
tag?


> > Hi Mr. Lerdorf,
> > I look forward to you upcoming O'Reilly PHP book. =)
> >
> > Yes, a META tag refresh or Javascript control seems to be the only way
left.
> > Strange that URL redirection is so unusual to implement in PHP compared
to
> > ASP or Coldfusion (unless they do something klunky under the hood).
>
> They do. There is no magic here. If you want output on a page and also do
> a redirect, the only way to do it is with a javascript meta-refresh (well,
> you can do some tricks with frames as well, but I lump those tricks under
> Javascript redirects). I don't care what ASP of Cold Fusion tells you, if
> they allow you to send some data for the page and then redirect, then they
> are either doing a Javascript meta-refresh or simply tossing your data and
> doing a Location redirect.
>
> If you have no output, then you can use a Location redirect.  What ASP and
> Cond Fusion might do is buffer your output and simply throw it away if you
> then at some point do a Location redirect.  That seems kind of silly to me
> though.  It seems like a mistake to me to just chuck away output data like
> that.  You can do that with PHP as well by turning on output buffering.
> You can send all sorts of output after a Location redirect, but there will
> be no browser around to see it because it has already received the
> Location redirect and is off viewing the other page.
>
> > Anyway, I also noticed that when the manual says you cannot output
ANYTHING,
> > I found out that if I close out all my spaces in the PHP page by
tightening
> > the php container tags, I will not output anything first.  I forgot that
> > even whitespace would be considered a web page and would generate http
> > headers (since the PHP processor probably translates whitespace as
> > echo/print statements).
>
> Yup, a space is as valid a character as any other.
>
> -Rasmus
>
> PS. One of the things with PHP is that we have never gone out of our way
> to hide the actual mechanics of HTTP very much from the users.  I think it
> is important for people to actually understand what is going on.  That's
> why we don't have a redirect() function but instead tell you to send an
> HTTP header called Location.  Because that is what needs to happen under
> the covers.
>


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




RE: [PHP] regex expession problems

2002-03-27 Thread Martin Towell

I don't have that much experience with preg* functions but if that's exactly
how you've got it in your code, shouldn't there be no spaces??
that is:

preg_match("/http:\/\/ | [[:space:]]/i",$valToEval);
  * *
  \-\both of these should be removed ?



-Original Message-
From: Carl E Shmidt [mailto:[EMAIL PROTECTED]]
Sent: Thursday, March 28, 2002 11:41 AM
To: [EMAIL PROTECTED]
Subject: [PHP] regex expession problems


But hey, who doesn't have em eh?  Anyway, here's my predicament.  I want to
look for either the string "http://";  or for 1 or more spaces in a string.
Here's the regex I've got

preg_match("/http:\/\/ | [[:space:]]/i",$valToEval);

I can get each test case working individually, but as soon as I combine
them, it no longer works.  What's going on here?


Carl



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

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




[PHP] regex expession problems

2002-03-27 Thread Carl E Shmidt

But hey, who doesn't have em eh?  Anyway, here's my predicament.  I want to
look for either the string "http://";  or for 1 or more spaces in a string.
Here's the regex I've got

preg_match("/http:\/\/ | [[:space:]]/i",$valToEval);

I can get each test case working individually, but as soon as I combine
them, it no longer works.  What's going on here?


Carl



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




Re: [PHP] odbc_fetch_array() Not Available?

2002-03-27 Thread eric.coleman

Good one.. hehe

Maybe Rasmus was going to notice this, and fix it ;P

Hehe,
Eric

- Original Message -
From: "Miguel Cruz" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Wednesday, March 27, 2002 6:41 PM
Subject: Re: [PHP] odbc_fetch_array() Not Available?


> On Wed, 27 Mar 2002 [EMAIL PROTECTED] wrote:
> >>> I am running php 4.1.1, and when i try to use odbc_fetch_array, it
says
> >>> "Call to undefined function"
> >>>
> >>> Why is this?
> >>
> >> Maybe your installation of PHP was not built with ODBC support? It's a
> >> compile-time option.
> >
> > Well, why would all the other ODBC function works?
>
> Good point. A quick click to the manual page at
>
>http://www.php.net/odbc_fetch_array
>
> reveals that you're not the first person to notice this, and someone has
> provided a workaround. The manual is a good first place to go when dealing
> with problems. You don't have to wait for people to respond, and you don't
> take time away from solving more complex problems that aren't immediately
> addressed in the manual.
>
> Like how I turned my mistake around into a lecture at you? That's what I
> learned in management school.
>
> miguel
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>


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




[PHP] Re: Nevermind I figured it out

2002-03-27 Thread Prolog

David,

There is a better way to do through a similar operator.

$variable = "hello and welcome";
$variable .= " to www.newimagedesign.com";

therefore...

print ($variable);

would result in...

hello and welcome to www.newimagedesign.com

hope this helps.

-Jordan K. Martin
New Image Design

-

"David Johansen" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> I just user $message = $message . "Some text";
> But is there a "better" way to do this with something like the +=
operator?
> Dave
>
> "David Johansen" <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > I was just wondering if there was a way to add new text to the end of
> > strings. I tried doing
> > $message += "Some text here";
> > but that just set $message to 0. I'm sure it's something simple  but I
> > couldn't find anything on it in the documentation.
> > Dave
> >
> >
>
>



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




Re: [PHP] odbc_fetch_array() Not Available?

2002-03-27 Thread Miguel Cruz

On Wed, 27 Mar 2002 [EMAIL PROTECTED] wrote:
>>> I am running php 4.1.1, and when i try to use odbc_fetch_array, it says
>>> "Call to undefined function"
>>> 
>>> Why is this?
>> 
>> Maybe your installation of PHP was not built with ODBC support? It's a 
>> compile-time option.
> 
> Well, why would all the other ODBC function works?

Good point. A quick click to the manual page at 

   http://www.php.net/odbc_fetch_array

reveals that you're not the first person to notice this, and someone has 
provided a workaround. The manual is a good first place to go when dealing 
with problems. You don't have to wait for people to respond, and you don't 
take time away from solving more complex problems that aren't immediately 
addressed in the manual.

Like how I turned my mistake around into a lecture at you? That's what I 
learned in management school.

miguel


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




Re: [PHP] odbc_fetch_array() Not Available?

2002-03-27 Thread eric.coleman

Well, why would all the other ODBC function works?

Thanks,
Eric

- Original Message - 
From: "Miguel Cruz" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Wednesday, March 27, 2002 5:58 PM
Subject: Re: [PHP] odbc_fetch_array() Not Available?


> On Wed, 27 Mar 2002 [EMAIL PROTECTED] wrote:
> > I am running php 4.1.1, and when i try to use odbc_fetch_array, it says
> > "Call to undefined function"
> > 
> > Why is this?
> 
> Maybe your installation of PHP was not built with ODBC support? It's a 
> compile-time option.
> 
> miguel
> 
> 
> 


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




Re: [PHP] odbc_fetch_array() Not Available?

2002-03-27 Thread Miguel Cruz

On Wed, 27 Mar 2002 [EMAIL PROTECTED] wrote:
> I am running php 4.1.1, and when i try to use odbc_fetch_array, it says
> "Call to undefined function"
> 
> Why is this?

Maybe your installation of PHP was not built with ODBC support? It's a 
compile-time option.

miguel


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




Re: [PHP] preg_replace - regex for replace string

2002-03-27 Thread James Taylor

Hm, nevermind my question :) I'm not thinking straight, not enough sleep.

On Wednesday 27 March 2002 02:53 pm, you wrote:
> On Wed, 27 Mar 2002, James Taylor wrote:
> > On Wednesday 27 March 2002 02:49 pm, you wrote:
> >> On Wed, 27 Mar 2002, James Taylor wrote:
> >>> I'm trying to do something to the effect of this for a preg_replace
> >>> statement:
> >>>
> >>> $string = "Hello\n\n\n\n\n\n\nHow are you?\n\n\n\n\n\n\n\nHi";
> >>> $string = preg_replace("/\n\n/", "/\n/", $string);
> >>>
> >>>
> >>> But, it appears the 'replace' portion of the function doesn't allow for
> >>> regex.  How can I do this so that I CAN have the second statement be
> >>> regex?
> >>
> >> I think you just have your syntax messed up. You don't need delimiters
> >> around the second argument.
> >>
> >>   $string = preg_replace("/\n\n/", "\n", $string);
> >
> > This is just an example.  There are some cases where I need the second
> > option to be a regular expression, the same way that you can do in Perl
> > regex...
>
> Regular expressions are for matching. Can you provide an example that
> illustrates what you're trying to do?
>
> miguel

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




Re: [PHP] preg_replace - regex for replace string

2002-03-27 Thread Miguel Cruz

On Wed, 27 Mar 2002, James Taylor wrote:
> Ok, let me try to refine this as the big picture.  User enters something into
> a form.
> 
> We take that form value and convert newlines into  though nl2br.
> 
> Then, I want the limit the number of consecutive 's a user can enter,
> to avoid abuse via a person just holding down enter for a while.
> 
> $message = nl2br($message);
> $message = preg_replace("/\n/", "", $message);
> 
> while (stristr($message, '')) {
>$message = str_replace('', '', $message);
> }

If you want to keep it to a maximum of, say, 2  tags, then why not 
just use something like:

  $message =
 preg_replace('/(\w*){2,}/', '', nl2br($message));

miguel


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




Re: [PHP] preg_replace - regex for replace string

2002-03-27 Thread James Taylor


Ok, let me try to refine this as the big picture.  User enters something into
a form.

We take that form value and convert newlines into  though nl2br.

Then, I want the limit the number of consecutive 's a user can enter,
to avoid abuse via a person just holding down enter for a while.

$message = nl2br($message);
$message = preg_replace("/\n/", "", $message);

while (stristr($message, '')) {
   $message = str_replace('', '', $message);
}

For some reason, nl2br leaves a newline after each  in the actual code.
So, If I type something in like:

Hello


How are you?


The string will contain the value:

Hello



How are you?


it NEEDS to say:

HelloHow are you?

I just can't get this to work at all.  I think my head's going to explode, as
I've been trying to get this to work for a few hours now





On Wednesday 27 March 2002 02:53 pm, you wrote:
> This is just an example.  There are some cases where I need the second
> option to be a regular expression, the same way that you can do in Perl
> regex...
>
> On Wednesday 27 March 2002 02:49 pm, you wrote:
> > On Wed, 27 Mar 2002, James Taylor wrote:
> > > I'm trying to do something to the effect of this for a preg_replace
> > > statement:
> > >
> > > $string = "Hello\n\n\n\n\n\n\nHow are you?\n\n\n\n\n\n\n\nHi";
> > > $string = preg_replace("/\n\n/", "/\n/", $string);
> > >
> > >
> > > But, it appears the 'replace' portion of the function doesn't allow for
> > > regex.  How can I do this so that I CAN have the second statement be
> > > regex?
> >
> > I think you just have your syntax messed up. You don't need delimiters
> > around the second argument.
> >
> >   $string = preg_replace("/\n\n/", "\n", $string);
> >
> > miguel


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




Re: [PHP] preg_replace - regex for replace string

2002-03-27 Thread Miguel Cruz

On Wed, 27 Mar 2002, James Taylor wrote:
> On Wednesday 27 March 2002 02:49 pm, you wrote:
>> On Wed, 27 Mar 2002, James Taylor wrote:
>>> I'm trying to do something to the effect of this for a preg_replace
>>> statement:
>>>
>>> $string = "Hello\n\n\n\n\n\n\nHow are you?\n\n\n\n\n\n\n\nHi";
>>> $string = preg_replace("/\n\n/", "/\n/", $string);
>>>
>>>
>>> But, it appears the 'replace' portion of the function doesn't allow for
>>> regex.  How can I do this so that I CAN have the second statement be
>>> regex?
>>
>> I think you just have your syntax messed up. You don't need delimiters
>> around the second argument.
>>
>>   $string = preg_replace("/\n\n/", "\n", $string);
> 
> This is just an example.  There are some cases where I need the second option
> to be a regular expression, the same way that you can do in Perl regex...

Regular expressions are for matching. Can you provide an example that
illustrates what you're trying to do?

miguel


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




Re: [PHP] preg_replace - regex for replace string

2002-03-27 Thread James Taylor


This is just an example.  There are some cases where I need the second option
to be a regular expression, the same way that you can do in Perl regex...

On Wednesday 27 March 2002 02:49 pm, you wrote:
> On Wed, 27 Mar 2002, James Taylor wrote:
> > I'm trying to do something to the effect of this for a preg_replace
> > statement:
> >
> > $string = "Hello\n\n\n\n\n\n\nHow are you?\n\n\n\n\n\n\n\nHi";
> > $string = preg_replace("/\n\n/", "/\n/", $string);
> >
> >
> > But, it appears the 'replace' portion of the function doesn't allow for
> > regex.  How can I do this so that I CAN have the second statement be
> > regex?
>
> I think you just have your syntax messed up. You don't need delimiters
> around the second argument.
>
>   $string = preg_replace("/\n\n/", "\n", $string);
>
> miguel


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




Re: [PHP] preg_replace - regex for replace string

2002-03-27 Thread Miguel Cruz

On Wed, 27 Mar 2002, James Taylor wrote:
> I'm trying to do something to the effect of this for a preg_replace statement:
> 
> $string = "Hello\n\n\n\n\n\n\nHow are you?\n\n\n\n\n\n\n\nHi";
> $string = preg_replace("/\n\n/", "/\n/", $string);
> 
> 
> But, it appears the 'replace' portion of the function doesn't allow for 
> regex.  How can I do this so that I CAN have the second statement be regex?

I think you just have your syntax messed up. You don't need delimiters
around the second argument.

  $string = preg_replace("/\n\n/", "\n", $string);

miguel


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




[PHP] preg_replace - regex for replace string

2002-03-27 Thread James Taylor

I'm trying to do something to the effect of this for a preg_replace statement:

$string = "Hello\n\n\n\n\n\n\nHow are you?\n\n\n\n\n\n\n\nHi";
$string = preg_replace("/\n\n/", "/\n/", $string);


But, it appears the 'replace' portion of the function doesn't allow for 
regex.  How can I do this so that I CAN have the second statement be regex?

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




RE: [PHP] class question 2

2002-03-27 Thread Martin Towell

once their instantiated, they're just like any other variable - that is: if
a "normal" variable, declared in the same place as the object, is accessable
in another function, then the object will be too.

HTH
Martin


-Original Message-
From: Caspar Kennerdale [mailto:[EMAIL PROTECTED]]
Sent: Thursday, March 28, 2002 1:17 PM
To: Php-General-List (E-mail)
Subject: [PHP] class question 2



Sorry Another question-

Do instances of classes remain in 'communication' with each other if
declared my different functions in a case switch statement.

At present I have an admin.php which is one long swtich statement.

Wihin each is a list iof functions which created the elements of the page

Each of these functions are defined in anither file and are instances of
classes.

If I create an instance of a DB class for exapmle- can I refer to it
thoughout the visit to the website-
ie does it maintaoin its values and variables even if different functions
freom the main index.php page are called

sorry if this is really confusing

any ideas much appreciated



-- 
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] how to close an http connection BUT carry on processing

2002-03-27 Thread Martin Towell

look at ignore_user_abort()
http://www.php.net/manual/en/function.ignore-user-abort.php
but make sure your script doesn't go into an infinate loop anywhere,
otherwise you'll have to kill the process manually caught me once on a
rare occasion.. :/

-Original Message-
From: Rick Emery [mailto:[EMAIL PROTECTED]]
Sent: Thursday, March 28, 2002 12:15 AM
To: 'Peter Clarke'; [EMAIL PROTECTED]
Subject: RE: [PHP] how to close an http connection BUT carry on
processing


Why?

-Original Message-
From: Peter Clarke [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, March 27, 2002 6:03 AM
To: [EMAIL PROTECTED]
Subject: [PHP] how to close an http connection BUT carry on processing


I'm looking for a way to close the connection with the browser yet have the
script carry on doing some processing.
Any ideas?

Peter



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

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

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




[PHP] serialize()

2002-03-27 Thread Rodrigo Peres

Hi list,

I've already look at the php manual but couldn't figure out a way to use
serialize to solve my problem.
I have a form, with many fields like (name, age, adress, state), that I put
a save button. This button allows my user to save the fields already filled
in order to finish the form later. I thought in get the values submited by
the save button and store it as cookie, them read it back later, but how can
I store the fields in cookie with serialize and use it later to complety my
fields again???

Thanks

Rodrigo
-- 



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




Re: [PHP] imap problems

2002-03-27 Thread Duncan

hm,

maybe reinstall imap?
Can i simply reinstall it, or do i also have to configure php again, if i do so?

Regards,

Hendrik



[PHP] odbc_fetch_array() Not Available?

2002-03-27 Thread eric.coleman

I am running php 4.1.1, and when i try to use odbc_fetch_array, it says "Call to 
undefined function"

Why is this?

Thanks,
Eric



RE: [PHP] New php functions?

2002-03-27 Thread Jason Murray

> I went to php.net wnating info on the date() function.  To my 
> surprise the word date was already in the "search for" field.  

It was probably the last thing you looked for there. I know I
constantly go back to look up Date() placeholders. :)

J

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




[PHP] New php functions?

2002-03-27 Thread charlesk

I went to php.net wnating info on the date() function.  To my surprise the word date 
was already in the "search for" field.  

Has PHP developed some new functions?

Possible code



If not are these ever planned as I have use for them.  

Thanks
Charles Killmer

PS In case you are wondering yes this is supposed to be humorous.  ;-)

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




Re: [PHP] Query bug

2002-03-27 Thread Erik Price


On Wednesday, March 27, 2002, at 04:28  PM, Daniel Ferreira Castro wrote:

> This way works, but not the way i would like to.
> Because it selects just the fields "nome","id_proj" and "arquivo" from 
> the
> table ALGORITMO, and here my goal is to select those fileds of 
> ALGORITMO and
> ATAS.

Then why not just add an additional lines?

SELECT ALGORITMO.nome,
 ALGORITMO.id_proj,
 ALGORITMO.arquivo,
 ATAS.nome,
 ATAS.id_proj,
 ATAS.arquivo
FROM   ALGORITMO,
 ATAS
WHERE  ALGORITMO.id_proj=0
ANDALGORITMO.eng=1
OR ALGORITMO.nome="teste"
OR ATAS.nome="de"
OR ATAS.nome="parse";
OR


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




[PHP] Re: Comparrison

2002-03-27 Thread Steve Clay

Ron,

You probably want strstr().  or stristr().
Just as a usability recommendation on you code below, please don't restrict your pages
to IE only..  This would be better:

if (!strstr($HTTP_USER_AGENT,"MSIE 5.5") {
  print "Please note this page has functionality designed for IE5.5";
}

Users of perfectly good browsers like Mozilla, Opera, and IE5/mac won't be
locked out.

Steve

Wednesday, March 27, 2002, 7:46:12 AM, Ron wrote:
R> How would I compare to variables where I would want one variable to equal
R> only part or some of the other variable?
R> Here is the code

R>  if ($HTTP_USER_AGENT !== "%MSIE 5.5%") {
R>  print "You must upgrade your browser";
R> } else {
R>  exit;
R> }

?>>

R> Any suggestions



-- 
[EMAIL PROTECTED] ** http://mrclay.org


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




[PHP] imap problems

2002-03-27 Thread Duncan

Hi,

i uploaded a script, which checks my inbox for new messages by using the imap 
extension for php.
However, everything was working just fine, but now every time i try to access my 
script, i get a "server not found" error and the logs say:

[Wed Mar 27 21:21:13 2002] [notice] child pid 11854 exit signal Segmentation fault (11)

I tracked it down to:

$box = imap_open("{".$mail_server.":110/pop3}INBOX", $mail_username, $mail_password);

Whenever any php file includes this line, it aborts and produces the above error.
Well, strange thing is, that it was working perfect a few hours ago and i didnt change 
a thing on my server till then!

Maybe anyone has an idea?

Thanks in advance,

Duncan



Re: [PHP] Query bug

2002-03-27 Thread Daniel Ferreira Castro

This way works, but not the way i would like to.
Because it selects just the fields "nome","id_proj" and "arquivo" from the
table ALGORITMO, and here my goal is to select those fileds of ALGORITMO and
ATAS.


"Erik Price" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
>
> On Wednesday, March 27, 2002, at 04:00  PM, Daniel Ferreira Castro wrote:
>
> > I want to select the fields nome,id_proj,arquivo FROM ALGORITMO and
> > ATAS.  But when I use the query below, I receive the error "ERROR 1052:
> > Column: 'nome' in field list is ambiguous".  What is wrong on my query?
> >
> > query: SELECT nome,id_proj,arquivo FROM ALGORITMO,ATAS WHERE id_proj=0
> > AND eng=1 OR nome="teste"  OR nome="de"  OR nome="parse";
>
> Daniel, try specifying which table you want the 'nome' column to be used
> in -- the ambiguous part is that many of the tables you are selecting
> FROM have a 'nome' column.  Do it like this:
>
> SELECT ALGORITMO.nome,
> ALGORITMO.id_proj,
> ATAS.arquivo
> FROM   ALGORITMO,
> ATAS
> WHERE  ALGORITMO.id_proj=0
> ANDALGORITMO.eng=1
> OR ALGORITMO.nome="teste"
> OR ATAS.nome="de"
> OR ATAS.nome="parse";
>
> Obviously, I have no idea how you want your query to look, so be sure to
> customize it for your needs, but this demonstrates what you need to do:
> Explicitly state the table whose column you want to access.
>
>
> Erik
>
>
>
>
> 
>
> Erik Price
> Web Developer Temp
> Media Lab, H.H. Brown
> [EMAIL PROTECTED]
>



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




Re: [PHP] while loop: detect next loop?

2002-03-27 Thread Erik Price


On Wednesday, March 27, 2002, at 04:11  PM, Matt Friedman wrote:

> When you have all your items in an array use implode to add a character
> in between every item.
>
> $str = implode($yourArray, $separator);
>
> This will add the separator to the end of each string except the last
> one.

I like that idea, but I don't think it would work in this case -- for 
one thing, the array is a pointer to a mysql_fetch_assoc() result, so I 
am not sure how to implode that (not saying it can't be done), and for 
another, I would have to explode the array again and would lose the 
separator.

Unless... unless I were to implode with say, a bogus separator AND a 
'real' separator, and then explode using only the bogus separator 
(leaving the 'real' separator hanging onto the end of each element).

This seems like it could work, but in a complex array like a 
mysql_fetch_assoc() result, I'm not sure how to implode.


Erik






Erik Price
Web Developer Temp
Media Lab, H.H. Brown
[EMAIL PROTECTED]


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




Re: [PHP] Query bug

2002-03-27 Thread Erik Price


On Wednesday, March 27, 2002, at 04:00  PM, Daniel Ferreira Castro wrote:

> I want to select the fields nome,id_proj,arquivo FROM ALGORITMO and
> ATAS.  But when I use the query below, I receive the error "ERROR 1052:
> Column: 'nome' in field list is ambiguous".  What is wrong on my query?
>
> query: SELECT nome,id_proj,arquivo FROM ALGORITMO,ATAS WHERE id_proj=0
> AND eng=1 OR nome="teste"  OR nome="de"  OR nome="parse";

Daniel, try specifying which table you want the 'nome' column to be used 
in -- the ambiguous part is that many of the tables you are selecting 
FROM have a 'nome' column.  Do it like this:

SELECT ALGORITMO.nome,
ALGORITMO.id_proj,
ATAS.arquivo
FROM   ALGORITMO,
ATAS
WHERE  ALGORITMO.id_proj=0
ANDALGORITMO.eng=1
OR ALGORITMO.nome="teste"
OR ATAS.nome="de"
OR ATAS.nome="parse";

Obviously, I have no idea how you want your query to look, so be sure to 
customize it for your needs, but this demonstrates what you need to do: 
Explicitly state the table whose column you want to access.


Erik






Erik Price
Web Developer Temp
Media Lab, H.H. Brown
[EMAIL PROTECTED]


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




RE: [PHP] preventing "back" button usage?

2002-03-27 Thread Darren Gamble

Good day,

This can be accomplished in a few ways.  The easiest way is to tell the
client not to cache the page.  And yep, you do this via headers.

In PHP (attempting to hit as many types of browsers as possible):

header("Cache-Control: no-store, no-cache, must-revalidate");
header("Pragma: no-cache");

You can also do some fancy redirection with Location headers.

As a failsafe, you should have the processing page make sure that the user
isn't submitting the same thing more than once.


Darren Gamble
Planner, Regional Services
Shaw Cablesystems GP
630 - 3rd Avenue SW
Calgary, Alberta, Canada
T2P 4L4
(403) 781-4948


-Original Message-
From: Erik Price [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, March 27, 2002 2:10 PM
To: [EMAIL PROTECTED]
Subject: [PHP] preventing "back" button usage?


Sorry to plague this list with questions today, but I was hoping someone 
could help me understand a fundamental thing about how browsers work -- 
how can I achieve the effect that many ecommerce sites (such as Amazon) 
use to prevent the user from going "back" in their history?  For obvious 
reasons, I would like to avoid JavaScript to achieve this feat.  I have 
some multi-part forms that I do not wish users to be able to repeat 
accidentally.

I believe it has something to do with a header and the browser's cache, 
but I really don't know anything about it.


TIA,

Erik







Erik Price
Web Developer Temp
Media Lab, H.H. Brown
[EMAIL PROTECTED]


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

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




RE: [PHP] Require variable declaration?

2002-03-27 Thread Johnson, Kirk

You can catch typos by setting the error reporting level to E_ALL (in
php.ini). PHP will then give you a warning whenever a variable is used
before it has been assigned a value.

Kirk

> That's too bad, 
> I used to do some ASP which is weakly typed too but I still 
> could use "Option Explicit" to require variables to be declared. 
> Then a small typo would produce very hard-to-find errors.

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




[PHP] Query bug

2002-03-27 Thread Daniel Ferreira Castro

I have a problem.

I have those tables on my database:
mysql> use projeto;
Database changed

mysql> show tables;
+---+
| Tables_in_projeto |
+---+
| ALGORITMO |
| ATAS  |
| MANUAIS   |
| PROJETO   |
| REFERENCIAS   |
| RELATORIOS|
+---+

mysql> describe ALGORITMO;
+-+--+--+-+-++
| Field   | Type | Null | Key | Default | Extra  |
+-+--+--+-+-++
| id  | int(11)  |  | PRI | NULL| auto_increment |
| id_proj | int(11)  | YES  | | NULL||
| nome| varchar(30)  | YES  | | NULL||
| arquivo | varchar(100) | YES  | | NULL||
| des | tinyint(4)   | YES  | | NULL||
| eng | tinyint(4)   | YES  | | NULL||
+-+--+--+-+-++
6 rows in set (0.00 sec)

mysql> describe ATAS;
+-+--+--+-+-++
| Field   | Type | Null | Key | Default | Extra  |
+-+--+--+-+-++
| id  | int(11)  |  | PRI | NULL| auto_increment |
| id_proj | int(11)  | YES  | | NULL||
| nome| varchar(30)  | YES  | | NULL||
| arquivo | varchar(120) | YES  | | NULL||
| des | tinyint(4)   | YES  | | NULL||
| eng | tinyint(4)   | YES  | | NULL||
+-+--+--+-+-++
6 rows in set (0.00 sec)

mysql> describe MANUAIS;
+-+--+--+-+-++
| Field   | Type | Null | Key | Default | Extra  |
+-+--+--+-+-++
| id  | int(11)  |  | PRI | NULL| auto_increment |
| id_proj | int(11)  | YES  | | NULL||
| nome| varchar(30)  | YES  | | NULL||
| arquivo | varchar(100) | YES  | | NULL||
| des | tinyint(4)   | YES  | | NULL||
| eng | tinyint(4)   | YES  | | NULL||
+-+--+--+-+-++
6 rows in set (0.00 sec)

mysql> describe REFERENCIAS;
+-+--+--+-+-++
| Field   | Type | Null | Key | Default | Extra  |
+-+--+--+-+-++
| id  | int(11)  |  | PRI | NULL| auto_increment |
| id_proj | int(11)  | YES  | | NULL||
| nome| varchar(30)  | YES  | | NULL||
| arquivo | varchar(100) | YES  | | NULL||
| des | tinyint(4)   | YES  | | NULL||
| eng | tinyint(4)   | YES  | | NULL||
+-+--+--+-+-++
6 rows in set (0.02 sec)

mysql> describe RELATORIOS;
+-+--+--+-+-++
| Field   | Type | Null | Key | Default | Extra  |
+-+--+--+-+-++
| id  | int(11)  |  | PRI | NULL| auto_increment |
| id_proj | int(11)  | YES  | | NULL||
| nome| varchar(30)  | YES  | | NULL||
| arquivo | varchar(100) | YES  | | NULL||
| des | tinyint(4)   | YES  | | NULL||
| eng | tinyint(4)   | YES  | | NULL||
+-+--+--+-+-++

I want to select the fields nome,id_proj,arquivo FROM ALGORITMO and ATAS.  But when I 
use the query below, I receive the error "ERROR 1052: Column: 'nome' in field list is 
ambiguous".  What is wrong on my query?

query: SELECT nome,id_proj,arquivo FROM ALGORITMO,ATAS WHERE id_proj=0 AND eng=1 OR 
nome="teste"  OR nome="de"  OR nome="parse";

Thank you

Daniel Ferreira Castro
[EMAIL PROTECTED]



RE: [PHP] Regex Form Filter Help

2002-03-27 Thread Demitrious S. Kelly

Why not just limit it to one ?


stuff";
while ( stristr($string, '') ) {
$string=str_replace('', '', $string);
}
echo $string;
?>

something like that would wok well enough...

-Original Message-
From: James Taylor [mailto:[EMAIL PROTECTED]] 
Sent: Wednesday, March 27, 2002 12:26 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Regex Form Filter Help

I have a site where users can type whatever they want in and it posts it
to a 
database.  I'm trying to eliminate whatever types of abuse I can think
of, 
and, since I'm using nl2br on the posts, I'm afraid a user might just
hold 
down enter for a couple of seconds and scroll everything off the page.
I'm 
trying to figure out a regex pattern that searches for say, more than 5
 strings in a row, and anything after 5 gets stripped out.  Any ideas
on 
how to possibly do this?

-- 
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] Require variable declaration?

2002-03-27 Thread Rick Emery

There has been some discussion at zend.com to add this to PHP5/engine 2.0.
However, the idea was rejected.

-Original Message-
From: Kjell Hansen [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, March 27, 2002 2:54 PM
To: Rick Emery; [EMAIL PROTECTED]
Subject: Re: [PHP] Require variable declaration?


That's too bad, 
I used to do some ASP which is weakly typed too but I still could use
"Option Explicit" to require variables to be declared. 
Then a small typo would produce very hard-to-find errors.

Well, I guess I have to live with it. Can I add it to a PHP5-wishlist?

Thanx
/Kjell 

- Original Message - 
From: "Rick Emery" <[EMAIL PROTECTED]>
To: "'Kjell Hansen'" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Wednesday, March 27, 2002 10:45 PM
Subject: RE: [PHP] Require variable declaration?


> PHP is weakly typed.  Therefore, definitions are not needed.  A variable
may
> assume any guise depending upon its context.
> 
> -Original Message-
> From: Kjell Hansen [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, March 27, 2002 2:47 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP] Require variable declaration?
> 
> 
> Hi,
> I've just started making my database/PHP-scripts and I'm used to, from
> my earlier development, have my variables declared at the top of each
> routine.
> But I can't find the command that would force me to declare my variables
> and I can't find the declare statement either.
> 
> Is there a way to do this?
> 
> Regards
> /Kjell
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 


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




[PHP] cookies

2002-03-27 Thread Scott St. John

Help!  I have not had a need to use sessions or cookies on PHP until now.  
My experience has been to use Sessions in ASP.  I am building a system to 
have users log in and then drop a cookie on their machine so they can log 
onto other apps.  It's an internal app.  The cookie will contain a userid 
only.

What am I doing wrong here:

setcookie ('userID', $userID); 

I set this cookie and can call it on another page, but then I loose it.  I 
have been wathching the cookie directory on my machine and oddly, a cookie 
never generates.  Feeling, uh, clueless at the moment.

Thanks,

-Scott



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




Re: [PHP] Require variable declaration?

2002-03-27 Thread Kjell Hansen

That's too bad, 
I used to do some ASP which is weakly typed too but I still could use "Option 
Explicit" to require variables to be declared. 
Then a small typo would produce very hard-to-find errors.

Well, I guess I have to live with it. Can I add it to a PHP5-wishlist?

Thanx
/Kjell 

- Original Message - 
From: "Rick Emery" <[EMAIL PROTECTED]>
To: "'Kjell Hansen'" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Wednesday, March 27, 2002 10:45 PM
Subject: RE: [PHP] Require variable declaration?


> PHP is weakly typed.  Therefore, definitions are not needed.  A variable may
> assume any guise depending upon its context.
> 
> -Original Message-
> From: Kjell Hansen [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, March 27, 2002 2:47 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP] Require variable declaration?
> 
> 
> Hi,
> I've just started making my database/PHP-scripts and I'm used to, from
> my earlier development, have my variables declared at the top of each
> routine.
> But I can't find the command that would force me to declare my variables
> and I can't find the declare statement either.
> 
> Is there a way to do this?
> 
> Regards
> /Kjell
> 
> 
> -- 
> 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] Require variable declaration?

2002-03-27 Thread Demitrious S. Kelly

You don't need to do this with PHP... a variable is created when you
assign a value to it. It is also unnecessary to assign a type. PHP will
typecast automatically as necessary

-Original Message-
From: Kjell Hansen [mailto:[EMAIL PROTECTED]] 
Sent: Wednesday, March 27, 2002 12:47 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Require variable declaration?

Hi,
I've just started making my database/PHP-scripts and I'm used to, from
my earlier development, have my variables declared at the top of each
routine.
But I can't find the command that would force me to declare my variables
and I can't find the declare statement either.

Is there a way to do this?

Regards
/Kjell


-- 
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] Require variable declaration?

2002-03-27 Thread Rick Emery

PHP is weakly typed.  Therefore, definitions are not needed.  A variable may
assume any guise depending upon its context.

-Original Message-
From: Kjell Hansen [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, March 27, 2002 2:47 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Require variable declaration?


Hi,
I've just started making my database/PHP-scripts and I'm used to, from
my earlier development, have my variables declared at the top of each
routine.
But I can't find the command that would force me to declare my variables
and I can't find the declare statement either.

Is there a way to do this?

Regards
/Kjell


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

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




[PHP] Require variable declaration?

2002-03-27 Thread Kjell Hansen

Hi,
I've just started making my database/PHP-scripts and I'm used to, from
my earlier development, have my variables declared at the top of each
routine.
But I can't find the command that would force me to declare my variables
and I can't find the declare statement either.

Is there a way to do this?

Regards
/Kjell


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




Re: [PHP] Deleted Files

2002-03-27 Thread Rogier Barendse

At 27.03.2002  14:27, you wrote:
>
>It seems that in using the PHP delete file function, I have inadvertently
>deleted the root folder instead, waxing the majority of my PHP files.  Is
>there a recovery mechanism on Windows or am I getting burned by playing
with
>fire?
>
>J
Look in your "wastebin" or how this is called in english, sould be on your
Desktop,
If there are not the files you´re looking for, your burned.
But you have a backup ! Don´t you ?
HTH Oliver

they are probably not there but there are some undelete programs out there
on the net. I suggest try cnet or tucows for them



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




[PHP] Regex Form Filter Help

2002-03-27 Thread James Taylor

I have a site where users can type whatever they want in and it posts it to a 
database.  I'm trying to eliminate whatever types of abuse I can think of, 
and, since I'm using nl2br on the posts, I'm afraid a user might just hold 
down enter for a couple of seconds and scroll everything off the page. I'm 
trying to figure out a regex pattern that searches for say, more than 5  strings in a row, and anything after 5 gets stripped out.  Any ideas on 
how to possibly do this?

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




Re: [PHP] Deleted Files

2002-03-27 Thread heinisch

At 27.03.2002  14:27, you wrote:
>
>It seems that in using the PHP delete file function, I have inadvertently
>deleted the root folder instead, waxing the majority of my PHP files.  Is
>there a recovery mechanism on Windows or am I getting burned by playing with
>fire?
>
>J
Look in your "wastebin" or how this is called in english, sould be on your 
Desktop,
If there are not the files you´re looking for, your burned.
But you have a backup ! Don´t you ?
HTH Oliver


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




[PHP] TurboPHP ?

2002-03-27 Thread miguel valero

Dear friends,

Is anyone familiar with TurboPHP and has anyone ever
tried to develop a real application (perhaps in the
accounting field) with this editor. 

I would like to know the feasibility and practicality
of using this editor to develop an accounting
application. I also would like to know what was
experienced and the advantages and disadvantages of
using TurboPHP.

Thanks in advance for your information.

Miguel

PS: I took a look at the QaDRAM editor, but IMO it is
not ready for prime time.



__
Do You Yahoo!?
Yahoo! Movies - coverage of the 74th Academy Awards®
http://movies.yahoo.com/

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




[PHP] Deleted Files

2002-03-27 Thread Jesse Warden

It seems that in using the PHP delete file function, I have inadvertently
deleted the root folder instead, waxing the majority of my PHP files.  Is
there a recovery mechanism on Windows or am I getting burned by playing with
fire?

J


** Scanned for Viruses **

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




Re: [PHP] syntax

2002-03-27 Thread Jan Rademaker

On Wed, 27 Mar 2002, John Fishworld wrote:

use this:
${"ned_".$i."_city"} = $ned_city;

after that you can use your new var as $ned_1_city, if $i was 1
ofcourse...

But in this case you might be better off using arrays, as some have
suggested.

> Can someone please remind me what the correct syntax for this is !
> in a loop
> and want individual
> 
> $ned_1_city = blah
> $ned_2_city = blur
> 
> I've been trying this but its wrong
> 
> $ned_.$i._city = $ned_city ;
> 
> thanks
> john
> 
> 
> 
> 
> 

-- 
Jan Rademaker <[EMAIL PROTECTED]>
http://www.ottobak.com



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




RE: [PHP] Nevermind I figured it out

2002-03-27 Thread Darren Gamble

Good day.

As you may have guessed by now, the .= operator does what you want.


Darren Gamble
Planner, Regional Services
Shaw Cablesystems GP
630 - 3rd Avenue SW
Calgary, Alberta, Canada
T2P 4L4
(403) 781-4948


-Original Message-
From: David Johansen [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, March 27, 2002 12:13 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Nevermind I figured it out


I just user $message = $message . "Some text";
But is there a "better" way to do this with something like the += operator?
Dave

"David Johansen" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> I was just wondering if there was a way to add new text to the end of
> strings. I tried doing
> $message += "Some text here";
> but that just set $message to 0. I'm sure it's something simple  but I
> couldn't find anything on it in the documentation.
> Dave
>
>



-- 
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] Adding stuff to the end of strings

2002-03-27 Thread J. Scott Johnson

Shouldn't this work: 

$string = $string . "Some text added to the end";

Or am I thinking your question is simpler than it really is?


* * * * * * * * * * * * * * * * * * * * * * * * * * 
J. Scott Johnson
PHP Consulting and Design Work
* * * * * * * * * * * * * * * * * * * * * * * * * * 
Virtual: 
* * * * * * * * * * * * * * * * * * * * * * * * * * 
[EMAIL PROTECTED]
http://www.fuzzygroup.com/
Yahoo IM: fuzzygroup



-Original Message-
From: David Johansen [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, March 27, 2002 2:03 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Adding stuff to the end of strings


I was just wondering if there was a way to add new text to the end of
strings. I tried doing
$message += "Some text here";
but that just set $message to 0. I'm sure it's something simple  but I
couldn't find anything on it in the documentation.
Dave



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



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




[PHP] Nevermind I figured it out

2002-03-27 Thread David Johansen

I just user $message = $message . "Some text";
But is there a "better" way to do this with something like the += operator?
Dave

"David Johansen" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> I was just wondering if there was a way to add new text to the end of
> strings. I tried doing
> $message += "Some text here";
> but that just set $message to 0. I'm sure it's something simple  but I
> couldn't find anything on it in the documentation.
> Dave
>
>



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




RE: [PHP] Adding stuff to the end of strings

2002-03-27 Thread Rick Emery

$message .= "Some text here";

-Original Message-
From: David Johansen [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, March 27, 2002 1:03 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Adding stuff to the end of strings


I was just wondering if there was a way to add new text to the end of
strings. I tried doing
$message += "Some text here";
but that just set $message to 0. I'm sure it's something simple  but I
couldn't find anything on it in the documentation.
Dave



-- 
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] Adding stuff to the end of strings

2002-03-27 Thread Johnson, Kirk

Close!

$message .= "Some text here";

Kirk

> -Original Message-
> From: David Johansen [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, March 27, 2002 12:03 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP] Adding stuff to the end of strings
> 
> 
> I was just wondering if there was a way to add new text to the end of
> strings. I tried doing
> $message += "Some text here";
> but that just set $message to 0. I'm sure it's something simple  but I
> couldn't find anything on it in the documentation.
> Dave
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

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




[PHP] Adding stuff to the end of strings

2002-03-27 Thread David Johansen

I was just wondering if there was a way to add new text to the end of
strings. I tried doing
$message += "Some text here";
but that just set $message to 0. I'm sure it's something simple  but I
couldn't find anything on it in the documentation.
Dave



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




RE: [PHP] variables within variables - question

2002-03-27 Thread Rick Emery

 $field2 = "<".$$field;


-Original Message-
From: Phil Schwarzmann [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, March 27, 2002 12:33 PM
To: [EMAIL PROTECTED]
Subject: [PHP] variables within variables - question


Im having a VERY hard time trying to explain this
 
Here is a bit of my code...
 
for ($i = 0; $i < $num_fields; $i++)
{
 $field = mysql_field_name($result, $i);
 $field2 = "<".$field;
 $output = str_replace($field2, $field), $output);
}
 
The problem I'm having here is that the variable $field contains a
string (a name of one of my fields in my table).  I need for the
variable $field to actually point to the another variable, not just
contain the string.
 
This little loop here is supposed to go through a RTF file and replace
all the $field2 it finds with $field.
 
Am I making sense? 
 
THANKS!!!

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




RE: [PHP] class question 2

2002-03-27 Thread Rick Emery

Objects which are instantiated from classes on one page are not available on
the next page.  You have to use session functionality.

-Original Message-
From: Caspar Kennerdale [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, March 27, 2002 8:17 PM
To: Php-General-List (E-mail)
Subject: [PHP] class question 2



Sorry Another question-

Do instances of classes remain in 'communication' with each other if
declared my different functions in a case switch statement.

At present I have an admin.php which is one long swtich statement.

Wihin each is a list iof functions which created the elements of the page

Each of these functions are defined in anither file and are instances of
classes.

If I create an instance of a DB class for exapmle- can I refer to it
thoughout the visit to the website-
ie does it maintaoin its values and variables even if different functions
freom the main index.php page are called

sorry if this is really confusing

any ideas much appreciated



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

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




[PHP] variables within variables - question

2002-03-27 Thread Phil Schwarzmann

Im having a VERY hard time trying to explain this
 
Here is a bit of my code...
 
for ($i = 0; $i < $num_fields; $i++)
{
 $field = mysql_field_name($result, $i);
 $field2 = "<".$field;
 $output = str_replace($field2, $field), $output);
}
 
The problem I'm having here is that the variable $field contains a
string (a name of one of my fields in my table).  I need for the
variable $field to actually point to the another variable, not just
contain the string.
 
This little loop here is supposed to go through a RTF file and replace
all the $field2 it finds with $field.
 
Am I making sense? 
 
THANKS!!!



RE: [PHP] Question on eval() SOLVED

2002-03-27 Thread heinisch

At 27.03.2002  10:54, you wrote:
Rick thank you,
the problem wasn´t ' ', but stripslashes.
The data come from a database, so no ' s come with them.
That´s good to see, if you send selects via terminal directly to mysql.
Thanks again
Oliver
>
>Note that vars[1] is created with ' ' so that the $-names are not
>interpreted.  I assume that when the text is read from the file, it comes
>with the $s and the ending semi-colon (;).
>
>$vars[1] =
>'$scar=\"3\";$anrede=\"Herr\";$pf_name=\"wert\";$pf_kontem=\"tzrtzetrz\";$pf
>_kontel=\"zuoioopöl\";$zeit=\"\";$pf_wt=\"löjlköjklö\";$sto=\"2\";';
>print $vars[1]."\n\n";
>
>$xx = stripslashes($vars[1]);
>print $xx."\n\n";
>
>$tmpeval=$xx; // $vars[1] is where the data is in my answer-array
>eval ($tmpeval);
>print $scar;
>?>
>
>-Original Message-
>From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
>Sent: Wednesday, March 27, 2002 10:34 AM
>To: [EMAIL PROTECTED]
>Subject: [PHP] Question on eval()
>
>
>Hi Folks,
>I save an ascii-sentence, representing my vars and their values in the db
>after I request them, I try to eval them.
>here is what I get back from the db
>$scar=\"3\";$anrede=\"Herr\";$pf_name=\"wert\";$pf_kontem=\"tzrtzetrz\";$pf_
>kontel=\"zuoioopöl\";$zeit=\"\";$pf_wt=\"löjlköjklö\";$sto=\"2\";
>(values are just typed in ;-) )
>then I try to eval them with
>
>$tmpeval=$vars[1]; // $vars[1] is where the data is in my answer-array
>eval ("\$tmpeval = \"$tmpeval\";");
>
>after this ther should each var have it´s values like
>$scar should be 3
>$anrede should be Herr
>
>I also tried
>$tmpeval=stripslashes($tmpeval);
>but that doesn´t work either.
>Can anybody see my mistake, or is there any length-limit in eval ??
>
>TIA Oliver
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php


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




[PHP] Class/ DB Question

2002-03-27 Thread Caspar Kennerdale

I'm in the slow process of transferring my contetn management system over to
full object oreinted code.

I have a function within a class which gets the field name and type
information from a mysql table, puts this into an array and then returns a
table with a form field for each field.

I specify switch case in my index.php where the form contents are posted to.
Within this case is another function holding my INSERT query.

The problem is that the value from my form do not seem to carry over.

normally whatever my form field is named eg- Name is then posted as a
variable $Name.
$Name can then be Inserted into the database.

In this case my field name is actually an array value (as the form is
created in a 'while' loop)- ie $row[$a][1]

My form is created correctly- (viewing source in a browser shows this)



If I hard code values into my INSERT function (ie no variables) then the
record inserts, but my variable values are lost.

I have tried declaring the variable names as global variables within my
insert function- and this doesnt work.

Ideally I like to post these variables, perhaps to an array that can then be
picked up by any instance of my class?

Any ideas?

Cheers

Caspar


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




[PHP] class question 2

2002-03-27 Thread Caspar Kennerdale


Sorry Another question-

Do instances of classes remain in 'communication' with each other if
declared my different functions in a case switch statement.

At present I have an admin.php which is one long swtich statement.

Wihin each is a list iof functions which created the elements of the page

Each of these functions are defined in anither file and are instances of
classes.

If I create an instance of a DB class for exapmle- can I refer to it
thoughout the visit to the website-
ie does it maintaoin its values and variables even if different functions
freom the main index.php page are called

sorry if this is really confusing

any ideas much appreciated



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




RE: [PHP] File Upload

2002-03-27 Thread Joel Caturia

This sounds similar to what I am having, but not exactly. What version
of PHP are using, and on what platform?

My problem is the files don't actually appear on the filesystem, yet all
of the internal functions in PHP that allow me to manipulate the files
appear to "work".

I'm using v4.1.2, and I'm wondering if they broke file uploads while
fixing some of the security bugs that was in that portion of the code?
I've had this problem on OpenBSD and Win2K.

- Joel

-Original Message-
From: Jesse Warden [mailto:[EMAIL PROTECTED]] 
Sent: Wednesday, March 27, 2002 6:26 AM
To: Php-General (E-mail)
Subject: [PHP] File Upload

I am having a problem with a file upload.

When I submit the file, I get an error saying "Could not open the file
for
reading: No such file or directory exists.".  However, when looking on
the C
drive (windows) where I have the file and browsed for it using the
Browse
button, it certainly is there.  The form doesn't seem to be posting it.

Any advice?

J


** Scanned for Viruses **

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

2002-03-27 Thread Darren Gamble

Good day,

In this situation, you should use an array to store the results.

Please check PHP's documentation for more information on how to use arrays.


Darren Gamble
Planner, Regional Services
Shaw Cablesystems GP
630 - 3rd Avenue SW
Calgary, Alberta, Canada
T2P 4L4
(403) 781-4948


-Original Message-
From: John Fishworld [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, March 27, 2002 11:09 AM
To: Darren Gamble; Php-General-List (E-mail)
Subject: Re: [PHP] syntax


Sorry I think I've badly explained this !

I'm getting results from mysql in a while loop
but I need the results outside of the loops
and so what I want to do is take the first variable from the db
and rename it as variable 1
and then before the end of the while loop have a $i++;

so i want
$newvar_$i = result 1
$newvar_$i = result 2

so I can use them outside the loops as
$newvar_1 and $newvar_2

hope that makes more sense !

>
>
> Can someone please remind me what the correct syntax for this is !
> in a loop
> and want individual
>
> $ned_1_city = blah
> $ned_2_city = blur
>
> I've been trying this but its wrong
>
> $ned_.$i._city = $ned_city ;
>
> thanks
> john
>
>
>
>
> --
> 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] syntax

2002-03-27 Thread Julio Nobrega Trabalhando

Make it this way:

Looping first. I will loop with while:

$i = 0;
$array = Array();

while (list($value) = mysql_fetch_array($result)) {
$array[$i] = $value;
$i++;
}

  Arrays are easier :-) Each $i will be a key.

--

Julio Nobrega.

Um dia eu chego lá:
http://sourceforge.net/projects/toca

Ajudei? Salvei? Que tal um presentinho?
http://www.submarino.com.br/wishlistclient.asp?wlid=664176742884


"John Fishworld" <[EMAIL PROTECTED]> wrote in message
001501c1d5ba$91eb6100$04010a0a@fishworld">news:001501c1d5ba$91eb6100$04010a0a@fishworld...
> Sorry I think I've badly explained this !
>
> I'm getting results from mysql in a while loop
> but I need the results outside of the loops
> and so what I want to do is take the first variable from the db
> and rename it as variable 1
> and then before the end of the while loop have a $i++;
>
> so i want
> $newvar_$i = result 1
> $newvar_$i = result 2
>
> so I can use them outside the loops as
> $newvar_1 and $newvar_2
>
> hope that makes more sense !
>
> >
> >
> > Can someone please remind me what the correct syntax for this is !
> > in a loop
> > and want individual
> >
> > $ned_1_city = blah
> > $ned_2_city = blur
> >
> > I've been trying this but its wrong
> >
> > $ned_.$i._city = $ned_city ;
> >
> > thanks
> > john
> >
> >
> >
> >
> > --
> > 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] syntax

2002-03-27 Thread Miguel Cruz

On Wed, 27 Mar 2002, John Fishworld wrote:
> so i want
> $newvar_$i = result 1
> $newvar_$i = result 2
> 
> so I can use them outside the loops as
> $newvar_1 and $newvar_2

Why don't you use an array? That's what they're for.

Nevertheless, 

  $i = 1;
  $varname = "newvar$i";
  $$varname = "result 1";

miguel


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




Re: [PHP] syntax

2002-03-27 Thread John Fishworld

Sorry I think I've badly explained this !

I'm getting results from mysql in a while loop
but I need the results outside of the loops
and so what I want to do is take the first variable from the db
and rename it as variable 1
and then before the end of the while loop have a $i++;

so i want
$newvar_$i = result 1
$newvar_$i = result 2

so I can use them outside the loops as
$newvar_1 and $newvar_2

hope that makes more sense !

>
>
> Can someone please remind me what the correct syntax for this is !
> in a loop
> and want individual
>
> $ned_1_city = blah
> $ned_2_city = blur
>
> I've been trying this but its wrong
>
> $ned_.$i._city = $ned_city ;
>
> thanks
> john
>
>
>
>
> --
> 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] syntax

2002-03-27 Thread Darren Gamble

Good day.

I believe that one would have to use the eval() statement to construct that
syntax.

You probably would be much better off using an array to store this
information.  If you are trying to read form data, then construct your form
names so that the results will be put into an array by PHP.


Darren Gamble
Planner, Regional Services
Shaw Cablesystems GP
630 - 3rd Avenue SW
Calgary, Alberta, Canada
T2P 4L4
(403) 781-4948


-Original Message-
From: John Fishworld [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, March 27, 2002 10:55 AM
To: Php-General-List (E-mail)
Subject: [PHP] syntax


Can someone please remind me what the correct syntax for this is !
in a loop
and want individual

$ned_1_city = blah
$ned_2_city = blur

I've been trying this but its wrong

$ned_.$i._city = $ned_city ;

thanks
john




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

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




[PHP] syntax

2002-03-27 Thread John Fishworld

Can someone please remind me what the correct syntax for this is !
in a loop
and want individual

$ned_1_city = blah
$ned_2_city = blur

I've been trying this but its wrong

$ned_.$i._city = $ned_city ;

thanks
john




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




RE: [PHP] ping

2002-03-27 Thread Chris Grigor

Hey Christoph

Thanks for your script, Ive just finished this one, its not that good but it works








body, td { font-family: Verdana, Arial, Helvetica, Geneva, sans-serif; font-size: 8pt; 
color: black; font-weight: normal;
}
h1  { font-family: Verdana, Arial, sans-serif; font-size: 14pt; font-weight: bold; 
color: #006699; }
h2  { font-family: Verdana, Arial, sans-serif; font-size: 12pt; font-weight: bold; 
}
th  { font-family: Verdana, Arial, sans-serif; font-size: 10pt; font-weight: bold; 
text-align: center; }
.h1 { font-family: Arial, sans-serif; font-size: 14pt; font-weight: bold; }
.h2 { font-family: Arial, sans-serif; font-size: 12pt; font-weight: bold; }
.label  { font-family: Arial, sans-serif; font-size: 10pt; font-weight: bold; }
.normal { font-family: Arial, Helvetica, sans-serif; font-size: 10pt; }
.small  { font-family: Arial, sans-serif; font-size: 8pt; color: black; font-weight: 
bold;}
a   { color: #f79700; }
a:visited { color: #00; }









%s", $array[$index]);

}





?>





--

Now remember to create an html page that submits to a script called ping.php
add the following to the ping.html page for example








   





--





-Original Message-
From: Christoph Starkmann [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, March 27, 2002 6:04 PM
To: Chris Grigor; Php-General-List (E-mail)
Subject: RE: [PHP] ping 


Hi CHris!

> has anyone written a script to check if a host is alive - 
> like a ping script ?

Something like this?

BTW, any hints to weak or wrong code are welcome, I'm not
this experienced with PHP ;)

Cheers, Kiko
P.S.: There are some formatting strings and some variables
stored in constants.php and a simple error function in
functions.php, but that's all, I guess anyone can change
this... ;)




.o0o.linktest.o0o.

http://";, "", $url);
$tempUrl = str_replace("/", "", $tempUrl);

$fp = fsockopen ($tempUrl, $tempPort, &$errno, &$errstr, 30);

if (!$fp)
{
echo "" . $f1 . "Link fehlerhaft: " . $url . $f1_e .
"\n";
}
else
{
fputs ($fp, "GET / HTTP/1.0\r\n\r\n");
$code = fgets($fp,1024);
$code = str_replace("HTTP/1.1 ", "", $code);
$code = (int)$code;
if ($code == 200) echo $f1 . "Link okay ($code)" .
$f1_e;
else
{
while ($code = fgets($fp, 2048))
{
echo $f1 . ">>" . $code . "" . $f1_e;
}
}
fclose($fp);
}
echo "" . $f_link . $tempName . $f_linke .
"";
}
?>
















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




  1   2   >