[PHP] Parsing Variables

2003-07-30 Thread Jason Williard
I would like to create a script that reads a file name that follows a
specific format and have it parsed into 2 variables.  The format is as
follows:

cli_info-ACCOUNT-USERNAME.dat

The two variables that I would like to get out of this are the ACCOUNT and
USERNAME.  The rest of the information can be discarded.  I can get the
entire filename into a variable, but I am not sure how to parse it properly.

Any assistance would be appreciated.

Thanks,
Jason



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



[PHP] Removing Spaces

2003-07-30 Thread Jason Williard
In parsing a file, I ended up with a number of variables that include
spaces.  Is there an easy way to remove a space from a variable?

Jason



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



[PHP] Displaying Multidimensional Arrays

2003-08-25 Thread Jason Williard
I am trying to create a function that will take a multidimensional array and
turn it into a form based off the information in the array.  I have run into
a bit of a road block when it comes to displaying the array.  Would anyone
be able to offer some assistance on this front?

 - Jason

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



[PHP] Re: Displaying Multidimensional Arrays

2003-08-26 Thread Jason Williard
I actually found a way of handling this on my own.  Thanks.

- Jason

"Jason Williard" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> I am trying to create a function that will take a multidimensional array
and
> turn it into a form based off the information in the array.  I have run
into
> a bit of a road block when it comes to displaying the array.  Would anyone
> be able to offer some assistance on this front?
>
>  - Jason

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



[PHP] Test Connection - fsockopen()

2003-10-21 Thread Jason Williard
I am trying to create a remote status page for my website.  So far, I 
have found the fsockopen() function and used the example code to create 
the following basic script:


While this works when the server is UP, I get the following error when 
it is down along with the 'Down' output:

Warning: fsockopen(): php_hostconnect: connect failed in 
//public_html/status/test.php on line 2

Warning: fsockopen(): unable to connect to xxx.xxx.xxx.xxx:80 in 
//public_html/status/test.php on line 2
Down

Can anyone help me out here?

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


RE: [PHP] Test Connection - fsockopen()

2003-10-21 Thread Jason Williard
Thank you.  That worked perfectly.

Jason

-Original Message-
From: Tom Rogers [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, October 21, 2003 12:34 AM
To: Jason Williard
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] Test Connection - fsockopen()

Hi,

Tuesday, October 21, 2003, 5:04:14 PM, you wrote:
JW> I am trying to create a remote status page for my website.  So far,
I 
JW> have found the fsockopen() function and used the example code to
create 
JW> the following basic script:

JW>  $fp = fsockopen ("xxx.xxx.xxx.xxx", 80, $errno, $errstr, 30);
JW> if (!$fp) {
JW>  echo "Down\n";
JW> }
JW> else{
JW>  echo "Up\n";
JW>  fclose ($fp);
JW> }
?>>

JW> While this works when the server is UP, I get the following error
when 
JW> it is down along with the 'Down' output:

JW> Warning: fsockopen(): php_hostconnect: connect failed in 
JW> //public_html/status/test.php on line 2

JW> Warning: fsockopen(): unable to connect to xxx.xxx.xxx.xxx:80 in 
JW> //public_html/status/test.php on line 2
JW> Down

JW> Can anyone help me out here?

JW> Thanks,
JW> Jason Williard


change your call to   @fsockopen() which will tell it to ignore errors

-- 
regards,
Tom

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



[PHP] Shortening a String

2003-10-28 Thread Jason Williard
I would like to display part of the output of a query.  In many cases,
the string returned by this query exceeds 200 characters.  Is there a
way to cut it off after 200 characters?  Even better, is there a way to
cut it off at the next space after 200 characters?

Thank you for any assistance,
 - Jason


RE: [PHP] Shortening a String

2003-10-28 Thread Jason Williard
Thanks.  That's exactly what I was looking for and is working perfectly.

- Jason


-Original Message-
From: Pablo Gosse [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, October 28, 2003 7:18 PM
To: Jason Williard; [EMAIL PROTECTED]
Subject: RE: [PHP] Shortening a String


On Tuesday, October 28, 2003 6:53 PM Jason Williard wrote:

> I would like to display part of the output of a query.  In many cases,
> the string returned by this query exceeds 200 characters.  Is there a
> way to cut it off after 200 characters?  Even better, is there a way
to
> cut it off at the next space after 200 characters?

This should do what you want.
 
substr($str,0,strpos($str,' ',200));

Cheers,
Pablo

-- 
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] Array --> If

2003-11-05 Thread Jason Williard
I am building a script that I would like to have do a specific task
based on whether specific counts have been reached.

Basically, the script checks for connectivity in a specific port.  If
the connectivity fails, it increases the count by 1.  It does this every
minute.  I would like the script to page me at specific marker points
(i.e. 5, 15, 30, 60, 90, 120, etc).  Is there anyway to make an if
statement or something similar to run in any case where the COUNT value
equals one of the numbers in the array?

Example:

$cases = array( 5, 15, 30, 60, 90, 120 );

if ( $count = {ITEM IN $cases} ){
EXECUTE PAGE
}

Thanks,
Jason Williard

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



[PHP] RE: Array --> If

2003-11-05 Thread Jason Williard
Thanks!  That did the trick.

Jason Williard

-Original Message-
From: Greg Beaver [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, November 05, 2003 6:55 PM
To: Jason Williard
Cc: [EMAIL PROTECTED]
Subject: Re: Array --> If

Hi Jason,

perhaps:



Regards,
Greg
--
phpDocumentor
http://www.phpdoc.org

Jason Williard wrote:
> I am building a script that I would like to have do a specific task
> based on whether specific counts have been reached.
> 
> Basically, the script checks for connectivity in a specific port.  If
> the connectivity fails, it increases the count by 1.  It does this
every
> minute.  I would like the script to page me at specific marker points
> (i.e. 5, 15, 30, 60, 90, 120, etc).  Is there anyway to make an if
> statement or something similar to run in any case where the COUNT
value
> equals one of the numbers in the array?
> 
> Example:
> 
> $cases = array( 5, 15, 30, 60, 90, 120 );
> 
> if ( $count = {ITEM IN $cases} )  {
>   EXECUTE PAGE
> }
> 
> Thanks,
> Jason Williard

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



[PHP] Random Character Generator

2003-11-10 Thread Jason Williard
I would like to have a script that randomly generates alpha-numeric
characters.  Does anyone know of any scripts that can do this or perhaps
the basic code to generate random characters?

Thank You,
Jason Williard


[PHP] E-mail Gateway

2003-11-18 Thread Jason Williard
I am in the beginning phases of developing a support system.  I would
like the program to be able to receiving and process e-mails.  However,
I am at a loss as to where to start.

The main roadblock, at this point, is how to best receive and process
the e-mail.  I have looked at 2 options.

1) Use a cron job to execute a php script every x minutes.
2) Create a script where mail can be piped to.  This is a method that I
have used previously with a cgi app called PerlDesk.

While I could develop the first option, the second option is the method
of choice, but I have no clue how to implement that.  Would anyone
happen to have any suggestions on where to start?  Perhaps, someplace
where I could go for further research?

Thank You,
Jason Williard

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



[PHP] Parsing a file line by line

2003-11-25 Thread Jason Williard
I would like some assistance in creating a script that will parse a file
line by line.  The file that I need to parse has a designator at the
beginning of most lines.  I need the script to search for a specific
designators (listed in an array) and then send an e-mail with the
contents of each line.  There will need to be a separate e-mail for each
line.

Example:

$array = array( "A120", "B120", "D120" );


Text File:

A120 Text
B120 Text
C120 Text
D120 Text


To make this more difficult... Occasionally, one of the lines may be
followed by multiple other lines containing more information.  I need to
be able to get that information as well.  The only distinct part of
those lines following is that they start with 15 spaces.

Example:

D120 Text Text Text Text
   More Text
   More Text
   More Text

Does anyone have any ideas for me?


Thanks,
Jason Williard

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



[PHP] Remote Server Info

2003-12-03 Thread Jason Williard
Is there a function that can get remote server information such as what
server software the remote host is running?

 - Jason

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



[PHP] Optional Vars in Functions

2004-01-02 Thread Jason Williard
Is there a way to make a variable of a function optional?

 

Thank You,

Jason Williard



[PHP] IIS6 - CGI vs ISAPI

2004-10-17 Thread Jason Williard
I am running a Windows 2003 web server with IIS 6.  I currently have PHP 
4.3.8 installed as CGI and it is almost working perfectly.  Occasionally, I 
get the following error:  "No input file specified."  I will be upgrading to 
4.3.9 soon and am considering switching to ISAPI.  I have heard good and bad 
things from people who I feel are not quite informed.  I would like to know 
your opinion on the matter.

Which is a better option for IIS6?  What are the upsides and downsides to 
each?

-- 

Thank You,
Jason Williard

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



[PHP] Array Question

2004-05-02 Thread Jason Williard
I am using the following array and function in the template for my website.
It works great, but I want to to be better.  I would to make it so the last
item displayed looks differently than the others, but I have been unable to
figure out how to distinguish the last item.

When displayed, the crumbs look like:

SITENAME » RANDOM » ITEM

I would like ITEM to look differently.  Can anyone tell me how to modify the
select ITEM?

// CRUMBS ARRAY
$crumbs = array(
  array( "RANDOM", "RANDOM_URL" ),
  array( "ITEM", "ITEM_URL" )
  );

// CRUMBS FUNCTION
function breadCrumbs($crumbs) {

 if ( count($crumbs) > 0 ) {
  $spacer   = " » ";
  $breadCrumbs  = "SITE_NAME\n";

   foreach( $crumbs as $crumb ) {
   if ( count($crumb) == "2" ) {
$breadCrumbs .=  "$spacer$crumb[0]\n";
   }

  }

 echo "\n";
 echo "\n";
 echo $breadCrumbs;
 echo "\n";
 echo "\n";
 }
}

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



[PHP] PHP+GD on FreeBSD 5.1

2004-06-23 Thread Jason Williard
I have been having an extremely difficult getting PHP installed with
GD support on a FreeBSD 5.1 system.  While I can get the default GD
package installed, I can't seem to get it installed with JPEG support.
 Does anyone know of any good tutorials or instructions for people
with basic general knowledge of FreeBSD?

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



[PHP] Mail Processing - Bounce

2004-06-29 Thread Jason Williard
I'm building a tool to process incoming mail.  So far, I have a script
that receives mail that is piped to it.  I am able to process the mail
without a problem.  However, the script causes a bounce message
containing the output of the script.  Does anyone know how I can fix
this?

The script:
http://www.janix.net/test/mail.phps


The bounce message:
This message was created automatically by mail delivery software.

A message that you sent could not be delivered to one or more of its
recipients. This is a permanent error. The following address(es)
failed:

  pipe to |/www/test/mail.php
generated by [EMAIL PROTECTED]

The following text was generated during the delivery attempt:

-- pipe to /www/test/mail.php
   generated by [EMAIL PROTECTED] --

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



[PHP] Piping Error

2004-07-18 Thread Jason Williard
I am working on creating a tool that processes mail for a support
system.  The script works, but still sends a bounce message.

Code: http://www.janix.net/test/mail.phps

When the script processes the e-mail, it sends a bounce with the
output of the script.  I got rid of the output in the bounce by adding
-q to the first line, but I still get the following error in the
bounce.

-
This message was created automatically by mail delivery software.

A message that you sent could not be delivered to one or more of its
recipients. This is a permanent error. The following address(es) failed:

  pipe to |/home/janix/www/test/rcvmail.php
generated by [EMAIL PROTECTED]

The following text was generated during the delivery attempt:

-- pipe to |/home/janix/www/test/rcvmail.php
   generated by [EMAIL PROTECTED] --
-


The server uses Sendmail.  Does anyone have any idea what is causing
this bounce and how I can fix it?

-- 

Jason Williard <[EMAIL PROTECTED]>
// www.jasondubya.com //

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



[PHP] Array Question

2004-02-28 Thread Jason Williard
I would like to be able to search an array for a match the a specific
variable.  So far, I have been trying to use preg_grep but am not getting
the results that I want.

Basically, I would have a variable: $url = "domain.com"

I would like to search an array to see if the value of the variable $url
exists in this array.  The array would look like:

$archives = array( "domain.com","domain2.com");

As for the results of the search, I just need a simple yes/no 1/0 response.
What would be the best method of handling this?


Thank You,
Jason Williard

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



[PHP] preg_match

2004-03-28 Thread Jason Williard
I am trying to use preg_match to pull a specific piece of a variable.
However, I don't have enough experience with the syntax to be able to figure
this out.

The variable looks like: "John {mailto:[EMAIL PROTECTED])"
All I need is the name, John.  The rest can be discarded.  How would I pull
that bit out?

Thanks,
Jason

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