Re: [PHP] Execute a shell command using thttpd-php

2006-03-15 Thread James E Hicks III

Nelson Carreira wrote:


James E Hicks III wrote:


Nelson Carreira wrote:


Yes, I've tried using both absolute and relative paths.

The system output is 0 when I execute, for example, nvram show 
from the php. From what I know this output means success. Although 
there's no output on php.


Nelson Carreira





From your original post it looks like the function you want to use is 
passthru(). I just noticed the following note on php.net:


Note: When safe mode is enabled, you can only execute executables 
within the safe_mode_exec_dir. For practical reasons it is currently 
not allowed to have .. components in the path to the executable.


Could this be your problem?

James


This version of php doesn't have a php.ini file for configuration, so 
there's no safe_mode_exec_dir. I tried to create the one mentioned in 
php_info() and copy the executables there but it didn't work.


Nelson Carreira


Hmmm. I'm all out of ideas.

James

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



Re: [PHP] Bar codes

2005-05-20 Thread James E Hicks III
Emil wrote:
Hello!
Sorry if this is off topic. I'm making a php site where one can order 
a kit and now I would like to mark the kits with bar codes generated 
by the php script. I would also need some kind of bar code hardware 
reader and some way for a computer to read the result from the bar 
code reader, guess php might not work here so I might create some java 
application or whatever.

I've never done anything like this before, do you know of any good 
starting points? I don't know anything about bar codes.

Regards Emil
I've written an entire Warehouse Management System using PHP that 
utilizes barcoding extensively. We use zebra printers and various 
barcode reading wands (usually USB connected) with wedges. Most of these 
wands allow you to set a postfix code to send after it sends the wanded 
data. I just set this to CRLF and that allows for easy wanding into 
webpages that are specially designed to accept this type of input.

The Zebra printers use a language called ZPL. We created our basic label 
templates using ZPL and use PHP to fill out the template and send it on 
to the cups server (which handles sending the data to the Zebra printer).

Good Luck, this will be a fun project!
James Hicks
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Re: I have some upload questions.

2005-05-16 Thread James E Hicks III
Lee Chen wrote:
Thanks
I check the phpinfo, and my safe_mode is off.
This is my phpinfo
http://homepage.ntu.edu.tw/~b91401010/phpinfo().htm
It is just a copy, not on the server.(so it's html file, not a php file)
Thanks.
 

Looks like you need to check this in your php.ini file. Could be your 
problem!

max_input_time integer
This sets the maximum time in seconds a script is allowed to receive 
input data, like POST, GET and file uploads.


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


Re: [PHP] str_replace on words?

2005-05-12 Thread James E Hicks III
Merlin wrote:
Hi there,
I am trying to strip some words from a sentence. I tried it with 
str_replace like described here:
http://www.totallyphp.co.uk/code/find_and_replace_words_in_a_text_string_using_str_replace.htm 

Unfortunatelly it does not work the way I want, because if I want to 
replace the word in all passages containing the characters in are 
replaced. For example Singapore.

Does anybody know how to do this on just words?
Thank you for any hint,
Merlin
$variable = 'I like to Sing in Singapore';
$variable = str_replace(' in ',' for ',$variable);
echo $varible;
Results should be:
I like to Sing for Singapore
James
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] PhP e COBOL

2004-11-19 Thread James E Hicks III
Andre wrote:
Hello 

I need some help in this subject php + COBOL.
I need to load data of a program in COBOL for a site written in php. 
The data must be loaded for a DB in mysql. 
 

Every night a job runs on our Mainframe here that creates a big file 
filled with SQL updates. Every morning a CLI PHP program fired off from 
cron attempts to download this file and after successfully doing so 
processes the SQL commands found in the file. Creating SQL queries with 
COBOL is so much fun

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


Re: [PHP] Arrays

2004-11-11 Thread James E Hicks III
Ben Miller wrote:
edit
I hope this is not a stupid question, but I am learning how to work with
Arrays, and am having trouble figuring out how to move array values [the
whole array and all of it's values] from
page to page and/or store in a db.  

?
echo (htmlheadtitleArray Example/title/headbody);
echo (form action=\.$_SERVER['PHP_SELF'].\ method=\POST\);
for ($i=0; $icount($array_variable); $i++){
   echo (input name=\array_variable[]\ type=\hidden\ 
value=\.$array_variable[$i].\);
}

##-- Add to the array?
echo (input name=\array_variable[]\ type=\text\ value=\\);
echo (input name=\submit\ type=\submit\ value=\Add to the Array\);
echo (/form);
echo (br);
echo (Current Array Elements:);
for ($i=0; $icount($array_variable); $i++){
   echo (BR.$array_variable[$i]);
}
echo (/body/html);
?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] UNSUBSCRIBE!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

2004-09-30 Thread James E Hicks III
On Thursday 30 September 2004 10:18 am, [EMAIL PROTECTED] wrote:
 Thank you,


You can't expect that people in government know how to read! Much less think!

James

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



Re: [PHP] Session understanding

2004-09-02 Thread James E Hicks III
On Thursday 02 September 2004 10:09 am, Michael Gale wrote:
 So if I try and store a variable that would be unique to each window it
 would get over written. Is this a configuration problem ?


It sounds to me like you need to turn off session.auto_start in your php.ini 
file and call session_start() on each page so that you can set a unique 
session name for each browser using session_name() function.

Or use PHP 4.3.8 which for some unknown reason creates a new session for your 
site anytime a new browser window has been opened. I'm just kidding here, I 
think that that is a bug. Which does not seem to exist anymore in 4.3.9 (Woo 
Hoo!)

James Hicks

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



[PHP] Session Problem PHP version 4.3.8

2004-08-13 Thread James E Hicks III
OK, so it wasn't the nut behind the wheel after all. I am still having 
problems with sessions after upgrading to PHP 4.3.8. The test code below 
works as expected on server equipped with PHP 4.3.6 and keeps the session 
start time the same no matter what link you click on. However with version 
4.3.8 when you click on the last link on the page it will start a new session 
and the session start time will be updated. What can I change to fix this?

All the session related php.ini settings are the same on both servers and I 
will repost that information here. Both servers are running the same version 
of Apache, Server version: Apache/1.3.27 (Unix)  (Gentoo/Linux).

## Session settings in php.ini
[Session]
session.save_handler = files
session.save_path = /tmp
session.use_cookies = 1
; session.use_only_cookies = 1
session.name = PHPSESSID
session.auto_start = 1
session.cookie_lifetime = 0
session.cookie_path = /
session.cookie_domain =
session.serialize_handler = php
session.gc_probability = 1
session.gc_divisor = 100
session.gc_maxlifetime = 1440
session.bug_compat_42 = 1
session.bug_compat_warn = 1
session.referer_check =
session.entropy_length = 0
session.entropy_file =
;session.entropy_length = 16
;session.entropy_file = /dev/urandom
session.cache_limiter = nocache
session.cache_expire = 180
session.use_trans_sid = 0
url_rewriter.tags = a=href,area=href,frame=src,input=src,form=,fieldset=

And here is the example code that I am having trouble with.

SESSION_TEST1.php

?php
echo(\n HTMLHEADTITLESESSION TEST/TITLE);
echo(\n SCRIPT LANGUAGE=\JavaScript\);
echo(\n !-- Begin );
echo(\n function popUpBI(URL) { );
echo(\n day = new Date(); );
echo(\n id = day.getTime(); );
echo(\n eval(\page\ + id + \ = window.open(URL, '\ + id + \', 
'toolbar=0,scrollbars=yes,location=0,statusbar=0,menubar=0,resizable=0,width=400,height=400');
\); );
echo(\n } );
echo(\n // End -- );
echo(\n /script);
echo(\n /HEADBODY);
if(!$_SESSION['start_time']){
echo(\n Session ResetBR);
$_SESSION['start_time'] = time();
}
echo(\n BRSession Start Time -.date(M/d/Y h:i:s,
$_SESSION['start_time']));
echo(\n form action=\.$_SERVER['PHP_SELF'].\ method=\POST\);
echo(\n BRinput type=\submit\ name=\submit\ value=\THIS WORKS\);
echo(\n /form);
echo(\n BRA HREF=\SESSION_TEST1.php\THIS ALSO WORKS/A);
echo(\n BRBRA HREF=\javascript:popUpBI('SESSION_TEST2.php')\THIS 
STARTS NEW SESSION/A);
echo(\n /BODY/HTML);
?

SESSION_TEST2.php

?php
echo(\n HTMLHEADTITLESESSION TEST 2/TITLE/HEADBODY);
echo(\n Now there is new session and the other window will update with new 
timeBR);
echo(\n BRa href=\javascript:window.close();\fontClose This 
Window/font/a);
echo(\n /BODY/HTML);
?

Help

James Hicks

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



Re: [PHP] Session Problem PHP version 4.3.8

2004-08-13 Thread James E Hicks III
On Friday 13 August 2004 11:14 am, Andre Dubuc wrote:
 Hi James,

 Well for what it's worth:

 Your code in Test1 sets the paraemters -
 if(!$_SESSION['start_time']){
   echo(\n Session ResetBR);
   $_SESSION['start_time'] = time();

 yet when Test2 loads, you haven't called $_SESSION[''start_time'} nor, for
 that matter, have you 'saved' it using session_write_close();

From the Manual:
Session data is usually stored after your script terminated without the need 
to call session_write_close(),


 Therefore when the Test2 loads, time is not set, so when it returns to

Time is set.

 Test1 and hits the above condition, it will write a new time, and hence a
 new session.


It should never hit the if condition after the first load of the page.

 I presume two things; 1. that you have ?php session_start(); ? as opener
 lines on each page  and 2. that register_globals=off. 

In my php.ini I have session.auto_start = 1, so that I do not need 
session_start(). And register_globals is set to off.

 The last thing caused 
 all sorts of grief for me last week - messes up sessions if 'on'


Been there done that! Thanks for trying to help!

James 

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



Re: [PHP] Session Problem PHP version 4.3.8

2004-08-13 Thread James E Hicks III
On Friday 13 August 2004 01:14 pm, Torsten Roehr wrote:
 James, have you tried with manually calling session_start() and setting
 auto_start = 0? If not, please try this.

 Haven't followed your previous thread so please forgive me if I'm asking
 something you already wrote. Are you using cookies? 

YES

These are my current cookie related php.ini settings.

session.use_cookies = 1
; session.use_only_cookies  defaults to 0
; session.use_only_cookies = 1

 If so, have you tried 
 without them by appending the session id manually to the links?


I tried that without turning cookies off and appending the SID to the 
offending anchor tag (the one with javascript). Nothing I tried worked with 
current php.ini settings.

I tried like this:

echo(\n BRBRA 
HREF=\javascript:popUpBI('SESSION_TEST2.php?.SID.')\THIS STARTS NEW 
SESSION/A);

Which gave me this anchor tag:
A HREF=javascript:popUpBI('SESSION_TEST2.php?')THIS STARTS NEW SESSION/A

And like this:

echo (a href=\javascript:popUpBI('SESSION_TEST2.php?PHPSESSID=.
$_REQUEST['PHPSESSID'].')\THIS STARTS NEW SESSION/A);

Which gave me this anchor tag:
A 
HREF=javascript:popUpBI('SESSION_TEST2.php?PHPSESSID=fae0cffb9f6c307e38aef7d2310e1d69')THIS
 
STARTS NEW SESSION/A

 Try these settings:
 session.auto_start    = 0
 session.use_cookies   = 0
 session.use_trans_sid = 0

 Put session_start() at the top of ALL your pages and write your links this
 way:
 a href=page2.php??php echo SID; ?to page 2 /a


I tried with php.ini settings like you suggested and it didn't work at all. 
Whatever you clicked on started a new session. Then I turned 
session.use_trans_sid = 1 with auto_start and use_cookies still turned off 
and my example code started working!!! My problem is that all my other real 
world apps do not work with php.ini settings like that. :(

So it seems that the cookie part of sessions is broken somehow and my earlier 
idea of adding something to url_rewrite wouldn't help even if I could figure 
out what to add to it. Anyone have any other ideas. Can I upgrade to 
something higher than 4.3.8? Would that mean upgrading to 5.x?

James Hicks

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



Re: [PHP] Securing Forms???

2004-08-13 Thread James E Hicks III
On Friday 13 August 2004 02:57 pm, Gerard Samuel wrote:
 I've read (at least on 2 occasions) that one can secure their forms, to
 ensure that the form came from the site, and not via a script kiddie.
 Not the method where one puts a graphic of random text to copy to the
 form, but via a hidden field.
 It has to do with having a hidden field of data, that must match some
 data, when the form is posted.
 I've been mulling over this for some time to figure out how its
 possible, (as I haven't seen a live example of it).
 Could anyone point me to an example to how this can be done, (if its
 even possible)???
 Thanks for your input...

I think you're looking for something like this, but be warned things like 
HTTP_REFERER are/can be set by the client so you can't really trust this too 
much.

if ($_SERVER['HTTP_REFERER'] != 'http://domain.com/I/AM/EXPECTING/script.php') 
{
echo (Dang Script Kiddie Go Away!);
exit;
}

Probably better is to include, like you said, a hidden variable on the page 
that would be very hard to guess in the form before presenting it to the user 
and also save it in a database or somewhere. Then when the user submits the 
form check your database for the existence of the super hard to guess value. 
If it exists in the DB, delete it and let the user go about her business. If 
it doesn't then:
{
echo (Dang Script Kiddie Go Away!);
exit;
}


James

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



[PHP] PHP 4.3.8 Session Handling w/ JavaScript

2004-08-12 Thread James E Hicks III
On a server that is running PHP 4.3.6 I can use a link like this and the 
accompanying javascript to get a popup window in my application. After 
upgrading to PHP version 4.3.8 this no longer works. For some reason when you 
click on this link now, it looks like it creates a new session which of 
course is logging my users out of the application. Is there something that I 
can add to url_rewrite to get this to work? Is there some other setting I am 
missing? Do I need better JavaScript?

echo (a href=\javascript:popUpBI('bin_info.php')\Bin Info/A);


SCRIPT LANGUAGE=JavaScript
!-- Begin
function popUpBI(URL) {
day = new Date();
id = day.getTime();
eval(page + id +  = window.open(URL, ' + id + ', 
'toolbar=0,scrollbars=yes,location=0,statusbar=0,menubar=0,resizable=0,width=400,height=400'););
}
// End --
/script

## Even tried to send the PHPSESSID by hand. This did not work.
echo (a href=\javascript:popUpBI('bin_info.php?PHPSESSID=.
$_REQUEST['PHPSESSID'].')\Bin Info/A);


## Session settings in php.ini
[Session]
session.save_handler = files
session.save_path = /tmp
session.use_cookies = 1
; session.use_only_cookies = 1
session.name = PHPSESSID
session.auto_start = 1
session.cookie_lifetime = 0
session.cookie_path = /
session.cookie_domain =
session.serialize_handler = php
session.gc_probability = 1
session.gc_divisor = 100
session.gc_maxlifetime = 1440
session.bug_compat_42 = 1
session.bug_compat_warn = 1
session.referer_check =
session.entropy_length = 0
session.entropy_file =
;session.entropy_length = 16
;session.entropy_file = /dev/urandom
session.cache_limiter = nocache
session.cache_expire = 180
session.use_trans_sid = 0
url_rewriter.tags = a=href,area=href,frame=src,input=src,form=,fieldset=

James Hicks

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



Re: [PHP] PHP 4.3.8 Session Handling w/ JavaScript

2004-08-12 Thread James E Hicks III
On Thursday 12 August 2004 10:32 am, James E Hicks III wrote:
 On a server that is running PHP 4.3.6 I can use a link like this and the


Please disregard this request for help, as the problem seems to be the nut 
behind the wheel.

James

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



Re: [PHP] Re: Retrieving Stored Values for Dropdown Menu

2004-07-28 Thread James E Hicks III
I'd like to make a few changes here to hopefully answer the original question.

On Wednesday 28 July 2004 01:35 pm, Ed Lazor wrote:
echo select name=\record\;
while ($record = mysql_fetch_array($results)) {
if ($_POST[record] == $record[ID]){ 
$SELECTED =  SELECTED ; 
} else { 
$SELECTED = ; 
}
echo option value=' . $record[ID] . ' .$SELECTED. . 
$record[Title] .
/option\n;
}
echo /select;



James Hicks

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



Re: [PHP] Printing using php script CRON

2004-07-27 Thread James E Hicks III
On Tuesday 27 July 2004 08:33 am, Vern wrote:
 Actually it's a netwotl printer and in order to print the job I need to
 type the following on the box:

     lpr -P hp1300n myfilename.txt

 So I'm not exctaly sure how I can do that

This works great for me. Except that I use lp -d printername filename.txt 
instead of the command you're using. I can print to any printer that I set up 
in CUPS on the webserver. I do this from webpages so I'm sure you can get it 
to work with CRON.

$filename = uniqid()..txt;
$filehandle = fopen($filename,w);
fwrite($filehandle, Hello World);
fclose($filehandle);
system(lpr -P hp1300n .$filename);

James

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



Re: [PHP] freeTDS

2004-07-27 Thread James E Hicks III
On Tuesday 27 July 2004 03:54 pm, Edward Peloke wrote:
 My web host recompiled php with the freeTDS library for me so that I can
 use the php mssql extensions but it still doesn't seem to work.  He has
 told me that I can change the configuration file...what needs to be done?


Just guessing here, (don't even know what TDS is) but there are some MSSQL 
specific settings in the php.ini file. You may need to make changes to them 
before phpinfo() will tell you anything at all about MSSQL. Again all guesses 
here.

James Hicks

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



Re: [PHP] background=#

2004-07-22 Thread James E Hicks III
On Thursday 22 July 2004 10:23 am, Tobias Brasier wrote:
 The problem is that when I run the page, the log files show that the page
 was accessed twice.

I would be looking for calls to the header() function or a meta refresh tag in 
the header of this program. Maybe there is an include() file that has one of 
these things in it? Setting the background color of a TD using the #123456 
method is not going to cause your script to load twice.

James Hicks

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



Re: [PHP] Log all GET AND POST?

2004-07-15 Thread James E Hicks III
On Thursday 15 July 2004 09:58 am, Robert Sossomon wrote:
 I was wondering if anyone knew of a way to log all GET and POST
 information being passed to a log file?

 Thanks,
 Robert

$DEBUG_DATA = $_SERVER['PHP_SELF'].\n;
while (list ($key, $val) = each ($_REQUEST)) {
if (is_array($_REQUEST[$key])){
while (list ($ar_key, $ar_val) = each ($_REQUEST[$key])) {
$DEBUG_DATA .= $key [ $ar_key ] = $ar_val\n;
}
} else {
$DEBUG_DATA .= $key = $val\n;
}
}
mysql_select_db(HISTORY);
$query = insert into BIG_BROTHER 
 values (
 '.$_SESSION['user_ID'].',
  .time().,
  '$DEBUG_DATA');
mysql_query($query);
reset($_REQUEST);

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



Re: [PHP] Email, Hotmail and PHP?

2004-07-13 Thread James E Hicks III
On Tuesday 13 July 2004 04:57 am, [EMAIL PROTECTED] wrote:
 Hi there...
 My misses has just started a new job, but has got loadsa websites blocked,
 including hotmail.
 So I've decided to see if there's a php alternative, that I can code/steal
 etc...

 If I can host a series of php pages, that can get a list of emails, and
 access to read them... replying would be cool, but not essential...
 she can reply via work...


I want to be the first to thank you for making your misses's work network less 
safe. I'm sure they won't mind all the virus laden emails you're sneaking 
through the back door. I'm sure I don't need to mention how much work your 
misses gets done while she's reading personal emails.

James Hicks

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



Re: [PHP] MySQL Database Connection Question

2004-07-08 Thread James E Hicks III
On Thursday 08 July 2004 09:59 am, Harlequin wrote:
 I have a user registration form that asks new users to register. However,
 Do I post the MySQLconnection string in the page they are completing or in
 the later page that the data is posted to, or both...?

I don't think I understand your question, but let me take a stab at it anyway. 
There should be no reason to pass along the mysql connection ID in a form as 
it will be quite useless when the page is submitted because these connections 
are dropped when your PHP program ends execution. You will need to make a new 
connection to the database in order to store the entered values from a form 
submission.

If I didn't get your question right, please be more clear about what you mean 
when you say MySQLconnection string.

James Hicks

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



[PHP] Re: Form + database / PHP survey + database

2004-06-23 Thread James E Hicks III
On Wednesday 23 June 2004 03:32 pm, tommie ramirez.andujar wrote:
 Dear colleagues..

 I am new to mysql and I am trying to do the following, to create a php file
 that may contain some kind of form or survey and the data entered may be
 added to a database. Here's the code of the html form


Dearest Colleague,

Start writing your project now. No one on this list or the PHP list is going 
to write this code for you. Either list will be glad to help you with 
problems you are having with code that you have written. Neither list is 
going to produce your project for you. I would suggest looking at 
sourceforge.net for pre-written code.


Not Your Code-Monkey,

Your Colleagues

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



Re: [PHP] phpmyadmin

2004-05-24 Thread James E Hicks III
On Monday 24 May 2004 04:04 pm, Chris W wrote:
 It sounds like this is for adding the date and time to file name for the
 backup but I can't figure out how it works.

Maybe an email to the phpMyAdmin list will get you an answer faster than in 
here?

James

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



Re: [PHP] cron job for php not working

2004-05-20 Thread James E Hicks III
On Thursday 20 May 2004 11:35 am, Jay Blanchard wrote:
 At the command line type which php and it will return the full path to
 php. Modify your line in the crontab with the full path...

 0 6 * * * /usr/local/bin/php
 /home/www/project/app_cron/follow_up_new_members.php

I always put the #!/usr/local/bin/php at the top of all my command line php 
scripts. Mine is actually #!/usr/bin/php. Then chmod 755 the file so that it 
can execute.

James Hicks

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



Re: [PHP] Webcapture to PDF

2004-05-13 Thread James E Hicks III
On Thursday 13 May 2004 11:59 am, Ashley M. Kirchner wrote:
 Looking for a (open source) solution here: is there some way that I
 can convert an already existing HTML page to a PDF file, by means of a
 script (on a unix box)?  What I'd like to do is have a button on all of
 our pages that, when clicked on, will perform a capture of that page,
 including all images, convert to PDF, and serve it back to the user's
 browser.  I don't just want what the user's viewing (I doubt that's
 possible anyway from a server-side point.)  I want a full page capture,
 and then converted.

This is how I do it. (Warning this is psuedo-code!)

http://user.it.uu.se/~jan/html2ps.html
http://www.ps2pdf.com/convert/index.htm

?php
system (html2ps http://taget.system.com/target.html;);
system (ps2pdf target.ps);
echo (META HTTP-EQUIV=\refresh\ content=\1; URL=target.pdf\);
?

James Hicks

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



Re: [PHP] Uploading and directory permissions

2004-05-10 Thread James E Hicks III
On Monday 10 May 2004 05:20 am, Mario wrote:
 Anyways I was wondering if there is a way to upload through PHP without
 having write permission to all. Is there a way maybe, for the script,
 to change permission to write before the upload and then take it off? or
 anything else I can do to protect the dir?

You could keep your upload directory with 777, but after uploading move files 
to safer directory with stricter file permissions. You could probably even 
get away with just changing the permission of the file after it was uploaded.

http://php.net/filesystem

http://php.net/manual/en/function.chmod.php

// Read and write for owner, read for everybody else
 chmod(/somedir/somefile, 0644);
 
 
James Hicks

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



Re: [PHP] How to disable browser's back- and refresh-Button

2004-04-19 Thread James E Hicks III
On Monday 19 April 2004 12:22 pm, Marco Schuler wrote:
 Hi

 I want to prevent the user to use the browser's back-/refresh-button in
 my multipage registration form (as well as in other forms). How can I do
 this?


If you look back in the archives of this list you will see the way that I did 
this. It wasn't more than a month ago that I posted it. Basically whenever I 
displayed a form I included a hidden tag with form_id that is saved in DB. 
When user submits form check that form_id exists in DB then delete it. If the 
form_id was found in DB, process form. If the form_id was not found in the 
DB, do not process the form and alert the user that they shouldn't be using 
the back button, refresh button, or pressing submit more than once.

James

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



[PHP] How to disable browser's back button, refresh button and multiple clicks of submit buttons using PHP.

2004-04-19 Thread James E Hicks III
This is the only way that I have been able to insure that the users can not 
use any of the bad buttons (back,refresh,double-click submit). The 
java-script solutions will only work for users that have java-script enabled.

I put the following in my authenticate.php which is included at the top of 
every page.

authenticate.php
?
if ($_POST['form_id'] != ''){
mysql_select_db(form_authentication);
$query = select count(*) as valid_form from form_id where form_id = 
'.$_POST['form_id'].';
extract(mysql_fetch_array(mysql_query($query)));
if ( $valid_form  1 ){
include(warn_doubleclick.php);
exit;
} else {
mysql_select_db(form_authentication);
$query = delete from form_id where form_id = 
'.$_POST['form_id'].';
mysql_query($query);
}
}
/*
MORE AUTHENTICATE STUFF HERE
*/
function create_form_id(){
mysql_select_db(form_authentication);
$new_form_id = uniqid(rand(),1);
$query = insert into form_id values ( '$new_form_id' );
mysql_query($query);
$form_field = input type=\hidden\ name=\form_id\ 
value=\$new_form_id\;
return $form_field;
}
?


Then inside every form that I want to protect from back button , refresh 
button or double-clicking of the submit button I echo the results of 
create_form_id inside the form tag. I also remember to include 
authenticate.php which is going to actually stop the user from resubmitting 
the same form.

?php
include(authenticate.php);
include(header.php);
echo form action=\.$_SERVER['PHP_SELF'].\ method=\POST\;
echo input type=\text\ name=\test\;
echo create_form_id();
echo /form;
include(footer.php);
?

Here is an example warn_doubleclick.php that you can edit to your taste. This 
is what the users will be redirected to if they break the button rules.

?php
include(header.php);
echo (BRBRh2You have double clicked the submit button titledb);
echo ($_POST['submit']./b or attempted to process this form twice by using 
the back button or the refresh button./h2);
echo (BRBRa href=index.phpReturn to Program/a);
include(footer.php);
?

Here is the SQL to create necessary DB and table.

CREATE DATABASE form_authentication;
CREATE TABLE form_id (
  form_id varchar(50) NOT NULL default ''
) TYPE=MyISAM;

James Hicks

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



[PHP] No Back Button in forms

2004-04-09 Thread James E Hicks III
On Friday 09 April 2004 02:14 pm, Daniel Clark wrote:
  Another question envolves the use of the back button.  My client wants
  the use of the back button to be turned off for security reasons for
  some pages.  His preference is to have a page expire if it is arrived on
  by pressing the back button.  Can this be done with sessions?

I put the following in my authenticate.php which is included at the top of 
every page.

if ($_POST['form_id'] != ''){
mysql_select_db(form_authentication);
$query = select count(*) as valid_form from form_id where form_id = 
'.$_POST['form_id'].';
extract(mysql_fetch_array(mysql_query($query)));
if ( $valid_form  1 ){
include(warn_doubleclick.php);
exit;
} else {
mysql_select_db(form_authentication);
$query = delete from form_id where form_id = '.$_POST['form_id'].';
mysql_query($query);
}
}

function create_form_id(){
mysql_select_db(form_authentication);
$new_form_id = uniqid(rand(),1);
$query = insert into form_id values ( '$new_form_id' );
mysql_query($query);
$form_field = input type=\hidden\ name=\form_id\ 
value=\$new_form_id\;
return $form_field;
}

Then inside every form that I want to protect from back button or 
double-clicking of the submit button I echo the results of create_form_id 
into.

?php
echo form action=\.$_SERVER['PHP_SELF'].\ method=\POST\;
echo input type=\text\ name=\test\;
echo create_form_id();
echo /form;
?

Here is an example warn_doubleclick.php that you can edit to your taste.

?php
include(header.php);
echo (BRBRh2You have double clicked the submit button titledb);
echo ($_POST['submit']./b or attempted to process this form twice./h2);
echo (BRBRa href=index.phpReturn to Program/a);
echo (/body/html);
?

Here is the SQL to create necessary DB and table.

CREATE DATABASE form_authentication;
CREATE TABLE form_id (
  form_id varchar(50) NOT NULL default ''
) TYPE=MyISAM;

James Hicks

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



Re: [PHP] Really Annoying Require/Include Error

2004-03-30 Thread James E Hicks III
On Tuesday 30 March 2004 12:33 pm, Mike R wrote:
 I am getting this error:
You came to the right place.

 Fatal error: Failed opening required
 '/home/sites/site111/web/news/settings/newsletter.settings.inc.php'
 (include_path='') in
include_path='' says that your php.ini does not have default include path set.

 /home/sites/site111/web/news/forms/sign_in_out_form.inc.php on line 7

This is the path and script name causing your problem.


 From this piece of code:

 require
 (/home/sites/site111/web/news/settings/newsletter.settings.inc.php);

This is a relative include. Your script is running in

 /home/sites/site111/web/news/forms/

so PHP is looking for your require file in this directory.

/home/sites/site111/web/news/forms/home/sites/site111/web/news/forms/

I am guessing that this directory does not exist nor the file.

Try this instead.

require(../settings/newsletter.settings.inc.php);

James Hicks

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



[PHP] session.bug_compat_42

2004-03-23 Thread James E Hicks III
What does the code look like that is causing this error? I know I can turn the 
error off but how do I fix the code that is causing it?

Warning: Unknown(): Your script possibly relies on a session side-effect which 
existed until PHP 4.2.3. Please be advised that the session extension does 
not consider global variables as a source of data, unless register_globals is 
enabled. You can disable this functionality and this warning by setting 
session.bug_compat_42 or session.bug_compat_warn to off, respectively. in 
Unknown on line 0

It only seems to appear when viewed using MSIE, Konqueror and Mozilla do not 
display this error, why?

Here is some example code that I am using.
?php
if (!session_is_registered('U_SI')) {
#do some stuff.
}
session_register(last_time);
$last_time = time();
echo $_SESSION['last_time'];
?

Here are some settings from php.ini from the server that is giving the error.

/etc/php4/php.ini

register_globals = Off
[Session]
session.save_handler = files
session.save_path = /tmp
session.use_cookies = 1
session.name = PHPSESSID
session.auto_start = 1
session.cookie_lifetime = 0
session.cookie_path = /
session.cookie_domain =
session.serialize_handler = php
session.gc_probability = 1
session.gc_divisor = 100
session.gc_maxlifetime = 1440
session.bug_compat_42 = 1
session.bug_compat_warn = 1
session.referer_check =
session.entropy_length = 0
session.entropy_file =
session.cache_limiter = nocache
session.cache_expire = 180
session.use_trans_sid = 0
url_rewriter.tags = a=href,area=href,frame=src,input=src,form=,fieldset=


PHP 4.3.2 (cli) (built: Aug 12 2003 14:25:22)
Copyright (c) 1997-2003 The PHP Group
Zend Engine v1.3.0, Copyright (c) 1998-2003 Zend Technologies
with Turck MMCache v2.3.20, Copyright (c) 2002-2003 TurckSoft, St. 
Petersburg, by Dmitry Stogov


James Hicks

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



Re: [PHP] session.bug_compat_42

2004-03-23 Thread James E Hicks III
Thanks to all who helped, I think I got it figured out now. 

James Hicks



On Tuesday 23 March 2004 12:11 pm, Rasmus Lerdorf wrote:
 This has nothing to do with the browser.  Instead of using
 session_register(last_time) and setting $last_time, do this:

   $_SESSION['last_time'] = time();

 It's shorter and it will make the warning go away.

 -Rasmus

 On Tue, 23 Mar 2004, James E Hicks III wrote:
  What does the code look like that is causing this error? I know I can
  turn the error off but how do I fix the code that is causing it?
 
  Warning: Unknown(): Your script possibly relies on a session side-effect
  which existed until PHP 4.2.3. Please be advised that the session
  extension does not consider global variables as a source of data, unless
  register_globals is enabled. You can disable this functionality and this
  warning by setting session.bug_compat_42 or session.bug_compat_warn to
  off, respectively. in Unknown on line 0
 
  It only seems to appear when viewed using MSIE, Konqueror and Mozilla do
  not display this error, why?
 
  Here is some example code that I am using.
  ?php
  if (!session_is_registered('U_SI')) {
  #do some stuff.
  }
  session_register(last_time);
  $last_time = time();
  echo $_SESSION['last_time'];
  ?
 
  Here are some settings from php.ini from the server that is giving the
  error.
 
  /etc/php4/php.ini
 
  register_globals = Off
  [Session]
  session.save_handler = files
  session.save_path = /tmp
  session.use_cookies = 1
  session.name = PHPSESSID
  session.auto_start = 1
  session.cookie_lifetime = 0
  session.cookie_path = /
  session.cookie_domain =
  session.serialize_handler = php
  session.gc_probability = 1
  session.gc_divisor = 100
  session.gc_maxlifetime = 1440
  session.bug_compat_42 = 1
  session.bug_compat_warn = 1
  session.referer_check =
  session.entropy_length = 0
  session.entropy_file =
  session.cache_limiter = nocache
  session.cache_expire = 180
  session.use_trans_sid = 0
  url_rewriter.tags =
  a=href,area=href,frame=src,input=src,form=,fieldset=
 
 
  PHP 4.3.2 (cli) (built: Aug 12 2003 14:25:22)
  Copyright (c) 1997-2003 The PHP Group
  Zend Engine v1.3.0, Copyright (c) 1998-2003 Zend Technologies
  with Turck MMCache v2.3.20, Copyright (c) 2002-2003 TurckSoft, St.
  Petersburg, by Dmitry Stogov
 
 
  James Hicks
 
  --
  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] input type=text value=He said, How do I get this to work?, with a frown size=50

2004-03-16 Thread James E Hicks III
How do I get this to work? the input box is only showing 

He said, 

input type=text value=He said, How'm I gonna get this to work?, with a 
frown size=50



James Hicks

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



Re: [PHP] connecting to MySQL from shellscript

2004-03-11 Thread James E Hicks III
On Thursday 11 March 2004 10:47 am, Ian Firla wrote:
 I have a shellscript written in php that needs to connect to a mysql
 database. Everything I've been reading suggests that this cannot be done
 easily. Is this true?

I ain't never heard anything like this before. I do it all the time. Just 
connect just like you would in a web based php script.

James

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



Re: [PHP] bar code scaning in intranet ap

2004-02-12 Thread James E Hicks III
On Thursday 12 February 2004 08:26 am, Michal wrote:
 Great idea. Can I use a keyboard and bar code scanner together? How to use
 a keyboard, if i connect a scanner into a keyboard port?

 Michal

You use a thing called a wedge. It plugs into your keyboard port on your 
computer. Then you plug in the keyboard and the scanner into the wedge. You 
must program your PHP to not look for submit buttons. You also need a 
browser that will submit a page when you press enter in a field.

You can also get scanners with USB connections that work like keyboards.

We've written a Warehouse Management System using these devices and a barcode 
printer. It's written in PHP and uses MySQL database. We use walkabout 
computers connected to the forklifts and cherrypickers. It's been working 
great now for almost a year now.

James Hicks

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



Re: [PHP] php header information

2004-02-02 Thread James E Hicks III
On Monday 02 February 2004 08:57 am, Angelo Zanetti wrote:
 HI all

 I have a page that has been written by someone else and when I run it and
 click on a button to valid the username and password to login it sends me
 back the same page with the following:

 Warning: Cannot modify header information - headers already sent by (output
 started at c:\program files\apache group\apache\htdocs\zero\db_class.inc:1)
 in c:\program files\apache group\apache\htdocs\zero\login.php on line 26


Check db_class.inc, it is probably got a space or something in it and that is 
enough to cause this problem. You cannot send anything at all before you use 
the header() function.

James Hicks

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



[PHP] Max GET size?

2004-01-07 Thread James E Hicks III
I've seen the post_max_size in the php.ini. Is there a corresponding 
get_max_size? I couldn't find anything about this anywhere in the php.ini or 
apache.conf. 

I want to send a lot of information via 
header(Location: http//server.com/program.php?val[]=1) 

Is there any limit on size of GET method? 

James Hicks

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



Re: [PHP] Sessions.. (I'm learning), can't call a variable?

2003-10-16 Thread James E Hicks III
Try this.
 mysql_query(INSERT INTO $table (
 salutation,
 name,
 city
 } VALUES {
 \.$_SESSION['salutation'].\,
 \.$_SESSION['name'].\,
 \.$_SESSION['city'].\
 }

James

On Thursday 16 October 2003 08:36 am, [EMAIL PROTECTED] wrote:
 Not sure if this is a MySQL Q. or a PHP one, but here goes...

 I'm just learning sessions...
 And I'm trying to add a session variable to a MySQL database.
 I've done this page that takes the results from a previous form...
 But I get this error:
 Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or
 `T_NUM_STRING'
 On line 83
 Which is the line that relates to the line:
 \$_SESSION['salutation'];\,

 I've tried removing the ';' but it change nothing...?
 Can anyone see my error?

 =
 ?
 session_start();
 header(Cache-control: private);

$_SESSION['salutation'] = $_POST['salutation'];

 //MySQL connection stuff
 mysql_query(INSERT INTO $table (
 salutation,
 name,
 city
 } VALUES {
 \$_SESSION['salutation'];\,
 \$_SESSION['name'];\,
 \$_SESSION['city'];\
 }

 ?
 //Rest of page... thanks etc...
 =

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

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



[PHP] How do you keep browser from timing out during lengthy process

2003-10-16 Thread James E Hicks III
I have a program that when an operator clicks on a button initiates an ftp 
transfer of a large file. The program also checks for succesful completion of 
the transfer and advises the operator of the transfer status. How do I keep 
the operators browser from timing out so that the status can be displayed 
upon transfer completion?

James

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



RE: [PHP] Help with my code

2003-06-18 Thread James E Hicks III
What is the value of $subject? fwrite() expects the third 
value passed to it to be the number of bytes to write.

James


-Original Message-
From: Mark Clarkstone [mailto:[EMAIL PROTECTED]
Sent: Wednesday, June 18, 2003 11:09 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Help with my code 


why won't this write?

?
require (config.php);
if ($action) {

If ($name==) {
echo Form Error  No Name;
echo $errorbk;
}
else if ($email==) {
echo Form Erorr  No e-mail;
echo $errorbk;
}
else if ($input==) {
echo Form Error  No Comment found;
echo $errorbk;
}
else if ($wb==1) {
mail($webemail, $subject, $input);
}
if ($action) {
$data = $name\n$email\n$input;
$fp = fopen(messages.txt,'a');
$fw = fwrite($fp,$data,$subject);
fclose($fp);
echo Thank you;
}
}
else if (!$action) {
echo html

head
meta name='GENERATOR' content='Microsoft FrontPage 5.0'
meta name='ProgId' content='FrontPage.Editor.Document'
meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'
title$pagetitle/title
/head

body

form method='POST' action='?action=send'
p align='left'font face='Tahoma'font size='2'Commentie Version
1.0/fontbr
font size='2'Your Name /font
input type='text' name='name' size='20' style='font-family: Tahoma;
font-size: 10pt'br
font size='2'Your E-mail/fontinput type='text' name='email' size='20'
style='font-family: Tahoma; font-size: 10pt'br
font size='2'Your msg / comment/fontbr
textarea rows='2' name='input' cols='20' style='font-family: Tahoma;
font-size: 10pt'/textareabr
/font
font size='2' face='Tahoma'e-mail amp; save /fontfont face='Tahoma'
select size='1' name='wb' style='font-family: Tahoma; font-size: 10pt'
option selected value='1'Yes/option
option value='0'No/option
/select/font/p
/p
p align='left'
font face='Tahoma'
input type='submit' value='Submit' name='B1' style='font-family: Tahoma;
font-size: 10pt'input type='reset' value='Reset' name='B2'
style='font-size: 10pt; font-family: Tahoma'/font/p
/form

/body

/html;
}
?





-- 
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] Very Wierd Problem

2003-06-14 Thread James E Hicks III
I am experiencing some weird problems with PHP. When I execute the following
query from within a PHP script, the description is set to 'EBCO' and not
'EBCO\030774-006\BUBBLER VALVE'. When I execute this query from the mysql
monitor the value is inserted correctly.

$query = update the_table
 set description = 'EBCO\\030774-006\\BUBBLER VALVE'
   where item_number = '1';
mysql_query($query);


This statement prints to console incorrectly (notice funky character after
EBCO):

echo (EBCO\030774-006\BUBBLER VALVE);
EBCO774-006\BUBBLER VALVE

This statement prints to console incorrectly (notice funky character after
EBCO):

echo addslashes(EBCO\030774-006\BUBBLER VALVE);
EBCO774-006\\BUBBLER VALVE


This statement prints the variable to the console correctly:

echo (EBCO\\030774-006\\BUBBLER VALVE);
EBCO\030774-006\BUBBLER VALVE


How can I handle this description correctly with PHP?


James E Hicks III
Noland Company
2700 Warwick Blvd
Newport News, VA 23607
757-928-9000 ext 435
[EMAIL PROTECTED]


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



RE: [PHP] Very Wierd Problem

2003-06-14 Thread James E Hicks III
 \0 is a NULL character, IIRC. Either use single quotes:
 echo ('EBCO\030774-006\BUBBLER VALVE');
 or use two slashes, like you did above:
 echo (EBCO\\030774-006\\BUBBLER VALVE);
 ---John Holmes...

Problem is that this description is coming from a DB, that's 
why I was trying to use addslashes, which caused me the same
problems. 

James



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



[PHP] Easier way to delete all entries in an array?

2003-06-12 Thread James E Hicks III
There's got to be an easier way, is there?

for ($i=0; $i  count($the_array); $i++){
array_pop($the_array);
}

James E Hicks III
Noland Company
2700 Warwick Blvd
Newport News, VA 23607
757-928-9000 ext 435
[EMAIL PROTECTED] 

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



RE: [PHP] Easier way to delete all entries in an array?

2003-06-12 Thread James E Hicks III
The following has solved my problem. Thanks to all who helped.

$the_array=array();

-Original Message-
From: Chris Hayes [mailto:[EMAIL PROTECTED]
Sent: Thursday, June 12, 2003 10:14 AM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] Easier way to delete all entries in an array?


At 16:13 12-6-03, you wrote:
There's got to be an easier way, is there?

for ($i=0; $i  count($the_array); $i++){
 array_pop($the_array);
}
$the_array=array(); ?


-- 
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] Importing emails

2003-03-27 Thread James E Hicks III
Your going to have to look at your MTA for the answer to this. Basically
you need to tell you MTA to invoke a PHP script when it receives an email
for this specific address instead of normal delivery.

James Hicks

-Original Message-
From: Alexis Antonakis [mailto:[EMAIL PROTECTED]
Sent: Thursday, March 27, 2003 11:15 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Importing emails


Hi,

I am trying to set up a system whereby users can send data, in a
pre-determined format, to a specified email address. I would then like to
import the contents within each email into a database.

The trouble I'm having is not knowing really where to start. Could any kind
sole point me in the right direction. I've done a search of the site, but
nothing has come up.

Regards
Alexis


-- 
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] IF statement madness

2003-03-14 Thread James E Hicks III
Help save my sanity! What can I do to the IF statement in the following code to
make it print the line that says By God they are equal in value.? I have tried
the following changes;

1. using === instead of ==
2. placing (float) in front of the $i and $target inside and before the IF
statement.

?
$start = 215;
$end = 217;
$target = 216;
for ($i=$start; $i=$end; $i+=.1){
if ( $i ==  $target ){
echo (BR$i - $target, By God, the are equal in value.);
} else {
echo (BR$i - $target, Eternal Damnation, they aren't
equal!);
}
}
?


James E Hicks III
Noland Company
2700 Warwick Blvd
Newport News, VA 23607
757-928-9000 ext 435
[EMAIL PROTECTED]


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



RE: [PHP] IF statement madness

2003-03-14 Thread James E Hicks III
Thank you (all who resonded)!!! It makes sense now. 
Now I can wait until 5:00pm, quitting time, to go crazy!!

James

-Original Message-
From: Johnson, Kirk [mailto:[EMAIL PROTECTED]
Sent: Friday, March 14, 2003 1:23 PM
To: [EMAIL PROTECTED]
Subject: RE: [PHP] IF statement madness


Comparing a float with an integer can have problems. You could try something
like:

if(abs($i - $target)  .1) {
  //then they are essentially equal
}

Kirk

 -Original Message-
 From: James E Hicks III [mailto:[EMAIL PROTECTED]
 Sent: Friday, March 14, 2003 11:22 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP] IF statement madness
 
 
 Help save my sanity! What can I do to the IF statement in the 
 following code to
 make it print the line that says By God they are equal in 
 value.? I have tried
 the following changes;
 
   1. using === instead of ==
   2. placing (float) in front of the $i and $target 
 inside and before the IF
 statement.
 
 ?
 $start = 215;
 $end = 217;
 $target = 216;
 for ($i=$start; $i=$end; $i+=.1){
 if ( $i ==  $target ){
 echo (BR$i - $target, By God, the are 
 equal in value.);
 } else {
 echo (BR$i - $target, Eternal Damnation, 
 they aren't
 equal!);
 }
 }
 ?
 
 
 James E Hicks III
 Noland Company
 2700 Warwick Blvd
 Newport News, VA 23607
 757-928-9000 ext 435
 [EMAIL PROTECTED]
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 

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


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



RE: [PHP] javascript

2003-03-07 Thread James E Hicks III
 And what are you doing if the javascript is not enabled in the browser of
 the client ???
 There will be no verification and the user can enter what he want in the
 field of your form
 And it's a bit dangerous for your DB if your insert data in a DB...

Wow, the only safe way to insure data integrity is validating it on the
server side. Does this means that javascript validations only effect is
to doubles the developers work?




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



RE: [PHP] internal site search

2003-02-18 Thread James E Hicks III
Great news, there is a new tool on the internet called a search engine. What you
do is enter a search topic, press enter, and all kinds of links with articles
related to your search are returned. Some say this might signal an end to
mailing lists, which have been historically used to get answers to tough
questions when all other resources have been exhausted.

James

-Original Message-
From: rehab mostafa [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, February 18, 2003 8:35 AM
To: [EMAIL PROTECTED]
Subject: [PHP] internal site search


hi guys,
 i wanna make an internal site search, i wanna search my internal html
pages and php pages..and i have no clue how to do thatany help!!!
Thx

_
Add photos to your e-mail with MSN 8. Get 2 months FREE*.
http://join.msn.com/?page=features/featuredemail


--
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 FTP a security risk?????

2003-02-11 Thread James E Hicks III
Please correct me if I am wrong, but it is impossible for a remote machine to
make an ftp connection to local machine running just PHP/Apache/Mysql. The ftp
functions available in PHP enable PHP scripts to act as an FTP client and can
not be used to accept remote FTP connections.

Other functions (the socket functions) however, could be used to create what is
needed in order provide the FTP server functionality that your ISP fears. It is
these functions that your ISP should be disabling and not the FTP functions in
order to protect themselves from a client allowing FTP access via a PHP script
that they have written.

James Hicks


-Original Message-
From: Christopher Ditty [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, February 11, 2003 3:34 PM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: Re: [PHP] PHP FTP a security risk?


Chris, Did you read the rest of the message?  It sounds like the web
host is saying that
someone can access PHP FTP from an outside server and hack into the
server.

I am not trying to start a debate on whether or not people should send
passwords and
userids over plain text.  Yes, that is a security risk.  My concern is
that this webhost is
telling my customer that PHP FTP itself is a security risk when it does
nothing more than
act like ws-ftp.

 Chris Wesley [EMAIL PROTECTED] 02/11/03 02:22PM 
On Tue, 11 Feb 2003, Chris Wesley wrote:

 On Tue, 11 Feb 2003, Christopher Ditty wrote:

  errors, no nothing.  I talked to his host and found out that they
do
  not allow PHP FTP because it is a security risk.  ?  U,
ok?

 That said ... FTP is a protocol;  there's nothing stopping you from
 opening a socket and talking FTP back  forth across it (unless your
host
 has disabled fsockopen() too).  If you know the protocol, you
probably
 know how and why to avoid its security concerns.

 Other options:  Move to a less security-minded hosting provider
(looks
 like you've already started that), or ask the FTP server admin to
provide
 download access to your file via HTTP.

You might find this interesting too -- straight from Example 1 for
fopen()
in the PHP manual:  http://www.php.net/manual/en/function.fopen.php

$handle = fopen (ftp://user:[EMAIL PROTECTED]/somefile.txt;, w);

b.careful ... g.luck,
~Chris



--
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] Variable Fun

2003-01-30 Thread James E Hicks III
This code:
?
$var1 = 02061030012452;
$var2 = 02061030012451;
$test1 = (string) $var1
$test2 = (string) $var2;
echo gettype($test2).---.gettype($test1).BRBR;
echo $test2.---.$test1.BRBR;
if ( $test2 != $test1){
echo (The variables are not equal.);
}
?
Produces the following output (Notice that it doesn't say vars are not equal);

string---string

02061030012451---02061030012452




And this code:
?
$var1 = A.02061030012452;
$var2 = A.02061030012451;
$test1 = (string) $var1
$test2 = (string) $var2;
echo gettype($test2).---.gettype($test1).BRBR;
echo $test2.---.$test1.BRBR;
if ( $test2 != $test1){
echo (The variables are not equal.);
}
?
Produces the following output (Notice it printed the message about vars not
being equal);

string---string

02061030012451---02061030012452

The variables are not equal.


Why does PHP Version 4.2.3 ignore my (string) - cast to string in the if
evaluation?
I even tried putting the (string) inside the IF statement with no difference in
execution.


P.S.
The variables were reporting string before I even tried (string).


James E Hicks III


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




RE: [PHP] uploading + downloading Large files ...

2002-12-27 Thread James E Hicks III
This might be your answer.

http://www.phpbuilder.com/columns/florian19991014.php3

James

-Original Message-
From: Jimmy Brake [mailto:[EMAIL PROTECTED]]
Sent: Friday, December 27, 2002 1:31 PM
To: [EMAIL PROTECTED]
Subject: [PHP] uploading + downloading Large files ...


Hi!

My users need to upload and download large files (100 + megs). Right now
I only allow 100k to be uploaded. Will I need to do anything to
php/apache to make sure things continue to be reliable? 

My google search only found threads with bad endings and they had much
smaller files. Should i just make em use ftp or scp? The problem with
using one of those protocols is that it makes it difficult for the users
to link the files to the proper account/relation/incident and anything
that is a problem for users is usually a problem for me. 

Thanks!

Jimmy 


-- 
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] e-mail

2002-12-26 Thread James E Hicks III
Maybe you need to add the -f to your sendmail command?

James

-Original Message-
From: Anil Garg [mailto:[EMAIL PROTECTED]]
Sent: Thursday, December 26, 2002 2:06 PM
To: [EMAIL PROTECTED]
Subject: [PHP] e-mail


hi
i found a 'formmail' scripts from somewhere..
the problem isthe email which i get from this scripts has 'unprivilaged
user' in the 'from' field.

mail($form['recipient'], $form['sublect'],$mailbody, From:Web User);

if i use this...in the from field..it says '[EMAIL PROTECTED]'

I just need the from field to show 'Web User' (instead of 'unprivilaged
user')
Can i do this!!
plz help

thanks and regards
anil


-- 
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] Sound with PHP

2002-12-19 Thread James E Hicks III
The only way this would work with PHP on the webserver would be to 
embed the sound file in the webpage or some other HTML to do
it. I even think there is a way to queue files like you are asking
about, but this would be an HTML thing and not PHP.

James


-Original Message-
From: Alfonso Ballesteros [mailto:[EMAIL PROTECTED]]
Sent: Thursday, December 19, 2002 3:03 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Sound with PHP


Hello... I'm a newcomer and wish to know if it is possible to play sound
files (mp3 or wav) using PHP. For example, if I have 2 sound files, how to
play one after the other.

Thanks
Alfonso



-- 
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] sorting files in directory

2002-11-27 Thread James E Hicks III
I've done this by reading the directory contents into an array and then sorting
that array. This really sorts on filename and not date, but your filenames seem
to contain dates so this might work for you.

James Hicks

-Original Message-
From: Nick Wilson [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, November 27, 2002 8:02 AM
To: php-general
Subject: [PHP] sorting files in directory


Hi all,

I have several directories filled with files written like this:

*   02-09-19-filename.etc
*   02-10-02-anotherfile.whatever

How does php order these files if read from the directory and printed to
the screen?  -- I need them in date order, do I need to sort them
somehow?

Many thanks...

--
Nick Wilson //  www.tioka.com




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


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




RE: [PHP] Re: who's in the chat?

2002-10-10 Thread James E Hicks III

My chat stores usernames, timestamps in a table on DB. When refresh script runs,
it updates the timestamp on usernames and deletes rows in DB with stale
timestamps (no refresh run). Pulling usernames from this table gives current
chat users.

James


-Original Message-
From: Oliver Witt [mailto:[EMAIL PROTECTED]]
Sent: Thursday, October 10, 2002 11:09 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Re: who's in the chat?


Jason Young schrieb:

 Without knowing how your chat works as far as entering the chat, you DO
 have to put some sort of name with the person, right?  Perhaps you could
 just update a temp table with their chat name..

 Or if you can only get into chat by logging into the site, you could
 just set a bit with their cookie data or something..

 Is this not what you wanted to do? (I guess I should have asked you to
 elaborate :) )

 Just throwing suggestions out there
 -Jason


I've been trying something similar like that. How can I update a temp table
when they enter and leave the chat? That's my problem,
Olli




--
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] Sessions /Cross Domain

2002-09-18 Thread James E Hicks III

Have a look at this php.ini setting, I think it will help you!

; The domain for which the cookie is valid.
session.cookie_domain =


James


-Original Message-
From: David Buerer [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, September 18, 2002 1:39 PM
To: '[EMAIL PROTECTED]'
Subject: [PHP] Sessions /Cross Domain


Are sessions domain specific?
 
What I mean is this.
 
Suppose I have two websites:
secure.web.com
www.web.com http://www.web.com 
and both web sites point to the same set of data.
 
If I looking at web page http://www.web.com/index.html
http://www.web.com/index.html  and have a set of session variables defined
and then I call the page https://secure.web.com/index.html
https://secure.web.com/index.html  do I still have access to the same
session variables?


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




RE: [PHP] basic voting

2002-09-11 Thread James E Hicks III

How bout this for just a little better than IP logging.
?
 if (getenv(HTTP_X_FORWARDED_FOR)){
   $internalip=getenv(HTTP_X_FORWARDED_FOR);
 }
 if (getenv(REMOTE_ADDR)){
  $externalip=getenv(REMOTE_ADDR);
 }
echo $externalip.-.$internalip;
?


-Original Message-
From: Adam Williams [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, September 11, 2002 11:24 AM
To: Justin French
Cc: php
Subject: Re: [PHP] basic voting


Most sites log by IP but if its the IP of a firewall, it would only be one
vote from everyone behind the firewall.

Adam




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




RE: [PHP] faxing

2002-08-28 Thread James E Hicks III

system(html2ps document.html);
system(hylafax -somedirectives document.ps);

I haven't got around to actually figuring this out, but this is my plan.

James


-Original Message-
From: Mike Mannakee [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, August 28, 2002 1:14 PM
To: [EMAIL PROTECTED]
Subject: [PHP] faxing


Does anyone know of a solution to get a script to actually connect with the
POTS system (even through a 3rd party provider) and send a fax?

Mike



-- 
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] question about executing a bash shell script...

2002-08-16 Thread James E Hicks III

try something like:
$bashoutput=shell_exec('/usr/bin/bash makethesite.sh username pathtoputfiles
pathtogetfiles');

if that doesn't work can you use the system() function instead?

James


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




Re: [PHP] png image doesn't show

2002-07-05 Thread James E Hicks III



img src=graphit.php to get the image output.  Unfortunately, I get nothing except 
the red X indicating a missing image.

  

You probably need to send the correct header at the top of your 
graphit.php to indicate to the browser that you are
sending it a file with a content type of image/png . graphit.php should 
do two things; First send the header, Second
send the PNG data.

-- 
James E Hicks III
Noland Company
2700 Warwick Blvd
Newport News, VA 23607
757-928-9000 ext 435
[EMAIL PROTECTED]




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




RE: [PHP] Whos online at the moment in PHP

2002-06-24 Thread James E. Hicks III

Why not;

1. Record each visitors IP that connects and the connect time.
2. Delete from this table all records that are 5 mins old.
3. Count the remaining records as people currently viewing page.

James



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




RE: [PHP] PHP with IIS

2002-06-24 Thread James E. Hicks III

It looks like apache doesn't have permission to write the file
//flcintranet/pi2000/ordentry/5788/pappexpt.dbf . If you were using a linux/unix
machine I'd tell you to check the permisions on this directory to make sure that
apache can write to it. I wish I could help you out further, but I don't do
windows.

James

-Original Message-
From: Dave Leather [mailto:[EMAIL PROTECTED]]
Sent: Monday, June 24, 2002 3:52 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] PHP with IIS


OK made some headway...

Made my network drive that I wanted to access a virtual directory on my
IIS - this is fine, I can now see all my files and folders when I surf that
virtual directory in a web browser.

However, when trying to create a DB using dbase_create - I receive the
following message

 start output -
attempting to create //flcintranet/pi2000/ordentry/5788/pappexpt.dbf

Warning: Unable to create database (13): Permission denied in
C:\InetPub\wwwroot\pappreport.php on line 93
Error creating table!
- end output -

Here is my code for this:

  // database name
  $dbname = //flc/pi2000/ord/pappexpt.dbf;
  // database definition
  $TableDef =
  array(
   array(BATCH_NUM,  C, 10),
   array(DONORNO,C,  8),
   array(FIRST_NAME, C, 15),
   array(MIDDLENAME, C, 15),
   array(LAST_NAME,  C, 20),
   array(ADDRESS_1,  C, 35),
   array(ADDRESS_2,  C, 35),
   array(ADDRESS_3,  C, 35),
   array(CITY,   C, 25),
   array(STATE,  C,  2),
   array(ZIP,C, 10),
   array(TOTAL,  N, 10, 2)
  );

  // creation
  Print attempting to create $dbnameBR;
  if (!dbase_create($dbname, $TableDef)){
   print strongError creating table!/strong;
  }else{
   print Table successfully created!BR;
  }

Any ideas
Dave



Dave Leather [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Yes, and Yes...

 Access is granted throughout.. Read, Write, Create, Erase, Modify and File
 Scan access is granted for this login ID.

 Any other suggestions?

 Thanks again
 Dave

 Andrew Brampton [EMAIL PROTECTED] wrote in message
 00ca01c21ba6$b2b36ea0$7432260a@student5830">news:00ca01c21ba6$b2b36ea0$7432260a@student5830...
  Does the user to which ISS runs under have network permissions to access
 p:\
  ?
  IIRC you need to set up ISUR_machine_name to have permission to the
remote
  share.
 
  Andrew
  - Original Message -
  From: Dave Leather [EMAIL PROTECTED]
  To: [EMAIL PROTECTED]
  Sent: Monday, June 24, 2002 6:29 PM
  Subject: [PHP] PHP with IIS
 
 
   Hello all,
  
   I am attempting to open and/or create a DBASE file on a NOVELL
network.
  
   When I attemp a command such as
 if (!dbase_open(C:\\orders.dbf,2)){
  print COULD NOT OPEN DB;
 }else{
  print DB WAS OPENED;
 }
  
   I receive a message that says DB WAS OPENED - no problem...
  
   On my IIS server, I have Novell drive map to P: - I can browse this
 using
   explorer or in CMD I can go to P: and do DIR etc etc.
  
   When I try :
 if (!dbase_open(P:\\orders.dbf,2)){
  print COULD NOT OPEN DB;
 }else{
  print DB WAS OPENED;
 }
  
   I receive a message that says :
   Warning: unable to open database P:\orders.dbf in
   C:\InetPub\wwwroot\pappreport.php on line 81
   COULD NOT OPEN DB
  
   Yes, the database exists, as I copied it FROM here to C:\ to do my
test.
  
   Any ideas??? I have checked the PHP.INI file, and all the regular
 settings
   in IIS - and could not find anything misconfigured.. but I am by no
 means
  an
   IIS expert, so I am not sure.
  
   Thanks in advance
   Dave
  
  
  
  
   --
   PHP General Mailing List (http://www.php.net/)
   To unsubscribe, visit: http://www.php.net/unsub.php
  
  
 





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


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




[PHP] Log files.

2002-06-21 Thread James E. Hicks III

I was having some problems with my error logs. I just figured out what the
problem was! Thought everybody might benefit from it's solution so here it goes.

The problem was that the php error log was only showing errors created by my
command line scripts that were being executed by cron. The solution was that one
of my cron jobs deleted the PHP error file late every night so it would be fresh
and only showing today's errors. The first error output was usually created by
one of the PHP scripts run through cron. When this script wrote it's error out
it created my error file with the owner being root. Then when the website users
started creating errors (later in the morning), apache was unable to write to
the file because it was owned by root. Duhhh!!

Maybe this will help someone in the future.

James E Hicks III


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




RE: [PHP] OT - php/mysql/cron

2002-06-03 Thread James E. Hicks III

Here's a little tweak to gzip the backup results. I put this into another script
that gets called by crontab. Are my DB userid and password still visible when
run this way? I'm never here to see it run, because it happens late at night.

/usr/bin/mysqldump --user=DBUSER --password=DBPASSWORD DATABASETOBACKUP | gzip 
/backup_path/backup.sql.gz

-Original Message-
From: Tobyn Baugher [mailto:[EMAIL PROTECTED]]
Sent: Monday, June 03, 2002 1:29 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] OT - php/mysql/cron


On Mon, 2002-06-03 at 13:18, Kelly Meeks wrote:
 Any way to use cron to automate the mysqldumping of databases on a nighly
basis?

 Any examples would be greatly appreciated.

This line's gonna wrap, but it all goes on the same line :P

0 0 * * * /usr/local/bin/mysqldump -u username --password=password
database  outputfile

Obviously replace username, password, database, and outputfile
with the values you want to use for each.

Of course, I would never recommend putting a secure password in a text
file like your crontab, so if you have admin rights on the server maybe
consider setting up a read-only account with no password, or maybe a
unique password that won't work on any other accounts.

Never hurts to be a little paranoid.

HTH,

Toby


--
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] Show an image

2002-05-29 Thread James E. Hicks III

I found a solution to this on the web somewhere. What they did was create
image.php wich extracts your image from the DB and echo's it to the page after
sending the correct content type header. Then in your other .php's/.html's
use...
img src=image.php?name=TEST.jpg

James

-Original Message-
From: Félix García Renedo [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, May 29, 2002 1:09 PM
To: php
Subject: [PHP] Show an image


Hello everybody,
I want to know how to show an image saved into a field of a database into a
web page.
I tried to print img src=FIELD but it shows ascii codes.

Thanks in advance.


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




RE: [PHP] tmpfile() errors?

2002-05-22 Thread James E. Hicks III

I'd check the owner of the directory you are trying to write to. It needs to be
owned by the same user as the httpd process runs as.

James

-Original Message-
From: Jas [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, May 22, 2002 4:18 PM
To: [EMAIL PROTECTED]
Subject: [PHP] tmpfile() errors?


Here are the errors I am recieving:
Warning: fopen(Resource id #4,wb) - Permission denied in
/path/to/asciiartist.php on line 295

Warning: Supplied argument is not a valid File-Handle resource in
/path/to/asciiartist.php on line 296

Warning: Supplied argument is not a valid File-Handle resource in
/path/to/asciiartist.php on line 297

Warning: getimagesize: Unable to open 'Resource id #4' for reading. in
/path/to/asciiartist.php on line 303
ASCIIArtist(): Cannot determine image type of shared/image02.jpg.

I have checked the file permissions for the files and directory in question
and they are all set to read  write, so I know this is not the problem.
Here is the function that I am trying to get to work.

function ASCIIArtist($image)
{
if ($input = @fopen($image, rb)) {
  $image_data = fread ($input, 2048576);
  fclose($input);
  $tmp_image = tmpfile();
  $output = fopen($tmp_image, wb);
  fwrite($output, $image_data);
  fclose($output);
} else {
exit(Cannot access .$image. for reading. (Does not exist or
has wrong permissions));
}

This code is from http://www.sebastian-r.de/.  And everything works fine
until it hits this function. Could I get some enlightenment on why it cannot
create a temp file named $tmp_image?  (ecspecially when the permissions for
the file are correct?)  Thanks in advance,
Jas



--
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] Using php as a scripting language within cron jobs?

2002-05-17 Thread James E. Hicks III

#!/path.to/php -q

I'd like to suggest the -q option for PHP shell scripts, which I rely on every
day.

James


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




RE: [PHP] PHP PDF

2002-05-17 Thread James E. Hicks III

I do a

   system(html2ps SOME.html  SOME.pd);

then I do a

   system(ps2pdf SOME.pd);

which gives me

   SOME.pdf

Which I then read into a variable with binary option,

   $fi=fopen(SOME.pdf,rb);
   $binfile = fread ($fi, filesize (SOME.pdf));
   fclose($fi);

then

   $encoded_attach = chunk_split(base64_encode($binfile)),

and finally attach it to my email (I'm using mail() function).

html2ps and ps2pdf are system() calls and need to be installed on your system
for this to work.

Output from my PHP shell script;
Processing E-voice file complete. 467 E-voices sent.
 START - 08:00:00
  STOP - 08:09:19

James

-Original Message-
From: peter tatischev [mailto:[EMAIL PROTECTED]]
Sent: Friday, May 17, 2002 9:43 AM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] PHP  PDF


Why not mail it as MIME??
if that's not the case, refer to
http://www.php.net/manual/en/ref.pdf.php
- Original Message -
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, May 17, 2002 5:17 PM
Subject: [PHP] PHP  PDF


 Hi the ML

 I have the following question :

 I have constructed several pages with PHP which look likes some reports.
(I
 attached one example to my mail)

 Now I need to convert this HTML page to PDF to send it by mail .

 Does any one has an idea ?

 Laurent Drouet

 (See attached file: samples.zip)
 #
 This message has been scanned for viruses with F-Secure Anti-Virus for
 Lotus Domino and it has been found clean.

 For more information about computer viruses, connect to
 http://www.F-Secure.com/vir-info/.
 #







 --
 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] PHP PDF

2002-05-17 Thread James E. Hicks III

I've gotta be able to do either one. Sometimes the script just stops with the PS
and sends that in the email based on a flag. It depends on what format the
customer prefers his invoices in.

James

-Original Message-
From: Miguel Cruz [mailto:[EMAIL PROTECTED]]
Sent: Friday, May 17, 2002 2:02 PM
To: [EMAIL PROTECTED]
Subject: RE: [PHP] PHP  PDF


On Fri, 17 May 2002, James E. Hicks III wrote:
 I do a

system(html2ps SOME.html  SOME.pd);

 then I do a

system(ps2pdf SOME.pd);

How about just:

   system('html2ps  some.html | ps2pdf  some.pdf');

?

miguel


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


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




RE: [PHP] Is it possible to verify that a form submision is not being spoofed?

2002-04-30 Thread James E. Hicks III

This random number, because it is being sent to the user is just as easy to
forge as the rest of the fields on the form. The only thing you can do is check
the refferer on the submitted page, but alas even this can be forged with enough
technohow. Good luck!

James


-Original Message-
From: Cal Evans [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, April 30, 2002 4:05 PM
To: Warrick Wilson; [EMAIL PROTECTED]
Subject: RE: [PHP] Is it possible to verify that a form submision is not
being spoofed?


Generate a random number when creating a form, store it in the session and
in a hidden on the form. Then when the post comes back, make sure the hidden
is there and that it matches the one in the session.

Cal
*
* Cal Evans
* Journeyman Programmer
* Techno-Mage
* http://www.calevans.com
*


-Original Message-
From: Warrick Wilson [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, April 30, 2002 2:52 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Is it possible to verify that a form submision is not
being spoofed?


I'm having a hard time explaining what I'm trying to do, which is why I'm
having a hard time finding anything online/in manuals...

My site serves a form for the user to fill in. User has been authenticated
with a login and we're using PHP 4 sessions. When using Internet Explorer,
the user can hit Ctrl-N and get a new window, but his session for that new
window is still valid. He could then load up a local page and submit it to
the target of my original form.

Is there some way of detecting that the submission came from a page that
hadn't been served up by my application, but was instead sent in from some
other foreign form?

Or maybe the question is - how can I kill off sessions if the user navigates
away from the page that I sent him originally?


Warrick Wilson
mailto:[EMAIL PROTECTED]


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



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


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




RE: [PHP] Open Download-Box

2002-04-18 Thread James E. Hicks III

try 

 header(Content-type: application/pdf);


James

-Original Message-
From: Martin Thoma [mailto:[EMAIL PROTECTED]]
Sent: Thursday, April 18, 2002 9:20 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Open Download-Box


Hello! I have a PDF-File, which the user should download (it should not
open in the browser, even if the Adobe-Reader-Pluging is installed). I
use:

 $filename = $DOCUMENT_ROOT./.$QUERY_STRING;
 $fd = fopen ($filename, rb);
 $contents = fread ($fd, filesize ($filename));
 fclose ($fd);

 header(Content-type: application/octet-stream);
 header(Content-Disposition:attachment;filename=$savename);

 echo $contents;

This doesn't work in IE (Version 6, 5 is not tested yet): When I get the
download-box and I choose open instead of save, the download-box
opens again! Then pressing open, everything is okay, but why is the
box opened twice?

Martin



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


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




RE: [PHP] email attachments

2002-04-16 Thread James E. Hicks III

You need a Content-Disposition in yer $mime variable. I'll leave it up to you to
figure out where, because I've forgotten where it goes exactly.

James


-Original Message-
From: ROBERT MCPEAK [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, April 16, 2002 8:46 AM
To: [EMAIL PROTECTED]
Subject: [PHP] email attachments


This nifty code (taken from PHP Cookbook) sends an email with a file
attached in-line.  The text from the attached file appears within the
body of the email.  I need to send attached files that are not in-line,
but, rather, come as attached files that the user views outside of their
email browser.  Can somebody help me with this.  Maybe tweak the code
I've got?

Thanks!

//attachment
$to = $the_email;
$subject = 'dump';
$message = 'this is the dump';
$email = '[EMAIL PROTECTED]';

$boundary =b . md5(uniqid(time()));
$mime = Content-type: multipart/mixed; ;
$mime .= boundary = $boundary\r\n\r\n;
$mime .= This is a MIME encoded
message.\r\n\r\n;
//first reg message
$mime_message .=--$boundary\r\n;
$mime .=Content-type: text/plain\r\n;
$mime .=Content-Transfer-Encoding: base64;
$mime .=\r\n\r\n .
chunk_split(base64_encode($message)) . \r\n;
//now attach
$filename = mysqldump/surveydump.txt;
$attach = chunk_split(base64_encode(implode(,
file($filename;
$mime .=--$boundary\r\n;
$mime .=Content-type: text/plain\r\n;
$mime .=Content-Transfer-Encoding: base64;
$mime .=\r\n\r\n$attach\r\n;






mail($to,
$subject,
,
$mime);



//attachment



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

2002-04-16 Thread James E. Hicks III

I think you've got the best set up already. I have a PDF library that I do a
similar thing with. To update the site I just dump the new PDF's into their
directory and the users reload the page to see the new content.

James

-Original Message-
From: Fifield, Mike [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, April 16, 2002 11:22 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Performance question


Ok I have a performance question. I run a wallpaper site; this is the url to
the main gallery page http://www.cognitivedistortion.com/php/gal.php
http://www.cognitivedistortion.com/php/gal.php  The page does a dir read
and lists all pictures found in each directory, it does this every time the
page is loaded. Now at first this seemed like a incredible inefficient way
to do generate pages. The alternatives to this would be to generate a list
of the pictures and save them in a text file, or create a list of the
pictures and store them in a database. If I use a text file I will have to
read the text file every time the page is generated which seems like it
would take just as long as reading the file allocation table, which I am
doing now. As for the database to get the same thing done I would first have
to log into the database and then pull the information.
I was hoping to get some input as to which would be the fastest/ best way to
use.


Mike Fifield
Charles Schwab  Co, Inc.
WARNING: All e-mail sent to or from this address will be received by the
Charles Schwab corporate e-mail system and is subject to archival and review
by someone other than the recipient.



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




RE: [PHP] attachment filename

2002-04-16 Thread James E. Hicks III

$mime .= Content-type: application/octet-stream;\r\n;
$mime .= Content-type: application/octet-stream; name=\$attach_name\\r\n;

-Original Message-
From: ROBERT MCPEAK [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, April 16, 2002 2:45 PM
To: [EMAIL PROTECTED]
Subject: [PHP] attachment filename


The code below very nicely sends an email attachment, but, the name of
the attachment appears as Part.000, not the original filename of the
attached file.

How do I set the filename of the attachment?  I'd like it to be
something nice, like yourfileattachment.txt or something, not
Part.000.  What is Part.000 anyway?

Stumped!

Help!

Thanks!

Code:

//attachment
$to = $the_email;
$subject = 'dump';
$message = 'this is the dump';
$email = '[EMAIL PROTECTED]';

$boundary =b . md5(uniqid(time()));
$mime = Content-type: multipart/mixed; ;
$mime .= boundary = $boundary\r\n\r\n;
$mime .= This is a MIME encoded
message.\r\n\r\n;
//first reg message
$mime_message .=--$boundary\r\n;
$mime .=Content-type: text/plain\r\n;
$mime .=Content-Transfer-Encoding: base64;
$mime .=\r\n\r\n .
chunk_split(base64_encode($message)) . \r\n;



//now attach
$filename = mysqldump/surveydump.dmp;
$attach = chunk_split(base64_encode(implode(,
file($filename;
$mime .=--$boundary\r\n;
$mime .=Content-type:
application/octet-stream;\r\n;
$mime .=Content-Disposition: attachment\r\n;
$mime .=Content-Transfer-Encoding: base64;
$mime .=\r\n\r\n$attach\r\n;






mail($to,
$subject,
,
$mime);



//attachment




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

2002-04-08 Thread James E. Hicks III

Why don't you just increment a counter as you are retrieving them.

mysql_select_db(some_DB) or die(DB not available);
$query = select some_data from some_table;
$result = mysql_query($query);
$rowcounter=0;
while ($row=mysql_fetch_array($result)){
   extract($row);
   $rowcounter++;
   echo(You are on Row $rowcounter wich contains the);
   echo( data $some_data for the field named some_data);
}

James

-Original Message-
From: Julian [mailto:[EMAIL PROTECTED]]
Sent: Monday, April 08, 2002 3:59 PM
To: [EMAIL PROTECTED]
Subject: [PHP] mysql question


Hi!!!

I want to know if there is a function to know which is the number of the row
that I selected.

Please, help me! Julian


-- 
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] date expressions

2002-04-02 Thread James E. Hicks III

Convert it to timestamp and then compare or if the date's in a mysql database
let mysql handle the comparison for you.

James

-Original Message-
From: ROBERT MCPEAK [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, April 02, 2002 8:25 AM
To: [EMAIL PROTECTED]
Subject: [PHP] date expressions


How do I compare a date (2002-05-01) against a date plus 5 days?  I need
help figuring out how to do math operations on dates, etc.  Could
somebody fill this newbie in?

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




RE: [PHP] Displaying Image with PHP

2002-03-29 Thread James E. Hicks III

## Heres where I add images to DB with field type of BLOB for image

if ( ($submit == 'Add Image')  ($userid != 'demo') ){
   if ($image != 'none'){
  $name = strtr($name, ',  );
  $image = addslashes(fread(fopen($image, r), filesize($image)));
  mysql_select_db($dbase) or die( Unable to select database);
  $query = insert into images values ('$name','$image');
  mysql_query($query);
  if (mysql_error()){
 echo (BRBRBRcenter Upload of image failed. It is possible
the);
 echo ( image name is already on file. Try another name./CENTER);
 echo (/BODY/HTML);
 exit;
  }
   }
   $submit = 'Image Index';
}

Here's my image script. I know I should send more information in the Header, but
it works w/out it. Notice that I ommitted the stripslashes. I ran into the same
problem as you are having when I had the stripslashes in it. I would make more
sense to me if you had to use the stripslashes.

?
include(connect.php4);
mysql_select_db($dbase) or die(Unable to select DB .$report_to);
$query = select image from images ;
$query .= where (image_name = '$name') ;
$result = mysql_query($query);
$row = mysql_fetch_array($result);
extract($row);

Header( Content-type: image);
echo $image;
?



Your code.
===
$query = SELECT filename, filedata, dateline FROM reviews where id=$id;
$results = dbQuery($query);

$filedata = stripslashes($results[rowData][FILEDATA][0]);
$filename = $results[rowData][FILENAME][0];

if (strstr($HTTP_USER_AGENT,MSIE)) {
  $attachment = '';
} else {
  $attachment = ' atachment;';
}

header(Cache-control: max-age=31536000);
header(Expires:  . gmdate(D, d M Y H:i:s,time()+31536000) . GMT);
header(Last-Modified:  . gmdate(D, d M Y
H:i:s,$results[rowData][DATELINE][0]) . GMT);
header(Content-disposition:$attachment filename=$filename);
header(Content-Length: .strlen($filedata));
$extension=strtolower(substr(strrchr($filename,.),1));

if ($extension==gif) {
  header(Content-type: image/gif);
} elseif ($extension==jpg or $extension==jpeg) {
  header(Content-type: image/pjpeg);
} elseif ($extension==png) {
  header(Content-type: image/png);
} elseif ($extension==pdf) {
 header(Content-type: application/pdf);
} else {
  header(Content-type: unknown/unknown);
}
echo $filedata;


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


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




[PHP] header() problem??

2002-03-11 Thread James E. Hicks III

I am trying to replace a perl script with the following PHP code. The perl code
acted like a redirector, sending you to a different script depending on the
value of the submit button. The following replacement code written in PHP works
quite well until the postString exceeds some unknown size (This number must be
known by someone because it is always chopping it at the same place). Why will
this not work and how can I fix it?? It seems to break when sending script has
more than 30 lines of form input, works fine otherwise.


?
while(list($key, $val) = each($HTTP_POST_VARS)) {
$key = stripslashes($key);
$val = stripslashes($val);
$key = urlencode($key);
$val = urlencode($val);
$postString .= $key=$val;
}
if ($defloc){
$gotoscript = $defloc;
}
$location = '/scriptdirectory/';
$go = http://www.site.com.$location.$gotoscript.?.$postString;
header(Location: $go);
?


James E Hicks III



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