Re: [PHP] adduser php

2010-07-10 Thread Matt M.
The only thing is, when I execute this command from a shell, it works. 
Obviously I'm replacing $username and $password with something valid when doing 
this manually.

It's like the script clears the $username variable just before it executes the 
command, or because the variable is inside quotes, it is not getting through.


From: Ashley Sheridan 
Sent: Saturday, July 10, 2010 2:01 PM
To: Matt Morrow 
Cc: php-general@lists.php.net 
Subject: Re: [PHP] adduser  php


On Sat, 2010-07-10 at 13:45 -0500, Matt Morrow wrote: 
I am using php 5 on OpenBSD 4.7

I have a script which takes a username and password from $_POST, and is
supposed to add the user to the system database. The problem is, adduser
creates a username with the same name as the group. The code is:

$username=$_POST['username'];
$password=$_POST['password'];
$output=exec('/usr/bin/sudo adduser -unencrypted -batch
$username hosting $firstname $lastname $password');
echo result:  . $result .  output:  .  $output;


The output is:
 Added user ``hosting''

I have validated that $username and $password contain the correct values
from the form, by outputting them as well above the line which calls the
adduser command.

Any help is appreciated.

Matt

I'm not entirely sure about the syntax you're using here, as it doesn't quite 
match up with what I see on the useradd (which is what adduser synonyms to) man 
page (type 'man useradd').

Aside from that, be very, very, very careful with this command. In your example 
you've not sanitised the user input, and the useradd command is used to update 
details as well as add new users, and you're running it with root privileges 
under sudo. Maybe enforce some specific name mechanism (a prefix like 
'yoursystemname_username') to ensure that people aren't unwittingly or 
deliberately trying to overwrite existing system user details.

  Thanks,
  Ash
  http://www.ashleysheridan.co.uk


 


Re: [PHP] Forms

2005-03-21 Thread Matt M.
 Does anyone know how to get a particular option to display in a drop menu?
 
 select name=category id=category
  option selected=true value=Option ValueOption Value/option
  option value=line-/option
  option value=value1 value1/option
  option value=value2 value2 /option
  option value=value3 value3/option
  option value=value4 value4/option
 /select

add selected=selected to the option

option value=value4  selected=selectedvalue4/option

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



Re: [PHP] PHP and Access

2005-02-25 Thread Matt M.
 I need to to an application in PHP with graphics creation.
 The database where i need to go and fetch the values is access.
 is possible for PHP to fecth values from an access database ??

http://us4.php.net/odbc

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



Re: [PHP] FATAL: emalloc()

2005-02-18 Thread Matt M.
 FATAL: emalloc() : Unable to allocate 1073741824 bytes

I found this at http://us4.php.net/odbc_exec

I kept getting FATAL: emalloc() errors when using select statements
via odbc for MS SQL.

I had no control over the DB as it is a commercial CRM system.

I found that by 1st issuing an SQL query of set textsize ;'
within my PHP script is has resolved the issue..

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



Re: [PHP] Destroying the Session Object

2005-02-18 Thread Matt M.
 I am developing an application. When the user signs in a Session ID is
 created (for argument sake: 123). I have a sign out page that has the script
 session_destroy() on it. This page directs me to the sign in page. When I
 sign the same or any other user in again I get the same session id (123).
 
 However, when I close the browser window and sign in again as any member,
 the session id changes.
 
 How does this work and how can I ensure that a unique session id is
 allocated to every new user that signs in?


some good reading
http://us2.php.net/session

you could use http://us2.php.net/session_regenerate_id to create new ids

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



Re: [PHP] mediator between PHP and Perl (with sessions)

2005-02-15 Thread Matt M.
 Is there a way to use sessions variables in PHP shell script (without
 reading the session file and parse it in the script)?

Do you have a database available?  You could put the session info in a database.

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



Re: [PHP] Delete a file immediately after download

2005-02-15 Thread Matt M.
 I have a database that contains encrypted data using Mysql function
 ENCODE(). Certain users will be allowed to view this data and I will allow
 them to download a CSV file contain the decrypted data using the Mysql
 DECODE() function. However I don't want this file to be left on the server,
 is there a way to ensure that the file is deleted immediately after it has
 been downloaded?

http://us4.php.net/unlink

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



Re: [PHP] [NEWBIE] Trying to combine array into one string

2005-02-15 Thread Matt M.
 The Problem:
 I can't quite figure out how to take the results of the
 mysql_query() and assemble them into a string. In my experiments so far,
 I either get a mysql_data_seek(): Offset 0 is invalid for MySQL result
 index error, or my mail function sends to a blank address.

no guarantee it works:

$tantoQuery = SELECT forum_members.emailAddress AS email FROM
forum_members, event_tanto WHERE forum_members.ID_MEMBER =
event_tanto.tanto AND event_tanto.event =' . $show . ';

$tantoResult = mysql_query($tantoQuery) or die('Query failed: ' .
mysql_error());

while ($tantoData = mysql_fetch_array($tantoResult, MYSQL_ASSOC))
{
$tantoEmail[] = $tantoData['email'];
}

if (count($tantoEmail)  0) {
mail(implode(',',$tantoEmail), $subject, $mailcontent, $addHeaders);
}


mysql_free_result($tantoResult);

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



Re: [PHP] Re: Image Creation

2005-02-15 Thread Matt M.
get rid of :

   echo table border='1' cellpadding='0' cellspacing='0'
style='border-collapse: collapse' bordercolor='#11' width='200'
bgcolor='#FFD1A4'
 tr
   td width='100%' colspan='2' align='center'This is a
testbr.makepie(20,200)./td
 /tr
   /table;

and only have this :

makepie(20,200);

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



Re: [PHP] PHP Array question

2005-02-15 Thread Matt M.
 What I want to do is to only show 20 pictures at a time with a Next link
 and a Previous link. For the first 20 only the Next link would show and
 whenever the last set would show only the Previous link would. Every other
 time both would show.
 
 Can someone point me in the right direction on how to count through the
 elements until the end and back to display them? I just can't figure it out.


sounds like you just might need some paging functions

http://pear.php.net/package/Pager
http://pear.php.net/manual/en/package.html.pager.php

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



Re: [PHP] Intelligent Forms and Form Processing

2005-02-15 Thread Matt M.
 Any feedback will be appreciated.


why reinvent the wheel?

take a look at:
http://pear.php.net/package/Html_quickform

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



Re: [PHP] Fancy Form processing Ideas

2005-02-14 Thread Matt M.
 I am looking for interesting approaches to form submissions and error
 checking in the forms.

http://pear.php.net/package/HTML_QuickForm

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



Re: [PHP] Primer for working with arrays

2005-02-09 Thread Matt M.
 I need a really good primer for working with arrays in PHP and with MySQL.  I
 can do what I need to do without them right now, but I would really like to 
 get
 arrays figured out.
 
 Any have some good ones?

http://www.php.net/array
http://us4.php.net/mysql

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



Re: [PHP] Parsing pdf file

2005-02-09 Thread Matt M.
 For a project of a customer i need to know if a pdf file contains special
 functions and buttons.
 
 Is there a way to parse a PDF file in php?

you might be able to find something at

http://us3.php.net/pdf

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



Re: [PHP] Parsing pdf file

2005-02-09 Thread Matt M.
did you try this?


?php
$test = pdf2string(pathtoPDFfile);
echo $test;

# Returns a -1 if uncompression failed
function pdf2string($sourcefile)
{
   $fp = fopen($sourcefile, 'rb');
   $content = fread($fp, filesize($sourcefile));
   fclose($fp);

   # Locate all text hidden within the stream and endstream tags
   $searchstart = 'stream';
   $searchend = 'endstream';
   $pdfdocument = ;

   $pos = 0;
   $pos2 = 0;
   $startpos = 0;
   # Iterate through each stream block
   while( $pos !== false  $pos2 !== false )
   {
 # Grab beginning and end tag locations if they have not yet been parsed
 $pos = strpos($content, $searchstart, $startpos);
 $pos2 = strpos($content, $searchend, $startpos + 1);
 if( $pos !== false  $pos2 !== false )
 {
 # Extract compressed text from between stream tags and uncompress
 $textsection = substr($content, $pos + strlen($searchstart) +
2, $pos2 - $pos - strlen($searchstart) - 1);
 $data = @gzuncompress($textsection);
 # Clean up text via a special function
 $data = ExtractText($data);
 # Increase our PDF pointer past the section we just read
 $startpos = $pos2 + strlen($searchend) - 1;
 if( $data === false ) { return -1; }
 $pdfdocument = $pdfdocument . $data;
 }
   }

   return $pdfdocument;
}

function ExtractText($postScriptData)
{
   while( (($textStart = strpos($postScriptData, '(', $textStart)) 
($textEnd = strpos($postScriptData, ')', $textStart + 1)) 
substr($postScriptData, $textEnd - 1) != '\\') )
   {
 $plainText .= substr($postScriptData, $textStart + 1, $textEnd -
$textStart - 1);
 if( substr($postScriptData, $textEnd + 1, 1) == ']' ) // This
adds quite some additional spaces between the words
 {
 $plainText .= ' ';
 }

 $textStart = $textStart  $textEnd ? $textEnd : $textStart + 1;
   }

   return stripslashes($plainText);
}
?

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



Re: [PHP] is_dir is_file bugs?

2005-02-08 Thread Matt M.
 $path = 'product_images';
 $handle = opendir($path);
 while (false !== ($file = readdir($handle)))
 {
  if ($file != .  $file != ..)
 {
 echo $file;
 if (is_dir($file))
 {
 echo ' -- folderbr';
 $folders[] = $file;
 }
 elseif (is_file($file))
 {
 echo ' -- imagebr';
 $images[] = $file;
 }
 else
 {
 echo ' -- ???br';
 }
 }
 }

try the absolute path in is_dir and is_file

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



Re: [PHP] Free library for PDF functoins ???

2005-01-18 Thread Matt M.
 Does anyone knows of a free library to compile PHP against and have PDF
 functions support ?

you could try this class

http://www.fpdf.org/

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



Re: [PHP] Error in foreach?

2005-01-10 Thread Matt M.
 This is in response to the following line:
 
 foreach ($_GET as $key = $value)

is $_GET an array?

when in doubt, print it out

try:
print_r($_GET)

or even check

is_array($_GET)

might be an earlier version of php

http://us2.php.net/manual/en/reserved.variables.php#reserved.variables.get

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



Re: [PHP] $_FILE[user][error] = 6 ?

2004-12-28 Thread Matt M.
is form enctype=multipart/form-data action=_url_ method=\post\
what comes out in the html or is it form
enctype=multipart/form-data action=_url_ method=post?

can you upload any files at all?

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



Re: [PHP] Destroying session data

2004-12-23 Thread Matt M.
 I have multiple pages on a website that uses sessions ($_SESSION) to
 store the data. However, I noticed that in the C:\Windows\Temp
 directory, all the session variables/data files are stored there from
 previous (and current) sessions.

what version of php are you using?

this might be coming into play:
http://us4.php.net/session

session.gc_maxlifetime  integer

session.gc_maxlifetime specifies the number of seconds after which
data will be seen as 'garbage' and cleaned up.

Note: If you are using the default file-based session handler,
your filesystem must keep track of access times (atime). Windows FAT
does not so you will have to come up with another way to handle
garbage collecting your session if you are stuck with a FAT filesystem
or any other fs where atime tracking is not available. Since PHP 4.2.3
it has used mtime (modified date) instead of atime. So, you won't have
problems with filesystems where atime tracking is not available.

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



Re: [PHP] How to set register_globals=off in the script?

2004-12-21 Thread Matt M.
 I know that register_globals = on is not secure. But one program
 requires to use register_globals=on. So in php.ini register_globals is
 set to on.
 
 I have PHP 5.1, is it possible in the code set register_globals=off
 for specific scripts.
 
 So I want to keep PHP register_globals=on in php.ini, but in local
 files set to off?

you could use .htaccess or httpd.conf files to set it

http://us2.php.net/ini_set

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



Re: [PHP] PHP parse Excel and Access files

2004-12-20 Thread Matt M.
 How to read and get data from Excel Files and Access Files.
 Can you post me articles and tutorials on the web-sites that explain
 the basic concept to create an interface for PHP and this files-type.
 Thanks so much to all.

I am pretty sure that you an set up odbc connections to access access
databases.  For excel, you could use com objects or I have used the
perl SpreadSheet::ParseExcel module to read data from excel.

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



Re: [PHP] convert hidden form to get url

2004-12-20 Thread Matt M.
 Anyone got any suggestions on the best way to convert the snippet of code
 below (which I'm dynamically collecting from another website) to a get url
 (i.e.
 http://www.somewebsite.co.uk/Availability?NUM_OF_ADTS=1CABIN=EB1_DAY=27 )
 
 form action=http://www.somewebsite.co.uk/Availability.cgi; method=POST
 name=flightsForm id=flightsForm
 input type=hidden name=NUM_OF_ADTS value=1/
 input type=hidden name=CABIN value=E/
 input type=hidden name=B1_DAY value=27/
 /form

not sure I understandd exactly what you want.  If you want the
variables to show up in the query string you could either change the
form method to get or change the action to form
action=http://www.somewebsite.co.uk/Availability?NUM_OF_ADTS=1CABIN=EB1_DAY=27;
method=POST name=flightsForm id=flightsForm

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



Re: [PHP] convert hidden form to get url

2004-12-20 Thread Matt M.
 Sorry for not been clear. The snippet of html is code I am getting
 dynamically using curl from another website. I want to then convert that
 html code into a url like
 http://www.somewebsite.co.uk/Availability?NUM_OF_ADTS=1CABIN=EB1_DAY=27.


you need something to parse the html, I found this: 
http://php-html.sourceforge.net/

and here is a quick script to try:

  include (htmlparser.inc);

  $htmlText = 'form
action=http://www.somewebsite.co.uk/Availability.cgi; method=POST
name=flightsForm id=flightsForm
input type=hidden name=NUM_OF_ADTS value=1/
input type=hidden name=CABIN value=E/
input type=hidden name=B1_DAY value=27/
/form';

  $parser = new HtmlParser ($htmlText);
  while ($parser-parse()) {
 
  // Data you can use here:
  //
  // $parser-iNodeType
  // $parser-iNodeName
  // $parser-iNodeValue
  // $parser-iNodeAttributes 

  if ($parser-iNodeType == NODE_TYPE_ELEMENT) {
$tmp = $parser-iNodeAttributes;
if($parser-iNodeName == 'form') {
$url = $tmp['action'];  
} elseif($parser-iNodeName == 'input') {
$qs[$tmp['name']] = $tmp['value'];
}
  }
  }

$tmp = array();
foreach($qs as $key = $value) {
print $key = $value br /;
$tmp[] = $key.'='.urlencode($value);
}

$url .= '?'.implode('',$tmp);

print 'url='.$url;

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



Re: [PHP] first letter

2004-12-20 Thread Matt M.
 $name = John;
 
 how can i echo the first letter only so the result on the browser will be J

echo $name{0};

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



Re: [PHP] Problem with loose typing

2004-12-17 Thread Matt M.
 You would expect the while loop to go on forever just looking
 at the above code.  However, what's happening is that when the
 empty string is getting returned due to $i being  10, the while
 loop is resolving FALSE when $bob is set to the value of the
 empty string.
 Is there any way that I can force this not to happen?  That the
 while loop resolves as FALSE only when the function actually
 returns a (boolean) FALSE value?

I think this should do it.

  function test() {
   static $i = 0;

   $i++;
   $retval = ( $i = 10 ) ? $i : '';

   return $retval;

 }
 while( ($bob = test()) !== false ) {
   echo $bob . 'ECHObr';

 }

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



Re: [PHP] in_array w/statement

2004-12-16 Thread Matt M.
 reason it seems to always be true, ... something i'm doing wrong? btw, i
 cannot add the in_array to the statement because if the $buddylist is empty
 it will generate errors because of the empty implode.

you could add the is_array() check.

 $buddylist = preg_split('/( )+/', trim($userinfo['buddylist']), -1,
 PREG_SPLIT_NO_EMPTY);
 
 if($buddylist)
 {
  $buddy = in_array($uname['uid'], array(implode(',', $buddylist)));
 }

not sure I understand this, implode returns a string, then you are
putting that string into the array() function.  I dont know what kind
of data you would get back from that.  $buddylist should already be an
array.

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



Re: [PHP] Delete files from the server

2004-12-16 Thread Matt M.
 I have uploaded some pictures and thumbnails using a PHP form into a
 particular directory. I would like to be able to select the name of the
 picture and then chose to delete that picture and its thumbnail from the
 server using another form.

try the manual my man

http://us2.php.net/unlink

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


Re: [PHP] fopen/fpassthur

2004-12-14 Thread Matt M.
 Hi all,
 I have created a download manger to handle files, when a user clicks a link
 the file is sent though fopen() and fpassthru()

you could try http://us3.php.net/readfile

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


Re: [PHP] Sorting...

2004-11-17 Thread Matt M.
 array (
  20040310, Title, Author
  20041115, Title, Author
  20040513, Title, Author
   )
 
 where each array element is 1 line from the csv. When I go to print it
 out, Im going to explode each by , and then print it out the way I like.
 
 BUT, I want to sort them all by those first 8 digits, which happen to be
 the date. Any way to sort an array by the first x characters in its
 string?
 
 This would save a lot on processor time, otherwise Im going to have to
 pull an array of those characters, sort it, and then run some matching
 scheme against the CSV data to print it in the order I like - which would
 be HUGELY processor intensive.

I think sort should do it for you

$array = array(20040310, Title, Author,
20041115, Title, Author,
20040513, Title, Author);
sort($array);
reset($array);
while (list($key, $val) = each($array)) {
   echo array[ . $key . ] =  . $val . br /;
}

but, if you wanted to just make sure it was the first entry in the CSV try usort

function cmp($a, $b)
{   

   $first = explode(',', $a);   
   $second = explode(',', $b);  

   if ($first == $second) {
   return 0;
   }
   return ($first  $second) ? -1 : 1;
}


$array = array(20040310, Title, Author,
20041115, Title, Author,
20040513, Title, Author);
usort($array, cmp);

while (list($key, $value) = each($array)) {
   echo array[ . $key . ] =  . $value . br /;
}

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



Re: [PHP] copy function?

2004-11-16 Thread Matt M.
 I have a button which I want to add a function to, so that when it is
 clicked, the data from one textarea will be copied to another textarea
 
 Which event handler of the button should I use and hoe should I construct
 the function?


onclick.  This is not really a php question. do some googleing for javascript.

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



Re: [PHP] PHP Working With Excel File ?

2004-11-01 Thread Matt M.
 Can PHP work with Excel files as database ?
 If not, how can I conver it to MySQL format and
 reconvert it to Excel 'coz I need it to report it
 in Excel format,


if you are on windows you could use a com object.

if you have access to perl, you could use
http://search.cpan.org/~kwitknr/Spreadsheet-ParseExcel-0.2603/ParseExcel.pm

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



Re: [PHP] exec() or system() to run *.exe and let php continue with code

2004-10-29 Thread Matt M.
 Hi all im new to PHP and im trying to let a process (*.exe file) to run in
 background(localhost) and let php continue processing the script. But PHP
 always stops and wait for the (*.exe) stops/close!
 
 Anyone here can help me by giving me an simply example to let PHP run the
 exe file and continue with code execution.


check out http://us2.php.net/manual/en/function.exec.php
read through the user comments
found this on php.net

function execInBackground($path, $exe, $args = ) {
   global $conf;
  
   if (file_exists($path . $exe)) {
   chdir($path);
   if (substr(php_uname(), 0, 7) == Windows){
   pclose(popen(start \bla\ \ . $exe . \  .
escapeshellarg($args), r));
   } else {
   exec(./ . $exe .   . escapeshellarg($args) .  
/dev/null );
   }
   }
}

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



Re: [PHP] Friday afternoon - being thick

2004-10-29 Thread Matt M.
 I've got some text that contains carriage returns, which are not br /.
 what tag do I need to use to display the text with the carriage returns?
 Can't even remember whether it's html or php.

html, pre

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



Re: [PHP] PHP and send XML

2004-10-28 Thread Matt M.
 I'm trying to pass XML file from Site  A to Site B for Site B to parse.
 Site B is maintained by other company, so I only need to worry about sending
 over the XML file. I've been hinted that fsockopen() can do the job.

if you have to do this I would suggest giving pear a try, no need to
reinvent the wheel.

http://pear.php.net/package/HTTP_Client

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



Re: [PHP] PHP + Javascript, immediate database update

2004-10-27 Thread Matt M.
 I have a webform which my users are expecting to act like a Windows program,
 they only need to check the box and it is automatically written to the
 database.

you could try this
http://developer.apple.com/internet/webcontent/iframe.html

or this

http://jibbering.com/2002/4/httprequest.html

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



Re: [PHP] Php files with .html extension?

2004-10-25 Thread Matt M.
 How can i do a php script with a html extensionsuch as 
 http://www.blinds-wise.com/shop/p/blind/bid/1/venetian_blinds.html
 

apache could do this a couple ways

http://httpd.apache.org/docs/mod/mod_mime.html#addhandler
http://httpd.apache.org/docs-2.0/mod/core.html#setinputfilter
http://httpd.apache.org/docs-2.0/mod/core.html#setoutputfilter

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



Re: [PHP] currency

2004-10-22 Thread Matt M.
  What is the best way to output 38884 as $38,884.00?
 
 
 
 number_format()


or http://us2.php.net/money_format

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



Re: [PHP] remote file existance when protected by a .htaccess

2004-10-21 Thread Matt M.
 Hi Matt,
 Yep, cURL is available but I was going through the
 manual for curl (and google too suggests that might be
 my best option)...but it does not look very easy to
 learn :-(

It is not to bad.  Go through the php manual and look at the examples.
 That should help.

If you still cant figure it out, I can put together a quick script to
help you out.

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



Re: [PHP] remote file existance when protected by a .htaccess

2004-10-21 Thread Matt M.
try this function, I lifted almost all of this stuff off of the manual
and the zend site

function check_link($link , $referer='') {
$main = array();
$ch = curl_init();
curl_setopt ($ch, CURLOPT_URL, $link);
curl_setopt ($ch, CURLOPT_HEADER, 1);
curl_setopt ($ch, CURLOPT_NOBODY, 1);
curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt ($ch, CURLOPT_NETRC, 1);
curl_setopt ($ch, CURLOPT_TIMEOUT, 10);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST,  2);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);  // this line
makes it work under https
if(isset($referer)) {
curl_setopt($ch, CURLOPT_REFERER, $referer);  
}
ob_start();
curl_exec ($ch);
$stuff = ob_get_contents();
ob_end_clean();
curl_close ($ch);
$parts = split(n,$stuff,2);
$main = split( ,$parts[0],3);
return $main;
} // function check_link

$url = 'your url';
$referer = 'your referer';
print_r(check_link($url , $referer));

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



Re: [PHP] CPU usage @5% during 2 minutes SOLVED

2004-10-20 Thread Matt M.
 The thing was:
 The new, 20 year old administrator guy set all clients to use the local
 network via the proxy. And the proxy wasn't able to handle the approx.
 1,5MB huge web pages.


good that the problem is solved.

Not sure if you know or not but you could probably cut the size of the
page down using mod_gzip, mod_deflate, or maybe
http://us2.php.net/ob_gzhandler

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



Re: [PHP] remote file existance when protected by a .htaccess

2004-10-20 Thread Matt M.
 which works great except I have been getting some 403
 access denied errors for some sites, checking I see
 that they are protected by a htaccess file (that
 checks the referrer) so i tried putting
 
 header('referer: domain')
 
 where domain is the parse_url['host'] of $remote_file
 but that too has failed...
 
 Any ideas?


might want to try http://pear.php.net/package/HTTP_Client

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



Re: [PHP] remote file existance when protected by a .htaccess

2004-10-20 Thread Matt M.
 Nope, no PEAR allowedany other options?

curl, Is that available to you?

http://us2.php.net/curl

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



Re: [PHP] remote file existance when protected by a .htaccess

2004-10-20 Thread Matt M.
  Nope, no PEAR allowedany other options?

also 

http://us2.php.net/fsockopen

check the user comments for setting referer

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



Re: [PHP] @session_start generates a new session_id

2004-10-19 Thread Matt M.
 @session_start();
 session_name(userauth);
 $_SESSION['SESS_CUS'] = $user_id;


I am not 100% sure what the problem is, but if you are trying to
change the session name to userauth, I think you need to do that
before session_start

http://us2.php.net/session_name

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



Re: [PHP] Session

2004-10-19 Thread Matt M.
 I am trying to make my pages last for only 1 minute but I am not been successfull.
 
 I have already changed session.cache_expire = 1 in php.ini (USING RedHat) but 
 nothing happens.
 
 I would like the pages to last only for 1 minute, this means that if the user do not 
 use the site within 1 minute all the session variables will be lost and he will have 
 to log on again (I am using session variables to store name and password).
 
 Can anyone help me?

you will have to expire the session manually.

keep track of the last time they access the site in a session
variable.  Check that variable every request they make.  If it is
longer than a minute, expire the session.

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



Re: [PHP] throw me a bone for a regexp please.

2004-10-15 Thread Matt M.
 Also if someone could direct me to a site that explains how to use and
 create regexp in a small minded manor since I have been unable to
 grasp the concepts.


the regex coach has been a big help to me

http://www.weitz.de/regex-coach/

you might find it useful

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



Re: [PHP] Help with parsing result code

2004-10-15 Thread Matt M.
 I'm setting up a credit card payment app. When I send the information
 through the form I get a result similar to this:
 
 NOT CAPTURED:00:428930479495:NA:1015:9755676331042890:1:1
 
 This is the only data in the result page.
 
 I have never done parsing, and I have no idea of how to get this
 information inerted into variables.
 
 The result data is a series of data separated by ':'
 
 Could anyone please give me a hint as of where to look for information
 on how to do the parsing, or a short sample script?

http://us2.php.net/manual/en/function.preg-split.php

should do it

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



Re: [PHP] Help with parsing result code

2004-10-15 Thread Matt M.
 http://us2.php.net/manual/en/function.preg-split.php
 
 should do it


also http://us2.php.net/explode

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



Re: [PHP] Re: Determine variable with the lowest value?

2004-10-14 Thread Matt M.
On Thu, 14 Oct 2004 10:52:20 -0500, BOOT [EMAIL PROTECTED] wrote:
 OK thanks but I guess I didn't explain what I am trying to do properly.
 
 I need to be able to identify the variable name as well as pick the variable
 with the lowest value.
 
 Something like this:
 
 Whose turn is it to take out the garbage?
 
 Mike has done it 3 times
 Bob has done it 2 times
 Jane has done it 5 times
 etc...
 
 Therefore its Bob's turn.


$arr['Mike'] = 3;
$arr['Bob'] = 2;
$arr['Jane'] = 5;

foreach ($arr as $key = $value) {
echo $key.' has done it '.$value.' timesbr /';
}
asort($arr);
print 'It is '.key($arr).'\'s turn';

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



Re: [PHP] Referring Page

2004-10-14 Thread Matt M.
 I am trying to set up a script that will do different things based on the
 reffering page, without having to include the information in the URL.  Does
 PHP have a built in variable or function that would tell the rest of the
 script what page the user came from?  Any help is much appreciated.

there is $_SERVER['HTTP_REFERER']

but it is unreliable

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



Re: [PHP] Referring Page

2004-10-14 Thread Matt M.
  I am trying to set up a script that will do different things based on
  the
  reffering page, without having to include the information in the URL.
  Does
  PHP have a built in variable or function that would tell the rest of the
  script what page the user came from?  Any help is much appreciated.
 
  there is $_SERVER['HTTP_REFERER']
 
  but it is unreliable
 
 
 Can I ask why?

 
not sure if you are asking me, but like someone already said in this
thread But be warned, they're not that reliable as some firewalls
block/muck with them, and they can also be easily spoofed.

I also even turn them off when I am using mozilla/firefox.  

Just not a reliable variable

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



Re: [PHP] detecting ssl

2004-10-13 Thread Matt M.
 It worked for me, for thousands of others, but not for everybody. Some people
 just could not use the site anymore. So I guess the SERVER_PORT var can not
 necessarily be count on.
 
 Has anybody an idea how to overcome this?

try

if ( !isset($_SERVER['HTTPS']) || strtolower($_SERVER['HTTPS']) != 'on' ) {
}

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



Re: [PHP] reg. expressions

2004-10-13 Thread Matt M.
 on one place I have string something (something_2)
 I have to take out of the string everything in brackets and brackets as
 well.
 probably I will need to use Regular Expression Functions but I'm really
 bad with them :)

$string = something (something_2);
$pattern = /\(.*\)/;
$replacement = ;
echo preg_replace($pattern, $replacement, $string);

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



Re: [PHP] .htaccess and .htpasswd

2004-10-13 Thread Matt M.
try an apache mailing list.

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



Re: [PHP] Working out the image path...partly solved, please have a look at my code

2004-10-12 Thread Matt M.
 /../imgs/blah.jpg should return
 http://www.textx.com/t1/t2/imgs/blah.jpg
 
 but its returning:
 http://www.textx.com/t1/t2/t3/imgs/blah.jpg
 
 and this: /../../imgs/blah.jpg
 should return: http://www.textx.com/t1/imgs/blah.jpg
 
 but its returning:
 http://www.textx.com/t1/t2/imgs/blah.jpg
 
 in both cases one extra level directory :-(
 
 Any ideas?

ok, I gave it a try and honestly this is probably over my head :) but
here is something to try

?php

$url='http://www.textx.com/t1/t2/t3/blah.html';

function ret_url($rel_path, $base = '')
{
$base_path = substr($base, 0, strpos($base, '/',7));

if(substr($rel_path,0,1)=='/'  strpos($rel_path,'/../') === false)
{  
return $base_path.$rel_path; 
}

elseif(strpos($rel_path,'://')  0)
{  return $rel_path; }

else {  
return collapse(dirname($base),$rel_path); 
}

return $rel_path;
}

/* this function removes the /../ parts */
function collapse($path,$rel_path)
{

$parsed = parse_url($path);
preg_match_all('/\/\.\./',$rel_path, $matches); 
if(($count = count($matches[0]))  0) {
$parts = preg_split('/\//', $parsed['path'], -1, PREG_SPLIT_NO_EMPTY);
for ($i = 1;$i = $count; $i++) {
array_pop($parts);
}
$path = str_replace($parsed['path'], '/'.implode($parts,'/'), $path);
}

$rel_path = (preg_match('/^\//',$rel_path)) ? $rel_path :'/'.$rel_path;
$path = preg_replace('/\/\.\./', '', $path.$rel_path);

return $path;
}


$uris = array();
$uris[] = '/blah.jpg';
$uris[] ='/imgs/blah.jpg';
$uris[] ='imgs/blah.jpg';
$uris[] ='../imgs/blah.jpg';
$uris[] ='/../imgs/blah.jpg';  // ## not working ##
$uris[] ='/../../imgs/test.jpg'; // ## not working ##
$uris[] ='http://some-site-blah.com/imgs/blah.jpg';

echo 'table border=1';
foreach($uris as $uri)
{
echo 'trtd'.htmlspecialchars($uri).'/
tdtd'.htmlspecialchars(ret_url($uri,$url)).'/td/tr';
}
echo '/table';
?

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



Re: [PHP] fpassthru failure with mozilla

2004-10-12 Thread Matt M.
 $filepath = bla/bla/files/;
 $filename = file.zip;
 $fullpath = $filepath/$filename;
 
 header( ' Pragma: ');
 header( ' Content-Type: application/force-download' );
 header( ' Content-Type: application/octet-stream ' );
 header( ' Content-length:'.(string)(filesize($fullpath)));
 header( ' Cache-Control: private' );
 header(  Content-Disposition: attachment; filename='$filename');
 
 $fh = fopen($filepath/$filename, rb);
 fpassthru($fh);

it looks good to me.  You might want to try: header('Pragma:
no-cache'); instead of header( ' Pragma: ');

Also, install http://livehttpheaders.mozdev.org/ on mozilla.  Will
help with debugging

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



Re: [PHP] Question about array_search

2004-10-11 Thread Matt M.
 Say I'm trying to add a value to an array, only if it's not already in
 there somewhere; so I do an array_search to see. The problem is that if
 the item is at index 0 in the array, array_search gives the same answer
 as if it's not in there at all. How does one circumvent this potential
 pitfall?

I think this would work (I could be wrong)

$array = array(0 = 'blue', 1 = 'red', 2 = 'green', 3 = 'red');

if(($key = array_search('bluesf', $array)) !== FALSE) {
echo $key;
}

if(($key = array_search('blue', $array)) !== FALSE) {
echo $key;
}

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



Re: [PHP] Working out the image path...partly solved, please have a look at my code

2004-10-11 Thread Matt M.
 ?php
 
 $url='http://www.textx.com/t1/t2/t3/blah.html';
 
 function ret_url($rel_path, $base = '')
 {
  $base_path = substr($base, 0, strpos($base, '/',7));
 
 if(substr($rel_path,0,1)=='/' 
 !strpos($rel_path,'/../'))
  {  return $base_path.$rel_path; }
 
  elseif(strpos($rel_path,'://')  0)
  {  return $rel_path; }
 
  else {  return
 collapse(dirname($base).'/'.$rel_path); }
 
  return $rel_path;
 }
 
 /* this function removes the /../ parts */
 function collapse($path)
 {
 
  while(strpos($path,'/../') !== false)
  {$p2 = ereg_replace('/([^/]*)/\.\./','/',$path);
   if($p2==$path)
break;
   $path = $p2;
  }
 
  return $path;
 }
 
 $uris = array();
 $uris[] = '/blah.jpg';
 $uris[] ='/imgs/blah.jpg';
 $uris[] ='imgs/blah.jpg';
 $uris[] ='../imgs/blah.jpg';
 $uris[] ='/../imgs/blah.jpg';  // ## not working ##
 $uris[] ='/../../imgs/blah.jpg'; // ## not working ##
 $uris[] ='http://some-site-blah.com/imgs/blah.jpg';
 
 echo 'table border=1';
 foreach($uris as $uri)
 {
 echo 'trtd'.htmlspecialchars($uri).'/
 tdtd'.htmlspecialchars(ret_url($uri,$url)).'/td/tr';
 }
 echo '/table';
 ?

try this:

function ret_url($rel_path, $base = '')
{
$base_path = substr($base, 0, strpos($base, '/',7));

if(substr($rel_path,0,1)=='/'  strpos($rel_path,'/../') === false)
{  return $base_path.$rel_path; }

elseif(strpos($rel_path,'://')  0)
{  return $rel_path; }

else {  return
collapse(dirname($base).'/'.$rel_path); }

return $rel_path;
}

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



Re: [PHP] Encoding Question for getting pages

2004-10-11 Thread Matt M.
 Mozilla%2F4.0%20%28compatible%3B%20MSIE%206.0%3B%20Windows%20NT%205.1%0A
 
 that one is using rawurlencode() but it's just as bad with urlencode -
 How *should* I be doing this?

is this how you tried to do it?

$userAgent = Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0);
curl_setopt($ch, CURLOPT_USERAGENT, $userAgent);

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



Re: [PHP] spaces in select

2004-10-11 Thread Matt M.
 I have a select/option that gets populated with countries. The value of
 these option are also set to the country name. The problem i have is
 that some countries have spaces in them
 
 eg: United States of America.

what doe your select loo like?  something like this should work

select name=country
option value=United States of AmericaUnited States of America/option
/select

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



Re: [PHP] Problem of varible

2004-10-11 Thread Matt M.
 When disable the globals varibles function, the following php can't be
 good for working :

this should point you in the right direction

http://us2.php.net/manual/en/features.file-upload.php

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



Re: [PHP] help me to get out of this mass mailing

2004-10-09 Thread Matt M.
 I'm implementing mass mailing program...as there are hundred's of users that receive 
 mails...as a result i'm getting this error...
 
 Fatal error: Maximum execution time of 30 seconds exceeded in 
 d:\phpsites\ac\asc\acendo on line 42

take a look at 

http://us4.php.net/manual/en/ref.info.php#ini.max-execution-time

you need to bump it up

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



Re: [PHP] fopen and http://

2004-10-08 Thread Matt M.
 But I don't understand why I am getting that error about failed to open
 strem: HTTP request failed, when I can bring up the links fine in a
 browser on the server running the php script.  So can anyone help me out?
 Thanks

do you have allow_url_fopen enabled? 

http://us4.php.net/manual/en/ref.filesystem.php#ini.allow-url-fopen

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



Re: [PHP] URL verification

2004-10-08 Thread Matt M.
 how can i check in the page if the user is accessing the the site via SSL ??
 or i have to put a redirect in the page anyway, whether the user is
 alredy accessing the page via SSL?

if it has to be https, why not just use mod_rewrite to make sure it is.

With php you could check $_SERVER['SERVER_PORT'] or $_SERVER['HTTPS']

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



Re: [PHP] Grab an array from a cookie without throwing errors?

2004-10-08 Thread Matt M.
 $cookie = $_COOKIE['bookmarks'];
 if(unserialize($cookie) == true) {
 $bookmarks = unserialize($cookie);
 } else {
 $bookmarks = array();
 }

if (isset($_COOKIE['bookmarks'])) {
$cookie = $_COOKIE['bookmarks'];
if(unserialize($cookie) == true) {
   $bookmarks = unserialize($cookie);
} else {
   $bookmarks = array();
}
}

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



Re: [PHP] header redirect with POST?

2004-10-08 Thread Matt M.
 Is it possible to have a form where I post variables to a processing
 script which would then redirect to another form have variables posted
 from the processing script? I am researching the HTTP header things as I
 write this, but have not found a viable answer that is PHP only.

I dont know if that is poosible.  I think you would have to find a way
to tell the browser to pass the post data.

Why are you trying to do this?  Why not use sessions, or the query string?

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



Re: [PHP] pdf_open_pdi_page

2004-10-07 Thread Matt M.
 Do you have a source for your assumption ?

to use pdi you need PDFlib Personalization Server (PPS)
http://www.pdflib.com/products/pdflib/pps.html

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



Re: [PHP] Re: Muti-Dimensional Array Help Please

2004-10-07 Thread Matt M.
$max = ($max = count($ips) ? $max : count($ips));

if ($max = count($ips)) {
$max = $max;
} else {
$max = count($ips);
}

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



Re: [PHP] pdf_open_pdi_page

2004-10-07 Thread Matt M.
 I was on that page.
 There's nothing which comes close to your  assumption.

sorry, wrong link you dont need PDFlib+PDI.  Is that the license that you have?

here is an assumption.  I assumed you would read the pdflib manual, did you see?

Note All functions described in this section require PDFlib+PDI. The
PDF import library (PDI) is not contained in PDFlib or PDFlib Lite.
Although PDI is integrated in all precompiled editions of PDFlib, a
license key for PDI (or PPS, which includes PDI) is required.

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



Re: [PHP] pdf_open_pdi_page

2004-10-07 Thread Matt M.
 sorry, wrong link you dont need PDFlib+PDI.  Is that the license that you have?

I mean you do need

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



Re: [PHP] general research question (maybe a little OT, sorry)

2004-10-07 Thread Matt M.
 My boss recently called PHP good for hobbyists but REAL sites have to
 be done with Microsoft technologies.  He wants to use Sharepoint for a
 wiki type site because of versioning.

:)

real sites use iis

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



Re: [PHP] pdf_open_pdi_page

2004-10-06 Thread Matt M.
 *Fatal error*: PDFlib error: [2016] PDF_open_pdi: PDF import (PDI) not
 supported in this configuration in
 *d:\worksheet-server\wss\html\pdf\test2.php* on line *7*

I could be wrong but I think you need a special license for this functionality.

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



Re: [PHP] Push file to FTP Server

2004-10-06 Thread Matt M.
 Does anyone know how I might be able to have php push a file to an FTP
 server?

did you look in the manual or even try google?

http://us4.php.net/ftp

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



Re: [PHP] Parse file and input into DB

2004-10-04 Thread Matt M.
 What I would like to do is upload a file and have PHP parse the file and
 dump the information into a MySQL database, putting the information into
 select tables.  I believe I can do everything EXCEPT parse the page.
 Anyone have some insight (or direct links) to some examples on what to
 use to do it?


what format will the uploaded file be in?  csv?

http://us2.php.net/manual/en/function.fgetcsv.php

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



Re: [PHP] Image Manipulation

2004-10-01 Thread Matt M.
 I would like to know if there is a way to have PHP determine the
 dimensions of an image (i.e. JPG or PNG) and if it more than Xpx wide
 or height have it scale it down proportionally to that width or
 height?

look at

http://us4.php.net/gd

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



Re: [PHP] PHP Host with PayFlow Pro

2004-10-01 Thread Matt M.
 I'm trying to locate a PHP web host, preferably one running PHP 5, that also
 supports the PHP payflow pro binaries? Anyone have any recommendations?

have you tried google?

http://www.google.com/search?hl=enlr=ie=UTF-8client=firefox-aq=PHP5+hosting+payflowbtnG=Search

also, search the mailing list archives

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



Re: [PHP] Session Variable Security

2004-09-30 Thread Matt M.
 Can anyone tell me how secure a session variable is.  I realize that if
 someone wanted to take the time to break into my site they will eventually
 succeed, but I dont want to make it too easy.  I have a database that stores
 a username and an encrypted password which both are verifyed when the user
 logs in to the site.  Then I have a session variable that I am checking for
 on all other pages that tells the page that they are logged in.  I also have
 a session variable that holds the users ID in the database.  Certain pages
 reference that ID to show the user there data.  Mainly used for a My Account
 page.  But If I'm logged in, how easy would it be, if its even possible, to
 change the session variable that holds my ID to someone elses ID so I can
 get their data.

all session data is stored on the server.  The only thing on the
client is the session id.  So somone would have to change that session
id to get someone elses info and you can make that harder to do.

I found this link, it has some good info.

http://shiflett.org/talks/phpworks2004-php-session-security/0

should give you some pointers

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



Re: [PHP] Zend PHP Certification test

2004-09-30 Thread Matt M.
 I'm glad to hear that, cause some of them did seem a bit difficult.  I
 understood perfectly after seeing the correct answer and the
 explanation, but they were a little tricky.


I would be interested in feedback on the exam.  I am looking into
taking the test, just hoping Zend runs the $100 deal again.

I know I am too late but good luck this morning.

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



Re: [PHP] Zend PHP Certification test

2004-09-30 Thread Matt M.
 You can win a free pass to take the exam by being the first to solve this
 puzzle:
 
 http://shiflett.org/archive/55
 
 Enjoy. :-)

I think I have it, why dont you email me the answer and I will double
check that against what I got.

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



Re: [PHP] Zend PHP Certification test

2004-09-30 Thread Matt M.
 This is just too easy:
 
 The shown times are posting-times for one day on this list, for posts
 regarding mysql.

ah ha.

could also be unsubscribe emails

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



Re: [PHP] splitting string into array

2004-09-29 Thread Matt M.
 Example,
 A12B05C45D34
 
 I need to split this into chunks of three A12,B05,C45..etc?

not sure if your string will always be the same patter but this might work

$string = 'A12B05C45D34';

$array = preg_split ( '/([a-zA-Z]\d{2})/', $string,
-1,PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE );
print_r($array);

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



Re: [PHP] Need help... getting information from external xml document

2004-09-23 Thread Matt M.
   ?xml version=1.0 encoding=UTF-8 ?
   THREAT_ADVISORY CONDITION=ELEVATED /
 
 can anyone help?

start looking here

http://us2.php.net/xml

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



Re: [PHP] Re: Need help... getting information from external xml document

2004-09-23 Thread Matt M.
  I am new to php and xml and would like to know how I can set a
  variable (i.e $terror_threat_level) equal to the value of
  Threat_Advisory's Condition in the following that is available at
  http://www.dhs.gov/dhspublic/getAdvisoryCondition ...
 
   ?xml version=1.0 encoding=UTF-8 ?
   THREAT_ADVISORY CONDITION=ELEVATED /

if you are using php 5 you could try this:

$file = 'http://www.dhs.gov/dhspublic/getAdvisoryCondition';
$xml = simplexml_load_file($file);
print findAttribute($xml,'CONDITION');
 

function findAttribute($object, $attribute) {
  foreach($object-attributes() as $a = $b) {
   if ($a == $attribute) {
 $return = $b;
   }
  }
  if($return) {
   return $return;
  }
}

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



Re: [PHP] PDF from PHP generated HTML, possible?

2004-09-23 Thread Matt M.
 Is it possible to have PHP dynamically build an HTML page (from database
 data etc) and provide an option to output the page as PDF without going
 through all the database query routine again?

you could use output buffering.

If they choose output as pdf, capture the html that was produced, run
it through your conversion program, then output it to the borwser.

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



Re: [PHP] Re: Need help... getting information from external xml document

2004-09-23 Thread Matt M.
 As John noted at the end... I do not have control over the format of
 the XML... but thanks I will try... BTW i am using PHP4 is
 SimpleXML able to be used and if so how?

I would just use John's regex idea, I am guessing (i could be wrong
though, I have been many times before) that the format is not going to
change much

$str =
file_get_contents('http://www.dhs.gov/dhspublic/getAdvisoryCondition');
preg_match('/CONDITION=([^]+)/',$str,$match);
echo $match[1];

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



Re: [PHP] PDF from PHP generated HTML, possible?

2004-09-23 Thread Matt M.
 Thanks for that John, I think the big issue will be how to 'cache' my HTML
 pages should I want to proceed down this route. BTW from memory I think the
 'product' was htmldoc, or similar.

use output buffering, save the html into some kind of temp file

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



Re: [PHP] converting from name - id and PHP not seeing it?

2004-09-23 Thread Matt M.
 I jsut finished converting my pages to be W3C compliant...
 One of the recuring 'errors' I had was my form elements were all using the
 'name' atrtribute...
 apparently, this is bad, and I was suggested to switch them ti use the
 'id' attribute...

if you want the info to be posted to the page, it needs the name attribute.

I am sure that the name attribute is w3c compliant for form elements

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



Re: [PHP] sorting multidimensional array by a second level value

2004-09-17 Thread Matt M.
  I'd like to sort the array based on one of the values in the field
  href, description, or time. Is there a canonical way of doing this?

you might be able to use http://us2.php.net/manual/en/function.usort.php

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



Re: [PHP] syntax questoin

2004-09-16 Thread Matt M.
 $Msg .= Test is complete
 
 I'm thinking it means concatenate $Msg with Test is complete and then
 store the new string into $Msg
 
 Am I right?

you are correct, same as:
$Msg = $Msg.Test is complete

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



Re: [PHP] problem with header(Location:home.php)

2004-09-09 Thread Matt M.
 the connection file I have included in every page.
 why this error is occuring?

check E:\PHPMySql scripts\bugtrack\connection.php for white space
before or after ?php ?

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



Re: [PHP] foreach()

2004-09-08 Thread Matt M.
 Warning: Invalid argument supplied for foreach() in
 c:\apache\htdocs\or_6.4.php on line 15

do a print_r on $_POST to see what is in the array.

 form method=post action=eat.php
 select name=lunch[] multiple
 option value=porkBBQ Pork Bun/option
 option value=chickenChicken Bun/option
 option value=lotusLotus Seed Bun/option
 option value=porkBean Paste Bun/option
 option value=chickenBird-Nest Bun/option
 /select
 brbr
 input type=submit name=submit
 /form
 Selected buns:
 br
 ?
 foreach ($_POST['lunch'] as $choice)
  {
   print You want a $choice bun.br;
  }
 ?

looks like you are posting to another page, eat.php

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



Re: [PHP] gzip

2004-09-07 Thread Matt M.
 I have a file on my server that I want to compress in a php page i.e take file.txt 
 and add it to the archive file.zip.
 
 How the hell do I do it using gzip cant understand the manual, or is there another 
 way to create a zip file or other compressed file.
 

have you looked at http://pear.php.net/package/Archive_Zip

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



Re: [PHP] More on the credit card fraud

2004-09-07 Thread Matt M.
 The fraudulent orders that I receive on my site come with email
 addresses of eight random alphanumerics @yahoo.com.

preg_match('/[EMAIL PROTECTED]/', $email) should do the trick

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



Re: [PHP] mail() from addess problems

2004-09-07 Thread Matt M.
 How would I get this to change? I didn't see anything in php.ini or
 httpd.conf. I've found it's not possible to do a header rewrite with
 postfix either.

There is examples in the manual

http://us2.php.net/mail

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



Re: [PHP] Correct headers for I.E. to open PDF?

2004-09-03 Thread Matt M.
 $pdfdoc = $__BASE_PDF_BUILD_DIRECTORY.$_GET['FID'];
 
 $filesize = filesize($pdfdoc);
 header(Pragma: );
 header(Expires: 0);
 header(Cache-Control: must-revalidate, post-check=0,pre-check=0);
 header(Content-type: application/pdf);
 header(Content-Length: .$filesize);
 header(Content-Disposition: inline; filename=FILE.pdf);
 header(Content-Transfer-Encoding: binary);
 header(Accept-Ranges: bytes);
 
 readfile($pdfdoc);
 exit();
 
 Why isn't it working?

IE can seems to ignore these headers some times (I think it might have
something to do with the .php extension).  I have had success creating
the file and saving it with .pdf as the extension then redirecting to
that file.

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



Re: [PHP] php does not get variable values in POST method

2004-09-02 Thread Matt M.
 I developed an html/php form  in a Php version 4.0.6, working fine, but when
 a moved the files to another web server with Php 4.3.2 the file
 procesaadmision.php called in the Post method does not get any of the input
 html variables defined in the calling form.
 form ACTION=procesaadmision.php METHOD=POST

I am guessing register_globals is off

check the manual, you should be able to find it

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




Re: [PHP] xml tags interfere with php tags

2004-09-01 Thread Matt M.
On Wed, 1 Sep 2004 13:08:11 -0500, Josh Close [EMAIL PROTECTED] wrote:
 How do I get an xml tag to work with a php script?
 
 ?xml version=1.0?
 
 php is trying to parse that.

you could just echo it at the top

?php echo '?xml version=1.0?';?

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



Re: [PHP] Include if file exists?

2004-08-27 Thread Matt M.
On Fri, 27 Aug 2004 12:16:32 +0200, Jay [EMAIL PROTECTED] wrote:
 Hi!
 
 Is there a ready to use PHP function for including ONLY if the file exists?
 
 I tried it like this:
 
 [main.php]
 include_once(lib.php);
 .later
 includeIf(somefile.php);
 
 [lib.php]
 function includeIf($filename)
 {
 if (!file_exists($filename))
 {
 include_once($filename);
 }
 }


you sure you dont mean this?

function includeIf($filename)
 {
 if (file_exists($filename)) /*instead of if (!file_exists($filename))*/
 {
 include_once($filename);
 }
 }

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



Re: [PHP] HTTP_POST Intermittent Problem

2004-08-26 Thread Matt M.
 function http_post($host, $path, $data)
 {
   $http_response = '';
   $content_length = strlen($data);
 
   $fp = fsockopen($host, 80);
   fputs($fp, POST $path HTTP/1.1\r\n);
   fputs($fp, Host: $host\r\n);
   fputs($fp, Content-Type: application/x-www-form-urlencoded\r\n);
   fputs($fp, Content-Length: $content_length\r\n);
   fputs($fp, Connection: close\r\n\r\n);
   fputs($fp, $data);
   while (!feof($fp))
   {
$http_response .= fgets($fp, 128);
   }
   fclose($fp);
 
   return $http_response;
 }
 
 $http_response = http_post('www.blah.com', '/test.aspx?', 'data');

can you use PEAR?

There is already a bunch of http packages

http://pear.php.net/package-search.php?pkg_name=httpbool=ANDsubmit=Search

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



  1   2   >