Re: [PHP] str_replace on words with an array

2006-10-29 Thread rich gray

Paul Novitski wrote:


If you go this route, perhaps you could enclose each member of your 
original array in \b word boundary sequences using an array_walk 
routine so that you don't have to muddy your original array 
declaration statement.


IIRC str_replace() does not interpret or understand regular expression 
syntax - you'd need preg_replace() for that

rich


Re: [PHP] PHP Frameworks - Opinion

2006-08-01 Thread rich gray

Robert Cummings wrote:

[chop]
An IDE is not a framework, it's an IDE :)

Cheers,
Rob.
  
I think Rob is being unduly modest - correct me if I am wrong but he is 
the core developer of the InterJinn php framework - 
http://interjinn.com - it's been out there for a while now (read: 
robust, fully featured) and the ZF is still in beta I think...

cheers
rich


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



Re: [PHP] looking for shopping cart

2006-04-22 Thread rich gray
Try Zen cart  http://www.zen-cart.com/modules/frontpage/ it is a fork of 
osCommerce which is a very popular OS cart.

I've used it and customised it on a few sites without problems.
Cheers
Rich

Lisa A wrote:
I'm still looking for an inexpensive shopping cart to use on my client's 
website.  Something they can easily update their products, prices, photos, 
etc once I set it up for them.  It must be very simple for them to use.

Anyone write any shopping cart scripts that might work?
thanks,
Lisa A

  



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



Re: [PHP] how to kill session id without closing the window?

2006-04-07 Thread rich gray

[chop]

How can I create new, other sesssion id (after I, for example, click on
'Log Out' button) without closing window?

Thanks for any help.

  

er .. session_regenerate_id()

hth
rich

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



[PHP] Array concatenation behaviour change

2004-10-08 Thread rich gray
Just a heads up on this change in array concatenation behaviour that
could cause a few probs for some people...

?
$arr1 = array(0 = 'Zero');
$arr2 = array(1 = 'One',2 = 'Two');

$arr2 = $arr1 + $arr2;
echo phpversion().'br /';
print_r($arr2);
?

this code produces on our provider's server...

4.2.3
Array ( [0] = Zero [1] = One [2] = Two ) 

and on my development server...

4.3.8
Array ( [1] = One [2] = Two [0] = Zero ) 

hth
rich

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



Re: [PHP] Array concatenation behaviour change

2004-10-08 Thread rich gray
 
 Can't you sort the array?
 
 

Yes of course but that wasn't the point of my post I was trying to
show that the same code produces differing results on 2 different
versions of PHP ...

rich

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



RE: [PHP] JavaScript Enabled?

2004-03-29 Thread Rich Gray
 Can anyone suggest a suitable means for detecting if a client browser
 has JavaScript enabled or not?

 I know this isn't exactly PHP related, but I need to make sure my PHP
 script offers an alternative in a friendly way and not a JS error, but
 I just wondered if there was a foolproof method of doing this?

Er ... how do you generate a JS error with a JS disabled browser?

I don't think there is a 100% reliable way of detecting server side whether
a client browser has disabled javascript. However what you could do is to
use a script/script block to spit out javascript enabled code using
document.write() which will be ignored by disabled clients and then use
noscript/noscript tags to enclose whatever stuff is necessary for the
disabled clients?

Just a thought
Cheers
Rich

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



RE: [PHP] Alternatives to Flush()

2004-03-24 Thread Rich Gray
 I do have a database and have considered using it in conjunction with
 cron.  However, I don't like the disconnected nature of the solution.
 There could be up to a minute delay before cron picks up the request.

 There's got to be another method similar to using flush(), that causes
 the lengthy processing to immediately start as well as redirecting the
 visitor to another page.

Hi Ron

Well if it is really critical that the batch job runs within seconds of
being requested by the web process then you have several alternatives apart
from using database/cron ... here's a few examples with various levels of
simplicity of implementation...

. Kick off a cli script to run the batch job using exec() or similar..
. Implement a web service using XML-RPC or SOAP - i.e. call an API on the
XML-RPC/SOAP server and let it do its stuff...
. Have a custom background script listening on a socket - send a request to
that socket from your web page...
. IPC through shared memory...
. probably loads more...

Rich

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



RE: [PHP] seesions problem

2004-02-27 Thread Rich Gray
 Notice: Undefined index: user_id in
 /home/pance/public_html/menu.php on line
 13

 Has anybody else come accross this problem - and how did you solve it?

 Pance Stojkovski

are you using session_start() at start of each page that manipulates
$_SESSION ?

rich

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



RE: [PHP] Uploading Files

2004-02-24 Thread Rich Gray
   ?php
 if($userfile) {
 copy($userfile, '/home/sites/site176/web/makeit/$userfile_name');
  echo Successfully Added!br\n;
 }
 ?
 form action=?php echo $PHP_SELF ? method=post name=upload
 File to Upload: input type=file name=userfileBR
 input type=submit value=Upload
 /form

Hi Tom

Here's some quick comments..

. You need enctype=multipart/form-data on your form for file uploads
. Watch out for max file size being exceeded -- check the php manual on
'Handling file uploads'
. If register_globals is off on your server you'd better start looking at
using the $_FILES superglobal (check the manual)
. use move_uploaded_file(...) rather than copy(...)

HTH
Rich

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



RE: [PHP] PHP's MySQL Query Length Limit? (Long SQL failing!)

2003-12-11 Thread Rich Gray
 I have a script that accepts large files (images) and inserts them into
 a MySQL table. The images are manipulated and whatnot, no problems at
 all getting the image into a string and running addslashes() on it.
 Then I go and use it with a mysql query. This is something I've coded
 dozens of times, but now there's a twist. The files are bigger than
 I've ever worked with. In theory, I didn't think there would be a
 problem, but there is. When I try in insert a file of about 800K or
 larger (9-10 MB is as large as I ever try to insert) the insert fails.
 The query is written correctly AKAIK, but no data reaches the table I'm
 writing to.

[chop]

Hi Galen

I'd hazard a guess that it is probably your MySQL server settings that are
cause of the problem - in particular check the max_allowed_packet_size (?? -
you'll probably need to check this name as I haven't any docs to hand at the
moment) setting in your my.ini file...

HTH
Cheers
Rich

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



RE: [PHP] Best way to increment an integer column in mysql

2003-12-11 Thread Rich Gray
 I was wondering if there is a php / mysql function call that will
 increment an integer column in a database.
 ie. the equivalent to
 $foo++;


Hi John
Well you can specify the column as auto_increment to let MySQL handle the
incrementation else I suppose - mysql_query('update mytable set
my_int_column = my_int_column + 1 where blah blah ...');
HTH
Rich

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



RE: [PHP] Calling PHP functions from within javascript

2003-11-13 Thread Rich Gray
 First thing is, it's possible, i've done it in the past myself, it's just
 not working due to some reason. Second, functioning cann't be
 achieved with
 javascript, cauz it's DB related.

 anyway thanx for ur reply
 Nitin


Hi Nitin

If you mean exchanging data between PHP and javascript without incurring a
page reload ... well it is definitely possible using javascript remote
scripting techniques and a hidden iframe however if the browser has
javascript switched off then this won't work of course...

Cheers
Rich

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



RE: [PHP] Session data getting lost

2003-09-18 Thread Rich Gray

 * Thus wrote Rich Gray ([EMAIL PROTECTED]):
  Well a functon that doesn't work under certain conditions should be
  deprecated IMO ... I haven't used it for a long time now...

 this makes absolutly no sense. So if I use a function improperly,
 it should become deprecated?

Er ...I'm not using it improperly I'm just not using it at all. Why? Because
it behaves differently in different operating conditions. Sure I could write
extra code to detect the operating conditions but what's the point? If
globals are off you can't use it as it doesn't work... The manual seems to
make it pretty obvious to me that it should be avoided and even mentions the
function is deprecated in a code example...


 session_register() is used in cases where you haver register_globals
 on; it is not useed when it is off.

So are you happy to use session_register() in your code?

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



RE: [PHP] Session data getting lost

2003-09-18 Thread Rich Gray
 * Thus wrote Rich Gray ([EMAIL PROTECTED]):
  So your telling me that all variables defined in the global scope are
  automatically added to the $_SESSION array...?
  Not true I think
 

 no. read the documentation, in full.

you're right - I'm sorry I hadn't read it in full...


 The soluction to your problem was resolved from the first reply (by
 Chris Shiflett), but you rejected it because of it not making sense
 to you, which seems to be the problem.

Yes, however I was simply asking Chris to explain to me more as it didn't
make sense to me (because I hadn't read the manual fully). I mistakenly
expected the $_SESSION array to hold copies of assigned data not references
to the global namespace variable ... my expectations were based on PHP's
current default behaviour of pass by copy rather than by reference.

It seems with globals on it can become a minefield eg below where a script
happens to define and use a variable with the same name as an entry in the
$_SESSION array...

?
// script_a.php - developed by dev A
session_start();
$_SESSION['test'] = 'dev A saves some data';
header('Location : script_b.php');
?

?
// script_b.php - developed by dev B
session_start();
$test = 'I am another variable in the global scope that happens to have the
same name as a $_SESSION array entry';
print_r($_SESSION);  // dev B has just trashed dev A's saved data...
?

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



RE: [PHP] Session data getting lost

2003-09-17 Thread Rich Gray
Chris

Thanks for your answer which I'm sorry to say makes no sense to me given the
code example I supplied ... can you explain to me why you think register
globals being set to on for the Linux server will cause the $_SESSION
superglobal array to lose data? Am I missing something obvious here?

Thx
Rich

 --- Rich Gray [EMAIL PROTECTED] wrote:
  I'm running v4.2.3 on RedHat v7.0 and am getting some strange
  behaviour with the $_SESSION superglobal...
 ...
  It works fine on Win2K albeit v4.3.0 of PHP.

 Maybe you have register_globals enabled on your Linux server and
 not on your
 Windows PC? Compare php.ini files before giving it too much thought.

 Chris


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



RE: [PHP] Session data getting lost

2003-09-17 Thread Rich Gray
Jan
Sorry - no that doesn't help - as you can see from the code snippet I posted
the session_start() is at the very top of the code...
Thx anyway.
Rich

 You have to put session_start(); at the VERY TOP of your code.
 even before alle the html tags.
 Hope that helps!

 Jan

 --- Rich Gray [EMAIL PROTECTED] wrote:
  I'm running v4.2.3 on RedHat v7.0 and am getting some strange
  behaviour with the $_SESSION superglobal...
 ...
  It works fine on Win2K albeit v4.3.0 of PHP.

 Maybe you have register_globals enabled on your Linux server and
 not on your
 Windows PC? Compare php.ini files before giving it too much thought.

 Chris


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



RE: [PHP] Session data getting lost

2003-09-17 Thread Rich Gray
Jay

Thanks, but no I don't think so ... session_register() is deprecated ...

Quote PHP manual:

Caution:
If you want your script to work regardless of register_globals, you need to
instead use the $_SESSION array as $_SESSION entries are automatically
registered. If your script uses session_register(), it will not work in
environments where the PHP directive register_globals is disabled.

Cheers
Rich


 [snip]
 ?php
 session_start();
 $test = -1;
 .

 [/snip]

 I think you need to register test 

 http://us3.php.net/session_register

 HTH!


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



RE: [PHP] Session data getting lost

2003-09-17 Thread Rich Gray
Well a functon that doesn't work under certain conditions should be
deprecated IMO ... I haven't used it for a long time now...

To answer your question ... yep I've used print_r() and after the 1st form
submission the entry is set to -1 however at no time do I ever set
$_SESSION['test'] to -1 in my code example ...

Rich

 [snip]
 Thanks, but no I don't think so ... session_register() is deprecated ...
 [/snip]

 Not depricated, just doesn't work when register_globals is off in the
 .ini

 Have you done a print_r($_SESSION) to see if in fact the $test variable
 is contained?


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



RE: [PHP] Session data getting lost

2003-09-17 Thread Rich Gray
So your telling me that all variables defined in the global scope are
automatically added to the $_SESSION array...?
Not true I think

 [snip]
 Well a functon that doesn't work under certain conditions should be
 deprecated IMO ... I haven't used it for a long time now...

 To answer your question ... yep I've used print_r() and after the 1st
 form
 submission the entry is set to -1 however at no time do I ever set
 $_SESSION['test'] to -1 in my code example ...
 [/snip]

 Nope, but $test is a GLOBAL variable, and therefore would be set to -1
 within $_SESSION as all GLOBALS are, as you pointed out earlier,
 registerd with $_SESSION. If $test is within a function it is a PRIVATE
 variable, local to the function only, unless declared as a GLOBAL.



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



[PHP] Session data getting lost

2003-09-16 Thread Rich Gray
Hi

I'm running v4.2.3 on RedHat v7.0 and am getting some strange behaviour with
the $_SESSION superglobal... below is a script to demonstrate the problem...
Whenever the $_SESSION array gets re-created by session_start() the reloaded
test entry is set to -1 however at no time does this value ever get assigned
to the $_SESSION array ... it seems to be picking up the initialised value
of the variable that gets assigned to the array...

It works fine on Win2K albeit v4.3.0 of PHP.

Anybody come across this before?
Cheers
Rich



?php
session_start();
$test = -1;

echo 'htmlbodyInitial script load ... $_SESSION value is
'.(isset($_SESSION['test']) ? $_SESSION['test'].' it should be 999...' :
'not set yet').'br /';

$test = 999;

$_SESSION['test'] = $test;
?
form action=? echo $_SERVER['PHP_SELF'] ? method=post
input type=submit name=but value=do it
/form
?
echo 'br /After the assignment $test is '.$test.' and the $_SESSION value
is '.$_SESSION['test'].'br /';
?
/body
/html

The output from the 'initial script load' line is shown below ...

Initial script load ... $_SESSION value is not set yet (first time only)
Initial script load ... $_SESSION value is -1it should be 999... (all
subsequent submits)

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



RE: [PHP] file

2003-03-28 Thread Rich Gray
 hi all!

 i have a simple program to open and write a file.
 but the file is not getting created.
 can anyone please spot the mistake?
 giving the code below.

 thanks a lot,
 diksha.

 ?php
 echohi?how are u doing??;
 $fp = fopen (sandrew.html, w);
 string=htmlheadtitlehi/title/headbodyi am

 fine/body/html;
 $contents=fwrite($fp,string);
 echo '$contents';
 fclose($fp);
 ?

Hi Diksha
Some comments...

. Your string variable needs to be defined and referenced as $string not
just string  - unless this is a typo in your post
. fwrite() returns an int - you are assigning this int to $contents - what
exactly are you expecting $contents to be set to?
. Does your user or web server process have the permissions to create files
in the directory?
. What does readfile('sandrew.html'); after your fclose($fp) return?

HTH
Rich


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



RE: [PHP] string replace problem!!

2003-03-28 Thread Rich Gray
 Good day ,
 
 I have the following string.
 ,slideimages[0],slideimages[1],slideimages[2]
 Wich starts with a ','. No my problem is i want to strip
 this first and only the first ','.
 
 i've tried 
 $string = ,slideimages[0],slideimages[1],slideimages[2];
 $string = preg_replace('/^./','',$string,1);
 
 wich results in slideimages[0]slideimages[1]slideimages[2]
 Can somebody help me out here??
 
 thnx
 Thijs

$string = substr($string,1);

Rich

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



RE: [PHP] Time stamp and changing to a date.

2003-03-28 Thread Rich Gray
 $mydate = 20030328231154;

 $myPrintDate=date (l dS of F Y h:i:s A,$mydate);

 echo $myPrintDate;

 Whats wrong

$mydate should be a unix style timestamp not  a MMDDHHMMSS type
date/time format...
Check the functions time() and mktime() to help you generate unix
timestamps.

HTH
Rich


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



RE: [PHP] Microsoft SQL Server varchar(500) field text concatenated at 255 characters.

2003-03-28 Thread Rich Gray
 Hi There.

 I am using PHP 4.3.0 on WIN32 to query data from a Microsoft SQL Server.
 One field I am requesting is type VARCHAR size 500. For some reason, PHP
 is returning only the first 255 characters of the text from that field.

 If I change the field type to TEXT, all of the data in that field
 is returned.

 Unfortunately, an ASP application is also using that database,
 and when I change
 the field type to TEXT, it pukes completely.
 I would rather try to resolve the issue in PHP than waste my time
 looking at ASP code.

 Has anyone got an idea why this might be hapenning?

 Many thanks.

 Scott

Hi Scott

I believe this is a problem because of the relatively old TDS libraries used
by native access methods...

Possible workarounds are...

. cast the data to TEXT before returning it
. use ODBC which doesn't have this problem IIRC

HTH
Rich


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



RE: [PHP] Persistent values between executions

2003-03-10 Thread Rich Gray

 I have some sets of values that I have stored in several tables in a mySQL
 database.  These don't often change, but are referenced on every
 single page
 view.  While each call is quick, as a gross the load on the server is too
 high.  I would like to know if there is a way to have these sets of values
 remain persistent in the server's memory between calls from browsers, like
 environment variables, to reduce the back and forth calls to
 mySQL.  As the
 data from the calls are almost always the same, it would seem easier this
 way.

 Any thoughts?  Comments?  RTFM suggestions?

 Mike

Use a 404 handler to build static html pages from the database. To refresh
the content just delete the static content - this could be done
automatically at predetermined intervals using cron or similar.

FFT
Rich


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



RE: [PHP] MySQL Alias and PHP

2003-03-07 Thread Rich Gray
 Hi all,

 I have this query:

 SELECT a.area_name, b.area_name FROM tbl_1 x, tbl_2 a, tbl_2 b
 WHERE x.area_1 = a.id
 AND x.area_2 = b.id

 I am using PEAR DB to get my results as an ASSOC ARRAY. How do I echo
 the values for a.id and b.id?

 Thnks
 Charles


I presume you mean area_name...

Try this - SELECT a.area_name as area_a, b.area_name as area_b FROM tbl_1
x, tbl_2 a, tbl_2 b
Then you can refer to the columns as $array['area_a'] and $array['area_b']

HTH
Rich


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



RE: [PHP] submit button

2003-03-06 Thread Rich Gray
 hi everybody,
 
 i have a PHP script by name registration.php
 in which i have a submit button at the bottom.
 the form in this script is sent to p.php by GET.
 but on clicking the submit button, nothing happens
 attaching registration.php.
 
 p.php has only the following:
 ?php
 echo hi how are u;
 ?
 
 please help,
 diksha.

Can you post the form code?
Rich

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



RE: [PHP] Uploading file problem

2003-03-06 Thread Rich Gray
 I'm very new to PHP, so I hope no one is offended by reading my very basic
 questions.

 I have created a web form that saves some data to a database and uploads
 three files, copies them to a new directory, and renames them.  From my
 work machine and home machine, it works great for me - there are never any
 errors.  When my boss tries it, two of the files work fine, but the other
 fails at the copy.  I have watched him do it, and it's not user error.
 What could the problem be?  I'm stumped!

 I can include code or links if needed.

 Thanks,
 Amanda

From what you say above I'd check the permissions on the 3rd target
directory to check if it allows writes by the web server process. Are all 3
files going into the same directory? Is the server *nix or Windows?

Rich


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



RE: [PHP] Uploading file problem

2003-03-06 Thread Rich Gray
 Thanks!!  I'll give that a try!
 
 On Thu, 6 Mar 2003, 1LT John W. Holmes wrote:
 
   Well, I have a statement that says:
   
   if ([EMAIL PROTECTED]($photo, $long_path . speakers/ . $photo_name)) {
   echo an error
   }else{
   proceed with renaming the file
   }
   
   The error that is echoed after the copy is the one that pops 
 up.  So, it
   could be some other problem, but I'm not sure what to look for.
  
  Take out the @ sign so you can see what the PHP error message is. 
  
  ---John Holmes...

Try using move_uploaded_file() as well...
Rich 

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



RE: [PHP] question about smarty

2003-03-04 Thread Rich Gray
 just wondering... does smarty have to be installed on the server where the
 web site or php scripts it makes are going to be ran... or do you
 just make
 the stuff and put on the server like normal php files...

No, the Smarty classes and plugins will have to be installed/accessible on
the target server. It can be outside the document root though if it bothers
you...

HTH
Rich


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



RE: [PHP] PHP on IIS session problems

2003-03-03 Thread Rich Gray
 I get these errors from a simple session_start(); script.

 Warning: session_start() [function.session-start]:
 open(/tmp\sess_f4aa3ef3c537bb6327d5e7b991e91be7, O_RDWR) failed: No such
 file or directory (2) in c:\inetpub\wwwroot\picoblog\admin.php on line 2

 Warning: session_start() [function.session-start]: Cannot send session
 cookie - headers already sent by (output started at
 c:\inetpub\wwwroot\picoblog\admin.php:2) in
 c:\inetpub\wwwroot\picoblog\admin.php on line 2

 Warning: session_start() [function.session-start]: Cannot send
 session cache
 limiter - headers already sent (output started at
 c:\inetpub\wwwroot\picoblog\admin.php:2) in
 c:\inetpub\wwwroot\picoblog\admin.php on line 2


Your php.ini still has the default /tmp session save path which is OK on
Unix but squawks on Win32. So you will need to reset the directive
session.save_path to c:\temp or any other valid scratch directory on your
windows machine you will probably also need to bounce IIS as well to
pick up the new settings if your running as an ISAPI module

The second and third errors are a knock-on effect of the 1st problem so fix
the bad session temp directory and they will probably disappear.

HTH
Rich


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



RE: [PHP] quick echo output

2003-03-03 Thread Rich Gray
 Ok most all programs I see they use ?php echo $somevar; ?
 within the html.
 Now I have always used the shortened version ?=$somevar? Is
 there a reason
 why I should not use this?  I've never had any problems with this way of
 doing things, but I just don't see anyone else using that format..

I think it's because the '=$blah' syntax relies on short tags ? ... ?...
and short tags can upset XML parsers... as a result short tags aren't
supported by all hosting providers  so your code could break if ported
to another site...

Cheers
Rich


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



RE: [PHP] Get variable from PHP before submit

2003-03-01 Thread Rich Gray
 I'm trying to implement the following functionality into the file 
 test.php:
 
 When I scroll down the page and then hit a button, the page 
 should remember
 the scrolled position, refresh the page and then scroll down to the
 remembered position. I've almost managed to make this work, but 
 only almost.
 
 The first time I click one of the buttons, the page won't scroll, 
 but after
 that it works fine. I think the reason for this is that the function
 hentKoordinat() gets called before $teller is set. hentKoordinat() uses
 $teller.
 
 Anyone know a way to make this work?
 
 Thanks alot!
 
 Lars

I've probably misunderstood but can you not use an HTML anchor...?
Rich


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



RE: [PHP] Parse exec output

2003-03-01 Thread Rich Gray
 
 If I exec a command like ifconfig, I'd like to be able to parse.  What is
 the best way to go about thihs?  An example output from ifconfig is:

Check http://www.php.net/manual/en/function.passthru.php

Rich

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



RE: [PHP] php.ini

2003-03-01 Thread Rich Gray
 I run the following script:
 
 ?
 phpinfo();
 ?
 
 // the page loads o.k. when the semi-colon remains as in:
 ;extension=php_gd2.dll
 
 but if I remove the semicolon as in:
 
 extension=php_gd2.dll
 
 the page won't load and the server hangs up.
 ..
 
 \\ this is my php.ini file on MS Win 98/ PHP/ Apache
 
 
 ; Directory in which the loadable extensions (modules) reside.
 extension_dir = C:\PHP\
 
 ; Whether or not to enable the dl() function.  The dl() function does NOT
 work
 ; properly in multithreaded servers, such as IIS or Zeus, and is
 automatically
 ; disabled on them.
 enable_dl = On
 
 extension=php_gd2.dll
 ...
 
 Any advice on how I can install GD libraries greatly appreciated.
 Thank you.
 Tony Ritter

Hi Tony

Still battling GD I see :)

Are there any errors in the Apache error.log?

What happens if you change your php.ini directive to ...

extension_dir = C:/php/extensions

HTH
Rich


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



RE: [PHP] mysql replication + mysql_pconnect

2003-03-01 Thread Rich Gray
 hi there i am setting up a test replication slave server as a mysql db
 master backup if it fails , i would like to know how to
 dynamically connect
 to the slave if the master fails , something really strange i have set the
 host like localhost:3307 for the slave but is still connecting to
 the master
 , and if i shut down the master it wont goto the slave :|



Not sure I understand ... are you saying that
mysql_connect('localhost:3307','user','password') connects to the master
server? Can you describe the problem in more detail?

Rich


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



RE: [PHP] php.ini

2003-03-01 Thread Rich Gray
 Rich,
 I've checked my php.ini files on my drive and all I've got is one.

 The php_gd2.dll file is in:

 C:/PHP/extensions

 There was no default folder called extensions when I installed
 PHP so I made
 a directory called extensions under PHP.

 Everytime I take out the semicolon in the .ini file, the page
 won't load and
 I've got to shut down Apache server manually.

 If I put the semicolon back in, the page loads fine.

 I don't have a clue.  Somewhere between the .ini file and Apache something
 is very screwed up.

 TR

You said in your earlier post that in your php.ini your extension_dir is set
to C:\PHP\ - this is wrong it should be c:/php/extensions
If the extensions directory was not there and you had to create it manually
then where did you get the php_gd2.dll from?
The extensions sub-directory should be there for a normal installation - did
you install from zip?

Rich


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



RE: [PHP] Random not working?

2003-03-01 Thread Rich Gray
 Hi All,

 I'm trying to get a random record each time this script runs;
 Only it's giving me everytime the first record back.. No random at all..

 // generate and execute query
 $query = SELECT stedenid, naamstad, stadomschrijvk FROM steden
 ORDER BY RAND() LIMIT 1;
 $result = mysql_query($query) or die (Error in query: $query. 
 . mysql_error());
 $row = mysql_fetch_object($result);
 echo $row-naamstad;


 Version info;

 PHP 4.3.1
 Mysql 3.23.54

 When i'm trying to excute the SELECT statement in phpmyadmin; i'm
 only getting the first record back and when i'm taking off the
 LIMIT 1 it will display all the records in ascending order so
 also not in random..


 Regards,

 Frank


Frank

This really belongs on the MySQL list but there was a known issue with
RAND() on 3.23.54 - can you upgrade? If your table has an auto_increment ID
column then a workaround would be to use rand() in PHP to generate a random
ID then use that with a 'where id = '.$id in your query...

HTH
Rich


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



RE: [PHP] How do I display the script file name?

2003-02-27 Thread Rich Gray
 How can I display the script file name? Presumably something like-:

 ?php
 echo $ScriptFileName;
 ?

 While I'm learning php and developing various Web page versions, I want to
 be sure the that the display is from the appropriate script.

 Regards
 Stephen Ford, Surrey, UK

Try any of these to see if it is what you want - some are absolute some are
relative ...
?
echo $_SERVER['SCRIPT_NAME'].' '.
 $_SERVER['SCRIPT_FILENAME'].' '.
 $_SERVER['PHP_SELF'];
?

Rich


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



RE: [PHP] Counting table fields having specific values

2003-02-27 Thread Rich Gray
Mike

Try ...
?
$res = mysql_query('select count(*) from names where not hide');
$row = mysql_fetch_row($res);
echo $row[0];
?

Rich
 -Original Message-
 From: rentAweek support [mailto:[EMAIL PROTECTED]
 Sent: 27 February 2003 17:32
 To: [EMAIL PROTECTED]
 Subject: [PHP] Counting table fields having specific values
 
 
   I have a table where the row named hide can have a value 0 or 1.
 I want to obtain a count of all the rows where hide has value 0.
 
 The following works on mysqladmin:
 
 SELECT SUM( hide = 0 ) FROM `names` LIMIT 0, - 1 
 
 Giving
 
 SUM( hide = 0 ) 
 7
 
 The PHP script statements generated are:
 
 $sql = 'SELECT SUM( hide = 0 ) FROM `names` LIMIT 0, -1';
 $result = mysql_query($sql);
 
 What assignment statement do I need to write now to obtain the SUM value 
 as shown by mysqladmin please?
 
 TIA
 
 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] Automatically included file?

2003-02-27 Thread Rich Gray
 New to PHP, I was wondering if PHP, running as a module under Apache 2,
 had an automatically included script that would run prior to any/each
 PHP script served by Apache?

 Tks,
 Dwayne

Dwayne
Look into the auto_prepend_file directive that you can specify in php.ini -
this may suit your needs.
Cheers
Rich



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



RE: [PHP] Destroying COM objects

2003-02-27 Thread Rich Gray
 When using the COM functions in PHP what is the equivalent of 
 ASPs set object=nothing?
 I am using the Crystal Report objects and I cannot seem to 
 destroy my Report object.

Have you tried setting it to NULL?
Rich


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



RE: [PHP] ftp browsing

2003-02-23 Thread Rich Gray
 -Original Message-
 From: Matt Palermo [mailto:[EMAIL PROTECTED]
 Sent: 23 February 2003 09:46
 To: [EMAIL PROTECTED]
 Subject: [PHP] ftp browsing


 I have a php script that is like and ftp client, only is just browsers the
 server and displays file names and folders.  If you click on the name of a
 folder that it displays, it will then display the files and folders inside
 that directory, and so on for all directories.  It works perfectly when I
 connect to my internet hosting company through ftp to browse, but
 it doesn't
 work right when I connect to my personal ftp server.  I have tried using
 both Serv-U and Bulletproof ftp servers to host my ftp site.  The script
 won't display my server correctly with either of these.  Can
 anyone give me
 some advice?  I would really appreciate it.  Thanks.

 Matt

What version of PHP are you running on your personal ftp server? Is your
personal server Win32? There was a bug with ftp_nlist()/ftp_rawlist() on
Windows that wasn't fixed till v4.3.x IIRC
Rich


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



RE: [PHP] ftp browsing

2003-02-23 Thread Rich Gray
 I am using Windows XP Pro, and I am using Serv-U to run my FTP server.
 It is just a server running from my machine.  Is it supposed to have PHP
 installed somewhere?

OK I've probably misunderstood - I assumed you were running your PHP scripts
locally - what platform are you running the PHP scripts on and what version
of PHP is it?

Rich


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



RE: [PHP] Block direct image loads but allow them in PHP

2003-02-19 Thread Rich Gray
[snip]
 
 if(isset($i))
 {
 //codeImageURL decodes $i into an image path that we can work with
 $link=codeImageURL($i);
 if($link!=  (isAdmin() || !isThisFileBlocked($link)))
 {
 header(Cache-control: private);
 header(Content-type: image/jpg);
 header(Content-Disposition: attachment; filename=.$link);
 $fp = fopen($link, 'r');
 fpassthru($fp);
 fclose($fp);
 }
 else
 echo Error: Couldn't decode image URLbr\n;
 }
Michael
Have you tried header('Content-type: image/jpeg') ?
Note the 'e'...
Rich


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




RE: [PHP] online tutorial

2003-02-19 Thread Rich Gray
 
 
 dear all,
 
 i am a final year engineering student and have
 started studying PHP since last 10 days.
 
 can anybody suggest some good online tutorial for mastering PHP?
 
 regards,
 diksha.
 
Hi Diskha

try these urls...

http://www.zend.com/zend/tut/
http://www.php.net/manual/en/tutorial.php
http://www.devshed.com/Server_Side/PHP


Rich

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




RE: [PHP] $_SESSIONS and printing off..

2003-02-18 Thread Rich Gray
Er... well I've seen a lot worse code than that but maybe you could use ...

if (isset($_SESSION['username'])  !empty($_SESSION['username'])) {
echo 'Welcome '.$_SESSION['username'].', you are still logged in.';
}
else {
header... etc etc
}

Rich
 -Original Message-
 From: Frank Keessen [mailto:[EMAIL PROTECTED]]
 Sent: 18 February 2003 09:00
 To: [EMAIL PROTECTED]
 Subject: [PHP] $_SESSIONS and printing off..
 
 
 Hi All,
 
 I'm a little bit confused and it's maybe a newbie question but 
 maybe you can help me out;
 
 A user is login in and after username password check it will 
 redirects to this page
 
 ?php
 session_start();
 if (isset($_SESSION['username'])){
 $username = $_SESSION['username'];
 echo 'Welcome, you are still loged in.';
 echo $username;
 }
 else{
 header ( Location: login.htm );
 }
 ?
 
 Question is; is this the way to print of his username?
 
 $username = $_SESSION['username'];
 Echo $username
 
 Or has anyone some alternatives..
 
 This is working o.k. but in my opinion it's a little bit quick and dirty?
 
 Thanks for the comments and suggestions!
 
 Frank

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




RE: [PHP] $_SESSIONS and printing off..

2003-02-18 Thread Rich Gray
Um... how about...

echo 'Welcome '.$_SESSION['username'].', you are still logged in and your
authentication level is '.(isset($_SESSION['level']) ? $_SESSION['level'] :
'unknown');

Or am I missing something here?

Rich

 -Original Message-
 From: Frank Keessen [mailto:[EMAIL PROTECTED]]
 Sent: 18 February 2003 12:15
 To: Rich Gray; [EMAIL PROTECTED]
 Subject: Re: [PHP] $_SESSIONS and printing off..


 Thanks,

 But then another question;

  if (isset($_SESSION['username'])  !empty($_SESSION['username'])) {
  echo 'Welcome '.$_SESSION['username'].', you are still logged in.';


 I want also checked if the level of authentication = 2; for example
 User Frank = level 1
 User Rich = level 2

 I've set $_SESSION['level'] to 2 but how can i check that with the above
 line?

 Thanks for your help,

 Frank


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




RE: [PHP] 4.0.6 to 4.3.0

2003-02-07 Thread Rich Gray

 Any thoughts as to why this snippet:

 25: if ($attach != none)
 26:  {
 27:$file = fopen($attach, r);
 28:$contents = fread($file, $attach_size);
 29:$encoded_attach = chunk_split(base64_encode($contents));
 30:fclose($file);

 would produce these errors:

 Warning: fread(): supplied argument is not a valid stream resource in
 /usr/virtual/share/pkgs/installed/aeromail/1.40/aeromail/send_mess
 age.php on line 28

 Warning: fclose(): supplied argument is not a valid stream resource in
 /usr/virtual/share/pkgs/installed/aeromail/1.40/aeromail/send_mess
 age.php on line 30

 After upgrading from 4.0.6 to 4.3.0


Most probably because with 4.3.0 register_globals is set to OFF by default -
where does $attach get set?

Rich


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




RE: [PHP] 4.0.6 to 4.3.0

2003-02-07 Thread Rich Gray
[snip]
  
   After upgrading from 4.0.6 to 4.3.0
  
 
  Most probably because with 4.3.0 register_globals is set to OFF
 by default -
  where does $attach get set?
 


 Nope, I do have register_globals on in php.ini

 Its being set in another file like this:
 form enctype=multipart/form-data name-doit action=send_message.php
 method=POST

 input type=file name=attach size=68

 It behaves like, if ($_GET['attach'] != none) or ($attach != none)
 is always true.

 If I attach something it goes through no prob, if I do not attach
 something
 it still goes through but with all the error messages and an
 empty attachment
 at the recieving end. Only thng that has changes was upgrading
 PHP from 4.0.6
 to 4.3.0

Hi Brian

Why are you using $_GET[] when your form is submitting via the 'post'
method? Secondly for file uploads why are you not using the $_FILES[]
superglobal array?

Rich


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




RE: [PHP] 4.0.6 to 4.3.0

2003-02-07 Thread Rich Gray
  Secondly for file uploads why are you not using the $_FILES[]
  superglobal array?
 
 I did not write the app, just trying to figure out why it stopped
 working after upgrading PHP. You think that's the problem?

Well try  ...

if (is_uploaded_file($_FILES['attach']['tmp_name'])) {
// Blah Blah Blah
}

Rich 

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




RE: [PHP] session id

2003-02-06 Thread Rich Gray
 -Original Message-
 From: Edward Peloke [mailto:[EMAIL PROTECTED]]
 Sent: 06 February 2003 13:56
 To: Php-General@Lists. Php. Net
 Subject: [PHP] session id


 Ok, I am sure this has been discussed but I have not been keeping up with
 the listserv.  I am using sessions so to test, I blocked all
 cookies and of
 course the sessionid is then in the url.  How can I hide it from the
 url?...or is this even possible?

 Thanks,
 Eddie

If you disable session.use_trans_sid in your php.ini then session id's will
not get passed via the url if cookies are being refused. But then of course
your session support is gone for that particular browser/user.

Rich


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




RE: [PHP] If... Else.. I'm not getting it!

2003-01-25 Thread Rich Gray
You are using the post method not get so $_GET[] should be empty.

Does this version of your code work?

?php
if(isset($_POST['submit'])) {
$vname=$_POST['vname'];
echo hello $vname;
} else {
?
form action=? echo ($_SERVER['PHP_SELF']); ? method=post
table
trtdInput yourname/tdtdinput type=text name=vname/td/tr
trtd colspan=2input type=submit name=submit/td/tr
/table
/form
?php
}
?

Rich
-Original Message-
From: Frank Keessen [mailto:[EMAIL PROTECTED]]
Sent: 25 January 2003 11:33
To: Johannes Schlueter; [EMAIL PROTECTED]
Subject: Re: [PHP] If... Else.. I'm not getting it!


Hi,

Thanks, but i'm a kind of a newbie in PHP and what i've read it's better to
have the register_globals = Off!!! If you look at my code you see that i'm
using the $_GET variable.. This works fine!! It's the IF.. ELSE what gives
me a lot of trouble!

Frank


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




RE: [PHP] Starting sessions, registering variables, destroying sessions with global_variables off....

2003-01-24 Thread Rich Gray
Phil
It should be as easy as ..
?
session_start();
$_SESSION['foo'] = 'bar';
?
You'll need a session_start() on all pages that will be using the
$_SESSION[] array.
Is your session.save_path pointing to a writable directory? Do you see any
errors in the server logs when you try to start a session?

Rich
-Original Message-
From: Phil Schwarzmann [mailto:[EMAIL PROTECTED]]
Sent: 24 January 2003 13:36
To: [EMAIL PROTECTED]
Subject: [PHP] Starting sessions, registering variables, destroying
sessions with global_variables off


I just switched from a 4.06 server with global_variables ON to a 4.22
with global_variables OFF



Can someone give me a quick run down of how to set/unset variables and
register/destroy sessions with PHP 4.22 (global_variables OFF).



I've been all through the php.net manual and still can't figure it out.



I know that I have to use $_SESSION['foo'] instead of just $foo now, but
for some reason I can't get session_start(); to properly start a
session.



Any ideas??



Thanks!!



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




RE: [PHP] PHP Sessions

2003-01-21 Thread Rich Gray
Sorry I'm a bit late in on this thread but I know there is a problem with
sessions with 4.1.2 with IIS 5 over Win2K... is that your platform? I
encountered it a while back and there is a hack/workaround which I can dig
up if you need it...

HTH
Rich
-Original Message-
From: Tim Thorburn [mailto:[EMAIL PROTECTED]]
Sent: 21 January 2003 10:26
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: RE: [PHP] PHP Sessions


There is some discussion as to whether my globals are on or not ... I am
using session_register to name my sessions, and then the global command
later on on the individual pages to remember which session it is we're
looking for.

It would be simply priceless if sessions were broken in 4.1.2 - and make
much sense in the long run.

Thanks
-Tim


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




RE: [PHP] Form Validating Class (OOP misunderstandings...)

2003-01-21 Thread Rich Gray
PHP does not yet support private methods ... your problem with getValue() is
most probably because register_globals is off in your php.ini try
substituting $_POST[] for $HTTP_POST_VARS[] and it may start to work...
HTH
Rich

-Original Message-
From: Nicholas Wieland [mailto:[EMAIL PROTECTED]]
Sent: 21 January 2003 14:13
To: [EMAIL PROTECTED]
Subject: [PHP] Form Validating Class (OOP misunderstandings...)


Hello everybody,
I'm working on a class but having a lot of problems... probably my
understanding of PhP-OOP is not so good ...
Here's the class: I found it on the web and I've tried to personalize
it to fit my needs...

?php

class FormV
{
var $errorList;

function FormV()
{
$this-reset_errorList();
}

function getValue( $field )
{
$value = $HTTP_POST_VARS[ $field ];
return $value;
}

function isEmpty( $field, $msg )
{
$value = $this-getValue( $field );

if( trim( $value ) ==  )
{
$this-errorList[] = array( field = $field,
value = $value, msg = $msg );
return true;
}
else
return false;

}

function isString( $field, $msg )
{
$value = $this-getValue( $field );

if( is_string( $value ) )
return true;

else
{
$this-errorList[] = array( field = $field,
value = $value, msg = $msg );
return false;
}
}

function isEmail( $field, $msg )
{
$value = $this-getValue( $field );
$pattern =
/^([a-zA-Z0-9])*@([a-zA-Z0-9_-])+(\.[a-zA-Z0-9_-]+)+/;

if( preg_match( $pattern, $value ) )
return true;

else
{
$this-errorList[] = array( field = $field,
value = $value, msg = $msg );
return false;
}
}

function isError()
{
if( sizeof( $this-errorList )  0 )
return true;

else
return false;
}

function get_errorList()
{
return $this-errorList;
}

function reset_errorList()
{
$this-errorList = array();
}

function stringConvert( $field )
{
$value = $this-getValue( $field );

$value = html_special_chars( $value );

$value = stripslashes( $value );

$value = strtolower( $value );

return $value;
}

};

?

Ok.
I think that the getter is *totally* wrong but I'm not able to debug
it, because it's private (I think...). Also the stringConvert() method
sucks, maybe I'll split it in some others accessor methods, for a
better design.
Now I'm totally lost, I don't have a clue how to continue, I've tried
for hours and hours to make it work, but didn't succeed :(
Any suggestion on improving and other enhancment for a good form
validating class is really really appreciated.

TIA,
Nicholas


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




RE: [PHP] setcooke(...) before header(Location: XYZ) - Cookie doesn't set!

2003-01-21 Thread Rich Gray
Mike
IIRC this is a known bug with IIS (not PHP) when it gets the http redirect
it junks the cookie - sorry I can't remember much more detail than that...
Workaround maybe is to spit out an HTML based META refresh redirect tag
instead of using the header() call.
HTH
Rich

-Original Message-
From: Mike Potter [mailto:[EMAIL PROTECTED]]
Sent: 21 January 2003 15:35
To: [EMAIL PROTECTED]
Subject: [PHP] setcooke(...) before header(Location: XYZ) - Cookie
doesn't set!


HELP!
I know I'm new at this so please don't laugh.  But I can't get this to work!
I am using Microsoft IIS with the latest PHP installed.
Here's a smple:

.
.
.
setcookie(testCookie, testValue, time() + 3600, /);
header(Location: http://newpage.php;);
exit;


Later, I pull the cookie:

echo $_COOKIE[testCookie];

and there is no value.  If I don't use the header function at the end, and
write something to the page, it works fine.
Why does this cookie not get set?

Thanks a ton!

Mike


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




RE: [PHP] How to upload a file

2002-12-20 Thread Rich Gray
And if you select a small file it works fine right?

-Original Message-
From: Somesh [mailto:[EMAIL PROTECTED]]
Sent: 20 December 2002 12:29
To: Rich Gray
Cc: [EMAIL PROTECTED]
Subject: RE: [PHP] How to upload a file


post_max_size 8M
upload_tmp_dir didn't set to any value

It fails immediately after clicking the submit button.

[thanx for ur concern]



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




RE: [PHP] PHP and MySQL queries

2002-12-19 Thread Rich Gray
Does it work if you put quotes around the array keys as follows...

echo $line['idn'];
echo $line['total'];
echo $line['idp'];
echo $line['position'];
echo $line['points'];

Rich

-Original Message-
From: Beauford.2002 [mailto:[EMAIL PROTECTED]]
Sent: 18 December 2002 20:28
To: PHP General
Subject: [PHP] PHP and MySQL queries


Hi,

I am having a real problem with variables in PHP and trying to query my
MySQL database. I have a form that a user inputs information and then that
info is used to query my database, but it's not working. I don't get any
errorrs and it appears every thing worked, but nothing gets displayed (see
code below). I know the info is getting passed from the form as it appears
correct in the address bar of my browser. The query below also works if I
use the command line in MySQL and hard code the information.

Any help is appreciated.

http://etc/etc?FromTrade=TRUEname=1from=2

$query = select tmanager.idn, tmanager.total, troster.idp, user, position,
points from troster join treference
join tmanager where tmanager.idn=treference.idn and
treference.idp=troster.idp and tmanager.name like '$name' and
troster.player like '$from';

$results = mysql_query($query) or die(Query failed);

while ($line = mysql_fetch_array($results, MYSQL_ASSOC)) {

 echo $line[idn];
 echo $line[total];
 echo $line[idp];
 echo $line[position];
 echo $line[points];

This just displays an empty page. So it appears the query found nothing, but
like I said, it works from the command line and there should be one entry
(see below). So I have to assume it is a problem with the variables.

+-++-++--++
| idn | total  | idp | user | position | points |
+-++-++--++
|   1 | 746.75 |   2 | Trevor  | F|  45.00 |
+-++-++--++


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




RE: [PHP] Check Uploaded File

2002-12-19 Thread Rich Gray
Shaun

Run getimagesize() on the uploaded file - if a valid jpeg the returned
array[2] will be set to 2...

http://www.php.net/manual/en/function.getimagesize.php

HTH
Rich

-Original Message-
From: shaun [mailto:[EMAIL PROTECTED]]
Sent: 19 December 2002 02:24
To: [EMAIL PROTECTED]
Subject: [PHP] Check Uploaded File


Hi,

Is it possible to ensure that a user is uploading a jpeg file from a form
and nothing else?

Thanks for your help



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




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




RE: [PHP] How to upload a file

2002-12-18 Thread Rich Gray
What does print_r($_FILES) tell you? Is $_FILES['userfile']['error'] set to
a value?
Rich

-Original Message-
From: Somesh [mailto:[EMAIL PROTECTED]]
Sent: 18 December 2002 11:18
To: [EMAIL PROTECTED]
Subject: [PHP] How to upload a file



Hi,

I am using the following code to upload file;
X---
form enctype=multipart/form-data action=load.php method=post
input type=hidden name=MAX_FILE_SIZE value=10
Send the file: input type=file name=userfilebr
input type=submit value=Send 
/form
X---

This works fine for small files of like some Kbs but fails to upload
larger files near to 1MB.

Can any one help me out from this problem

my file processing code is::
X---
if(is_uploaded_file($userfile)) {
copy($userfile,./upload/$userfile_name);
echo Successfully completed the uploading of the file
$userfile_name of size $userfile_sizebr;
}else{
echo some error has occured while uploading the file
$userfile_namebr;
echo $userfile;
}
-X---


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




RE: [PHP] How to upload a file

2002-12-18 Thread Rich Gray
As others have suggested does it make any difference if you up the script
timeout limit with set_time_limit() or via the max_execution_time in
php.ini?

-Original Message-
From: Somesh [mailto:[EMAIL PROTECTED]]
Sent: 18 December 2002 13:37
To: Rich Gray
Cc: [EMAIL PROTECTED]
Subject: RE: [PHP] How to upload a file


It is not displaying any thing.
It just gives the browser's error page
The page cannot be displayed

And the print_r($_FILES) prints an empty array;



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




RE: [PHP] How to upload a file

2002-12-18 Thread Rich Gray
What are these settings in your php.ini?

post_max_size
upload_tmp_dir

Does the upload_tmp_dir have enough space? Are the permissions on the
directory correct? When you start the upload - how long does it take to fail
immeditaely you click submit or after a delay. If the latter then is there
anything created in the upload directory after teh submit is clicked and
before it fails...?

-Original Message-
From: Somesh [mailto:[EMAIL PROTECTED]]
Sent: 18 December 2002 15:52
To: Rich Gray
Cc: [EMAIL PROTECTED]
Subject: RE: [PHP] How to upload a file



No difference


On Wed, 18 Dec 2002, Rich Gray wrote:

 As others have suggested does it make any difference if you up the script
 timeout limit with set_time_limit() or via the max_execution_time in
 php.ini?




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




RE: [PHP] server problems.

2002-12-10 Thread Rich Gray
A wild guess: Are you using a database abstraction class or configuration
file? Is it still pointing to the live server database instead of the
production server database?

Rich

-Original Message-
From: Steve Jackson [mailto:[EMAIL PROTECTED]]
Sent: 10 December 2002 12:34
To: PHP General
Subject: [PHP] server problems.


I have a production server and a 'live' web server. The set-ups are the
same and yet I can view code fine on the 'live' web site but not on the
production server. At least I can view one shopping cart section online
but not offline. All the other database driven stuff appears fine. I've
even tried dumping the 'live' database onto my production server and
deleting and re-installing the code. No effect. Any ideas? The shop
section even worked offline until I added a new category now it simply
doesn't show anything. Flummoxed because on the live server everything
works hunky dory. Also the shop admin functions are password protected -
now when I try to login to that it refuses to let me in, even though the
same password and login functions are ok on the live server. I tried
adding a new user - no effect. It's like it just refuses to read this
part of my database, but everything else will work OK. Any ideas?

Steve Jackson
Web Developer
Viola Systems Ltd.
http://www.violasystems.com
[EMAIL PROTECTED]
Mobile +358 50 343 5159



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




RE: [PHP] run query

2002-12-10 Thread Rich Gray
Er... but the original poster wanted a count of rows returned by a
particular query... your method just returns the number of rows in the
table...

Rich

-Original Message-
From: @ Edwin [mailto:[EMAIL PROTECTED]]
Sent: 10 December 2002 17:21
To: Jon Haworth; 'Diana Castillo'
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] run query


Or,

Jon Haworth [EMAIL PROTECTED] wrote:

 Hi Diana,

  After I run a query lik this,
  $db-query($sql);
 
  what is the quickest way to find out how many
  records result?

 Look into mysql_num_rows (or the equivalent if you're not using MySQL)

... you can even do it faster by using a

  select count(*) as something from some_table

More info (found in the manual):

  http://www.faqts.com/knowledge_base/view.phtml/aid/114/fid/12

HTH,

- E



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




RE: [PHP] Help Need in PHP File Upload

2002-12-10 Thread Rich Gray
probably register_globals is off on the client's machine - use $_FILES[][]
instead of $HTTP_POST_FILES[][] BTW I would upgrade your local Linux box
from v.4.0.3 it is pretty old now and unsupported...

Rich
-Original Message-
From: ppf [mailto:[EMAIL PROTECTED]]
Sent: 10 December 2002 13:21
To: [EMAIL PROTECTED]
Subject: [PHP] Help Need in PHP File Upload


Hi:
I need to upload a file during form submittion, I had
done all the coding on my local Linux box It work fine
over here.
When i moved the code to my Client machine File upload
is not working  well.
Server side code first check where file upload is
successful by
is_uploaded_file($HTTP_POST_FILES['file']['tmp_name'])
method, if it is True it will copy it to the
destination folder.
 Once i hosted this code on my clients machine First
attempt will work successfully, it will copy the file
into the destnation folder. But when i tries to repeat
the form submission process, from second time onwards
unsuccessful.
  I am programmatically creating new folder each time
so there is no chance of over writing issues.
  Whe i checked the code more care fully, Function
is_uploaded_file($HTTP_POST_FILES['file']['tmp_name'])
returns False
 I am quite new to Linux env. Is it due to some sought
of permission issue? Or due to Version problem.
  I am using Php4.0.3 on my local Linux Box and 4.2.3
on Clients machine. I also tested this code on
window's Apache/php4.2.3 It works fine over windows .
 If anybody can point out the error will be a great
Help for me.. Thanks in advance

  Prad




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




RE: [PHP] Can anyone help? PHP script/MySQL problem

2002-12-10 Thread Rich Gray
Hi Steven
so what exactly is the problem then?
Rich

-Original Message-
From: Steven M [mailto:[EMAIL PROTECTED]]
Sent: 10 December 2002 14:25
To: [EMAIL PROTECTED]
Subject: [PHP] Can anyone help? PHP script/MySQL problem


Hi, i am trying to create a member login/authentication script to
automatically send newly signed up people an email with a confirmation link.
I am following a tutorial:

http://www.phpfreaks.com/tutorials/40/0.php

My form is located at:

http://www.tricia-marwick.co.uk/members/join_form.php

[snip]


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




RE: [PHP] Can anyone help? PHP script/MySQL problem

2002-12-10 Thread Rich Gray
Any error messages? You say it is not stored 'as it should be' does that
mean it *is* stored but incorrectly, or is the data just not there?
FWIW I just used your test form and it said I had registered ok I then
retried with the same info and I got 2 error messages as I would have
expected which implies the data is hitting the database ok...
Rich

-Original Message-
From: Steven M [mailto:[EMAIL PROTECTED]]
Sent: 10 December 2002 14:47
To: [EMAIL PROTECTED]
Subject: Re: [PHP] Can anyone help? PHP script/MySQL problem


Hi Rich

The prob is that the data isn't stored into the database as it should be and
the user doesn't get an email back with their data.  It seems to get lost
before reaching the database, meaning the rest of it wont work, and i don't
know why.

Thanks

Steven M



--
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] Different output on two different servers

2002-12-09 Thread Rich Gray
Steve
Not quite clear on your problem - did you run an ALTER TABLE on your MySQL
table or just an INSERT of a new row? Assuming it was the former, all I can
say is look at the code that populates the $cat_array variable to see if the
underlying query would have been affected by the alter table command...
Does the query that populates $cat_array run OK if executed directly in
MySQL?
Rich

-Original Message-
From: Steve Jackson [mailto:[EMAIL PROTECTED]]
Sent: 09 December 2002 13:11
To: PHP General
Subject: [PHP] Different output on two different servers


Hi all,

I have set-up a production server and a live server. The problem is with
the production server. I am using PHP version 4.2.3 and MySQL 3.23.39 on
both servers. We have just configured the production server to mimick
the live server (which incidentally works fine) and the code from both
servers is identical. I dumped all the data into the production MySQL
database then copied the code from the live server to our production one
and there didn't seem to be any problems. However today my boss asked
for a new category to go into our webshop with a new product. I went
into MySQL and updated the database fine then when I went to check the
section of the site to see if the extra category and product are there I
get my own PHP encoded error 'No categories currently available'. It
fails on the first function:
function display_categories($cat_array)

{
  //display all categories in the array passed in
  if (!is_array($cat_array))
  {
 echo brNo categories currently available.br;
  }
  else
  {
//create table
echo table width = \760\ border='0'
background='images/shopbg.gif';
etc.

Now it works superbly on my live server and did work fine until I tried
adding another field to the database on the production server. Where
should I start looking to de-bug this?

Steve Jackson
Web Developer
Viola Systems Ltd.
http://www.violasystems.com
[EMAIL PROTECTED]
Mobile +358 50 343 5159


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




RE: [PHP] Script not working from one computer

2002-12-09 Thread Rich Gray
Does a print_r() of the superglobal arrays differ in any significant way
when posting the username/password from the troublesome client when compared
to the superglobals for a well behaved machine?

-Original Message-
From: 1LT John W. Holmes [mailto:[EMAIL PROTECTED]]
Sent: 09 December 2002 16:32
To: M.A.Bond; php-general
Cc: heflinaw
Subject: Re: [PHP] Script not working from one computer


 Have you checked:

 Browser versions? (is the browser the same type/version as on the other
 machines)
 Is it a laptop? If so, are you using the internal keyboard with Numlock
on?
 Is the machine in question set-up on the network correctly, i.e. has it
got
 domain, gateway addresses etc setup - this would only affect it if the
 Intranet server is set-up to only allow a certain range of IP addresses or
 doamin/hostnames etc.

Browser's are the same (128bit). It's not a laptop. The web page can pull up
any other external web page correctly.

What gets me is that the computer can pull up the log in page. It can pull
up another, unprotected page from that web server. But, no matter who tries
to log in from that machine, I get a bad username and password, even though
they are right. It's like the browser is sending bad data to a script that
works fine from every other computer.

Anyone else have any other ideas?


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




RE: [PHP] Bizarreness with htmlentities() and other things

2002-11-28 Thread Rich Gray
Hi James
There is a bug in PHP for the capitalisation problem
http://bugs.php.net/bug.php?id=14655
If you check the link then a workaround was posted by someone.
HTH
Rich
-Original Message-
From: James Coates [mailto:[EMAIL PROTECTED]]
Sent: 28 November 2002 13:11
To: [EMAIL PROTECTED]
Subject: [PHP] Bizarreness with htmlentities() and other things


Hello!

I'm currently doing some work that requires a mySQL database of actor
names. For all my actors, I have three columns; first_name, last_name and
between_name. Because between_name can be written in many ways (Peter van
Wibble or Fred d'Angelo), and the French have a habit of writing their
surnames in capitals, I wrote a little function to prepare the actor names
for output:

?
  function actor_name($last,$middle,$first) {
  // because we have so many different name combinations, write out a string
  // that does capitalisation and the like properly (hopefully)
  // ex: actor_name(ANGELO,d',Jean-Pierre) = Jean-Pierre d'Angelo

   // strtolower() everything because ucwords() doesn't work on mixed case
   $last=strtolower($last);
   $middle=strtolower($middle);
   $first=strtolower($first);

   // split hyphenated names so we can ucwords() them
   if (strpos($last,-)) {
$lasthyphen=true;
$last=ereg_replace(-, ,$last);
   } else { $lasthyphen=false; }

   if (strpos($first,-)) {
$firsthyphen=true;
$first=ereg_replace(-, ,$first);
   } else { $firsthyphen=false; }

   // if the middle name doesn't end with an apostrophe, add a space and
   // lowercase it just in case someone's mis-typed it
   if (!strrpos($middle,')) {
$middle.= ;
   }

   $last=ucwords($last);
   $first=ucwords($first);

   if ($lasthyphen==true) { $last=ereg_replace( ,-,$last); }
   if ($firsthyphen==true) { $first=ereg_replace( ,-,$first); }

  return htmlentities($first $middle$last);

  }

?

Thing is, I'm getting bizarre behaviour where some characters become
modified in a way I don't like - in particular, when the letter L follows
an E with a diaresis (Raphaël, for example) it becomes upper case.
Suggestions, anyone?

And if anyone wants to make that code shorter and more readable, I'd
appreciate it greatly. :-)

James.
xx


--
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] Newbie : How work with parameters?

2002-11-27 Thread Rich Gray
Stephane

http://www.php.net/manual/en/security.registerglobals.php

http://www.php.net/manual/en/faq.php

Substitute 'fr' for 'en' if your prefer it en francais

Use: $_GET['id'] or $_REQUEST['id']

Ciao
Rich
-Original Message-
From: Stéphane Génin [mailto:[EMAIL PROTECTED]]
Sent: 27 November 2002 08:58
To: [EMAIL PROTECTED]
Subject: [PHP] Newbie : How work with parameters?


Hello,

I want to read the parameters in the URL, but I can't find the right way to
do that. I've tried several things :

my URL is:  http://localhost/test.php?id=abc

I tried to use the $id, but in this case, I have a notice with 'undefined
variable'.
I have the same problem if I try the variable $QUERY_STRING (still undefined
variable).

Do you know what is the best way to read this parameters?

Many thanks
Stéphane



--
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] Newbie Mail() Question...

2002-11-27 Thread Rich Gray
Er yea - just call the mail() function at the appropriate time in your
script...

http://www.php.net/manual/en/function.mail.php

However IMO if you need to log this sort of information then using a
database is far more appropriate than sending emails - especially on a busy
site...

Rich
-Original Message-
From: Chase [mailto:[EMAIL PROTECTED]]
Sent: 27 November 2002 14:24
To: [EMAIL PROTECTED]
Subject: [PHP] Newbie Mail() Question...


Is there a way to have an email sent to a specified email address either
when a page is accessed, or when a file is downloaded?

Maybe I should just be logging the info into a table?

Basically, I am trying to set up a secure site that would send the sysadmin
an email when a file has been downloaded with reference to the page title
and/or filename.

I have a feeling that this may be a bit too complicated for a newbie like
me...

...Suggestions?


Chase




--
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] ignoring client supplied session data

2002-11-27 Thread Rich Gray
I know I'm late in on this thread but 

Ignoring cookies is easy - just don't set them and don't use any data in
$_COOKIE[]... or am I missing your point?

$_COOKIE[] data should be treated with far more caution than $_SESSION[]
i.e. it should be treated as hostile data. If you really have to recognise
users coming back to your site after their session has timed out then store
the bare minimum in the cookie e.g. an encrypted User ID. You can then use
that to look up their information in a database table and deal with their
profile accordingly. Users can switch off cookie support at any time or
delete/tamper with cookies so don't make your code reliant on the stuff
stored in them...

In effect it is up to you what you save and process from persistent
cookies...

HTH
Rich

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

I'm not worried about them using the query string for malicious purposes- I
have register_globals off... I'm worried about someone messing with their
cookie and sedding authorized to true- that _will_ change my $_SESSION
variable, unless I can find some way to ignore cookies, which brings us back
to my original question- how do i ignore all client input, _especially_
cookies??


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




RE: [PHP] session problems again

2002-11-27 Thread Rich Gray
Jason

session.cookie_lifetime set to 0 means the session cookie persists until the
client browser is closed...

I'm not clear if you are still having session problems now or the advice you
got earlier sorted it?

Rich
-Original Message-
From: Jason Romero [mailto:[EMAIL PROTECTED]]
Sent: 27 November 2002 15:09
To: [EMAIL PROTECTED]
Subject: [PHP] session problems again


--when using session registered variables
--i can only get them to save as session variables for one page
--then on the next page they are gone
--far as i can tell the variables are not getting written over or unset
--and the session is not gettting destroyed
--any other ideas what it might be?

i tried the seggestions you guys had
and i came up with one more question
does the session cookie.cookie_lifetime have anything to do with the amount
of time that session variables can be stored
the session.use_cookies is on and register.globals is turned on
however session.cookie_lifetime is set to 0
so would this affect the session variable lifetime?




--
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] File upload on Win2k ...

2002-11-26 Thread Rich Gray
PHP v4.2.3
Win2K Sp2
Apache v1.3.24

I'm testing some file upload code for a image library type site and the file
upload keeps failing... here's some code to explain what the issue is...

?
// The form has been posted and we are processing the posted data
print_r($_FILES);
copy($_FILES['userpic']['tmp_name'],'c:/test.jpg');
echo (is_uploaded_file($_FILES['userpic']['tmp_name']) ? 'brUploaded' :
'brNot Uploaded');
?

This outputs the following:-

Array ( [userpic] = Array ( [name] = garden.jpg [type] = image/pjpeg
[tmp_name] = C:\\WINNT\\TEMP\\phpC0.tmp [error] = 0 [size] = 59501 ) )
Not Uploaded

The copy() function works in that the temp file is copied to c:\test.jpg.

So why is is_uploaded_file() returning false?

TIA
Rich


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




RE: [PHP] File upload on Win2k ...

2002-11-26 Thread Rich Gray
Don't bother to respond people... worked out the issue - the double
backslashes in the name...
Cheers
Rich
-Original Message-
From: Rich Gray [mailto:[EMAIL PROTECTED]]
Sent: 26 November 2002 21:14
To: [EMAIL PROTECTED]
Subject: [PHP] File upload on Win2k ...


PHP v4.2.3
Win2K Sp2
Apache v1.3.24

I'm testing some file upload code for a image library type site and the file
upload keeps failing... here's some code to explain what the issue is...

?
// The form has been posted and we are processing the posted data
print_r($_FILES);
copy($_FILES['userpic']['tmp_name'],'c:/test.jpg');
echo (is_uploaded_file($_FILES['userpic']['tmp_name']) ? 'brUploaded' :
'brNot Uploaded');
?

This outputs the following:-

Array ( [userpic] = Array ( [name] = garden.jpg [type] = image/pjpeg
[tmp_name] = C:\\WINNT\\TEMP\\phpC0.tmp [error] = 0 [size] = 59501 ) )
Not Uploaded

The copy() function works in that the temp file is copied to c:\test.jpg.

So why is is_uploaded_file() returning false?

TIA
Rich


--
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 cookies

2002-11-23 Thread Rich Gray
Ken

Do *not* use hidden form statements or cookies to store any SQL this is
extremely dangerous and a relatively simple hack could destroy your database
completely!

By all means use hidden form fields to store row ID values but your PHP
scripts should treat all user input data via $_GET/$_POST/$_COOKIE/$_FILES
as hostile and you should be rigorous in validating that data coming into
your script is as you would expect...

Having said that it seems your server has magic_quotes_gpc() switched on -
this automatically escapes all incoming data that could upset a SQL query
i.e. the quotes - you can remove them by using stripslashes() or switch off
magic quotes in your php.ini file. But I would repeat *don't* continue down
the path you are going unless you like being hacked!

HTH
Rich
-Original Message-
From: Ken Nagorski [mailto:[EMAIL PROTECTED]]
Sent: 23 November 2002 11:52
To: [EMAIL PROTECTED]
Subject: [PHP] using cookies


Hi there,

I have never used cookies before, however I am trying to implement them to
make things a little more secure. Rather than passing a sql statement via a
hidden input tag I am setting a cookie. This works fine except that when I
look at the sql after it is pulled from the cookie everything is escaped,
for instance.

SELECT * FROM inventory WHERE name='Watches'
  would become
SELECT manufacturer FROM inventory WHERE name=\'Watches\'

This is a problem cause trying to use preg_replace doesn't seem to work. I
get an error saying that the delimeter must not be a \. What a bummer. I am
a little stuck. I will take any suggestions. Maybe I am just going about
things the wrong way. *** Shrug ***

Thanks
Ken




--
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 cookies

2002-11-23 Thread Rich Gray
Try the system() or passthru() functions...

Rich
-Original Message-
From: Paul Marinas [mailto:[EMAIL PROTECTED]]
Sent: 23 November 2002 13:09
To: Rich Gray
Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: RE: [PHP] using cookies



dose anyone how to send a ping in local network

thanks

Paul Marinas
Technical Support
RDS Craiova


Phone:  +402-51-410-194
Mobile: +407-22-451-439
Fax:+402-51-416-579
www.rdsnet.ro
.

Privileged/Confidential Information may be contained in this message. If you
are not the addressee indicated in this
message (or responsible for delivery of the message to such person), you may
not copy or deliver this message to
anyone. In such a case, you should destroy this message and kindly notify
the sender by reply e-mail.



--
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] Passing Variables

2002-11-23 Thread Rich Gray
Is your register_globals setting set to Off? This is the default setting in
v4.2.x upwards.

Rich
-Original Message-
From: Craig Edgmon [mailto:[EMAIL PROTECTED]]
Sent: 23 November 2002 11:43
To: [EMAIL PROTECTED]
Subject: [PHP] Passing Variables


I am sure this question has been answered, but there is a ton of data to
sift through on this. I am running Apache 1.3 and the latest PHP 4.2.3. .
I am just working with variables and I cannot seem to get them to pass from
my html file to the php call. I will get the html portion fine, but not the
variable. I have checked my language and have compared my files with
supposed good code from a reliable source with the same results. Any idea on
this. It happens on multiple systems.



--
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] getting mysql dump using php

2002-11-23 Thread Rich Gray
Answer is No. 2)

Use cron to run the mysqldump utility instead of a php script.
Let me know if you need more info.

Cheers
Rich

-Original Message-
From: See Kok Boon [mailto:[EMAIL PROTECTED]]
Sent: 23 November 2002 07:35
To: PHP
Subject: [PHP] getting mysql dump using php


hi,

can anyone tell me how to make auto backups of mysql databases?

i have a particular database that i want to backup everyday. what i can
think of now is to use crontab to execute a .php that will do the work, then
send the db schema (dump) via email every midnight.

however, i do not know the code to GET THE DUMP of the mysql db.

i know that i can be done because phpAdmin from sourceforge.net has the
export feature, which does what i want, except that i cannot execute the
hyperlink there using crontab.

can someone tell me:
1. what is the php code for getting the schema?
2. what is an alternatively BETTER way to backup?

thanks in advance

Yours sincerely,
See Kok Boon
-
looking for - jobs? career? customer?
look in realPortal!
http://realportal.realizecreations.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] easy things - forms, variable sending

2002-11-22 Thread Rich Gray
Hi
Some suggestions below...
Cheers
Rich

This is a trivial question - what function can I use to automatically
proceed to some link, one that can be executed without any user input.

header('Location: http://www.newurl.blah')
 
How can we, most efficiently, send all the data (variables) from one
page to another?

Many ways... here's some ... Query string, Sessions, Form Post hidden vars 

Also, would you happen to know, as PHP is very often used in forms, how
to generate a radiobutton, which when clicked upon automatically
proceeds and does not need a Submit button? 

use javascript - onclick=this.form.submit()




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




RE: [PHP] session trouble

2002-11-22 Thread Rich Gray
I don't know which version of PHP you are using but if v4.2.x upwards then
use session_start() and the $_SESSION[] superglobal array instead of
session_register(). Your warning is because you have either started output
of HTML or you have some blank lines in your PHP scripts before the session
related calls were made.

HTH
Rich
-Original Message-
From: empty [mailto:[EMAIL PROTECTED]]
Sent: 22 November 2002 14:22
To: [EMAIL PROTECTED]
Subject: [PHP] session trouble


hi guys ;

 I can't use session bla..as on my site.
PHP Code
?php
session_register();
if(isset($username)  isset($pass)){
if(login($username,$pass)){
$valid_user=$username;
session_start(valid_user);
do_html_url(/,Ana Sayfa);

}else{
echo(Teknik bir sorun nedeniyle giriþ iþleminiz
gerçekleþtirilemiyor. Lütfen Daha sonra tekrar deneyiniz3.);
}
}
else{
 ?
...

Warning: Cannot send session cache limiter - headers already sent (output
started at D:\sites\inc\register.inc:23) in D:\sites\uyelik\login.php on
line 90

I cant understand and solve the warning message, what is it?

thanks all.


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