[PHP] It only prints lines that beggin with a number? I'm on a deadline!

2002-11-14 Thread Godzilla
Hi everyone,

I have a pretty strange problem that may be simple, but I have never heard
of it.

//I have a database in the following format:

2
2
2
Cd's
Cd's
DVD's
DVD's
DVD's
DVD's
DVD's

// Someone recently helped me out in writing a short script that
would turn it into this:

2   1 \\ each unique entry gets a unique number separated by Tabs
2   1
2   1
Cd's2
Cd's2
DVD's   3
DVD's   3
DVD's   3
DVD's   3
DVD's   3

Here is the script
--
 $count = 0;
$db = mysql_connect("localhost", "user", "pass");
mysql_select_db("database",$db);
$result = mysql_query ("SELECT * FROM `data` WHERE categories");
while ($row = mysql_fetch_array($result)) {
  $currow = $row["0"];
  if ($count == 0) {
$lastrow = $currow;
$count = 1;
  }
  echo $row["0"] . "\t" . $count . "\n";
  if ($currow != $lastrow) {
  $count++;
  } $lastrow = $currow;
}
--
This worked great on my home server. Now I need to move it over to our real
server which has an almost identical setup. The problem I have is that it
will only print rows that begin with a number! I have tried changing the
dbase format to just about everything, but still no good.
The table has about 4000 rows but the script only prints the first 300 or so
which are the ones that begin with a number. I have tried removing all of
the rows that start with a number, in that case it prints nothing, acting
like the other row's don't exist. My home server has since been formatted so
I can't verify what the setup was or if there was anything different about
it.
If anyone can help in any way it would be greatly appreciated, I am on a
deadline which ends in a few days and this is putting me behind schedule.

Thanks Very Much,Tim




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




Re: [PHP] Relaying variables to distant site

2002-11-14 Thread Jason Wong
On Friday 15 November 2002 14:32, Mike MacDonald wrote:


> $CompositeURL="http://202.20.65.2:3000/sportzHUB/Fletchers/BookingResults
> ?$post";
> echo $CompositeURL;
>
> // Pull in Snoopy
> include "ProxyInc.html";
> $snoopy = new Snoopy;
> $snoopy->fetch("$CompositeURL");
> print $snoopy->results;
>
> The error is the ioctl error that one gets if the page is not there.
> However the page is there -- I can prove it by pasting the printed URL
> into the browser.

The site that you're trying to connect to may be doing some checks to see 
whether the user-agent is a known browser in an attempt to stop people from 
programatically (sp?) accessing it.

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *

/*
Don't get mad, get even.
-- Joseph P. Kennedy

Don't get even, get jewelry.
-- Anonymous
*/


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




Re: [PHP] Relaying variables to distant site

2002-11-14 Thread Mike MacDonald
[EMAIL PROTECTED] (Ernest E Vogelsinger) wrote in 
news:5.1.1.6.2.20021115015548.028ef858@;mail.vogelsinger.at:

> [EMAIL PROTECTED]

Ernest ! 
I just tried out your solution and it formats up the get string out of 
the box!  We're really close because although the page still errors, if I 
print the composite URL out to the page, and paste it into the browser it 
works fine.

If I run the script as below then it doesn't.

This version uses the 'snoopy' php class, but I get the same result when 
I just use readfile()


$post = null;
foreach($_REQUEST as $var => $val) {
 if ($post) $post .= '&';
 $post .= htmlentities($var).'='.htmlentities($val);
 }
//echo $post;
$post=trim($post);
$CompositeURL="http://202.20.65.2:3000/sportzHUB/Fletchers/BookingResults
?$post";
echo $CompositeURL;

// Pull in Snoopy
include "ProxyInc.html";
$snoopy = new Snoopy;
$snoopy->fetch("$CompositeURL");
print $snoopy->results;

The error is the ioctl error that one gets if the page is not there.
However the page is there -- I can prove it by pasting the printed URL 
into the browser.

We're very nearly there !!
Thanks very much for your help
and all the others who have contributed !!

Kind regards
Mike

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




[PHP] Thanks !!!

2002-11-14 Thread Mike MacDonald
Well thanks heaps everyone for some very good ideas !
I'm taking bits and pieces and coming together with a very fine 
understanding !

Much appreciated !


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




Re: [PHP] Swear word substitution

2002-11-14 Thread Tony Earnshaw
tor, 2002-11-14 kl. 16:54 skrev CJ:

> There was not a swear word in my original post but there was a word that
> contained a swear word but is itself not a swear word.  The word is Scu
> 
> n
> 
> thorpe

Don't believe it.

-- 

Tony Earnshaw, Yorkshireman, ah cum fra Scunthorpe mesemn.

Cricketers are strange people. They wake up
in October, only to find that their wives had
left them in May.

e-post: [EMAIL PROTECTED]
www:http://www.billy.demon.nl





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




Re: [PHP] icmp ping, check port, etc.

2002-11-14 Thread Tony Earnshaw
tor, 2002-11-14 kl. 20:32 skrev Ewout de Boer:

> You could exec the ping command and analyze its output using regular
> expressions.

I just wondered whether Bryan wasn't trying to reinvent the wheel
(www.nessus.org, www.insecure.org, etc.)

Best,

Tony

-- 

Tony Earnshaw

Cricketers are strange people. They wake up
in October, only to find that their wives had
left them in May.

e-post: [EMAIL PROTECTED]
www:http://www.billy.demon.nl





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




[PHP] PHP Database

2002-11-14 Thread Steven Priddy
I am looking into how I can make a database like this one that is MySql
controlled. http://www.uhlfans.com/uhlstats/ That is one of my partners
sites but the guy that created the database can't or won't tell me how to
build one myself for a different subject. Thanks for your help!



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




[PHP] Download Counter Script

2002-11-14 Thread Twist
	Okay this is probably a common subject for questions from 
newbies like me but I searched the archive first and I didn't find 
anything about my specific question.

	I have been learning PHP for a few weeks now and I have a 
working download counter script already wrote.  It works great the 
way it is, it just doesn't work quite the way I want it to.  My 
script can keep track of multiple files, it adds new files on the fly 
if they are not already in the counter file, it keeps track of an 
unlimited (with-in reason of course) number of files all from a 
single text file (could easily be configured to use a database as 
well), it can display the count for any file, it has an option to 
display a list of all the files it is tracking with the count for 
each file, and with a little work I will be able to combine it with a 
page load tracking script I made and they will be able to share the 
same text file to store the counts in.

	This is all great, the problem is that it loads a new page 
the way I am doing it.  I am using the header() function to get the 
browser to download.  I have seen sites with counters that download 
the file and update the count without loading a new page, without 
reloading the current page even.  So I am wondering how are they 
doing this?  Or better yet how can I get my script to work like I 
wish it to?
--
Twist
[EMAIL PROTECTED]
http://www.twistedtechnology.net

"You rely on what you get high on and you last just as long as it 
serves you." - The Cardigans

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



[PHP] does PHP4.0 supports https:// post?

2002-11-14 Thread Peter
Hi,
  What's the latest version of PHP that can handle HTTPS:// post?


Thanks,
-Peter



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




[PHP] Re: Installing extensions (winXP)

2002-11-14 Thread Seung Hwan Kang
Some extensions are like not 100% available for Win32 environment. I use PHP
4.3.0pre2, Apache 2.0.43 and J2SDK 1.4.1

For XML, you need expat-1.95.5 and copy libexpat.dll to c:\windows\system32.

For XSLT, you need sablot-0.96 and copy sablot.dll to c:\windows\system32.

//php.ini

extension_dir = C:\php\extensions

[Java]
java.class.path = "c:\php\extensions\php_java.jar;d:\apache2\htdocs\classes"
// that's right I place all my java classes here \classes
java.home = "c:\j2sdk1.4.1\bin"
java.library = "c:\j2sdk1.4.1\jre\bin\client\jvm.dll"
java.library.path = "c:\php\extensions"

;Windows Extensions
extension=php_xslt.dll
; for XML don't have to do anything it's built-in module
extension=php_java.dll


"Davy Obdam" <[EMAIL PROTECTED]> wrote in message
news:004c01c28c2e$3dcd8aa0$960a@;hewlett0bg96om...
> Hiya people,
>
> I want to install some extensions like PDF and XSLT, curl etc. I have
> the GD libary installed in my php.ini like this:
>
> extension=php_gd.dll.
>
> When i try to un quote the other extensions and restart Apache i get
> errors, that he could load this extension. Also i have done this in my
> php.ini :
>
> ; Directory in which the loadable extensions (modules) reside.
> extension_dir = "C:\Program Files\PHP\extensions"
>
> , is this alright? If i look at my phpinfo(); it does show those
> extensions but stil i get errors. I use Windows XP home with Apache
> 2.0.40 and PHP 4.2.3 installed as a apache(sapi) module. Can anyone help
> me, any help is apreciated. Also wich extensions should i use or wich
> are most commonly used? Thanks already...
>
> Best regards,
>
> Davy Obdam
> mailto:info@;davyobdam.com
>
>



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




[PHP] curl_exec() hangs

2002-11-14 Thread Jacek Woloszuk
Hi,

I am using curl to send xml string to my merchant's account gateway when
curl_exec() executes the xml is successfully received by its destination but
I am not getting anything back (it just hangs) Could anyone help me with
this problem?

The following is my curl configuration:

// TELL cURL TO DO A REGULAR HTTP POST.

curl_setopt ($ch, CURLOPT_POST, 1);

// PASS THE REQUEST STRING THAT WE BUILD ABOVE

curl_setopt ($ch, CURLOPT_POSTFIELDS, $request);

// TELL cURL TO USE strlen()  TO GET THE DATA SIZE.

curl_setopt ($ch, CURLOPT_POSTFIELDSIZE, 0);

// TELL cURL WHEN TO TIME OUT
//IF YOU'RE TIMING OUT BEFORE GETTING A RESPONSE FROM SUREPAY, INCREASE THIS
NUMBER

curl_setopt ($ch, CURLOPT_TIMEOUT, 3300);

// TELL cURL TO INCLUDE THE HEADER IN THE OUTPUT

curl_setopt ($ch, CURLOPT_HEADER, 0);

// TELL cURL TO USE SSL VERSION 3.

curl_setopt ($ch, CURLOPT_SSLVERSION, 3);

// TRANSFER THE SUREPAY RESPONSE INTO A VARIABLE.

curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);

Thank you,
Jacek




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




Re: [PHP] query question

2002-11-14 Thread Steve Buehler
Not sure if I wrote and thanked you or not, but this did the trick.  THANK 
YOU THANK YOU THANK YOU!!!

Steve

At 08:41 PM 11/14/2002 +0100, Marek Kilimajer wrote:
This is checked:

function getstart_end(){
   $result=mysql_query("SELECT * FROM aplayabletimes ORDER BY min");
   while(($row=mysql_fetch_object($result))){
   if(!$i){
   echo $row->min . " - ";
   $i=$row->min;
   } else {
   list($houre,$minutee,$seconds)=explode(":",$i);
   $minutee=$minutee+5;

if($minutee>=60){$minutee=$minutee-60;$houre=$houre+1;}
   $tmp = 
implode(':',array(str_pad($houre,2,'0',STR_PAD_LEFT) 
,str_pad($minutee,2,'0',STR_PAD_LEFT),'00'));

   if($tmp != $row->min) {  // there is a gap
   //echo $row->min ." != $tmp";
 echo $i ."\n";  // print previous time 
as end
 echo $row->min . " - ";  // print this time 
as new start
   }
   $i = $row->min; // keep this new time for next loop
   }
   //echo $i." - $tmp  --tmp\n";
   //echo $row->min."\n";
   }
   echo $i ."\n";  // print last row
}

Steve Buehler wrote:

Ok.  That output was my fault.  I had an error in one of my other 
functions.  I needed to set $hours to "00" to start with in my 
populatetemptable() function.  Now my output is:
00:05:00 - 00:05:00
00:05:00 - 00:10:00
00:10:00 - 00:15:00
00:10:00 - 00:20:00
00:15:00 - 00:25:00
00:15:00 - 00:30:00

Problem is that it isn't giving me just the start and end times.  I will 
keep working on it.

Thanks
Steve


At 12:48 PM 11/14/2002 -0600, you wrote:

Thanks for the help, but that is not actually producing the desired 
results either.  This returns the following results:
00:00:05 - 00:00:05
00:00:05 - 5
00:00:05 - 10
00:00:05 - 15
00:00:10 - 20
00:00:10 - 25
00:00:10 - 30
00:00:10 - 35
00:00:15 - 40
00:00:15 - 45
00:00:15 - 50
00:00:15 - 55
00:00:20 - 60
00:00:20 - 65

I am not going to post all of them. :)

Here is the code that is now in the getstart_end() function.  I had to 
change the line that you had because the 5 minutes would give an 
error.  I just took out the "minutes" part.
$tmp = $i+5 minutes; // add 5 minutes to $i, 
implement it yourself
function getstart_end(){
$result=mysql_query("SELECT * FROM aplayabletimes ORDER BY min");
while(($row=mysql_fetch_object($result))){
if(!$i){
echo $row->min . " - ";
$i=$row->min;
}else{
$tmp = $i+5; // add 5 minutes to $i, implement 
it yourself
if($tmp != $row->min) {  // there is a gap
echo $i ."\n";  // print previous 
time as end
echo $row->min . " - ";  // print this 
time as new start
}
$i = $tmp; // keep this new time for next loop
}
}
echo $row->min ."\n";  // print last row
}

At 07:09 PM 11/14/2002 +0100, you wrote:

Untested, but should work

Steve Buehler wrote:



function getstart_end(){
$result=mysql_query("SELECT * FROM aplayabletimes ORDER BY min");
while(($row=mysql_fetch_object($result))){
if(!$i){
echo $row->min . " - ";



   $i=$row->min;



}else{



$tmp = $i + 5 minutes // add 5 minutes to $i, implement it yourself
if($tmp != $row->min) {  // there is a gap
   echo $i ."\n";  // print previous time as end
   echo $row->min . " - ";  // print this time as new start
}
$i = $tmp; // keep this new time for next loop



}
}



echo $row->min ."\n";  // print last row



}



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


--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
ow3





--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
ow3


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


--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
ow3





--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
ow3




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


--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
ow3




--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
ow3


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

Re: [PHP] $_SESSION question

2002-11-14 Thread Ernest E Vogelsinger
At 02:42 15.11.2002, Sascha Cunz said:
[snip]
>This sounds like a pretty good idea to work around that problem :-)
>
>Does this system work, if the user decides to split "one session" accross 
>multiple "Browser-Windows", i.e. the uses the "Open in new window"-Function 
>of most browsers?
[snip] 

Halfway it does (I told you there's more to it...)
There are two scenarios:

a) user has two logins in two browser windows at the same time:

The cookie "name" is not hard coded but generated as well, just as
"UTOKEN_1234" or something. The cookie name is also stored in session data.

b) user has one login but two different windows:

Generally this presents a problem as an application usually has a "state"
that's reflected in session data. What needs to be done is:
a) detect that the user has "split" the application
b) split session data, or create a new session.

As for (a) - we chose out application windows to be generally non-cacheable
(at least those using this mechanism). Thus, opening a new window will
rerun the code, transmitting an altered user-token cookie to the browser.
The reloaded window will simply continue the application from it's current
state, and alter the user-token cookie.

As for (b) it depends on the content of the "original" page. If this is a
form it's easy to detect that the form is not the "most recent" (out forms
generally have a "serial number" to avoid duplicate actions through form
reloads). If the form that is detected as being "reloaded" is not the last
form the application has seen we decide that the application has been
"split up" - we simply close the session and require the user to log in
anew (in this window only, of course), now using a different session ID.

If the cloned window is _not_ a form I have no solution yet - all our apps
are form-based.

One last word to "close the session" - this is done by calling
session_write_close() and redirecting the browser to the application entry
page, now _not_ using SID (session has already closed, no SID available).


-- 
   >O Ernest E. Vogelsinger
   (\)ICQ #13394035
^ http://www.vogelsinger.at/



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




Re: [PHP] $_SESSION question

2002-11-14 Thread Sascha Cunz
Hi Jochen,

> How can I process $_SESSION variables if the user disables cookies
> and session.use_trans_sid = 0 ?

You could use a combination of outputbuffering and a self-written 
session-handler.
So you could build a trans_sid-alike system, that would do more checks (i.e. 
compare IP-Addresses) to validate, if a session is really the one it is 
claiming. (Of course this would be slower as trans_sid's and ain't that easy 
to do)

-Sascha

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




Re: [PHP] Subtracting Money

2002-11-14 Thread Hugh Danaher
Try:
number_format()
Hugh

- Original Message -
From: "Sascha Cunz" <[EMAIL PROTECTED]>
To: "Stephen" <[EMAIL PROTECTED]>; "PHP List"
<[EMAIL PROTECTED]>
Sent: Thursday, November 14, 2002 5:37 PM
Subject: Re: [PHP] Subtracting Money


Hi Stephen,

> I'm having a problem. I need to subtract money, but if they type in an
> ammount such as $2.30 and I subtract $0.20, instead of returning $2.10
like
> it should, it returns $2.1. How can I fix this keeping in mind that other
> variable could be $2.40 or $100.30 and so on...?

This is because, 2.1 is equal to 2.10 :-) You need to format the numbers in
the way you want them.

have a look at:
  http://www.php.net/manual/en/function.number-format.php
and/or
  http://www.php.net/manual/en/function.sprintf.php

both of them should do that job.

sprintf's Example 6:

  $money1 = 68.75;
  $money2 = 54.35;
  $money = $money1 + $money2;
  // echo $money will output "123.1";
  $formatted = sprintf("%01.2f", $money);
  // echo $formatted will output "123.10"

-Sascha

--
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] $_SESSION question

2002-11-14 Thread Sascha Cunz
> Simply put - you can't.
>
> You need a way to transmit the session identifier, and AFAIK there's
> nothing except either cookies or SID.
>
> Using SID for security relevant issues presents a problem - users can send
> links with a SID to friends by mail or else, so this is not really a secure
> solution. However there are numerous application parts where no security is
> involved, and sessions are just used to construct a site - it's unnecessary
> IMHO to avoid SID use here.
>
> On our server we have disabled session cookies in general, as a courtesy to
> our users. However when logged in we require a user to accept a cookie. The
> value of this cookie is randomly generated (something like "md5(rand())"),
> and changes with every "click". This value (we call it a "login token" is
> also stored in session data to verify the cookie against the session. If no
> user token, or a wrong token, is transmitted, we assume a "hijacked"
> session and automatically logout the user. (there's more to it, but
> basically you get the idea)

This sounds like a pretty good idea to work around that problem :-)

Does this system work, if the user decides to split "one session" accross 
multiple "Browser-Windows", i.e. the uses the "Open in new window"-Function 
of most browsers?

-Sascha

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




Re: [PHP] Subtracting Money

2002-11-14 Thread Sascha Cunz
Hi Stephen,

> I'm having a problem. I need to subtract money, but if they type in an
> ammount such as $2.30 and I subtract $0.20, instead of returning $2.10 like
> it should, it returns $2.1. How can I fix this keeping in mind that other
> variable could be $2.40 or $100.30 and so on...?

This is because, 2.1 is equal to 2.10 :-) You need to format the numbers in 
the way you want them.

have a look at:
  http://www.php.net/manual/en/function.number-format.php
and/or
  http://www.php.net/manual/en/function.sprintf.php

both of them should do that job.

sprintf's Example 6:

  $money1 = 68.75;
  $money2 = 54.35;
  $money = $money1 + $money2;
  // echo $money will output "123.1";
  $formatted = sprintf("%01.2f", $money);
  // echo $formatted will output "123.10"

-Sascha

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




Re: [PHP] $_SESSION question

2002-11-14 Thread Ernest E Vogelsinger
At 02:18 15.11.2002, Jochen Kächelin said:
[snip]
>How can I process $_SESSION variables if the user disables cookies
>and session.use_trans_sid = 0 ?
[snip] 

Simply put - you can't.

You need a way to transmit the session identifier, and AFAIK there's
nothing except either cookies or SID.

Using SID for security relevant issues presents a problem - users can send
links with a SID to friends by mail or else, so this is not really a secure
solution. However there are numerous application parts where no security is
involved, and sessions are just used to construct a site - it's unnecessary
IMHO to avoid SID use here.

On our server we have disabled session cookies in general, as a courtesy to
our users. However when logged in we require a user to accept a cookie. The
value of this cookie is randomly generated (something like "md5(rand())"),
and changes with every "click". This value (we call it a "login token" is
also stored in session data to verify the cookie against the session. If no
user token, or a wrong token, is transmitted, we assume a "hijacked"
session and automatically logout the user. (there's more to it, but
basically you get the idea)


-- 
   >O Ernest E. Vogelsinger
   (\)ICQ #13394035
^ http://www.vogelsinger.at/



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




Re: [PHP] Subtracting Money

2002-11-14 Thread Timothy Hitchens (HiTCHO)
This sounds like you are in Javascript.. if not what about just replacing
out the $ with nothing then doing the equation and then re adding and
formating to currency.

You could do the same with Javascript as well.


Timothy Hitchens (HiTCHO)
[EMAIL PROTECTED]


If you need PHP hosting with an experienced
support team 24/7 then email me today.

On Thu, 14 Nov 2002, Stephen wrote:

> I'm having a problem. I need to subtract money, but if they type in an ammount such 
>as $2.30 and I subtract $0.20, instead of returning $2.10 like it should, it returns 
>$2.1. How can I fix this keeping in mind that other variable could be $2.40 or 
>$100.30 and so on...?
>
> Thanks,
> Stephen Craton
> http://www.melchior.us
>
> "Life is a gift from God. Wasting it is like destroying a gift you got from the 
>person you love most." -- http://www.melchior.us


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




[PHP] Subtracting Money

2002-11-14 Thread Stephen



I'm having a problem. I need to subtract money, but if they 
type in an ammount such as $2.30 and I subtract $0.20, instead of returning 
$2.10 like it should, it returns $2.1. How can I fix this keeping in mind that 
other variable could be $2.40 or $100.30 and so on...?
Thanks,Stephen Cratonhttp://www.melchior.us
 
"Life is a gift from God. Wasting it is like destroying a gift you got from 
the person you love most." -- http://www.melchior.us
-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] $_SESSION question

2002-11-14 Thread Jochen Kächelin
I  made a test with the Phoenix-Browser and ENABLE COOKIES = OFF in
the Privacy configuration of the browser.

my index.php:

index2.php\n";

?>

my index2.php:



My php.ini:

session.use_trans_sid = 0

on index2.php there's no result -> $_SESSION["test"] is not set.

when I enable

session.use_trans_sid = 1

the session_id is added to the url, but php.ini says not to use
session.use_trans_sid = 1 for security reasons.

How can I process $_SESSION variables if the user disables cookies
and session.use_trans_sid = 0 ?


-- 
Jochen Kaechelin


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




[PHP] Re: Whats the deal with HotScripts.com?

2002-11-14 Thread Manuel Lemos
Hello,

On 11/14/2002 03:38 PM, Www.Nukedweb.Com wrote:

How many of you have listed "premium" (not free) scripts on HotScripts?
Have you ever had ranking problems? Everything was going great for me,
I had 12 scripts listed, all on the tops of the categories, and then
poof!
Now all my scripts are on the last page, I get zero traffic from that
site
now, and I can't figure out what the hell happened! I've even submitted
two more scripts to them that never showed up. Do any of you know how it

works?! Or have experienced this problem and know why it happened? It's
really killin me traffic-wise. I've even gone so far as saying "screw ya


If your scripts are actually classes of objects in PHP, you may want to 
upload them to the PHP Classes site. You do not have to pay anything to 
get highly ranked, you just need to provide your classes code, hopefully 
with nice examples of usage and documentation, and if the users of the 
site find it interesting, you will get highly ranked automatically.

To start with, once your classes are approved, about 50,000 users eager 
to know about new PHP classes objects are notified by e-mail. This 
guarantees you a very nice exposure.

Feel free to try it at:

http://www.phpclasses.org/


--

Regards,
Manuel Lemos


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



Re: [PHP] PHP/Flash

2002-11-14 Thread Maxim Maletsky

wanna write an article for PHP Beginner? We'd be looking for something
like this some time next month...

-- 
Maxim Maletsky
[EMAIL PROTECTED]


On Mon, 4 Nov 2002 15:46:12 -0600 "Clint Tredway" <[EMAIL PROTECTED]> 
wrote:

> I have a small example of using Flash/PHP if anyone wants it..
> 
> Clint
> 
> 
> 
> -- 
> 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] Re: Authentication with PHP and HTTP

2002-11-14 Thread BigDog
Just never do it period...that is the best habit to have...

That is poor coding on the programmers part...

On Fri, 2002-11-15 at 00:59, Maxim Maletsky wrote:
> using this method for a production environment is incredibly vulnerable.
> Just think of having a link on that page to some other site (or even having
> a third-party banner displayed) on which there is a hit counter (and on
> 90% there are) those can simply read the link in their logs.
> 
> Never ever use it if security is of a minimum importance or you're
> completely sure you know what you do.
> 
> -- 
> Maxim Maletsky
> [EMAIL PROTECTED]
> 
> 
> On Tue, 5 Nov 2002 02:04:52 +0100 "silver" <[EMAIL PROTECTED]> wrote:
> 
> > hi - I'm not quite sure if this will help you, but lets give it a try:
> > 
> > you could use this URL syntax:
> >  http://user:password@;www.site.com to automatically log your user in to the
> > htaccess protected area. the bad thing about it is that user / password show
> > up in the URL, but you could hide this information with using frames...
> > are PHP/MySQL usernames + passwords the same like in Apache/HTTP?
> > 
> > greets,
> > _andi
> > 
> > 
> > 
> > 
> > 
> > 
> > "Phillip Erskine" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
> > news:F13i7M4BAyxJMXehYSo4e46@;hotmail.com...
> > >
> > > I have a site that uses PHP/MySQL authentication for one section and
> > > Apache/HTTP authentication for another.  Eventually I would like to use
> > only
> > > PHP and MySQL for authenticating users, but in the meantime, I have to use
> > > both.
> > >
> > > First, users will log in to the main section of the site and I will use
> > PHP
> > > session variables to maintain state for that section.  What I would like
> > to
> > > be able to do is allow users to click a link that would redirect them to
> > the
> > > other section of the site and automatically log them in.
> > >
> > > The section of the site that users will be redirected to uses .htaccess
> > and
> > > .htpassword files to enforce HTTP authentication.
> > >
> > > Is this possible?  If so, how?
> > >
> > >
> > > =
> > > http://www.pverskine.com/
> > >
> > >
> > >
> > >
> > > _
> > > Protect your PC - get McAfee.com VirusScan Online
> > > http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963
> > >
> > 
> > 
> > 
> > -- 
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> > 
-- 
.: B i g D o g :.



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




Re: [PHP] Relaying variables to distant site

2002-11-14 Thread Ernest E Vogelsinger
At 00:41 15.11.2002, Mike MacDonald said:
[snip]
>Hi People!
>Can anyone help with this:
>
>
>   Want to pick up variables passed from form in
>   PHP page and pass to distant site. Can use
>   long get, but would like to access ALL variables
>   in the PHP page and pass them forward, without
>   coding each individual one if possible

To construct the data to post to the distant server you'd simply loop
through the $_REQUEST array, like this:

$post = null;
foreach($_REQUEST as $var => $val) {
if ($post) $post .= '&';
$post .= htmlentities($var).'='.htmlentities($val);
}

You could use cUrl to POST data received from the form. Or, if you use a
query string, just transmit
http://wherever.distant:3000/receipient.php?$post. Be aware that there's a
size limit for a query string.



-- 
   >O Ernest E. Vogelsinger
   (\)ICQ #13394035
^ http://www.vogelsinger.at/



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




Re: [PHP] Re: Authentication with PHP and HTTP

2002-11-14 Thread Maxim Maletsky

using this method for a production environment is incredibly vulnerable.
Just think of having a link on that page to some other site (or even having
a third-party banner displayed) on which there is a hit counter (and on
90% there are) those can simply read the link in their logs.

Never ever use it if security is of a minimum importance or you're
completely sure you know what you do.

-- 
Maxim Maletsky
[EMAIL PROTECTED]


On Tue, 5 Nov 2002 02:04:52 +0100 "silver" <[EMAIL PROTECTED]> wrote:

> hi - I'm not quite sure if this will help you, but lets give it a try:
> 
> you could use this URL syntax:
>  http://user:password@;www.site.com to automatically log your user in to the
> htaccess protected area. the bad thing about it is that user / password show
> up in the URL, but you could hide this information with using frames...
> are PHP/MySQL usernames + passwords the same like in Apache/HTTP?
> 
> greets,
> _andi
> 
> 
> 
> 
> 
> 
> "Phillip Erskine" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
> news:F13i7M4BAyxJMXehYSo4e46@;hotmail.com...
> >
> > I have a site that uses PHP/MySQL authentication for one section and
> > Apache/HTTP authentication for another.  Eventually I would like to use
> only
> > PHP and MySQL for authenticating users, but in the meantime, I have to use
> > both.
> >
> > First, users will log in to the main section of the site and I will use
> PHP
> > session variables to maintain state for that section.  What I would like
> to
> > be able to do is allow users to click a link that would redirect them to
> the
> > other section of the site and automatically log them in.
> >
> > The section of the site that users will be redirected to uses .htaccess
> and
> > .htpassword files to enforce HTTP authentication.
> >
> > Is this possible?  If so, how?
> >
> >
> > =
> > http://www.pverskine.com/
> >
> >
> >
> >
> > _
> > Protect your PC - get McAfee.com VirusScan Online
> > http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963
> >
> 
> 
> 
> -- 
> 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] phpMyAdmin 2.2.6

2002-11-14 Thread Maxim Maletsky
On Sun, 12 Nov 2000 22:25:59 - "Iguider" <[EMAIL PROTECTED]> wrote:

> I am running normally a phpMyAdmin 2.2.6, until yesterday it shows me :

So it works now?

I will assume no... Describe your system to the list and what could
have possibly be changed yesterday. You might have an solution soon.

-- 
Maxim Maletsky
[EMAIL PROTECTED]


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




Re: [PHP] Escaping characters won't work

2002-11-14 Thread Ernest E Vogelsinger
At 23:53 14.11.2002, Lars Espelid said:
[snip]
>Try to execute this code:
>if (ereg[^0-9], $num))
>print "That's not a number!";
>
>result: parsing error, expects ')' on the if-line.

You forgot an opening bracket, and need to quote the regex, like
if (ereg('[^0-9]', $num))
print "That's not a number!";


>When I write:
>echo "HELLO \n";
>echo "WORLD";
>
>I get: HELLO WORLD
>(on one line!?)

You need to tell the browser to create a newline when displaying HTML:
echo "HELLOWORLD"
will look identical to
echo "HELLO\nWORLD"

You can also use the nl2br() function to convert all newlines to a line break:
echo nl2br("HELLO\nWORLD");

If you display preformatted text you'll see the linebreak:
echo "HELLO\nWORLD";


-- 
   >O Ernest E. Vogelsinger
   (\)ICQ #13394035
^ http://www.vogelsinger.at/



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




Re: [PHP] Fw: help please

2002-11-14 Thread Timothy Hitchens (HiTCHO)
Why not put them into an array then look at array functions such
as unique checking etc...


Timothy Hitchens (HiTCHO)
[EMAIL PROTECTED]


If you need PHP hosting with an experienced
support team 24/7 then email me today.

On Fri, 15 Nov 2002, John Fishworld wrote:

>  Hi,
>
>  I've got some variable variables which i need to check that they are not
> the
>  same !
>  There can be up to 9 of them !
>
>  for ($i = 1; $i <= $city_only_one; $i++) {
>  $citydb = "stellen_city_".$i ;
>  $new_city_db.$i = $$citydb;
>
>  and what i need to do is check that
>  $new_city_db1 does not equal $new_city_db2 or 3 etc
>  and then
>  $new_city_db2 does not equal 3 + 4 etc...
>   }
>
>  Whats the best way of doing this !??
>
>
>  Any help appreciated
>  thanks
>
>
>
>
>
> --
> 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]

2002-11-14 Thread @ Nilaab
Ok, I have a problem with the header() redirect function, below is the
part-code/part-pseudocode information. The file that this code is
encapsulated in is a single file named add_item.php. There is no output
before the header() function. Now this is a weird one, but I did some
testing and here is what happens:

If there are no rows returned, redirect browser to the same page with some
needed get variables. The problem is with the submit_cat=1 get variable
attached to the URL-to-be-redirected. When I take this out of the get
string, the script redirects the user just fine when the value of
$num_rows=0. I still need that variable to be sent so when I place the
submit_cat=1 variable back into the get string it takes you to the default
Apache error page entitled, "Internal Server Error". Why is this submit_cat
variable causing me so much trouble?

fetch_results($query);
.
.
.
   }
}

?>

- Nilaab


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




[PHP] Fw: help please

2002-11-14 Thread John Fishworld
 Hi,

 I've got some variable variables which i need to check that they are not
the
 same !
 There can be up to 9 of them !

 for ($i = 1; $i <= $city_only_one; $i++) {
 $citydb = "stellen_city_".$i ;
 $new_city_db.$i = $$citydb;

 and what i need to do is check that
 $new_city_db1 does not equal $new_city_db2 or 3 etc
 and then
 $new_city_db2 does not equal 3 + 4 etc...
  }

 Whats the best way of doing this !??


 Any help appreciated
 thanks





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




Re: [PHP] Can't escape characters in php??

2002-11-14 Thread Ewout de Boer

- Original Message -
From: "Lars Espelid" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, November 14, 2002 9:59 PM
Subject: [PHP] Can't escape characters in php??


> Hello,
>
> I'm running Apache/1.3.26 and PHP 4.0.5 on WinXP pro.
>
> Also  '\n' in an echo-expression won't work. It is ignored.
> code:
> echo "HELLO \n";
> echo "WORLD";
>
> result:
> HELLO WORLD
>
> What can be wrong? Do I miss a library or something??

You are using a browser for the output ?

when you use "\n" you'll see a nice newline in the html source your
browser expects html so use html code !
(newline in html is )



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




Re: [PHP] Escaping characters won't work

2002-11-14 Thread John Nichel
Hello again...

Lars Espelid wrote:

Hello,

I'm running Apache 1.3.26, PHP 4.0.5 and WinXPpro.

My problem is as follows:

Try to execute this code:
if (ereg[^0-9], $num))
print "That's not a number!";

result: parsing error, expects ')' on the if-line.



This one does have a parse error

if ( ereg ( [^0-9], $num ) )
  ^


Have also tried other expressions where I escape characters. They won't
work.

When I write:
echo "HELLO \n";
echo "WORLD";

I get: HELLO WORLD
(on one line!?)

Anyone know what's wrong? Do I need to install an extension?

Bottom of my httpd.conf:

   LoadModule php4_module c:/php/sapi/php4apache.dll
   AddModule mod_php4.c
   AddType application/x-httpd-php .php
   AddType application/x-httpd-php-source .phps

Thanks,

Lars






--
By-Tor.com
It's all about the Rush
http://www.by-tor.com


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




Re: [PHP] Can't escape characters in php??

2002-11-14 Thread John Nichel
Hello,

Lars Espelid wrote:

Hello,

I'm running Apache/1.3.26 and PHP 4.0.5 on WinXP pro.

The following code is taken from the book mastering PHP 4.1 and is supposed
to work:

if (ereg([^0-9], "2002-11-14"))
print "That's not a number!";

It won't work for me. I get a parse error expecting a ')'.


Is this the only code on the page?  Try quoting your expression, and 
bracketing your if check i.e.
if ( ereg ( "[^0-9]", "2002-11-14" ) ) {
	print "That's not a number!";
}


I have also tried other regular expressions, but almost all of them fails.
One that works: if (ereg("-..-..", "2002-11-14"))

Also  '\n' in an echo-expression won't work. It is ignored.
code:
echo "HELLO \n";
echo "WORLD";

result:
HELLO WORLD



What did you expect this to do?  Most, if not all browsers don't start a 
new line when they encounter a new line or carrige return unless it's 
encased by  tags.  Try this...

echo "HELLO\n";
echo "WORLD";


What can be wrong? Do I miss a library or something??

Thanks,

Lars







--
By-Tor.com
It's all about the Rush
http://www.by-tor.com


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




Re: [PHP] Can't escape characters in php??

2002-11-14 Thread Marco Tabini
Oh, WRT the \n: it works--but you're probably outputting to a browser,
which ignores the newline and only interprets HTML code.


Marco
-- 

php|architect - The magazine for PHP Professionals
The first monthly worldwide magazine dedicated to PHP programmers

Come visit us at http://www.phparch.com!

--- Begin Message ---
Hello,

I'm running Apache/1.3.26 and PHP 4.0.5 on WinXP pro.

The following code is taken from the book mastering PHP 4.1 and is supposed
to work:

if (ereg([^0-9], "2002-11-14"))
print "That's not a number!";

It won't work for me. I get a parse error expecting a ')'.

I have also tried other regular expressions, but almost all of them fails.
One that works: if (ereg("-..-..", "2002-11-14"))

Also  '\n' in an echo-expression won't work. It is ignored.
code:
echo "HELLO \n";
echo "WORLD";

result:
HELLO WORLD

What can be wrong? Do I miss a library or something??

Thanks,

Lars




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



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


Re: [PHP] Can't escape characters in php??

2002-11-14 Thread Marco Tabini
You're simply missing quotation marks, as far as I can see:

if (ereg('[^0-9]', "2002-11-14"))
print "That's not a number!";


Marco
-- 

php|architect - The magazine for PHP Professionals
The first monthly worldwide magazine dedicated to PHP programmers

Come visit us at http://www.phparch.com!

--- Begin Message ---
Hello,

I'm running Apache/1.3.26 and PHP 4.0.5 on WinXP pro.

The following code is taken from the book mastering PHP 4.1 and is supposed
to work:

if (ereg([^0-9], "2002-11-14"))
print "That's not a number!";

It won't work for me. I get a parse error expecting a ')'.

I have also tried other regular expressions, but almost all of them fails.
One that works: if (ereg("-..-..", "2002-11-14"))

Also  '\n' in an echo-expression won't work. It is ignored.
code:
echo "HELLO \n";
echo "WORLD";

result:
HELLO WORLD

What can be wrong? Do I miss a library or something??

Thanks,

Lars




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



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


Re: [PHP] Relaying variables to distant site

2002-11-14 Thread Timothy Hitchens (HiTCHO)
Are you using array vars in your HTML form?

eg:



etc etc



Timothy Hitchens (HiTCHO)
[EMAIL PROTECTED]


If you need PHP hosting with an experienced
support team 24/7 then email me today.

On 14 Nov 2002, Mike MacDonald wrote:

> Hi People!
> Can anyone help with this:
>
>
>Want to pick up variables passed from form in
>PHP page and pass to distant site. Can use
>long get, but would like to access ALL variables
>in the PHP page and pass them forward, without
>coding each individual one if possible
>
>
>   Port 80   Port 3000
>
>+-WebForm-+ +-PHP Page++-DistantSite-+
>| | | || |
>| | | || |
>|Form Variables--->   || |
>| | | || |
>| | |  readfile() -> |
>| | | |  ^ | |
>| | | |  | | |
>| | | |  | | |
>| | | |  | | |
>|  +--- |  +---  | |  +---
>|  | /  |  | /   | |  | /
>|  |/   |  |/| |  |/
>+---+--- | +---
> |
> |
>   
>
>Need to on forward all
>variables passed from
>form
>
> --
> 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't escape characters in php??

2002-11-14 Thread Lars Espelid
Hello,

I'm running Apache/1.3.26 and PHP 4.0.5 on WinXP pro.

The following code is taken from the book mastering PHP 4.1 and is supposed
to work:

if (ereg([^0-9], "2002-11-14"))
print "That's not a number!";

It won't work for me. I get a parse error expecting a ')'.

I have also tried other regular expressions, but almost all of them fails.
One that works: if (ereg("-..-..", "2002-11-14"))

Also  '\n' in an echo-expression won't work. It is ignored.
code:
echo "HELLO \n";
echo "WORLD";

result:
HELLO WORLD

What can be wrong? Do I miss a library or something??

Thanks,

Lars




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




Re: [PHP] Relaying variables to distant site

2002-11-14 Thread Jonathan Sharp
Pulling this idea from down south, but could you do serialize($_GLOBALS)
and then POST that to the distant site and unserialize it?

what are you trying to accomplish exactly? A Proxy?

-js


Mike MacDonald wrote:
> Hi People!
> Can anyone help with this:
> 
> 
>Want to pick up variables passed from form in
>PHP page and pass to distant site. Can use
>long get, but would like to access ALL variables
>in the PHP page and pass them forward, without
>coding each individual one if possible
> 
> 
>   Port 80   Port 3000
> 
>+-WebForm-+ +-PHP Page++-DistantSite-+
>| | | || |
>| | | || |
>|Form Variables--->   || |
>| | | || |
>| | |  readfile() -> |
>| | | |  ^ | |
>| | | |  | | |
>| | | |  | | |
>| | | |  | | |
>|  +--- |  +---  | |  +---
>|  | /  |  | /   | |  | /
>|  |/   |  |/| |  |/
>+---+--- | +---
> |
> |
>   
> 
>Need to on forward all
>variables passed from
>form
> 




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




Re: [PHP] Relaying variables to distant site

2002-11-14 Thread Marco Tabini
If your variables are not more than 4,096 bytes (which I think is limit
for the get string), you can just pass a GET variable whose value is 
urlencode (serialize ($_REQUEST));


Marco
-- 

php|architect - The magazine for PHP Professionals
The first monthly worldwide magazine dedicated to PHP programmers

Come visit us at http://www.phparch.com!

--- Begin Message ---
Hi People!
Can anyone help with this:


   Want to pick up variables passed from form in
   PHP page and pass to distant site. Can use
   long get, but would like to access ALL variables
   in the PHP page and pass them forward, without
   coding each individual one if possible


  Port 80   Port 3000

   +-WebForm-+ +-PHP Page++-DistantSite-+
   | | | || |
   | | | || |
   |Form Variables--->   || |
   | | | || |
   | | |  readfile() -> |
   | | | |  ^ | |
   | | | |  | | |
   | | | |  | | |
   | | | |  | | |
   |  +--- |  +---  | |  +---
   |  | /  |  | /   | |  | /
   |  |/   |  |/| |  |/
   +---+--- | +---
|
|
  

   Need to on forward all
   variables passed from
   form

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



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


[PHP] Relaying variables to distant site

2002-11-14 Thread Mike MacDonald
Hi People!
Can anyone help with this:


   Want to pick up variables passed from form in
   PHP page and pass to distant site. Can use
   long get, but would like to access ALL variables
   in the PHP page and pass them forward, without
   coding each individual one if possible


  Port 80   Port 3000

   +-WebForm-+ +-PHP Page++-DistantSite-+
   | | | || |
   | | | || |
   |Form Variables--->   || |
   | | | || |
   | | |  readfile() -> |
   | | | |  ^ | |
   | | | |  | | |
   | | | |  | | |
   | | | |  | | |
   |  +--- |  +---  | |  +---
   |  | /  |  | /   | |  | /
   |  |/   |  |/| |  |/
   +---+--- | +---
|
|
  

   Need to on forward all
   variables passed from
   form

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




Re: [PHP] Auto_Prepend_File for non-PHP files?

2002-11-14 Thread Marco Tabini
The problem is that non-php files are not (normally) parsed through the
PHP interpreter, and therefore the clause you're specifying has no
effect.

There are two solutions (at least that come to mind now):

1) Change your Apache configuration so that all files are parsed through
PHP (inefficient and potentially dangerous)

2) You can use server-side includes (but you still have to modify your
files)

Otherwise, take a look at the Apache manual:

How can I attach a footer to my documents without using SSI?

You can make arbitrary changes to static documents by configuring an
Action which launches a CGI script. The CGI is then responsible for
setting a content-type and delivering the requested document (the
location of which is passed in the PATH_TRANSLATED environment
variable), along with whatever footer is needed.

Busy sites may not want to run a CGI script on every request, and should
consider using an Apache module to add the footer. There are several
third party modules available through the Apache Module Registry which
will add footers to documents. These include mod_trailer, PHP
(php3_auto_append_file), mod_layout, and mod_perl (Apache::Sandwich).


Marco
-- 

php|architect - The magazine for PHP Professionals
The first monthly worldwide magazine dedicated to PHP programmers

Come visit us at http://www.phparch.com!

--- Begin Message ---
Hi,

I couldn't find this in the documentation, or in the archives of the mailing list, so 
I apologize if it's been answered many times before :)

I'm trying to use auto_prepend_file to prepend a php file to every file in a folder, 
not just .php files.  

I have:

  php_value auto_prepend_file "/path/to/php_file.php"

in my Apache httpd.conf.

What am I doing wrong?

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


[PHP] Escaping characters won't work

2002-11-14 Thread Lars Espelid
Hello,

I'm running Apache 1.3.26, PHP 4.0.5 and WinXPpro.

My problem is as follows:

Try to execute this code:
if (ereg[^0-9], $num))
print "That's not a number!";

result: parsing error, expects ')' on the if-line.

Have also tried other expressions where I escape characters. They won't
work.

When I write:
echo "HELLO \n";
echo "WORLD";

I get: HELLO WORLD
(on one line!?)

Anyone know what's wrong? Do I need to install an extension?

Bottom of my httpd.conf:

   LoadModule php4_module c:/php/sapi/php4apache.dll
   AddModule mod_php4.c
   AddType application/x-httpd-php .php
   AddType application/x-httpd-php-source .phps

Thanks,

Lars



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




[PHP] Auto_Prepend_File for non-PHP files?

2002-11-14 Thread Sara Keesler
Hi,

I couldn't find this in the documentation, or in the archives of the mailing list, so 
I apologize if it's been answered many times before :)

I'm trying to use auto_prepend_file to prepend a php file to every file in a folder, 
not just .php files.  

I have:

  php_value auto_prepend_file "/path/to/php_file.php"

in my Apache httpd.conf.

What am I doing wrong?

Sara Keesler


Fw: [PHP] parse comma delimited file

2002-11-14 Thread Kevin Stone
Yeah I had the same problem a while ago.  it's an easy one to miss if you
don't know what keywords to search for.  :)
-Kevin

- Original Message -
From: "Greg" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, November 14, 2002 4:06 PM
Subject: Re: [PHP] parse comma delimited file


> Great, thanks...didn't see  that one :)
> -Greg
>
>
> "Kevin Stone" <[EMAIL PROTECTED]> wrote in message
> news:176401c28c32$11cf7fe0$6601a8c0@;kevin...
> > You bet there is..
> >
> > fgetcsv();
> > http://www.php.net/manual/en/function.fgetcsv.php
> >
> > -Kevin
> >
> > - Original Message -
> > From: "Greg" <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> > Sent: Thursday, November 14, 2002 3:57 PM
> > Subject: [PHP] parse comma delimited file
> >
> >
> > > Hi-\
> > > Is there an easy way in PHP to parse a comma delimited text file that
> > could
> > > be uploaded in a form?  Thanks!
> > > -Greg
> > >
> > >
> > >
> > > --
> > > 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




Re: [PHP] parse comma delimited file

2002-11-14 Thread Greg
Great, thanks...didn't see  that one :)
-Greg


"Kevin Stone" <[EMAIL PROTECTED]> wrote in message
news:176401c28c32$11cf7fe0$6601a8c0@;kevin...
> You bet there is..
>
> fgetcsv();
> http://www.php.net/manual/en/function.fgetcsv.php
>
> -Kevin
>
> - Original Message -
> From: "Greg" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Thursday, November 14, 2002 3:57 PM
> Subject: [PHP] parse comma delimited file
>
>
> > Hi-\
> > Is there an easy way in PHP to parse a comma delimited text file that
> could
> > be uploaded in a form?  Thanks!
> > -Greg
> >
> >
> >
> > --
> > 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




Fw: [PHP] parse comma delimited file

2002-11-14 Thread Kevin Stone
You bet there is..

fgetcsv();
http://www.php.net/manual/en/function.fgetcsv.php

-Kevin

- Original Message -
From: "Greg" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, November 14, 2002 3:57 PM
Subject: [PHP] parse comma delimited file


> Hi-\
> Is there an easy way in PHP to parse a comma delimited text file that
could
> be uploaded in a form?  Thanks!
> -Greg
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>



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




Re: [PHP] PHP download problem IE5 on mac

2002-11-14 Thread Justin French
IE5 Mac is a  *B I T C H*  with file downloads.  It doesn't behave like any
tutorial suggests it should.


Justin French



on 15/11/02 1:22 AM, Ernest E Vogelsinger ([EMAIL PROTECTED]) wrote:

> At 15:13 14.11.2002, Javier Montserat spoke out and said:
> [snip]
>> I'm using this code to various files for download via a http header -
>> 
>> $filename = basename($filepath);
>> header("Content-type: unknown/unknown");
>> header("Content-Disposition: attachment; filename=$filename");
>> readfile($filepath);
>> 
>> works fine in most cases - the save dialogue appears.  However -
>> 
>> IE on a MAC loads the file inline rather than throwing the save prompt.
> [snip]
> 
> Try the "application/octet-stream" content type. Any browser should ask to
> save this.
> 

Justin French

http://Indent.com.au
Web Developent & 
Graphic Design



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




Re: [PHP] returning unique values in columns

2002-11-14 Thread Justin French
Check out DISTINCT in the MySQL manual... or is it UNIQUE ??

Try something like "SELECT DISTINCT * FROM "

JF




on 15/11/02 7:17 AM, [EMAIL PROTECTED] ([EMAIL PROTECTED])
wrote:

> but I only want it to return unique values - in this case I would only
> want Fashion, Basics, Plus - instead of the Fashion, Basics, Fashion,
> Plus, Plus I would get if I had run: SELECT column FROM tblname;
> 
> any help would be greatly appreciated...


Justin French

http://Indent.com.au
Web Developent & 
Graphic Design



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




Re: [PHP] How to implode multi-dimensional arrays?

2002-11-14 Thread Jonathan Sharp
Dope...try this instead...

foreach ( $array AS $a )
{
$string .= implode("\t", $a) . "\n";
}

-js


Jonathan Sharp wrote:
> foreach( $array AS $d2 )
> {
>$string .= implode('', $d2) . "\n";
> }
> 
> -js
> 
> 
> René Fournier wrote:
> 
>>The docs don't seem to discuss this... Or maybe I'm looking in the wrong
>>place. Anyway, I want to convert a multidimensional array back to the
>>tab-delimited format it began as ("\t" separating fields, "\n"
>>seperating records/rows)...  Any ideas???
>>
>>Rene
>>
>>---
>>René Fournier,
>>[EMAIL PROTECTED]
>>
>>Toll-free +1.888.886.2754
>>Tel +1.403.291.3601
>>Fax +1.403.250.5228
>>www.smartslitters.com
>>
>>SmartSlitters International
>>#33, 1339 - 40th Ave NE
>>Calgary AB  T2E 8N6
>>Canada
>>
>>
> 
> 
> 
> 




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




Re: [PHP] How to implode multi-dimensional arrays?

2002-11-14 Thread Jonathan Sharp
foreach( $array AS $d2 )
{
   $string .= implode('', $d2) . "\n";
}

-js


René Fournier wrote:
> The docs don't seem to discuss this... Or maybe I'm looking in the wrong
> place. Anyway, I want to convert a multidimensional array back to the
> tab-delimited format it began as ("\t" separating fields, "\n"
> seperating records/rows)...  Any ideas???
> 
> Rene
> 
> ---
> René Fournier,
> [EMAIL PROTECTED]
> 
> Toll-free +1.888.886.2754
> Tel +1.403.291.3601
> Fax +1.403.250.5228
> www.smartslitters.com
> 
> SmartSlitters International
> #33, 1339 - 40th Ave NE
> Calgary AB  T2E 8N6
> Canada
> 
> 




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




Re: [PHP] scanning for non alpha characters

2002-11-14 Thread Justin French
Reading your other post, I think what you REALLY want to do is throw away an
variable that contains non-numeric values...  Since you only want numbers,
then everything else must be a mistake, or an attack.

take the URL blah.php?foo=45&bah=hekygu

if(in_numeric($_GET['foo']))
{
// do stuff
}
else
{
unset($_GET['foo'])
}

if(in_numeric($_GET['bah']))
{
// do stuff
}
else
{
unset($_GET['bah'])
}


A LOT quicker than regexp, and you're changing the question from "i want to
strip this stuff out" to "i want to keep this stuff in", which is a lot
safer than trying to imagine everything a hacker might try... a good rule to
live by, even if it's not totally needed in this case.


Justin French


on 15/11/02 1:32 AM, CJ ([EMAIL PROTECTED]) wrote:

> I want to scan the variables passed from teh url of my script for non alpha
> characters.  The variables should only consist of a-z A-Z 0-9 and spaces,
> full stops and commas (Basically I don't want scripts to be passed via the
> variable to the server)
> 
> I've used perl a long time ago and its regular expressions seemed ideal for
> this kind of thing.  Can enybody suggest a scrip to remove unwanted
> characters from my variable?
> 
> 

Justin French

http://Indent.com.au
Web Developent & 
Graphic Design



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




[PHP] parse comma delimited file

2002-11-14 Thread Greg
Hi-\
Is there an easy way in PHP to parse a comma delimited text file that could
be uploaded in a form?  Thanks!
-Greg



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




Re: [PHP] passing multiple variables in a url

2002-11-14 Thread Justin French
on 15/11/02 12:11 AM, CJ ([EMAIL PROTECTED]) wrote:

> I have a "contact us" php script on my site that allows users to email
> direct from the webiste.  I want to be able to pass the to address and
> subject line to the script so I can call teh web page from elsewhere on the
> site and have it automatically choose the correct email address and subject
> line.
> 
> EG instad of using mailto:joe@;bloggs.mail.com> which requires them
> to have an email client set up on the machine I want to link to
> 
> The script already handles the email=director by setting a default entry in
> a drop down form but I can't get it to separate the first and second
> variables in the URL.




> Also is this a big security risk as I will be echoing the 2nd variable as
> the contents of a form field.  Would it be possible for someone to type in
> the URL with HTML/php in it that would make a mess of everything?  How can I
> protect against this?  Would it be sufficient to just pase the 2nd variable
> for non alphabetic characters and remove them?

As I think I read replied by someone else, I'd have numeric IDs for both the
staff AND the subject.

staff
1 = [EMAIL PROTECTED]
2 = [EMAIL PROTECTED]
3 = [EMAIL PROTECTED]
4 = [EMAIL PROTECTED]

subjects
1 = general enquiry
2 = technical support
3 = gambling addiction
4 = debate about red cars being faster


Then your link url is a lot cleaner




contactus.php simply has to check an array, or sql table, or what ever, to
find out what a subject id of "1" really is.  To ensure extra security over
text stuff, you can check to make sure sure $e and $s are both numeric
(check out is_numberic(), is_int(), etc etc).

You could also set defaults, so that if the $s or $e is excluded, or
invalid, you can set a default.

So these three links won't break the the page:






Good luck


Justin French

http://Indent.com.au
Web Developent & 
Graphic Design



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




[PHP] help variables !

2002-11-14 Thread John Fishworld
Hi,

I've got some variable variables which i need to check that they are not the
same !
There can be up to 9 of them !

for ($i = 1; $i <= $city_only_one; $i++) {
$citydb = "stellen_city_".$i ;
$new_city_db.$i = $$citydb;
 }


Any help appreciated
thanks



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




Re: [PHP] PROBLEMS

2002-11-14 Thread rija
Try to put this at the top of your script-


///  SCRIPT  ///




- Original Message -
From: "Ysrael Guzmán" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, November 15, 2002 9:00 AM
Subject: [PHP] PROBLEMS


THIS IS MY SCRIPT:
AND THE ERROR IS
Warning: Cannot send session cache limiter - headers already sent
(output started at
c:\foxserv\www\t-demo1\pedidos\prod_mostrar_tipo.php:4) in
c:\foxserv\www\t-demo1\pedidos\prod_mostrar_tipo.php on line 5


///  SCRIPT  ///












";
   echo "";
echo "", $filas['prod_descripcion'], "";
echo "";
echo "
";
echo "\n";
echo "";
echo "";
 file://echo "";
 echo "";
 // if (esta_en_array($camion, $cantidad))
  //   {
//   echo "VALUE='$cantidad' size='15'>";
  //  }
//else
  //

//   $cantidad = 0;
  // echo "VALUE='$cantidad' size='15'>";
//}
 // echo ">";


  echo "\n";
  echo "\n";
  echo "\n";



 // echo "";
 // echo "";

  echo "";
  echo "\n";
  echo "";

  echo "";
  echo "";





echo "";
echo "";
echo "";
echo "";
echo "";

echo "";
echo "";
echo "CODIGO: ", $filas['prod_cod'], "\n";
echo "";
echo "";

echo "";
echo "";
echo "PRESENTACION: ", $filas['prod_presentacion'],
"\n";
echo "";
echo "";

echo "";
echo "";
echo "FABRICANTE: ", $filas['prod_fabricante'],
"\n";

echo "";
echo "";
echo "DESCRIPCION: ", $filas['prod_propiedades'],
"\n";
echo "";
echo "";
}

echo "";
?>












Ysrael Guzmán Meza


-Mensaje original-
De: BigDog [mailto:bigdog@;venticon.com]
Enviado el: Jueves, 14 de Noviembre de 2002 09:54 a.m.
Para: [EMAIL PROTECTED]
Asunto: RE: [PHP] PHP Auth with Apache


You are sending the header information to the browser before the session
stuff begins...


make sure that you call "session_start();" right after your  I have a problem, i'm new in PHP
>
> It is the problem in my browsegive me the solution please
>
> Warning: Cannot send session cache limiter - headers already sent
> (output started at c:\foxserv\www\t-demo1\pedidos\prod_oficina.php:5)
> in c:\foxserv\www\t-demo1\pedidos\prod_oficina.php on line 6
>
>
> HELP MEEE!!1
>
> Sos
>
> ygm
--
.: B i g D o g :.



--
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] Redirect Problem

2002-11-14 Thread @ Nilaab
Ok, I have a problem with the header() redirect function, below is the
part-code/part-pseudocode information. The file that this code is
encapsulated in is a single file named add_item.php. There is no output
before the header() function. Now this is a weird one, but I did some
testing and here is what happens:

If there are no rows returned, redirect browser to the same page with some
needed get variables. The problem is with the submit_cat=1 get variable
attached to the URL-to-be-redirected. When I take this out of the get
string, the script redirects the user just fine when the value of
$num_rows=0. I still need that variable to be sent so when I place the
submit_cat=1 variable back into the get string it takes you to the default
Apache error page entitled, "Internal Server Error". Why is this submit_cat
variable causing me so much trouble?

fetch_results($query);
.
.
.
   }
}

?>

- Nilaab


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




[PHP] Installing extensions (winXP)

2002-11-14 Thread Davy Obdam
Hiya people,

I want to install some extensions like PDF and XSLT, curl etc. I have
the GD libary installed in my php.ini like this: 

extension=php_gd.dll. 

When i try to un quote the other extensions and restart Apache i get
errors, that he could load this extension. Also i have done this in my
php.ini :

; Directory in which the loadable extensions (modules) reside.
extension_dir = "C:\Program Files\PHP\extensions" 

, is this alright? If i look at my phpinfo(); it does show those
extensions but stil i get errors. I use Windows XP home with Apache
2.0.40 and PHP 4.2.3 installed as a apache(sapi) module. Can anyone help
me, any help is apreciated. Also wich extensions should i use or wich
are most commonly used? Thanks already...

Best regards,
 
Davy Obdam
mailto:info@;davyobdam.com



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




Re: [PHP] OOP-related question

2002-11-14 Thread Danny Shepherd
I think the error is fairly self explanatory here - you can't pass the
parameter by reference. Globalising the $$class var will retain scope.

Danny.

- Original Message -
From: "Tularis" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, November 14, 2002 9:29 PM
Subject: Re: [PHP] OOP-related question


> Ok, I combined both, your tip and Brent's, now I have the following
> error, with the following code:
>
> Fatal error: Cannot pass parameter 1 by reference in
> /home/shadowlight/public_html/test/libs/global.lib.php on line 296
>
> code:
> function load(&$class){
> global $$class;
>
> $$class = new $class;
> $this->loaded[$class] = 1;
>
> $$class->setup(); // Run constructor
>
> if(!is_object($$class)){
> return false;
> }
> return true;
> }
> }
> Danny Shepherd wrote:
>
> > Hello,
> >
> > Adding the following as the first line of overall->load() should solve
> > your
> > problem.
> >
> > global $$class;
> >
> > HTH,
> >
> > Danny.
> >
> > - Original Message -
> > From: "Tularis"
> > To:
> > Sent: Thursday, November 14, 2002 8:18 PM
> > Subject: [PHP] OOP-related question
> >
> >
> >
> > >Hey,
> > >I have the following script:
> > >class overall {
> > >
> > >function overall(){
> > >$this->loaded['overall'] =1;
> > >
> > >function load($class){
> > >
> > >$$class = new $class;
> > >$this->loaded[$class] = 1;
> > >
> > >$$class->setup(); // Run constructor
> > >
> > >if(!is_object($$class)){
> > >return false;
> > >}
> > >return true;
> > >}
> > >}
> > >
> > >then I have a few classes, which hold a setup() function as thei
> > >'constructor'. Then, I do this:
> > >
> > >$overall = new overall;
> > >$overall->load('debug');
> > >
> > >this should load the debug class. I want it to load to $debug->, but it
> > >won't even load to $overall->debug
> > >
> > >It's not really a *need* to have this, it's just something that will
> > >help me in keeping control over all classes. I don't want to use new
> > >class, because this way it would be easier to 'instruct' the
> > >'constructor' of those new classes to change the values of the vars to
a
> > >specific one, without calling for something weird...
> > >
> > >anyway, it doesn't work, and it doesn't spit out an error either.
> > >Any ideas?
> > >
> > >- Tularis
> > >
> > >
> > >--
> > >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] How to implode multi-dimensional arrays?

2002-11-14 Thread René Fournier
The docs don't seem to discuss this... Or maybe I'm looking in the 
wrong place. Anyway, I want to convert a multidimensional array back to 
the tab-delimited format it began as ("\t" separating fields, "\n" 
seperating records/rows)...  Any ideas???

...Rene

---
René Fournier,
[EMAIL PROTECTED]

Toll-free +1.888.886.2754
Tel +1.403.291.3601
Fax +1.403.250.5228
www.smartslitters.com

SmartSlitters International
#33, 1339 - 40th Ave NE
Calgary AB  T2E 8N6
Canada


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



Re: [PHP] Trivial newbie regex question

2002-11-14 Thread Jonathan Sharp
one more thought bout this just for the record... not sure which is
faster, but this may be the better solution:

$index = substr($url, strrpos($url, '/'), strrpos($url, '.')-1);

-js


Jonathan Sharp wrote:
> good catch, i guess i love php so much i just expect it to know what i
> want it to do!
> 
> -js
> 
> 
> John W. Holmes wrote:
> 
>>substr(basename($url), 0, strrpos($url,'.')-1);
>>
>>note the '.' 
>>
>>:)
>>
>>---John Holmes...
>>
>>
>>
>>>-Original Message-
>>>From: Jonathan Sharp [mailto:js-lists@;sharpmedia.net]
>>>Sent: Wednesday, November 13, 2002 10:50 PM
>>>To: [EMAIL PROTECTED]
>>>Cc: 'Charles Wiltgen'; 'List ? PHP General'
>>>Subject: Re: [PHP] Trivial newbie regex question
>>>
>>>but my way is so pretty! i mean, who cares if it doesn't work
>>
>>'exactly'
>>
>>
>>>as you want, we're going for the ballpark solution right???
>>>
>>>fine...
>>>substr(basename($url), 0, strrpos($url)-1);
>>>
>>>(note the strRpos)
>>>
>>>-js
>>>
>>>
>>>John W. Holmes wrote:
>>>
>>>
He wants just "index" though, instead of "index.html"

You can do it a variety of ways. You can use basename() like
>>>
>>Jonathan
>>
>>
said, and just strip off the last 5 characters using substr().

Or you can use either of the following two regular expressions.

preg_match('~/([^/]*)\.html$~', $source, $dest);
ereg('/([^/]*)\.html$',$source,$dest);

---John Holmes...




>-Original Message-
>From: Jonathan Sharp [mailto:js-lists@;sharpmedia.net]
>Sent: Wednesday, November 13, 2002 10:34 PM
>To: Charles Wiltgen
>Cc: List ˆ PHP General
>Subject: Re: [PHP] Trivial newbie regex question
>
>try basename('http://www.domain.com/stuff/index.html');
>
>-js
>
>
>Charles Wiltgen wrote:
>
>
>
>>Hello,
>>
>>I just want to get the "index" part of
>
>>"http://www.domain.com/stuff/
>>
>>
>>index.html".
>>
>>I'm trying to figure out this regex stuff, but it hasn't yet
>
clicked.



>>Here's my best guess:
>>
>>  ereg('?/(*)\.html$', $source, $dest);
>>
>>To me -- and please be gentle -- this means, "Starting with the
>
forward



>>slash closest to the end of $source, capture whatever comes after
>
>>it
>>
>>
and



>>before '.html', and put it in $dest."  Obviously not correct, but
>
I've



>spent
>
>
>
>>an embarrassing amount of time feel stupid.  Help?
>>
>>-- Charles Wiltgen
>>
>>
>
>
>
>
>--
>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: PROBLEMS

2002-11-14 Thread Tularis
all header-modifying functions should be BEFORE any echoing is done, so:

session_start();
if(!session_is_registered("camion"))
   DIE("error");

should be BEFORE:




Ysrael guzmán wrote:


THIS IS MY SCRIPT:
AND THE ERROR IS
Warning: Cannot send session cache limiter - headers already sent
(output started at
c:\foxserv\www\t-demo1\pedidos\prod_mostrar_tipo.php:4) in
c:\foxserv\www\t-demo1\pedidos\prod_mostrar_tipo.php on line 5


///  SCRIPT  ///








 ";		echo " "; echo "*", 
$filas['prod_descripcion'], "*"; echo ""; echo "
 "; echo "
\n"; echo "

"; echo " ";  			//echo "";  			echo ""; //		if 
(esta_en_array($camion, $cantidad))   //	   { // 
 echo "VALUE='$cantidad' size='15'>";   // 
  } //else   //  {  // 
  $cantidad = 0;   // echo 
"VALUE='$cantidad' size='15'>"; //} 
// echo ">"; echo "\n"; 
echo "\n";   echo "\n"; 
// echo "";  // echo "";echo " "; 
  echo "\n";   echo ""; 
   echo "
";   echo "
"; 	    		 		echo ""; echo " "; echo "

"; echo ""; echo "
";  		 		echo ""; echo " "; echo "*CODIGO: *", 
$filas['prod_cod'], "
\n"; echo ""; echo "
";  echo ""; echo " "; echo "*PRESENTACION: *", 
$filas['prod_presentacion'], "
\n"; echo ""; echo "
";  echo ""; echo " "; echo "*FABRICANTE: *", 
$filas['prod_fabricante'], "
\n";  echo "
"; echo " "; echo "*DESCRIPCION: *", $filas['prod_propiedades'], "
\n"; echo ""; echo "
";	 } 	 echo "

"; ?>









Ysrael Guzmán Meza


-Mensaje original-
De: BigDog [mailto:bigdog@;venticon.com]
Enviado el: Jueves, 14 de Noviembre de 2002 09:54 a.m.
Para: [EMAIL PROTECTED]
Asunto: RE: [PHP] PHP Auth with Apache


You are sending the header information to the browser before the session
stuff begins...


make sure that you call "session_start();" right after your I have a 
problem, i'm new in PHP
>
>It is the problem in my browsegive me the solution please
>
>Warning: Cannot send session cache limiter - headers already sent
>(output started at c:\foxserv\www\t-demo1\pedidos\prod_oficina.php:5)
>in c:\foxserv\www\t-demo1\pedidos\prod_oficina.php on line 6
>
>
>HELP MEEE!!1
>
>Sos
>
>ygm



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




[PHP] Re: PROBLEMS

2002-11-14 Thread Coert Metz
call session_start() before 

in this way:



..


and so on...

Coert Metz

Ysrael guzmán wrote:

THIS IS MY SCRIPT:
AND THE ERROR IS 
Warning: Cannot send session cache limiter - headers already sent
(output started at
c:\foxserv\www\t-demo1\pedidos\prod_mostrar_tipo.php:4) in
c:\foxserv\www\t-demo1\pedidos\prod_mostrar_tipo.php on line 5


///  SCRIPT  ///




session_start();
if(!session_is_registered("camion"))
   DIE("error");
?>



//require "comun.inc"; para llamar a la conexion mejor poner include
//include "array.inc" para funciones de array
$conexion = mysql_connect("localhost", "root");
mysql_select_db("bd1", $conexion);
?>






echo $codigo;
// función que determina si un determinado valor coincide con 
// un elemento que pertenece al array que se pasa como parámetro  
//
//function esta_en_array($objetos, $elemento)
//   {
//   $i = 0;
//   $encontrado = false;
//   while (($i < count($objetos)) && !$encontrado)
//  {
//  while($elemento = each($objetos[$i]))
//  {
//  $encontrado = ($objetos[$i] == $elemento);
//  $i++;
// }
//  }
//   return $encontrado;  
//   }
//
$consulta = "select * from productos where prod_cod = '$codigo'";
$rta = mysql_query($consulta, $conexion);
$num_filas = mysql_num_rows($rta);
$num_campos = mysql_num_fields($rta);
//echo $num_filas;
while($filas = mysql_fetch_array($rta))
{
$codigo = $filas['prod_cod'];
$nombre = $filas['prod_descripcion'];
$precio = $filas['prod_precio'];
 	 		echo "";
   		echo "";
echo "
face='verdana' size=2>", $filas['prod_descripcion'], "";
echo "";
echo "
";
echo "
ACTION='guardar_array.php'>\n";
echo "";
echo "";
 			//echo "
VALUE='$filas['prod_cod']'>";
 			echo "";   
 //		if (esta_en_array($camion, $cantidad))
  //	   {
//   echo "VALUE='$cantidad' size='15'>";
  //  }
//else
  //  { 
//   $cantidad = 0;
  // echo "VALUE='$cantidad' size='15'>";
//}
 // echo ">";
  
  
  echo "
VALUE='$codigo'>\n";
  echo "
VALUE='$nombre'>\n";
  echo "
VALUE='$precio'>\n";
  


 // echo "";
 // echo "";

  echo "";
  echo "\n";
  echo "";
  
  echo "";
  echo "";
	   




		 		echo "";
echo "";
echo "";
echo "";
echo "";

		 		echo "";
echo "
width='100%'>";
echo "CODIGO: 
color='red' face='verdana' size=2>", $filas['prod_cod'], "\n";
echo "";
echo "";

echo "";
echo "
width='100%'>";
echo "PRESENTACION: 
color='red' face='verdana' size=2>", $filas['prod_presentacion'],
"\n";
echo "";
echo "";

echo "";
echo "
width='100%'>";
echo "FABRICANTE: 
color='red' face='verdana' size=2>", $filas['prod_fabricante'],
"\n";

echo "";
echo "
width='100%'>";
echo "DESCRIPCION: 
color='red' face='verdana' size=2>", $filas['prod_propiedades'],
"\n";
echo "";
echo "";	
}
	
echo "";
?>










mysql_free_result($rta);
mysql_close($conexion);
?>



Ysrael Guzmán Meza


-Mensaje original-
De: BigDog [mailto:bigdog@;venticon.com] 
Enviado el: Jueves, 14 de Noviembre de 2002 09:54 a.m.
Para: [EMAIL PROTECTED]
Asunto: RE: [PHP] PHP Auth with Apache


You are sending the header information to the browser before the session
stuff begins...


make sure that you call "session_start();" right after your 
tag...



On Thu, 2002-11-14 at 21:50, Ysrael Guzmán wrote:

I have a problem, i'm new in PHP

It is the problem in my browsegive me the solution please

Warning: Cannot send session cache limiter - headers already sent 
(output started at c:\foxserv\www\t-demo1\pedidos\prod_oficina.php:5) 
in c:\foxserv\www\t-demo1\pedidos\prod_oficina.php on line 6


HELP MEEE!!1

Sos

ygm




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




[PHP] PROBLEMS

2002-11-14 Thread Ysrael Guzmán
THIS IS MY SCRIPT:
AND THE ERROR IS 
Warning: Cannot send session cache limiter - headers already sent
(output started at
c:\foxserv\www\t-demo1\pedidos\prod_mostrar_tipo.php:4) in
c:\foxserv\www\t-demo1\pedidos\prod_mostrar_tipo.php on line 5


///  SCRIPT  ///












";
echo "";
echo "", $filas['prod_descripcion'], "";
echo "";
echo "
";
echo "\n";
echo "";
echo "";
//echo "";
echo "";   
 // if (esta_en_array($camion, $cantidad))
  //   {
//   echo "VALUE='$cantidad' size='15'>";
  //  }
//else
  //  { 
//   $cantidad = 0;
  // echo "VALUE='$cantidad' size='15'>";
//}
 // echo ">";
  
  
  echo "\n";
  echo "\n";
  echo "\n";
  


 // echo "";
 // echo "";

  echo "";
  echo "\n";
  echo "";
  
  echo "";
  echo "";
   




echo "";
echo "";
echo "";
echo "";
echo "";

echo "";
echo "";
echo "CODIGO: ", $filas['prod_cod'], "\n";
echo "";
echo "";

echo "";
echo "";
echo "PRESENTACION: ", $filas['prod_presentacion'],
"\n";
echo "";
echo "";

echo "";
echo "";
echo "FABRICANTE: ", $filas['prod_fabricante'],
"\n";

echo "";
echo "";
echo "DESCRIPCION: ", $filas['prod_propiedades'],
"\n";
echo "";
echo "";   
}

echo "";
?>












Ysrael Guzmán Meza


-Mensaje original-
De: BigDog [mailto:bigdog@;venticon.com] 
Enviado el: Jueves, 14 de Noviembre de 2002 09:54 a.m.
Para: [EMAIL PROTECTED]
Asunto: RE: [PHP] PHP Auth with Apache


You are sending the header information to the browser before the session
stuff begins...


make sure that you call "session_start();" right after your  I have a problem, i'm new in PHP
> 
> It is the problem in my browsegive me the solution please
> 
> Warning: Cannot send session cache limiter - headers already sent 
> (output started at c:\foxserv\www\t-demo1\pedidos\prod_oficina.php:5) 
> in c:\foxserv\www\t-demo1\pedidos\prod_oficina.php on line 6
> 
> 
> HELP MEEE!!1
> 
> Sos
> 
> ygm
-- 
.: B i g D o g :.



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


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




RE: [PHP] PHP Auth with Apache

2002-11-14 Thread BigDog
You are sending the header information to the browser before the session
stuff begins...


make sure that you call "session_start();" right after your  I have a problem, i'm new in PHP
> 
> It is the problem in my browsegive me the solution please
> 
> Warning: Cannot send session cache limiter - headers already sent
> (output started at c:\foxserv\www\t-demo1\pedidos\prod_oficina.php:5) in
> c:\foxserv\www\t-demo1\pedidos\prod_oficina.php on line 6
> 
> 
> HELP MEEE!!1
> 
> Sos
> 
> ygm
-- 
.: B i g D o g :.



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




Re: [PHP] Removing duplicates in multi-dimensional array

2002-11-14 Thread rija
You can also create new uni dimensional array
with key like this '0-1' and run array_unique
and after come back to myarray

for example
[UNTESTED]

foreach ($myarray as $key1 => $value)
foreach($value as $key2 => $value2) $new_array["$key1-$key2"] = $value2
;
unset($myarray) ;

$new_array = array_unique($new_array) ;
foreach($new_array as $key => $value)
 if (ereg("([0-9])-([0-9])", $key, $reg) $myarray[$reg[1]][$reg[2]] = $value
;

- Original Message -
From: "René Fournier" <[EMAIL PROTECTED]>
To: "php" <[EMAIL PROTECTED]>
Sent: Friday, November 15, 2002 7:31 AM
Subject: [PHP] Removing duplicates in multi-dimensional array


I'm finding this one hard to approach...

I have a two-dimensional array, containing customer contact
information. Looks like:

$myarray[0][0] = "Microsoft";
$myarray[0][1] = "Bill";
$myarray[0][2] = "123-1234";

$myarray[1][0] = "Apple";
$myarray[1][1] = "Steve";
$myarray[1][2] = "456-1234"; <

$myarray[2][0] = "Oracle";
$myarray[2][1] = "Larry";
$myarray[2][2] = "987-4321";

$myarray[3][0] = "Pixar";
$myarray[3][1] = "Steve";
$myarray[3][2] = "456-1234"; <

What I want to do is remove records that have the same fax number, so
that each fax number occurs only once. For example,  $myarray[1][2] and
$myarray[3][2] are the same--I would like to remove/unset one of them.

I know that array_unique() will do this for one-dimensional arrays, but
I'm kinda stuck here, since the repeating element is in the second
dimension. Any ideas how I might do this?

Thanks.

...Rene

---
René Fournier,
[EMAIL PROTECTED]

Toll-free +1.888.886.2754
Tel +1.403.291.3601
Fax +1.403.250.5228
www.smartslitters.com

SmartSlitters International
#33, 1339 - 40th Ave NE
Calgary AB  T2E 8N6
Canada


--
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] returning unique values in columns

2002-11-14 Thread rija
GROUP BY column ???

For example if you want the count(*) of each value
do like this
SELECT column, count(*) from 'tablename' GROUP BY column ;

- Original Message - 
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, November 15, 2002 8:17 AM
Subject: [PHP] returning unique values in columns


> Is there any way to run a query in mysql that retuns unique values in a
> column?  For example, say i had this colum:
> 
> Column:
> -
> Fashion
> -
> Basics
> -
> Fashion
> -
> Plus
> 
> Plus
> -
> 
> but I only want it to return unique values - in this case I would only
> want Fashion, Basics, Plus - instead of the Fashion, Basics, Fashion,
> Plus, Plus I would get if I had run: SELECT column FROM tblname;
> 
> any help would be greatly appreciated...
> 



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




RE: [PHP] PHP Auth with Apache

2002-11-14 Thread Ysrael Guzmán
I have a problem, i'm new in PHP

It is the problem in my browsegive me the solution please

Warning: Cannot send session cache limiter - headers already sent
(output started at c:\foxserv\www\t-demo1\pedidos\prod_oficina.php:5) in
c:\foxserv\www\t-demo1\pedidos\prod_oficina.php on line 6


HELP MEEE!!1

Sos

ygm



Re: [PHP] Ordering a text field

2002-11-14 Thread 1LT John W. Holmes
> I'm running a mysql query with the ORDER BY clause, the problem is that
> the column that I'm running them on is type tinytext.  The data are
> product numbers, most of which are numbers, but some are like "404R" or
> whatever else.  So if my values are 403, 404R,405, 4150 - the order ends
> up being:
> 403
> 4150
> 404R
> 405

You'll have to make them numbers, which can be done by adding zero to it. As
long as your letters are only at the end of the numbers, it'll work...

ORDER BY 0+column

404R will be 404, but 4R04 would become 4. You lose everything after the
first letter.

---John Holmes...


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




Re: [PHP] OOP-related question

2002-11-14 Thread Tularis
Ok, I combined both, your tip and Brent's, now I have the following 
error, with the following code:

Fatal error: Cannot pass parameter 1 by reference in 
/home/shadowlight/public_html/test/libs/global.lib.php on line 296

code:
	function load(&$class){
		global $$class;

		$$class = new $class;
		$this->loaded[$class] = 1;

		$$class->setup(); // Run constructor

		if(!is_object($$class)){
			return false;
		}
		return true;
	}
}
Danny Shepherd wrote:

Hello,

Adding the following as the first line of overall->load() should solve 
your
problem.

global $$class;

HTH,

Danny.

- Original Message -
From: "Tularis"
To:
Sent: Thursday, November 14, 2002 8:18 PM
Subject: [PHP] OOP-related question



>Hey,
>I have the following script:
>class overall {
>
>function overall(){
>$this->loaded['overall'] =1;
>
>function load($class){
>
>$$class = new $class;
>$this->loaded[$class] = 1;
>
>$$class->setup(); // Run constructor
>
>if(!is_object($$class)){
>return false;
>}
>return true;
>}
>}
>
>then I have a few classes, which hold a setup() function as thei
>'constructor'. Then, I do this:
>
>$overall = new overall;
>$overall->load('debug');
>
>this should load the debug class. I want it to load to $debug->, but it
>won't even load to $overall->debug
>
>It's not really a *need* to have this, it's just something that will
>help me in keeping control over all classes. I don't want to use new
>class, because this way it would be easier to 'instruct' the
>'constructor' of those new classes to change the values of the vars to a
>specific one, without calling for something weird...
>
>anyway, it doesn't work, and it doesn't spit out an error either.
>Any ideas?
>
>- Tularis
>
>
>--
>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] returning unique values in columns

2002-11-14 Thread Ewout de Boer
use: SELECT DISTINCT column FROM table



regards,

Ewout de Boer


- Original Message - 
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, November 14, 2002 10:17 PM
Subject: [PHP] returning unique values in columns


> Is there any way to run a query in mysql that retuns unique values in a
> column?  For example, say i had this colum:
> 
> Column:
> -
> Fashion
> -
> Basics
> -
> Fashion
> -
> Plus
> 
> Plus
> -
> 
> but I only want it to return unique values - in this case I would only
> want Fashion, Basics, Plus - instead of the Fashion, Basics, Fashion,
> Plus, Plus I would get if I had run: SELECT column FROM tblname;
> 
> any help would be greatly appreciated...
> 

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




[PHP] Ordering a text field

2002-11-14 Thread drparker
I'm running a mysql query with the ORDER BY clause, the problem is that
the column that I'm running them on is type tinytext.  The data are
product numbers, most of which are numbers, but some are like "404R" or
whatever else.  So if my values are 403, 404R,405, 4150 - the order ends
up being:
403
4150
404R
405

Is there any way I can leave these products numbers as text and still
order them correctly?



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




Re: [PHP] Removing duplicates in multi-dimensional array

2002-11-14 Thread Jonathan Sharp
When you build your 2d array you could make a seperate 1d array that's
indexed by the fax number and if it's set, not set it in your array...

-js


René Fournier wrote:
> I'm finding this one hard to approach...
> 
> I have a two-dimensional array, containing customer contact information.
> Looks like:
> 
> $myarray[0][0] = "Microsoft";
> $myarray[0][1] = "Bill";
> $myarray[0][2] = "123-1234";
> 
> $myarray[1][0] = "Apple";
> $myarray[1][1] = "Steve";
> $myarray[1][2] = "456-1234"; <
> 
> $myarray[2][0] = "Oracle";
> $myarray[2][1] = "Larry";
> $myarray[2][2] = "987-4321";
> 
> $myarray[3][0] = "Pixar";
> $myarray[3][1] = "Steve";
> $myarray[3][2] = "456-1234"; <
> 
> What I want to do is remove records that have the same fax number, so
> that each fax number occurs only once. For example,  $myarray[1][2] and
> $myarray[3][2] are the same--I would like to remove/unset one of them.
> 
> I know that array_unique() will do this for one-dimensional arrays, but
> I'm kinda stuck here, since the repeating element is in the second
> dimension. Any ideas how I might do this?
> 
> Thanks.
> 
> Rene
> 
> ---
> René Fournier,
> [EMAIL PROTECTED]
> 
> Toll-free +1.888.886.2754
> Tel +1.403.291.3601
> Fax +1.403.250.5228
> www.smartslitters.com
> 
> SmartSlitters International
> #33, 1339 - 40th Ave NE
> Calgary AB  T2E 8N6
> Canada
> 
> 




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




[PHP] returning unique values in columns

2002-11-14 Thread drparker
Is there any way to run a query in mysql that retuns unique values in a
column?  For example, say i had this colum:

Column:
-
Fashion
-
Basics
-
Fashion
-
Plus

Plus
-

but I only want it to return unique values - in this case I would only
want Fashion, Basics, Plus - instead of the Fashion, Basics, Fashion,
Plus, Plus I would get if I had run: SELECT column FROM tblname;

any help would be greatly appreciated...



Re: [PHP] OOP-related question

2002-11-14 Thread Brent Baisley
I think it is working, but you are not seeing anything because all the 
"variables" and objects that are declared in your classes are destroyed 
once the function exits (out of scope?). I just finished reading up on 
this, but I think you want to look into passing data by reference 
instead of value like you are doing. I see that you were trying to 
accomplish this by using variable variables, but variables are unique to 
the function they were created in.

I wish I could explain it more, but like I said, I just finished reading 
up on it. These two articles may help you a lot:
http://www.onlamp.com/pub/a/php/2002/08/15/php_foundations.html
http://www.onlamp.com/pub/a/php/2002/09/12/php_foundations.html

On Thursday, November 14, 2002, at 03:18 PM, Tularis wrote:

Hey,
I have the following script:
class overall {

	function overall(){
		$this->loaded['overall'] =1;

	function load($class){
		
		$$class = new $class;
		$this->loaded[$class] = 1;
		
		$$class->setup(); // Run constructor
		
		if(!is_object($$class)){
			return false;
		}
		return true;
	}
}

then I have a few classes, which hold a setup() function as thei 
'constructor'. Then, I do this:

$overall = new overall;
$overall->load('debug');

this should load the debug class. I want it to load to $debug->, but it 
won't even load to $overall->debug

It's not really a *need* to have this, it's just something that will 
help me in keeping control over all classes. I don't want to use new 
class, because this way it would be easier to 'instruct' the 
'constructor' of those new classes to change the values of the vars to 
a specific one, without calling for something weird...

anyway, it doesn't work, and it doesn't spit out an error either.
Any ideas?

- Tularis


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


--
Brent Baisley
Systems Architect
Landover Associates, Inc.
Search & Advisory Services for Advanced Technology Environments
p: 212.759.6400/800.759.0577


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




Re: [PHP] OOP-related question

2002-11-14 Thread Danny Shepherd
Hello,

Adding the following as the first line of overall->load() should solve your
problem.

global $$class;

HTH,

Danny.

- Original Message -
From: "Tularis" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, November 14, 2002 8:18 PM
Subject: [PHP] OOP-related question


> Hey,
> I have the following script:
> class overall {
>
> function overall(){
> $this->loaded['overall'] =1;
>
> function load($class){
>
> $$class = new $class;
> $this->loaded[$class] = 1;
>
> $$class->setup(); // Run constructor
>
> if(!is_object($$class)){
> return false;
> }
> return true;
> }
> }
>
> then I have a few classes, which hold a setup() function as thei
> 'constructor'. Then, I do this:
>
> $overall = new overall;
> $overall->load('debug');
>
> this should load the debug class. I want it to load to $debug->, but it
> won't even load to $overall->debug
>
> It's not really a *need* to have this, it's just something that will
> help me in keeping control over all classes. I don't want to use new
> class, because this way it would be easier to 'instruct' the
> 'constructor' of those new classes to change the values of the vars to a
> specific one, without calling for something weird...
>
> anyway, it doesn't work, and it doesn't spit out an error either.
> Any ideas?
>
> - Tularis
>
>
> --
> 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] Error uploading a file

2002-11-14 Thread BigDog
Are you sure that the size is specified correctly?

I remember that i have but down 32 for mb when really it takes bytes as
the number so i had 32 bytes which sucked for me...


On Thu, 2002-11-14 at 20:36, Emiliano Marmonti wrote:
> Hello all,
> 
>   when I try to upload a file I receive the following error:
>
>   Warning: Max file size of 2 bytes exceeded - file [Archivo] not saved in 
> Unknown on line 
> 
>   I've looked into php.ini and it has the limit set to 2Mb. Have looked using 
> phpinfo and everything looks OK. I'm sure this code was working, I'm using PHP 
> v 4.01pl2
> 
> Anu help?
> Thanks a lot
> Emiliano Marmonti
> 
> 
> 
>   
> 
> 
> 
> -
> This mail sent through IMP: http://horde.org/imp/
-- 
.: B i g D o g :.



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




[PHP] sendmail problem

2002-11-14 Thread Jeff Bluemel
OK - I got the rasmail codes from Zend.com's code library.  it is working
perfectly for my application except for one problem.  the email I am using
to send has a .pdf file attachment.

I can open that PDF file up directly from the site after it is created, but
I cannot open the file attachment up.  it seems the coding is wrong of
something like that so that the attachment is getting corrupted.

I have emailed the author for assistance, but haven't receive a response.
I'm hoping somebody here can assist me.

here is the part of code;

function Attachment($attachedfile) {
  if ($attachedfile) {
  $pf=@fopen($attachedfile,"r") or die($this->ErrorOutput(9));
  $bytes=fread($pf,filesize($attachedfile));
  $file=chunk_split(base64_encode($bytes));
  fclose($pf);
  }



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




Re: [PHP] STDIN question

2002-11-14 Thread BigDog
There sys admins just do not want to deal with it...

On my box i have about 2-3 versions of php and 2 version of apache at
any given moment...

but it can get confusing sometimes... :)



On Thu, 2002-11-14 at 20:27, Mike D wrote:
> Thanks for the feedback BigDog and Jason Wong (you guys rock!)
> 
> That's what I thought as far as the STDIN goes... My host has told me 
> that it would screw up our current DSO version of PHP if we installed a 
> second CGI version of PHP, is that a crock or what?
> 
> 
> On Thursday, November 14, 2002, at 05:18  AM, BigDog wrote:
> 
> > You would have to pass it through the "get" method...
> >
> > You can only pass stdin to the binary...
> >
> >
> >
> > On Thu, 2002-11-14 at 20:05, Mike D wrote:
> >> Is it possible to pass STDIN data to a php script via wget  or lynx
> >> (cuz Apache is not installed in CGI mode, so I don't have a binary to
> >> call)??
> >>
> >> I am trying to create a setup where, a certain email address when 
> >> sent,
> >> takes the message data and passes it to a php script to insert into a
> >> DB for a ticketing system.
> >>
> >> Thanks
> >> Mike D
> > -- 
> > .: B i g D o g :.
> >
> >
> >
> > -- 
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
-- 
.: B i g D o g :.



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




Re: [PHP] STDIN question

2002-11-14 Thread Mike D
Thanks again Jason. - MD


On Thursday, November 14, 2002, at 12:38  PM, Jason Wong wrote:


On Friday 15 November 2002 04:27, Mike D wrote:

Thanks for the feedback BigDog and Jason Wong (you guys rock!)

That's what I thought as far as the STDIN goes... My host has told me
that it would screw up our current DSO version of PHP if we installed 
a
second CGI version of PHP, is that a crock or what?

It's not "what" :)

Compiling a CGI (or CLI) version of PHP does not interfere at all with 
the DSO
version of PHP. You can copy the resulting php binary to wherever you 
want
and it runs fine as a standalone executable.

--
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *

/*
Ask yourself whether you are happy and you cease to be so.
		-- John Stuart Mill
*/


--
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] STDIN question

2002-11-14 Thread Jason Wong
On Friday 15 November 2002 04:27, Mike D wrote:
> Thanks for the feedback BigDog and Jason Wong (you guys rock!)
>
> That's what I thought as far as the STDIN goes... My host has told me
> that it would screw up our current DSO version of PHP if we installed a
> second CGI version of PHP, is that a crock or what?

It's not "what" :)

Compiling a CGI (or CLI) version of PHP does not interfere at all with the DSO 
version of PHP. You can copy the resulting php binary to wherever you want 
and it runs fine as a standalone executable.

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *

/*
Ask yourself whether you are happy and you cease to be so.
-- John Stuart Mill
*/


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




[PHP] Removing duplicates in multi-dimensional array

2002-11-14 Thread René Fournier
I'm finding this one hard to approach...

I have a two-dimensional array, containing customer contact 
information. Looks like:

$myarray[0][0] = "Microsoft";
$myarray[0][1] = "Bill";
$myarray[0][2] = "123-1234";

$myarray[1][0] = "Apple";
$myarray[1][1] = "Steve";
$myarray[1][2] = "456-1234"; <

$myarray[2][0] = "Oracle";
$myarray[2][1] = "Larry";
$myarray[2][2] = "987-4321";

$myarray[3][0] = "Pixar";
$myarray[3][1] = "Steve";
$myarray[3][2] = "456-1234"; <

What I want to do is remove records that have the same fax number, so 
that each fax number occurs only once. For example,  $myarray[1][2] and 
$myarray[3][2] are the same--I would like to remove/unset one of them.

I know that array_unique() will do this for one-dimensional arrays, but 
I'm kinda stuck here, since the repeating element is in the second 
dimension. Any ideas how I might do this?

Thanks.

...Rene

---
René Fournier,
[EMAIL PROTECTED]

Toll-free +1.888.886.2754
Tel +1.403.291.3601
Fax +1.403.250.5228
www.smartslitters.com

SmartSlitters International
#33, 1339 - 40th Ave NE
Calgary AB  T2E 8N6
Canada


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



Re: [PHP] PHP download problem IE5 on mac

2002-11-14 Thread Jason Wong
On Thursday 14 November 2002 23:22, Ernest E Vogelsinger wrote:
> At 15:13 14.11.2002, Javier Montserat spoke out and said:
> [snip]
>
> >I'm using this code to various files for download via a http header -
> >
> >$filename = basename($filepath);
> >header("Content-type: unknown/unknown");
> >header("Content-Disposition: attachment; filename=$filename");
> >readfile($filepath);
> >
> >works fine in most cases - the save dialogue appears.  However -
> >
> >IE on a MAC loads the file inline rather than throwing the save prompt.
>
> [snip]
>
> Try the "application/octet-stream" content type. Any browser should ask to
> save this.

Or most likely an IE bug, it makes a regular appearance in the Windows 
versions.

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *

/*
I don't care where I sit as long as I get fed.
-- Calvin Trillin
*/


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




[PHP] Error uploading a file

2002-11-14 Thread Emiliano Marmonti
Hello all,

  when I try to upload a file I receive the following error:
   
  Warning: Max file size of 2 bytes exceeded - file [Archivo] not saved in 
Unknown on line 

  I've looked into php.ini and it has the limit set to 2Mb. Have looked using 
phpinfo and everything looks OK. I'm sure this code was working, I'm using PHP 
v 4.01pl2

Anu help?
Thanks a lot
Emiliano Marmonti



  



-
This mail sent through IMP: http://horde.org/imp/

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




Re: [PHP] STDIN question

2002-11-14 Thread Mike D
Thanks for the feedback BigDog and Jason Wong (you guys rock!)

That's what I thought as far as the STDIN goes... My host has told me 
that it would screw up our current DSO version of PHP if we installed a 
second CGI version of PHP, is that a crock or what?


On Thursday, November 14, 2002, at 05:18  AM, BigDog wrote:

You would have to pass it through the "get" method...

You can only pass stdin to the binary...



On Thu, 2002-11-14 at 20:05, Mike D wrote:

Is it possible to pass STDIN data to a php script via wget  or lynx
(cuz Apache is not installed in CGI mode, so I don't have a binary to
call)??

I am trying to create a setup where, a certain email address when 
sent,
takes the message data and passes it to a php script to insert into a
DB for a ticketing system.

Thanks
Mike D
--
.: B i g D o g :.



--
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] OOP-related question

2002-11-14 Thread Tularis
Hey,
I have the following script:
class overall {

	function overall(){
		$this->loaded['overall'] =1;

	function load($class){
		
		$$class = new $class;
		$this->loaded[$class] = 1;
		
		$$class->setup(); // Run constructor
		
		if(!is_object($$class)){
			return false;
		}
		return true;
	}
}

then I have a few classes, which hold a setup() function as thei 
'constructor'. Then, I do this:

$overall = new overall;
$overall->load('debug');

this should load the debug class. I want it to load to $debug->, but it 
won't even load to $overall->debug

It's not really a *need* to have this, it's just something that will 
help me in keeping control over all classes. I don't want to use new 
class, because this way it would be easier to 'instruct' the 
'constructor' of those new classes to change the values of the vars to a 
specific one, without calling for something weird...

anyway, it doesn't work, and it doesn't spit out an error either.
Any ideas?

- Tularis


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



Re: [PHP] STDIN question

2002-11-14 Thread BigDog
You would have to pass it through the "get" method...

You can only pass stdin to the binary...



On Thu, 2002-11-14 at 20:05, Mike D wrote:
> Is it possible to pass STDIN data to a php script via wget  or lynx 
> (cuz Apache is not installed in CGI mode, so I don't have a binary to 
> call)??
> 
> I am trying to create a setup where, a certain email address when sent, 
> takes the message data and passes it to a php script to insert into a 
> DB for a ticketing system.
> 
> Thanks
> Mike D
-- 
.: B i g D o g :.



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




Re: [PHP] STDIN question

2002-11-14 Thread Jason Wong
On Friday 15 November 2002 04:05, Mike D wrote:
> Is it possible to pass STDIN data to a php script via wget  or lynx

Not directly. If you're calling a php script via wget then the only way to 
send info to it would be using something like POST, or by putting the info 
into the URL.

> (cuz Apache is not installed in CGI mode, so I don't have a binary to
> call)??

Nothing to do with Apache. You just need to compile PHP in CGI (or the new 
CLI) mode: 

  ./configure --enable-cli ...

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *

/*
There's no point in being grown up if you can't be childish sometimes.
-- Dr. Who
*/


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




Re: [PHP] Syntax Help

2002-11-14 Thread conbud
Jason thanks,
I completely forgot about trying echo $sql by using that I found where it
was messing up. Thanks again.

Lee

"Jason Wong" <[EMAIL PROTECTED]> wrote in message
news:200211141725.47510.php-general@;gremlins.biz...
> On Thursday 14 November 2002 17:22, conbud wrote:
> > Whats wrong here ?? The variables are getting the correct information
from
> > the form but for some reason as soon as I put the variables into the
$sql
> > they dont post the proper data to the database, its connecting to the
> > database ok but just not updating the data.
> >
> > $sql = "UPDATE updates SET member= '{$_POST['mem']}', email=
> > '{$_POST['email']}', position= '{$_POST['pos']}', dateadded=
> > '{$_POST['dateadded']}', descp= '{$_POST['descp']}', message=
> > '{$_POST['message']}' where id= '{$_POST['id']}'";
> >
> > $result = mysql_query($sql);
>
> Does echo($sql) look OK?
>
> How about echo mysql_error()? Or executing $sql in the mysql command line
> interface?
>
> --
> Jason Wong -> Gremlins Associates -> www.gremlins.biz
> Open Source Software Systems Integrators
> * Web Design & Hosting * Internet & Intranet Applications Development *
>
> /*
> SANTA CLAUS comes down a FIRE ESCAPE wearing bright blue LEG WARMERS
> ... He scrubs the POPE with a mild soap or detergent for 15 minutes,
> starring JANE FONDA!!
> */
>



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




[PHP] Re: passing multiple variables in a url

2002-11-14 Thread Tularis
If I understand correctly, you want to ahev links like:


To get the vars from the thread, if you don't know it's name, you can 
use soemthing like this:
foreach($_GET as $key => $name){
$get[] = htmlentites($name, 'ENT_QUOTES');
}

that way you'll get a $get array, with all the url parts in it, numbered 
from 0->n

the htmlentities() makes sure that all html compatible chars get 
transformed in to others, which look the same but don't work as html (eg 
» and such).

Hope this helps,
- Tularis
XMB Lead Developer
Cj wrote:

I have a "contact us" php script on my site that allows users to email
direct from the webiste.  I want to be able to pass the to address and
subject line to the script so I can call teh web page from elsewhere 
on the
site and have it automatically choose the correct email address and 
subject
line.

EG instad of using  which requires them
to have an email client set up on the machine I want to link to
 
The script already handles the email=director by setting a default 
entry in
a drop down form but I can't get it to separate the first and second
variables in the URL.

Also is this a big security risk as I will be echoing the 2nd variable as
the contents of a form field.  Would it be possible for someone to type in
the URL with HTML/php in it that would make a mess of everything?  How 
can I
protect against this?  Would it be sufficient to just pase the 2nd 
variable
for non alphabetic characters and remove them?


 



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




Re: [PHP] PHP apache module question

2002-11-14 Thread BigDog
When you compile php + apachemany people have php as a DSO.  So
there is no actual binary file in a bin directory that is called.  You
can also have php as a module that is in the apache core, where it is
loaded automatically in apache (not a DSO).

You can run php as a cgi which uses the binary...however that is really
slow compared to the module.

If you need the binary php then you can reconfigure php without apache
(leave everything else), make, make install.  I also like to add the
config option of "--bindir=/usr/local/bin" to mine so that i get it all
in where all users can use the php binary...

HTH


On Thu, 2002-11-14 at 19:25, Mike D wrote:
> I am trying to execute a php script from the command line but came to 
> realize that I can't locate any php binary file.
> I thought there had to be a php bin file in order for php to work or am 
> i missing something?
> 
> NOTE: i have looked in /usr/bin/, /usr/local/bin/ and ran locates but 
> found nothing.
> 
> Msytified,
> Mike D
-- 
.: B i g D o g :.



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




Re: [PHP] PHP Auth with Apache

2002-11-14 Thread BigDog
You should use sessions for this...however, i would not store the
password in the session...

And verify it that way...i would probably use all sessions for this...

Check sessions first and see...if not then do the mysql or apache
auth...

When you do sessions you can save the page they are trying to access,
then have them login (authenticate), then redirect to the page that they
wanted...

If you are unfamiliar about sesssions:

1. php.net
2. phpbeginner.com
3. phpbuilder.com
4. php.net archives
5. google



On Thu, 2002-11-14 at 18:09, [EMAIL PROTECTED] wrote:
>  I can set the $_SERVER['PHP_AUTH_USER'] and $_SERVER['PHP_AUTH_PW']
> easily enough but how would you pass that information along with the
> redirect so apach doesn't prompt you for username and password? I have
> tried the header("Location http://usernam:password@;URL") method and it
> always prompts as well.
> 
> Thanks,
> 
> Ed
> 
> 
> On 14 Nov 2002, BigDog wrote:
> 
> > Ed,
> > 
> > When you do auth with mysql and they succeed then u can set the
> > $_SERVER['PHP_AUTH_USER'] and in theory that should allow you to connect
> > to the directory because that should be set for apache http
> > authentication.
> > 
> > You might have to play with it, but i am sure you can get it to work.
> > 
> > 
> > On Thu, 2002-11-14 at 16:42, [EMAIL PROTECTED] wrote:
> > >  I'm now understanding how you can get PHP to present you with a username
> > > and password promt just like APache would do if you had a .htaccess file
> > > in the directory you were trying to enter. Great idea but it seems that it
> > > would be easier to just use the .htaccess file in the directory.
> > > 
> > >  What I've been trying to find out is how to pass through a .htaccess file
> > > if someone has already passed an database authentication lookup in PHP.
> > > 
> > > I have an area on my site "Special Publications" where users login and
> > > their username and password is checked against a MySQL database. One field
> > > in their user records is the URL to their directory on our server. Each
> > > one of these directories is protected via .htaccess. What I would really
> > > like to do is have them redirected to their URL if they pass
> > > authentication and not have them enter their username and password again.
> > > Is their a way to do this?
> > > 
> > > Thanks,
> > > 
> > > Ed
> > >  
> > > 
> > > 
> > > On Wed, 13 Nov 2002, Ewout de Boer wrote:
> > > 
> > > > in httpd.conf
> > > > 
> > > > 
> > > > AllowOverride AuthConfig
> > > > 
> > > > 
> > > > 
> > > > More info at http://httpd.apache.org/docs/mod/core.html#allowoverride
> > > > 
> > > > 
> > > > regards,
> > > > 
> > > > Ewout
> > > > 
> > > > 
> > > > - Original Message - 
> > > > From: "Alexander Bemme" <[EMAIL PROTECTED]>
> > > > To: <[EMAIL PROTECTED]>
> > > > Sent: Wednesday, November 13, 2002 12:02 PM
> > > > Subject: [PHP] PHP Auth with Apache
> > > > 
> > > > 
> > > > > Hi,
> > > > > i got a little problem (i hope so)
> > > > > 
> > > > > I have installed Apache 1.3.26 and PHP 4.2.3 as module.
> > > > > 
> > > > > I used the example from www.php.net to do a PHP authentication,
> > > > > but it didn't work, the pop appears but i can't login.
> > > > > 
> > > > > In PHPManual is someting about "AuthType" but nothing about how
> > > > > to fix it.
> > > > > 
> > > > > Can someone help out?
> > > > > 
> > > > > Thanks
> > > > > 
> > > > > --Alex
> > > > > 
> > > > > 
> > > > > 
> > > > > -- 
> > > > > 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
> > > > 
> > -- 
> > .: B i g D o g :.
> > 
> > 
> > 
> > -- 
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> > 
-- 
.: B i g D o g :.



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




Re: [PHP] LDAP specific?

2002-11-14 Thread Tony Earnshaw
tor, 2002-11-14 kl. 11:50 skrev Krzysztof Dziekiewicz: <

> You can not put any html code with image code.
> If you send some html you mean to send
> header("Content-Type: text/html")
> with
> header("Content-type: image/jpeg")
> Where do you want go to ?
> 
> You can do so:
> There is on the page http://xxx/user.html?name=smith some html code where a user can 
>act.
> Among the html code you insert http://xxx/userfoto.html?name=smith";>
> On http://xxx/userfoto.html you send  header("Content-type: image/jpeg") and the
> image content and no html code.

tor, 2002-11-14 kl. 09:20 skrev BigDog: <

> I create a php page that gets the image and sends the correct header. 
> Then in my other php page that displays the details about a user i
call
> . Then in showperson i send
the
> correct image headers and the image is displayed properly.
> 
> HTH...
__

These are the answer. Bless you both, pretty sirs.

Best,

Tony

-- 

Tony Earnshaw

Cricketers are strange people. They wake up
in October, only to find that their wives had
left them in May.

e-post: [EMAIL PROTECTED]
www:http://www.billy.demon.nl





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




[PHP] STDIN question

2002-11-14 Thread Mike D
Is it possible to pass STDIN data to a php script via wget  or lynx 
(cuz Apache is not installed in CGI mode, so I don't have a binary to 
call)??

I am trying to create a setup where, a certain email address when sent, 
takes the message data and passes it to a php script to insert into a 
DB for a ticketing system.

Thanks
Mike D



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



Re: [PHP] query question

2002-11-14 Thread Marek Kilimajer
This is checked:

function getstart_end(){
   $result=mysql_query("SELECT * FROM aplayabletimes ORDER BY min");
   while(($row=mysql_fetch_object($result))){
   if(!$i){
   echo $row->min . " - ";
   $i=$row->min;
   } else {
   list($houre,$minutee,$seconds)=explode(":",$i);
   $minutee=$minutee+5;
   
if($minutee>=60){$minutee=$minutee-60;$houre=$houre+1;}
   $tmp = 
implode(':',array(str_pad($houre,2,'0',STR_PAD_LEFT) 
,str_pad($minutee,2,'0',STR_PAD_LEFT),'00'));
  
   if($tmp != $row->min) {  // there is a gap
   //echo $row->min ." != $tmp";
 echo $i ."\n";  // print previous time 
as end
 echo $row->min . " - ";  // print this 
time as new start
   }
   $i = $row->min; // keep this new time for next loop
   }
   //echo $i." - $tmp  --tmp\n";
   //echo $row->min."\n";
   }
   echo $i ."\n";  // print last row
}

Steve Buehler wrote:

Ok.  That output was my fault.  I had an error in one of my other 
functions.  I needed to set $hours to "00" to start with in my 
populatetemptable() function.  Now my output is:
00:05:00 - 00:05:00
00:05:00 - 00:10:00
00:10:00 - 00:15:00
00:10:00 - 00:20:00
00:15:00 - 00:25:00
00:15:00 - 00:30:00

Problem is that it isn't giving me just the start and end times.  I 
will keep working on it.

Thanks
Steve


At 12:48 PM 11/14/2002 -0600, you wrote:

Thanks for the help, but that is not actually producing the desired 
results either.  This returns the following results:
00:00:05 - 00:00:05
00:00:05 - 5
00:00:05 - 10
00:00:05 - 15
00:00:10 - 20
00:00:10 - 25
00:00:10 - 30
00:00:10 - 35
00:00:15 - 40
00:00:15 - 45
00:00:15 - 50
00:00:15 - 55
00:00:20 - 60
00:00:20 - 65

I am not going to post all of them. :)

Here is the code that is now in the getstart_end() function.  I had 
to change the line that you had because the 5 minutes would give an 
error.  I just took out the "minutes" part.
$tmp = $i+5 minutes; // add 5 minutes to $i, 
implement it yourself
function getstart_end(){
$result=mysql_query("SELECT * FROM aplayabletimes ORDER BY 
min");
while(($row=mysql_fetch_object($result))){
if(!$i){
echo $row->min . " - ";
$i=$row->min;
}else{
$tmp = $i+5; // add 5 minutes to $i, 
implement it yourself
if($tmp != $row->min) {  // there is a gap
echo $i ."\n";  // print previous 
time as end
echo $row->min . " - ";  // print 
this time as new start
}
$i = $tmp; // keep this new time for next loop
}
}
echo $row->min ."\n";  // print last row
}

At 07:09 PM 11/14/2002 +0100, you wrote:

Untested, but should work

Steve Buehler wrote:



function getstart_end(){
$result=mysql_query("SELECT * FROM aplayabletimes ORDER BY min");
while(($row=mysql_fetch_object($result))){
if(!$i){
echo $row->min . " - ";



   $i=$row->min;



}else{



$tmp = $i + 5 minutes // add 5 minutes to $i, implement it yourself
if($tmp != $row->min) {  // there is a gap
   echo $i ."\n";  // print previous time as end
   echo $row->min . " - ";  // print this time as new start
}
$i = $tmp; // keep this new time for next loop



}
}



echo $row->min ."\n";  // print last row



}




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


--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
ow3





--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
ow3


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


--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
ow3





--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
ow3





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




Re: [PHP] icmp ping, check port, etc.

2002-11-14 Thread Ewout de Boer
You could exec the ping command and analyze its output using regular
expressions.



regards,

Ewout de Boer


- Original Message -
From: "Bryan Koschmann - GKT" <[EMAIL PROTECTED]>
To: "PHP General" <[EMAIL PROTECTED]>
Sent: Thursday, November 14, 2002 8:09 PM
Subject: [PHP] icmp ping, check port, etc.


> Hello,
>
> I've been looking into setting up a site to check the hosts on my network.
> Basically, I want it to ping each host and tell whether it is up or not,
> then also check various services (www, ftp, smtp, pop3, dns, ssh) and see
> if they are available. This would check either for a connection refused or
> a timeout. I am wondering first, how to do the icmp ping. Then, will
> fsockopen work for both seeing if the port is open, and checking for
> timeout? I'm sure I can play with fsockopen and figure it out, but I
> wanted to ask and make sure it was possible first. The ping portion is
> where I am stuck at.
>
> Any help would he greatly appreciated!
>
> Thanks,
>
> Bryan
>
>
> --
> 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] PHP apache module question

2002-11-14 Thread Mike D
I am trying to execute a php script from the command line but came to 
realize that I can't locate any php binary file.
I thought there had to be a php bin file in order for php to work or am 
i missing something?

NOTE: i have looked in /usr/bin/, /usr/local/bin/ and ran locates but 
found nothing.

Msytified,
Mike D



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



Re: [PHP] Regular Expression trouble

2002-11-14 Thread Ewout de Boer
You could exclude the '}' sign from the expression

$content = ereg_replace("\{[^}]*}","",$content);

This should do the trick... i'm not 100% certain about the '[^}]'
expression, but you should find it in any regexp tutorial


regards,

Ewout de Boer

- Original Message -
From: "Brent Baisley" <[EMAIL PROTECTED]>
To: "php-gen" <[EMAIL PROTECTED]>
Sent: Thursday, November 14, 2002 7:32 PM
Subject: [PHP] Regular Expression trouble


> I'm trying create form template as I have seen recommended in many
> places. It seems fairly simple but I can't seem to get ereg_replace to
> work the way I want it.
> I'm starting off easy and I want to use the sample template for entering
> a new record or editing an existing one. If they are editing, then I
> obviously want to populate the form fields with values. If it's a new
> entry, I don't want any values. Simple enough.
>
> A form entry looks like this:
> 
> 
>
> So I load the template into a variable using ob_start(), etc. I assumed
> that to "clear" out all the value declarations I would simply do this:
> $content = ereg_replace("\{.*}","",$content);
>
> But it seems to be replacing everything between the first instance of
> { and the last instance of }, rather than each instance of {}. I've used
> regular expressions before and I even tested it using grep in BBEdit 6.5
> and it works as I would expect. I'm using PHP 4.1.2 on Mac OSX 10.1.5.
>
> --
> Brent Baisley
> Systems Architect
> Landover Associates, Inc.
> Search & Advisory Services for Advanced Technology Environments
> p: 212.759.6400/800.759.0577
>
>
> --
> 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] icmp ping, check port, etc.

2002-11-14 Thread Bryan Koschmann - GKT
Hello,

I've been looking into setting up a site to check the hosts on my network.
Basically, I want it to ping each host and tell whether it is up or not,
then also check various services (www, ftp, smtp, pop3, dns, ssh) and see
if they are available. This would check either for a connection refused or
a timeout. I am wondering first, how to do the icmp ping. Then, will
fsockopen work for both seeing if the port is open, and checking for
timeout? I'm sure I can play with fsockopen and figure it out, but I
wanted to ask and make sure it was possible first. The ping portion is
where I am stuck at.

Any help would he greatly appreciated!

Thanks,

Bryan


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




Re: [PHP] query question

2002-11-14 Thread Steve Buehler
Ok.  That output was my fault.  I had an error in one of my other 
functions.  I needed to set $hours to "00" to start with in my 
populatetemptable() function.  Now my output is:
00:05:00 - 00:05:00
00:05:00 - 00:10:00
00:10:00 - 00:15:00
00:10:00 - 00:20:00
00:15:00 - 00:25:00
00:15:00 - 00:30:00

Problem is that it isn't giving me just the start and end times.  I will 
keep working on it.

Thanks
Steve


At 12:48 PM 11/14/2002 -0600, you wrote:
Thanks for the help, but that is not actually producing the desired 
results either.  This returns the following results:
00:00:05 - 00:00:05
00:00:05 - 5
00:00:05 - 10
00:00:05 - 15
00:00:10 - 20
00:00:10 - 25
00:00:10 - 30
00:00:10 - 35
00:00:15 - 40
00:00:15 - 45
00:00:15 - 50
00:00:15 - 55
00:00:20 - 60
00:00:20 - 65

I am not going to post all of them. :)

Here is the code that is now in the getstart_end() function.  I had to 
change the line that you had because the 5 minutes would give an error.  I 
just took out the "minutes" part.
$tmp = $i+5 minutes; // add 5 minutes to $i, 
implement it yourself
function getstart_end(){
$result=mysql_query("SELECT * FROM aplayabletimes ORDER BY min");
while(($row=mysql_fetch_object($result))){
if(!$i){
echo $row->min . " - ";
$i=$row->min;
}else{
$tmp = $i+5; // add 5 minutes to $i, implement it 
yourself
if($tmp != $row->min) {  // there is a gap
echo $i ."\n";  // print previous 
time as end
echo $row->min . " - ";  // print this 
time as new start
}
$i = $tmp; // keep this new time for next loop
}
}
echo $row->min ."\n";  // print last row
}

At 07:09 PM 11/14/2002 +0100, you wrote:
Untested, but should work

Steve Buehler wrote:



function getstart_end(){
$result=mysql_query("SELECT * FROM aplayabletimes ORDER BY min");
while(($row=mysql_fetch_object($result))){
if(!$i){
echo $row->min . " - ";


   $i=$row->min;



}else{


$tmp = $i + 5 minutes // add 5 minutes to $i, implement it yourself
if($tmp != $row->min) {  // there is a gap
   echo $i ."\n";  // print previous time as end
   echo $row->min . " - ";  // print this time as new start
}
$i = $tmp; // keep this new time for next loop



}
}


echo $row->min ."\n";  // print last row



}




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


--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
ow3




--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
ow3


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


--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
ow3




--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
ow3


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




  1   2   >