|
Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com |
php-general Digest 19 Mar 2005 04:43:11 -0000 Issue 3346
php-general-digest-help
lists.php.net
Date: Fri Mar 18 2005 - 22:43:11 CST
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
php-general Digest 19 Mar 2005 04:43:11 -0000 Issue 3346
Topics (messages 211040 through 211085):
ldap_get_values warning
211040 by: Jeff Bunting
Re: getting text with strange encodng
211041 by: Diana Castillo
211042 by: Diana Castillo
Re: Setting cookies for other domains
211043 by: Brian Dunning
211080 by: Scott Haneda
Re: sessioncookies?
211044 by: Ken
211055 by: William Stokes
Re: New Website for PHP Coders.. www,lifenit.com
211045 by: Ryan A
211074 by: James Williams
211077 by: Chris W. Parker
211078 by: Robert Cummings
Memory exhausted message wrong
211046 by: Andrew Hill
211048 by: Marek Kilimajer
211050 by: Andrew Hill
211052 by: Andrew Hill
Referer checking is able to be referer spoofed
211047 by: Dan Rossi
211049 by: Dan Rossi
211051 by: Marek Kilimajer
preg_replace with rawurlencoded?
211053 by: BlackDex
build an array of checkbox
211054 by: Tomás Rodriguez Orta
211056 by: Forest Liu
211062 by: Leif Gregory
apache_request_headers() does not return HTTP Authorization headers
211057 by: LacaK
Re: Files upload - Encrypt into a variable - Do not injectinto db (PHP/Apache/MySQL)
211058 by: Steven Altsman
211061 by: Steven Altsman
211067 by: Steven Altsman
Re: More function troubles
211059 by: Chris Shiflett
PHP Compiler for .NET platform
211060 by: Pablo Gosse
problem with csv file (or php code?!?)
211063 by: afan.afan.net
XML & HTTP
211064 by: Jerry Swanson
211065 by: Chris Shiflett
211071 by: Jerry Swanson
211072 by: Chris Shiflett
211073 by: Jason Barnett
211082 by: Forest Liu
Re: problem with csv file - SOLVED :)
211066 by: afan.afan.net
Convert time
211068 by: virtualsoftware.gmail.com
211069 by: Chris W. Parker
211070 by: Jason Barnett
211079 by: Jim Plush
Chapter 38. Handling file uploads
211075 by: Timothy A. Whitley, P.E.
211076 by: Jason Barnett
Re: Different approach?
211081 by: John Taylor-Johnston
Problem calling function within a class
211083 by: Ahmed Abdel-Aliem
211084 by: Forest Liu
XSLT solution
211085 by: Devraj Mukherjee
Administrivia:
To subscribe to the digest, e-mail:
php-general-digest-subscribe
lists.php.net
To unsubscribe from the digest, e-mail:
php-general-digest-unsubscribe
lists.php.net
To post to the list, e-mail:
php-general
lists.php.net
----------------------------------------------------------------------
attached mail follows:
Hi,
I'm retrieving a user via LDAP and am getting a warning from this line:
$values = ldap_get_values($ldapconn, $entry, "middleName");
because middleName is not present in $entry. This doesn't seem to agree
with the documentation for ldap_get_values:
array ldap_get_values ( resource link_identifier, resource
result_entry_identifier, string attribute )
Returns an array of values for the attribute on success and FALSE on error.
The warning I get is:
Warning: ldap_get_values(): Cannot get the value(s) of attribute Decoding
error in......
Shouldn't I be getting a FALSE?
I'm running PHP 4.3.10, ldap query is against Windows 2003 server. I'm a
relative newb to PHP.
thanks.
Jeff
attached mail follows:
no, its not html entity, it doesnt have a semicolon, its exactly as I wrote
it.
"Chris Shiflett" <shiflett
php.net> wrote in message
news:4239CE14.5020904
php.net...
> Diana Castillo wrote:
>> Does anyone know what kind of string encoding this is :
>> ®®
>> mA®
>> and how can I decode this?
>
> That looks almost like an HTML entity:
>
> ®
>
> Assuming that's what it is, and you just left off the semicolon, you can
> decode it with this:
>
> html_entity_decode()
>
> Hope that helps.
>
> Chris
>
> --
> Chris Shiflett
> Brain Bulb, The PHP Consultancy
> http://brainbulb.com/
attached mail follows:
from a text description provided via an xml
"Jim Plush" <jiminoc
gmail.com> wrote in message
news:20050318021433.44449.qmail
lists.php.net...
> Where did the string come from?
>
>
>
> Jim
> PHP WebBlog =
> http://www.litfuel.net/plush/
>
>
> Diana Castillo wrote:
>> Does anyone know what kind of string encoding this is :
>> ®®
>> mA®
>> and how can I decode this?
>>
attached mail follows:
> You are misinterpreting the prefs in browsers, they can not do what
> you ask.
That's fine, I'm perfectly willing to accept this - but can someone
explain what the pref IS for?
attached mail follows:
on 3/18/05 5:47 AM, Brian Dunning at brian
briandunning.com wrote:
>> You are misinterpreting the prefs in browsers, they can not do what
>> you ask.
>
> That's fine, I'm perfectly willing to accept this - but can someone
> explain what the pref IS for?
you have not said which browser and what pref you are referring to.
--
-------------------------------------------------------------
Scott Haneda Tel: 415.898.2602
<http://www.newgeo.com> Novato, CA U.S.A.
attached mail follows:
No, you'll have to use another cookie name.
Alternatively, you can use arrays
setcookie('cookiename['arrayname']', $value, time());
On Fri, 18 Mar 2005 15:07:34 +0200, William Stokes <kalles
operamail.com> wrote:
> Hello,
>
> I have a following line in my code to set a session cookie when user logs
> in. It works fine.
> setcookie("sess_id","$sess_id",0,"/");
>
> Can I store more information to the session cookie? I mean other variables.
> Like I tried it like this with no success.
> setcookie("sess_id","$sess_id",$another_variable,0,"/");
>
> Thanks
> -Will
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
attached mail follows:
OK. so can I set 2 or more session cookies for the same user? Like this:
setcookie("sess_id","$sess_id",0,"/");
setcookie("cookie2","$another_variable",0,"/");
If so is there a limit? Or is it a bad idea for some other reason?
Thanks
-Will
"Ken" <kenkam
gmail.com> kirjoitti
viestissä:827f7534050318055923d44650
mail.gmail.com...
> No, you'll have to use another cookie name.
> Alternatively, you can use arrays
>
> setcookie('cookiename['arrayname']', $value, time());
>
>
> On Fri, 18 Mar 2005 15:07:34 +0200, William Stokes <kalles
operamail.com>
> wrote:
>> Hello,
>>
>> I have a following line in my code to set a session cookie when user logs
>> in. It works fine.
>> setcookie("sess_id","$sess_id",0,"/");
>>
>> Can I store more information to the session cookie? I mean other
>> variables.
>> Like I tried it like this with no success.
>> setcookie("sess_id","$sess_id",$another_variable,0,"/");
>>
>> Thanks
>> -Will
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
attached mail follows:
Stupid damn sites dont even open, get yourself some decient hosting...and
after you do that DONT SPAM THIS LIST,DUMBASS.
On 3/17/2005 8:22:17 PM, freshersworld .com (freshersworld
yahoo.com) wrote:
> Hi All,
>
>
>
> This is a very interesting website.
>
>
>
> Visit www.lifenit.com
>
>
>
> Also I can refer one more sebsite for you..
>
>
>
> www.merchantii.com
>
>
>
> Hope these were Useful.
>
>
>
> Rgds,
>
> Freshersworld
>
>
>
> First Job..... Dream Job....... Freshersworld.com
>
>
>
> __________________________________________________
>
> Do You Yahoo!?
>
> Tired of spam? Yahoo! Mail has the best spam protection around
>
> http://mail.yahoo.com
>
>
>
> --
>
> PHP General Mailing List (http://www.php.net/)
>
> To unsubscribe, visit: http://www.php.net/unsub.php
--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.7.3 - Release Date: 3/15/2005
attached mail follows:
God damn it this is really startin to piss me off...
> On 3/17/2005 8:22:17 PM, freshersworld .com (freshersworld
yahoo.com) wrote:
>
>>Hi All,
>>
>>
>>
>>This is a very interesting website.
>>
>>
>>
>>Visit www.lifenit.com
>>
>>
>>
>>Also I can refer one more sebsite for you..
>>
>>
>>
>>www.merchantii.com
>>
>>
>>
>>Hope these were Useful.
>>
>>
>>
>>Rgds,
>>
>>Freshersworld
>>
>>
>>
>>First Job..... Dream Job....... Freshersworld.com
>>
>>
>>
>>__________________________________________________
>>
>>Do You Yahoo!?
>>
>>Tired of spam? Yahoo! Mail has the best spam protection around
>>
>>http://mail.yahoo.com
>>
>>
>>
>>--
>>
>>PHP General Mailing List (http://www.php.net/)
>>
>>To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>
>
attached mail follows:
James Williams <mailto:php
jamwil.com>
on Friday, March 18, 2005 1:59 PM said:
> God damn it this is really startin to piss me off...
Yeah I hate it when people don't trim their emails and they top po... oh
wait you meant the spam! Silly me. ^_^
attached mail follows:
I feel the need to side once more with freedom of choice ;)
Cheers,
Rob.
On Fri, 2005-03-18 at 17:56, Chris W. Parker wrote:
> James Williams <mailto:php
jamwil.com>
> on Friday, March 18, 2005 1:59 PM said:
>
> > God damn it this is really startin to piss me off...
>
> Yeah I hate it when people don't trim their emails and they top po... oh
> wait you meant the spam! Silly me. ^_^
--
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting |
| a powerful, scalable system for accessing system services |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for |
| creating re-usable components quickly and easily. |
`------------------------------------------------------------'
attached mail follows:
Hi all,
I'm trying to run phpDocumentor 1.3.0RC3 under PHP 4.3.10, and I get the
following error:
Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to
allocate 3668 bytes) in
/usr/local/lib/php/PhpDocumentor/phpDocumentor/phpDocumentorTWordParser.
inc on line 236
The problem is that in my php.ini file, I have the line:
memory_limit = 8M
So, why is PHP reporting that the allowed memory size is 256M? The
phpinfo() function correctly reports that memory_limit is set to 8M.
With this problem, I can't run phpDocumentor, as it doesn't matter how
large I set memory_limit in php.ini, it always crashes with the same
error.
TIA,
--
Andrew Hill
Software Developer
Awarez Ltd.
Kirkman House, 12-14 Whitfield Street, London W1T 2RF
T: +44 (0)20 7299 7367 F: +44 (0)20 7299 7374
IRC: #max on freenode.net
attached mail follows:
Andrew Hill wrote:
> Hi all,
>
> I'm trying to run phpDocumentor 1.3.0RC3 under PHP 4.3.10, and I get the
> following error:
>
> Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to
> allocate 3668 bytes) in
> /usr/local/lib/php/PhpDocumentor/phpDocumentor/phpDocumentorTWordParser.
> inc on line 236
>
> The problem is that in my php.ini file, I have the line:
>
> memory_limit = 8M
>
> So, why is PHP reporting that the allowed memory size is 256M? The
> phpinfo() function correctly reports that memory_limit is set to 8M.
> With this problem, I can't run phpDocumentor, as it doesn't matter how
> large I set memory_limit in php.ini, it always crashes with the same
> error.
>
> TIA,
Are you running phpini() from command line? cli-php might be using
another php.ini
attached mail follows:
Marek Kilimajer wrote:
> Andrew Hill wrote:
> > The problem is that in my php.ini file, I have the line:
> >
> > memory_limit = 8M
> >
> > So, why is PHP reporting that the allowed memory size is 256M?
> > The phpinfo() function correctly reports that memory_limit is
> > set to 8M.
>
> Are you running phpini() from command line? cli-php might be using
> another php.ini
I've checked, and it's the same php.ini file.
Thanks,
--
Andrew Hill
Software Developer
Awarez Ltd.
Kirkman House, 12-14 Whitfield Street, London W1T 2RF
T: +44 (0)20 7299 7367 F: +44 (0)20 7299 7374
IRC: #max on freenode.net
attached mail follows:
> > Andrew Hill wrote:
> > > The problem is that in my php.ini file, I have the line:
> > >
> > > memory_limit = 8M
> > >
> > > So, why is PHP reporting that the allowed memory size is 256M?
> > > The phpinfo() function correctly reports that memory_limit is
> > > set to 8M.
I've just been informed off-list that phpDocumentor sets the memory
limit to 256M in the code.
Thanks all!
--
Andrew Hill
Software Developer
Awarez Ltd.
Kirkman House, 12-14 Whitfield Street, London W1T 2RF
T: +44 (0)20 7299 7367 F: +44 (0)20 7299 7374
IRC: #max on freenode.net
attached mail follows:
Hi there I am building a syndicate feed system for a client, it is
based on referer checking and a id is passed over, I could do what I do
with the expired url and generate a random string of some sort to login
the user automatically, but then it relies on the third party to have
php. I have tested with a referer spoofing app, and its true, it will
still let you through if you end up putting in the correct referring
domain which is join via the database. Is there another way around this
?
attached mail follows:
On 19/03/2005, at 2:06 AM, php-list-replies
listmail.innovate.net wrote:
> the other side of this is blocking legit users.
>
> if you base your access (at least in part) on the referrer (aka
> referer), you will block anyone who has turned them off in their
> browser or who is behind a firewall that doesn't pass them. both of
> these are increasingly available privacy options, and something that
> the user may, or may not, have control over.
>
>
I think you misunderstood me or I wasnt clear, the links are coming
from a syndicate site to the main site, so we check on that domain. I
am looking at other options, maybe someway of trasparently logging in ?
attached mail follows:
Dan Rossi wrote:
>
> On 19/03/2005, at 2:06 AM, php-list-replies
listmail.innovate.net wrote:
>
>> the other side of this is blocking legit users.
>>
>> if you base your access (at least in part) on the referrer (aka
>> referer), you will block anyone who has turned them off in their
>> browser or who is behind a firewall that doesn't pass them. both of
>> these are increasingly available privacy options, and something that
>> the user may, or may not, have control over.
>>
>>
>
> I think you misunderstood me or I wasnt clear, the links are coming from
> a syndicate site to the main site, so we check on that domain. I am
> looking at other options, maybe someway of trasparently logging in ?
>
You were not clear at all. What are you trying to do?
attached mail follows:
I have a litle problem with replaceing a string in some HTML code.
the html code is:
---
<img width="240" height="180"
src="01%20-%20Raptor%20AMD%20Sempron_image001.jpg">
---
I want to change the "01%20-%20Raptor%20AMD%20Sempron_image001.jpg" becouse
the location of the file will be changed after the upload.
the location for instains will be
"/images/uploaded/01%20-%20Raptor%20AMD%20Sempron_image001.jpg"
After the upload i have moved the image to the right location, and i can
access it trough the browser.
How can replace that string so that it will point to the right location?
I tryed a few preg_replace options, but i doesn't changes it. I think this
is becouse of the urlencoded string.
Does someone has en example?
The filename i get trough the $_FILE['userfile'] variable.
Thx in advance.
attached mail follows:
Hello people.
I have a doubt, I want to build an array of checkbox, why?
well because I list a recordset from data base, and I want to delete the
current record when the check is selected by the click mouse.
for example the editor of mail.yahoo.xx, that you can delete any mail when
you selected any checkbox.
somebody help me, please.
sincerely TOMAS
-------------------------------------------------------------------------
Este correo fue escaneado en busca de virus con el MDaemon Antivirus 2.27
en el dominio de correo angerona.cult.cu y no se encontro ninguna coincidencia.
attached mail follows:
I guess you have the experiences with VB development, right? :)
I think it is not a problem in php, because the index of an array in
php can be a string. That is the solution.You can name the checkboxes
in a certain sequence in your html doc.Then use array to judge in php,
such as foreach.
wish helps.
On Fri, 18 Mar 2005 12:31:40 -0800, Tomás Rodriguez Orta
<admin
angerona.cult.cu> wrote:
> Hello people.
>
> I have a doubt, I want to build an array of checkbox, why?
> well because I list a recordset from data base, and I want to delete the
> current record when the check is selected by the click mouse.
> for example the editor of mail.yahoo.xx, that you can delete any mail when
> you selected any checkbox.
>
> somebody help me, please.
>
> sincerely TOMAS
>
> -------------------------------------------------------------------------
> Este correo fue escaneado en busca de virus con el MDaemon Antivirus 2.27
> en el dominio de correo angerona.cult.cu y no se encontro ninguna coincidencia.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--
Sincerely,
Forest Liu(刘云赟)
attached mail follows:
Hello Tomás,
Friday, March 18, 2005, 1:31:40 PM, you wrote:
T> I have a doubt, I want to build an array of checkbox, why? well
T> because I list a recordset from data base, and I want to delete the
T> current record when the check is selected by the click mouse. for
T> example the editor of mail.yahoo.xx, that you can delete any mail
T> when you selected any checkbox.
<input type="checkbox" name="delete[]" value="<?php echo $r['id']; ?>" />
delete becomes your array
i.e. print_r($_POST['delete']);
$r['id'] is the record id from the DB.
Then do a foreach through the delete array and delete out records
where id = the "as" variable used in the foreach.
--
Leif (TB lists moderator and fellow end user).
Using The Bat! 3.0.9.7 Return (pre-beta) under Windows XP 5.1
Build 2600 Service Pack 2 on a Pentium 4 2GHz with 512MB
attached mail follows:
Hello,
my PHP is running as Apache module.
if safe_mode=on
function apache_request_headers() does not return Authorization headers
so there is no possibilty to validate "HTTP Digest Authorization ..."
if safe_mode=off
all wotks OK.
I send to browser :
Header( "HTTP/1.0 401 Unauthorized");
Header( "WWW-Authenticate: Digest realm=\"www.myrealm.sk\",
opaque=\"{$opaque}\", nonce=\"{$nonce}\", stale=\"{$stale}\",
qop=\"auth\"");
browser respond with HTTP header :
Authorization: Digest .....
which is OK, but this header is not included in apache_request_headers()
I thing, that is a bug ...
or can anyone help ?
Thank you
LacaK.
attached mail follows:
[code]
<?php
// Variable-ize all of the attributes of the file object
$binFile = $_FILES['binFile'];
$binFile_name = $_FILES['binFile']['name'];
$binFile_size = $_FILES['binFile']['size'];
$binFile_type = $_FILES['binFile']['type'];
$binFile_tmp = $_FILES['binFile']['tmp_name'];
// Get sender information
$author = "test";
$recipient = "test";
// Tracking information on the file
$date_submitted = date('Y-m-d H:i:s');
$txtDescription = "test";
$binFile_unique =
md5($author.$txtDescription.$binFile_name);
$email_id = "test";
$data = file_get_contents($binFile_tmp);
$bytes_in_data = strlen($data);
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
</head>
<body>
<form name="form1" enctype="multipart/form-data" method="post" action="">
<p>
<input name="binFile" type="file" size="50">
</p>
<p>
<input type="submit" name="Submit" value="Submit">
</p>
</form>
<?php echo $bytes_in_data; ?>
</body>
</html>
[/code]
Here is a proof of concept.. I loaded up the nVidia drivers to my default
tmp directory, then echoed out the strlen of the file when opened in
file_get_contents function. It gave out the correct size.
From here, I'm just going to see if it encrypts and spits out a different
(or no) number.
-----Original Message-----
From: Marek Kilimajer [mailto:lists
kilimajer.net]
Sent: Friday, March 18, 2005 4:26 AM
To: webphp
efastfunding.com
Cc: php-general
lists.php.net
Subject: Re: [PHP] Files upload - Encrypt into a variable - Do not
injectinto db (PHP/Apache/MySQL)
Steven Altsman wrote:
> Yes, the link is http://www.radinks.com/upload/config.php
>
> file_uploads = On
> upload_max_filesize = 40M
> max_input_time = 9000 (seconds)
> memory_limit (not limited, per handload config, from source)
> max_execution_time = 9000 (seconds)
> post_max_size = 40M
>
> also, hidden INPUT tag MAX_FILE_SIZE with value="40000", which I'm
guessing
> needs it in kilobytes.
It's in bytes.
Check apache's config, namely LimitRequestBody directive.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
Updated : It ain't MCRYPT.
[code]
<?php
// Variable-ize all of the attributes of the file object
$binFile = $_FILES['binFile'];
$binFile_name = $_FILES['binFile']['name'];
$binFile_size = $_FILES['binFile']['size'];
$binFile_type = $_FILES['binFile']['type'];
$binFile_tmp = $_FILES['binFile']['tmp_name'];
// Get sender information
$author = "test";
$recipient = "test";
// Tracking information on the file
$date_submitted = date('Y-m-d H:i:s');
$txtDescription = "test";
$binFile_unique =
md5($author.$txtDescription.$binFile_name);
$email_id = "test";
$data = file_get_contents($binFile_tmp);
$bytes_in_data = strlen($data);
$key = "supa_secret_key_type_thingie";
$input = $data;
$td = mcrypt_module_open('twofish', '', 'ecb', '');
$iv = mcrypt_create_iv (mcrypt_enc_get_iv_size($td),
MCRYPT_RAND);
mcrypt_generic_init($td, $key, $iv);
$encrypted_data = mcrypt_generic($td, $input);
$bytes_in_encrypted_data = strlen($encrypted_data);
mcrypt_generic_deinit($td);
mcrypt_module_close($td);
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
</head>
<body>
<form name="form1" enctype="multipart/form-data" method="post" action="">
<p>
<input name="binFile" type="file" size="50">
</p>
<p>
<input type="submit" name="Submit" value="Submit">
</p>
</form>
<?php echo $bytes_in_data; ?>
<br>
<?php echo $bytes_in_encrypted_data;?>
</body>
</html>
[/code]
-----Original Message-----
From: Marek Kilimajer [mailto:lists
kilimajer.net]
Sent: Friday, March 18, 2005 4:26 AM
To: webphp
efastfunding.com
Cc: php-general
lists.php.net
Subject: Re: [PHP] Files upload - Encrypt into a variable - Do not
injectinto db (PHP/Apache/MySQL)
Steven Altsman wrote:
> Yes, the link is http://www.radinks.com/upload/config.php
>
> file_uploads = On
> upload_max_filesize = 40M
> max_input_time = 9000 (seconds)
> memory_limit (not limited, per handload config, from source)
> max_execution_time = 9000 (seconds)
> post_max_size = 40M
>
> also, hidden INPUT tag MAX_FILE_SIZE with value="40000", which I'm
guessing
> needs it in kilobytes.
It's in bytes.
Check apache's config, namely LimitRequestBody directive.
--
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
attached mail follows:
Got packet bigger than 'max_allowed_packet'
... Gotta love mysql_error();
If I find out what causes this, I'll bring it over to this list too.. since
it's been pretty quiet, I guess I've gotten folks stumped.
attached mail follows:
AndreaD wrote:
> I keep getting a Warning: Missing argument 2 for check_zero() in
> c:\Inetpub\wwwroot\ecurry\order.php on line 5
>
> if ($name == "andrea") {
> $experience= 2;
> $age= 24
> check_zero($age, $experience);
> }
>
> This calls check which is at the very top of the page
>
> function check($age, $experience){ // this is line 5
Maybe you error is that check_zero() is spelled differently than check()?
Chris
--
Chris Shiflett
Brain Bulb, The PHP Consultancy
http://brainbulb.com/
attached mail follows:
Hey folks.
Has anybody played with this the PHP compiler for .NET, Phalanger?
http://www.php-compiler.net/
I'd be interested to hear of any experiences people have had using this.
Cheers,
Pablo
--------------------------------------------------
Pablo Gosse
Webmaster, University of Northern British Columbia
250.960.5621
gossep
unbc.ca
--------------------------------------------------
attached mail follows:
My marketing department create a csv file which later upload into
database. Everything was working fine - until upload they tried to make
two days ago. In that file there were few of products that drive me
crazy. The file is here: http://www.afan.net/7V_2005.csv The file has
just "troublemakers".
When you look at them with excel or any text editor - it looks just
fine. Can't see anything wrong.
But, when you display them using print_r() or foreach() or while()
functions the products will be splitted into 2 arrays:
This is product 07V0120 (index 0):
Array ( [0] => 07V0120 [1] => Ultra Cotton Heavyweight Tee [2] => 6.1
ounce, 100% cotton pre-shrunk jersey. Comfortable European cut with
double-needle topstitched neckline, double stitched sleeve and waist
hems. Seamless collar with taped neck & shoulders. Sizes S-2X. 3X, 4X
and 5X in select colors. [3] => Neutrals - **White, *Natural | Heathers
- **Ash, **Sport Grey | Colors - Leaf, Eggplant, *Stone Blue, *Cardinal
Red, Lime, *Kelly Green, Vegas Gold, Lt Pink, Ice Grey, *Gold, *Texas
Orange, Sapphire, Jade Dome, **Navy, *Forest Green, Steel, **Black,
*Orange, *Sand, Olive, **Red, *Charcoal, **Royal, Pine, *Prairie Dust,
*Lt Blue, Azalea, *Blue Dusk, *Indigo Blue, *Purple, *Maroon, Chestnut,
Violet, *Daisy | Color/ Size key: *available up to 3X, **available up to
5X [4] => Price includes 1-color screened imprint. Screen charge, add
$24.00(g) per color, per location. Additional imprint colors add $.42(c)
per color per location. Add $1.33(c) per 2X - 5X. [5] => 12 [6] => 24
[7] => 48 [8] => 72 [9] => 144 [10] => Screened - neutrals [11] => 5.29
[12] => 5.2 [13] => 5.15 [14] => 5.11 [15] => 3.69 [16] => [17] => [18]
=> [19] => [20] => [21] => [22] => Screened - heathers [23] => 5.89 [24]
=> 5.79 [25] => 5.73 [26] => 5.68 [27] => 4.26 [28] => [29] => [30] =>
[31] => [32] => [33] => [34] => Screened - colors [35] => 6.49 [36] =>
6.37 [37] => 6.32 [38] => 6.26 [39] => 4.82 [40] => [41] => [42] => [43]
=> [44] => [45] => [46] => 5c [47] => [48] => 5c [49] => [50] => 5c [51]
=> [52] => 46, [53] => [54] => [55] => [56] => [57] => [58] => 3 [59] =>
15 [60] => 2006 )
Array has alway 61 element. Index 0 is product ser. number and always
start with '07V0' and last element, index 60, is alway '2006'.
But, when I list it using print_r() function I'll get this:
Array ( [0] => 07V0120 [1] => Ultra Cotton Heavyweight Tee [2] => 6.1
ounce, 100% cotton pre-shrunk jersey. Comfortable European cut with
double-needle topstitched neckline, double stitched sleeve and waist
hems. Seamless collar with taped neck & shoulders. Sizes S-2X. 3X, 4X
and 5X in select colors. [3] => Neutrals - **White, *Natural | Heathers
- **Ash, **Sport Grey | Colors - Leaf, Eggplant, *Stone Blue, *Cardinal
Red, Lime, *Kelly Green, Vegas Gold, Lt Pink, Ice Grey, *Gold, *Texas
Orange, Sapphire, Jade Dome, **Navy, *Forest Green, Steel, **Black,
*Orange, *Sand, Olive, **Red, *Charcoal, **Royal, Pine, *Prairie Dust,
*Lt Blue, Azalea, *Blue Dusk, *Indigo Blue, *Purple, *Maroon, Chestnut,
Violet, *Daisy | Color/ Size key: *available up to 3X, **available up to
5X [4] => Price includes 1-color screened imprint. Screen charge, add
$24.00(g) per color, per location. Additional imprint colors add $.42(c)
per color per location. Add $1.33(c) per 2X - 5X. [5] => 12 [6] => 24
[7] => 48 [8] => 72 [9] => 144 [10] => Screened - neutrals [11] => 5.29
[12] => 5.2 [13] => 5.15 [14] => 5.11 [15] => 3.69 [16] => [17] => [18]
=> [19] => [20] => [21] => [22] => S )
------------------------------------------------------------------------
Array ( [0] => creened - heathers [1] => 5.89 [2] => 5.79 [3] => 5.73
[4] => 5.68 [5] => 4.26 [6] => [7] => [8] => [9] => [10] => [11] => [12]
=> Screened - colors [13] => 6.49 [14] => 6.37 [15] => 6.32 [16] => 6.26
[17] => 4.82 [18] => [19] => [20] => [21] => [22] => [23] => [24] => 5c
[25] => [26] => 5c [27] => [28] => 5c [29] => [30] => 46, [31] => [32]
=> [33] => [34] => [35] => [36] => 3 [37] => 15 [38] => 2006 )
The array is splitted into 2 arrays. As you ca see, this one is splitted
right in the middle of the content S*|*creened - heathers.
And, when I try to upload this into database I'll get error because
code's trying to insert 'creened - heathers' fro 2nd array as product
ser. number.
But, funny thing is it looks like it cut right after certain number of
characters of WHOLE ROW? As far as I was able to calculate, it breaks
between 951st and 993rd character.?
Also, if I delete certain number of characters from first array - same
number of characters will be pulled from 2nd to 1st array. If I delete
e.g., "neutrals" (8 characters) from [10] =>Screened - neutrals from 1st
array, first 8 characters from 2nd array, "creened ", from [0] =>
creened - heathers, will be moved to 1st array, and the array will look now:
Array ( [0] => 07V0120 [1] => Ultra Cotton Heavyweight Tee [2] => 6.1
ounce, 100% cotton pre-shrunk jersey. Comfortable European cut with
double-needle topstitched neckline, double stitched sleeve and waist
hems. Seamless collar with taped neck & shoulders. Sizes S-2X. 3X, 4X
and 5X in select colors. [3] => Neutrals - **White, *Natural | Heathers
- **Ash, **Sport Grey | Colors - Leaf, Eggplant, *Stone Blue, *Cardinal
Red, Lime, *Kelly Green, Vegas Gold, Lt Pink, Ice Grey, *Gold, *Texas
Orange, Sapphire, Jade Dome, **Navy, *Forest Green, Steel, **Black,
*Orange, *Sand, Olive, **Red, *Charcoal, **Royal, Pine, *Prairie Dust,
*Lt Blue, Azalea, *Blue Dusk, *Indigo Blue, *Purple, *Maroon, Chestnut,
Violet, *Daisy | Color/ Size key: *available up to 3X, **available up to
5X [4] => Price includes 1-color screened imprint. Screen charge, add
$24.00(g) per color, per location. Additional imprint colors add $.42(c)
per color per location. Add $1.33(c) per 2X - 5X. [5] => 12 [6] => 24
[7] => 48 [8] => 72 [9] => 144 [10] => Screened - neutrals [11] => 5.29
[12] => 5.2 [13] => 5.15 [14] => 5.11 [15] => 3.69 [16] => [17] => [18]
=> [19] => [20] => [21] => [22] => Screened )
------------------------------------------------------------------------
Array ( [0] => - heathers [1] => 5.89 [2] => 5.79 [3] => 5.73 [4] =>
5.68 [5] => 4.26 [6] => [7] => [8] => [9] => [10] => [11] => [12] =>
Screened - colors [13] => 6.49 [14] => 6.37 [15] => 6.32 [16] => 6.26
[17] => 4.82 [18] => [19] => [20] => [21] => [22] => [23] => [24] => 5c
[25] => [26] => 5c [27] => [28] => 5c [29] => [30] => 46, [31] => [32]
=> [33] => [34] => [35] => [36] => 3 [37] => 15 [38] => 2006 )
Any ideas what's going on???
I tried to explain as better as I can, but you can laugh to my English :)
-afan
attached mail follows:
I create XML file, how to pass the XML file to another server through HTTP?
Thanks
attached mail follows:
Jerry Swanson wrote:
> I create XML file, how to pass the XML file to another server through HTTP?
This is similar to asking how to ship a package, only there are even
more options. :-)
What is the other server's API? How are they expecting to be sent the
XML file? HTTP can practically be assumed, but this alone doesn't
provide enough information.
Chris
--
Chris Shiflett
Brain Bulb, The PHP Consultancy
http://brainbulb.com/
attached mail follows:
I generated XML file. I need to send the file to another server not
through FTP but though HTTP.
On Fri, 18 Mar 2005 14:17:28 -0500, Chris Shiflett <shiflett
php.net> wrote:
> Jerry Swanson wrote:
> > I create XML file, how to pass the XML file to another server through HTTP?
>
> This is similar to asking how to ship a package, only there are even
> more options. :-)
>
> What is the other server's API? How are they expecting to be sent the
> XML file? HTTP can practically be assumed, but this alone doesn't
> provide enough information.
>
> Chris
>
> --
> Chris Shiflett
> Brain Bulb, The PHP Consultancy
> http://brainbulb.com/
>
attached mail follows:
Jerry Swanson wrote:
> I generated XML file. I need to send the file to another server not
> through FTP but though HTTP.
Yes, I gathered that, but you're not telling us how you're supposed to
send it. For example, when Google first provided their web API, they
didn't say, "just send us an XML document." :-)
There are many details you're not giving us (you can leave out the
details involving the XML document itself, of course), so it's pretty
much impossible to even guess an answer to your question.
Chris
--
Chris Shiflett
Brain Bulb, The PHP Consultancy
http://brainbulb.com/
attached mail follows:
Chris Shiflett wrote:
> Jerry Swanson wrote:
>
>> I generated XML file. I need to send the file to another server not
>> through FTP but though HTTP.
>
>
> Yes, I gathered that, but you're not telling us how you're supposed to
> send it. For example, when Google first provided their web API, they
> didn't say, "just send us an XML document." :-)
>
> There are many details you're not giving us (you can leave out the
> details involving the XML document itself, of course), so it's pretty
> much impossible to even guess an answer to your question.
>
> Chris
>
Seriously... Chris is truly trying to help you. There are many, many
ways to send an XML file. The following are HTTP methods off of the top
of my head:
SOAP (possibly with WSDL)
Simple HTTP POST (usually through a form)
Simple HTTP GET (possibly through a form, though passing XML documents
through URL parameters is probably not "A Good Thing".)
It really depends on what the *receiving server* expects. Is there a
documented API? Or perhaps can you just point us to the page (URL) that
is supposed to receive the XML document?
--
Teach a man to fish...
NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-general&w=2
STFM | http://php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY |
http://mycroft.mozdev.org/download.html?name=PHP&submitform=Find+search+plugins
attached mail follows:
I suppose Jerry was talking about the possibilities, just like the
ways you listed.
And, perhaps Jerry have his own two servers, and wanna build a whole
system in which the servers communicate with ach other via xml doc. In
this case, I think SOAP is a better way for Jerry.
On Fri, 18 Mar 2005 16:03:20 -0500, Jason Barnett
<jason.barnett
telesuite.com> wrote:
> Chris Shiflett wrote:
> > Jerry Swanson wrote:
> >
> >> I generated XML file. I need to send the file to another server not
> >> through FTP but though HTTP.
> >
> >
> > Yes, I gathered that, but you're not telling us how you're supposed to
> > send it. For example, when Google first provided their web API, they
> > didn't say, "just send us an XML document." :-)
> >
> > There are many details you're not giving us (you can leave out the
> > details involving the XML document itself, of course), so it's pretty
> > much impossible to even guess an answer to your question.
> >
> > Chris
> >
>
> Seriously... Chris is truly trying to help you. There are many, many
> ways to send an XML file. The following are HTTP methods off of the top
> of my head:
>
> SOAP (possibly with WSDL)
> Simple HTTP POST (usually through a form)
> Simple HTTP GET (possibly through a form, though passing XML documents
> through URL parameters is probably not "A Good Thing".)
>
> It really depends on what the *receiving server* expects. Is there a
> documented API? Or perhaps can you just point us to the page (URL) that
> is supposed to receive the XML document?
>
> --
> Teach a man to fish...
>
> NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
> STFA | http://marc.theaimsgroup.com/?l=php-general&w=2
> STFM | http://php.net/manual/en/index.php
> STFW | http://www.google.com/search?q=php
> LAZY |
> http://mycroft.mozdev.org/download.html?name=PHP&submitform=Find+search+plugins
>
>
>
--
Sincerely,
Forest Liu(刘云赟)
attached mail follows:
problem solved.
while getting info from csv file I limited myself with 1000 charcters:
$data = fgetcsv($handle, 1000);
:)
afan
afan.net wrote:
> My marketing department create a csv file which later upload into
> database. Everything was working fine - until upload they tried to
> make two days ago. In that file there were few of products that drive
> me crazy. The file is here: http://www.afan.net/7V_2005.csv The file
> has just "troublemakers".
> When you look at them with excel or any text editor - it looks just
> fine. Can't see anything wrong.
>
> But, when you display them using print_r() or foreach() or while()
> functions the products will be splitted into 2 arrays:
>
> This is product 07V0120 (index 0):
> Array ( [0] => 07V0120 [1] => Ultra Cotton Heavyweight Tee [2] => 6.1
> ounce, 100% cotton pre-shrunk jersey. Comfortable European cut with
> double-needle topstitched neckline, double stitched sleeve and waist
> hems. Seamless collar with taped neck & shoulders. Sizes S-2X. 3X, 4X
> and 5X in select colors. [3] => Neutrals - **White, *Natural |
> Heathers - **Ash, **Sport Grey | Colors - Leaf, Eggplant, *Stone Blue,
> *Cardinal Red, Lime, *Kelly Green, Vegas Gold, Lt Pink, Ice Grey,
> *Gold, *Texas Orange, Sapphire, Jade Dome, **Navy, *Forest Green,
> Steel, **Black, *Orange, *Sand, Olive, **Red, *Charcoal, **Royal,
> Pine, *Prairie Dust, *Lt Blue, Azalea, *Blue Dusk, *Indigo Blue,
> *Purple, *Maroon, Chestnut, Violet, *Daisy | Color/ Size key:
> *available up to 3X, **available up to 5X [4] => Price includes
> 1-color screened imprint. Screen charge, add $24.00(g) per color, per
> location. Additional imprint colors add $.42(c) per color per
> location. Add $1.33(c) per 2X - 5X. [5] => 12 [6] => 24 [7] => 48 [8]
> => 72 [9] => 144 [10] => Screened - neutrals [11] => 5.29 [12] => 5.2
> [13] => 5.15 [14] => 5.11 [15] => 3.69 [16] => [17] => [18] => [19] =>
> [20] => [21] => [22] => Screened - heathers [23] => 5.89 [24] => 5.79
> [25] => 5.73 [26] => 5.68 [27] => 4.26 [28] => [29] => [30] => [31] =>
> [32] => [33] => [34] => Screened - colors [35] => 6.49 [36] => 6.37
> [37] => 6.32 [38] => 6.26 [39] => 4.82 [40] => [41] => [42] => [43] =>
> [44] => [45] => [46] => 5c [47] => [48] => 5c [49] => [50] => 5c [51]
> => [52] => 46, [53] => [54] => [55] => [56] => [57] => [58] => 3 [59]
> => 15 [60] => 2006 )
>
> Array has alway 61 element. Index 0 is product ser. number and always
> start with '07V0' and last element, index 60, is alway '2006'.
>
> But, when I list it using print_r() function I'll get this:
>
> Array ( [0] => 07V0120 [1] => Ultra Cotton Heavyweight Tee [2] => 6.1
> ounce, 100% cotton pre-shrunk jersey. Comfortable European cut with
> double-needle topstitched neckline, double stitched sleeve and waist
> hems. Seamless collar with taped neck & shoulders. Sizes S-2X. 3X, 4X
> and 5X in select colors. [3] => Neutrals - **White, *Natural |
> Heathers - **Ash, **Sport Grey | Colors - Leaf, Eggplant, *Stone Blue,
> *Cardinal Red, Lime, *Kelly Green, Vegas Gold, Lt Pink, Ice Grey,
> *Gold, *Texas Orange, Sapphire, Jade Dome, **Navy, *Forest Green,
> Steel, **Black, *Orange, *Sand, Olive, **Red, *Charcoal, **Royal,
> Pine, *Prairie Dust, *Lt Blue, Azalea, *Blue Dusk, *Indigo Blue,
> *Purple, *Maroon, Chestnut, Violet, *Daisy | Color/ Size key:
> *available up to 3X, **available up to 5X [4] => Price includes
> 1-color screened imprint. Screen charge, add $24.00(g) per color, per
> location. Additional imprint colors add $.42(c) per color per
> location. Add $1.33(c) per 2X - 5X. [5] => 12 [6] => 24 [7] => 48 [8]
> => 72 [9] => 144 [10] => Screened - neutrals [11] => 5.29 [12] => 5.2
> [13] => 5.15 [14] => 5.11 [15] => 3.69 [16] => [17] => [18] => [19] =>
> [20] => [21] => [22] => S )
> ------------------------------------------------------------------------
> Array ( [0] => creened - heathers [1] => 5.89 [2] => 5.79 [3] => 5.73
> [4] => 5.68 [5] => 4.26 [6] => [7] => [8] => [9] => [10] => [11] =>
> [12] => Screened - colors [13] => 6.49 [14] => 6.37 [15] => 6.32 [16]
> => 6.26 [17] => 4.82 [18] => [19] => [20] => [21] => [22] => [23] =>
> [24] => 5c [25] => [26] => 5c [27] => [28] => 5c [29] => [30] => 46,
> [31] => [32] => [33] => [34] => [35] => [36] => 3 [37] => 15 [38] =>
> 2006 )
>
> The array is splitted into 2 arrays. As you ca see, this one is
> splitted right in the middle of the content S*|*creened - heathers.
> And, when I try to upload this into database I'll get error because
> code's trying to insert 'creened - heathers' fro 2nd array as product
> ser. number.
>
> But, funny thing is it looks like it cut right after certain number of
> characters of WHOLE ROW? As far as I was able to calculate, it breaks
> between 951st and 993rd character.?
>
> Also, if I delete certain number of characters from first array - same
> number of characters will be pulled from 2nd to 1st array. If I delete
> e.g., "neutrals" (8 characters) from [10] =>Screened - neutrals from
> 1st array, first 8 characters from 2nd array, "creened ", from [0] =>
> creened - heathers, will be moved to 1st array, and the array will
> look now:
>
>
> Array ( [0] => 07V0120 [1] => Ultra Cotton Heavyweight Tee [2] => 6.1
> ounce, 100% cotton pre-shrunk jersey. Comfortable European cut with
> double-needle topstitched neckline, double stitched sleeve and waist
> hems. Seamless collar with taped neck & shoulders. Sizes S-2X. 3X, 4X
> and 5X in select colors. [3] => Neutrals - **White, *Natural |
> Heathers - **Ash, **Sport Grey | Colors - Leaf, Eggplant, *Stone Blue,
> *Cardinal Red, Lime, *Kelly Green, Vegas Gold, Lt Pink, Ice Grey,
> *Gold, *Texas Orange, Sapphire, Jade Dome, **Navy, *Forest Green,
> Steel, **Black, *Orange, *Sand, Olive, **Red, *Charcoal, **Royal,
> Pine, *Prairie Dust, *Lt Blue, Azalea, *Blue Dusk, *Indigo Blue,
> *Purple, *Maroon, Chestnut, Violet, *Daisy | Color/ Size key:
> *available up to 3X, **available up to 5X [4] => Price includes
> 1-color screened imprint. Screen charge, add $24.00(g) per color, per
> location. Additional imprint colors add $.42(c) per color per
> location. Add $1.33(c) per 2X - 5X. [5] => 12 [6] => 24 [7] => 48 [8]
> => 72 [9] => 144 [10] => Screened - neutrals [11] => 5.29 [12] => 5.2
> [13] => 5.15 [14] => 5.11 [15] => 3.69 [16] => [17] => [18] => [19] =>
> [20] => [21] => [22] => Screened )
> ------------------------------------------------------------------------
> Array ( [0] => - heathers [1] => 5.89 [2] => 5.79 [3] => 5.73 [4] =>
> 5.68 [5] => 4.26 [6] => [7] => [8] => [9] => [10] => [11] => [12] =>
> Screened - colors [13] => 6.49 [14] => 6.37 [15] => 6.32 [16] => 6.26
> [17] => 4.82 [18] => [19] => [20] => [21] => [22] => [23] => [24] =>
> 5c [25] => [26] => 5c [27] => [28] => 5c [29] => [30] => 46, [31] =>
> [32] => [33] => [34] => [35] => [36] => 3 [37] => 15 [38] => 2006 )
>
> Any ideas what's going on???
>
> I tried to explain as better as I can, but you can laugh to my English :)
>
> -afan
>
>
>
>
attached mail follows:
Hi,
I have a database where i store the username and date when he registered.
The time when he registered is using the time() function.
I want to display the date he registered in this format: year, month, day, hour, minute, second.
Please somebody tell me how can i do that.
I know is is very stupid from me that i've stored the date when a user register using the time() function.
Thank you very very much in advance for your help
attached mail follows:
MIME-Version: 1.0
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
Date: Fri, 18 Mar 2005 12:22:11 -0800
Message-ID: <97FD54B5E57A1842AA1A4B232E4761170B31DD
ati-ex-02.ati.local>
From: "Chris W. Parker" <cparker
swatgear.com>
To: <virtualsoftware
gmail.com>,
<php-general
lists.php.net>
Subject: RE: [PHP] Convert time
virtualsoftware
gmail.com <mailto:virtualsoftware
gmail.com>
on Friday, March 18, 2005 12:10 PM said:
> Hi,
Hello virtualsoftware!
> I want to display the date he registered in this format: year, month,
> day, hour, minute, second. Please somebody tell me how can i do that.
Take a look at: http://www.php.net/date
> I know is is very stupid from me that i've stored the date when a
> user register using the time() function.
No it's not stupid. The date() function was created for just such an
occassion.
> Thank you very very much in advance for your help
You're welcome.
Chris.
attached mail follows:
virtualsoftware
gmail.com wrote:
> Hi,
>
> I have a database where i store the username and date when he registered.
> The time when he registered is using the time() function.
>
> I want to display the date he registered in this format: year, month, day, hour, minute, second.
<?php
/** For more information, see http://php.net/manual/en/function.date.php */
/** Get this from the DB */
$time = time();
/** This is the formatting string. Change if you want a new format. */
$format = 'Y-m-d h:i:s';
/** Voila! Formatted timestamp. */
echo date($format, $time);
?>
--
Teach a man to fish...
NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-general&w=2
STFM | http://php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY |
http://mycroft.mozdev.org/download.html?name=PHP&submitform=Find+search+plugins
attached mail follows:
try something like
echo date("Y, m, d, g, i, s", $timevalue);
thats based on your example or you can do
echo date("m/d/Y g:i s", $timevalue);
which would show something like
05/19/2005 5:45 23
Jim's PHP Weblog
www.litfuel.net/plush
virtualsoftware
gmail.com wrote:
> Hi,
>
> I have a database where i store the username and date when he registered.
> The time when he registered is using the time() function.
>
> I want to display the date he registered in this format: year, month, day, hour, minute, second.
> Please somebody tell me how can i do that.
> I know is is very stupid from me that i've stored the date when a user register using the time() function.
>
> Thank you very very much in advance for your help
attached mail follows:
I am using the code at the top of this chapter to upload a file and move
to a given destination directory. I get the following error messages and
my file is not to be found. The only thing I am changing is where I want
the file to be stored.
Thanks.
Warning: move_uploaded_file(/images/tim.jpg): failed to open stream: No
such file or directory in
/usr/hsphere/local/home/ice-admi/iceagents.com/CxDatabase/fileuploadh.ph
p on line 20
Warning: move_uploaded_file(): Unable to move '/var/tmp/phpcrIqVo' to
'/images/tim.jpg' in
/usr/hsphere/local/home/ice-admi/iceagents.com/CxDatabase/fileuploadh.ph
p on line 20
Possible file upload attack!
Here is some more debugging info:Array
(
[userfile] => Array
(
[name] => tim.jpg
[type] => image/pjpeg
[tmp_name] => /var/tmp/phpcrIqVo
[error] => 0
[size] => 17024
)
)
attached mail follows:
Message-ID: <20050318222837.32436.qmail
lists.php.net>
To: php-general
lists.php.net
Date: Fri, 18 Mar 2005 17:26:10 -0500
From: Jason Barnett <jason.barnett
telesuite.com>
MIME-Version: 1.0
Content-Type: multipart/signed; micalg=pgp-sha1;
protocol="application/pgp-signature";
boundary="------------enigD86E6930E422096354F17BB0"
Subject: Re: Chapter 38. Handling file uploads
--------------enigD86E6930E422096354F17BB0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Timothy A. Whitley wrote:
> I am using the code at the top of this chapter to upload a file and move
> to a given destination directory. I get the following error messages and
> my file is not to be found. The only thing I am changing is where I want
> the file to be stored.
>
> Thanks.
>
> Warning: move_uploaded_file(/images/tim.jpg): failed to open stream: No
> such file or directory in
Do you have the folder /images ? Does the PHP user have write access to
this directory? PHP *might* also need X-ecute permissions on the directory.
> /usr/hsphere/local/home/ice-admi/iceagents.com/CxDatabase/fileuploadh.ph
> p on line 20
>
>
>
> Warning: move_uploaded_file(): Unable to move '/var/tmp/phpcrIqVo' to
> '/images/tim.jpg' in
> /usr/hsphere/local/home/ice-admi/iceagents.com/CxDatabase/fileuploadh.ph
> p on line 20
>
Does the PHP user have read / write access to the folder /var/tmp ?
>
> Possible file upload attack!
> Here is some more debugging info:Array
> (
> [userfile] => Array
> (
> [name] => tim.jpg
> [type] => image/pjpeg
> [tmp_name] => /var/tmp/phpcrIqVo
> [error] => 0
> [size] => 17024
> )
>
> )
Seems that the temp file was created ok because you have error code 0.
So the problem appears to be related to moving / writing the file to
/images/tim.jpg. Couple of possibilities off the top of my head:
- insufficient permissions (ls -l)
- open_basedir in php.ini (are you using it?)
- safe_mode in php.ini (are you using it?)
- /images is relative, but not in your include_path. If this is the
problem then using an absolute path should work.
--
Teach a man to fish...
NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-general&w=2
STFM | http://php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY |
http://mycroft.mozdev.org/download.html?name=PHP&submitform=Find+search+plugins
--------------enigD86E6930E422096354F17BB0
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (Cygwin)
iD8DBQFCO1WHGK7BL3TShWoRArjaAJ0V9mTSxEOUx2L4JooF4NvhgrTpbACfRmKq
cAfz9zgDksXODjwsclVKZJ8=
=GNeb
-----END PGP SIGNATURE-----
--------------enigD86E6930E422096354F17BB0--
attached mail follows:
Sorry to bother. I was hoping for inspiration. The code works. I wonder if there is a cleaner way?
John
> John Taylor-Johnston wrote:
> Hi,
>
> I've read:
>
> > http://dev.mysql.com/doc/mysql/en/create-table.html
>
> Would anyone code/approach this differently?
>
> #################################################
> $server = "localhost";
> $user = "myname";
> $pass = "mypass";
> $db = "mydb";
> $table = "demo_assignment1";
>
> #################################################
> $myconnection = mysql_connect($server,$user,$pass);
>
> #################################################
> $sql = "CREATE TABLE IF NOT EXISTS `demo_assignment1` (
> `StudentNumber` varchar(8) NOT NULL default '',
> `Exercise1` varchar(100) NOT NULL default '',
> `Exercise2` varchar(100) NOT NULL default '',
> `TimeStamp` timestamp(14) NOT NULL,
> PRIMARY KEY (`TimeStamp`)
> ) TYPE=MyISAM COMMENT='place something here';";
>
> mysql_select_db($db,$myconnection);
> mysql_query($sql) or die(print mysql_error());
>
> #################################################
> $sql = "INSERT INTO $table
> (StudentNumber,Exercise1,Exercise2) values
> ('$StudentNumber','$Exercise1','$Exercise2')";
>
> mysql_select_db($db,$myconnection);
> mysql_query($sql) or die(print mysql_error());
>
> mysql_close($myconnection);
--
John Taylor-Johnston
-----------------------------------------------------------------------------
"If it's not Open Source, it's Murphy's Law."
' ' ' Collège de Sherbrooke:
ô¿ô http://www.collegesherbrooke.qc.ca/languesmodernes/
- 819-569-2064
°v° Bibliography of Comparative Studies in Canadian, Québec and Foreign Literatures
/(_)\ Université de Sherbrooke
^ ^ http://compcanlit.ca/ T: 819.569.2064
attached mail follows:
hi
i am new to classes and i have a problem with a class i wrote
here is the class
-----------------------------------------------------------------------
class Company {
var $Company_Name;
var $Company_Referrer_Table;
var $Company_Visitor_Table;
var $Company_ID;
var $Message;
var $File;
var $FileName;
var $Record_Data;
function CompanyInfo (){
$SQL_Query = mysql_query("SELECT * FROM company_list WHERE
Company_ID = $this->Company_ID");
$Record = mysql_fetch_array($SQL_Query);
$this->Company_ID = $Record['Company_ID'];
$this->Company_Name = $Record['Company_Name'];
$this->Company_Referrer_Table = $Record['Company_Referrer_Table'];
$this->Company_Visitor_Table = $Record['Company_Visitor_Table'];
return $this->Company_Referrer_Table;
return $this->Company_Visitor_Table;
}
function GenerateUniqueID(){
return md5(uniqid(mt_rand(),TRUE));
}
function UploadFile($File) {
$this->File = $File;
$dst_file_name = $this->GenerateUniqueID();
$arr = split("\.",$this->File['name']);
$this->File['name'] = $dst_file_name;
$this->File['name'] .= ".".$arr[count($arr)-1];
$dest_dir = 'temp';
$dest = $dest_dir . '/' .$this->File['name'];
$r = move_uploaded_file($this->File['tmp_name'], $dest);
$this->FileName = $this->File['name'];
chmod("temp/".$this->FileName, 777);
}
function TakeData($File, $Company_ID, $Destination) {
$this->Company_ID = $Company_ID;
$this->CompanyInfo();
if ($Destination == "Referrer"){
$SQL_Query = "INSERT INTO $this->Company_Referrer_Table ( Record_ID
, Record_Data ) VALUES ( '', '$this->Record_Data')";
}elseif ($Destination == "Visitor"){
$SQL_Query = "INSERT INTO $this->Company_Visitor_Table ( Record_ID
, Record_Data ) VALUES ( '', '$this->Record_Data')";
}
$this->UploadFile($File);
$fh = fopen("temp/".$this->FileName, "r");
while (! feof($fh)) : $this->Record_Data = fgets($fh, 4096);
mysql_query($SQL_Query)or die("Error In Importing Records To The Database");
endwhile;
fclose($fh);
$this->Message = "Date Imported Successfully";
return $this->Message;
}
}
-------------------------------------------------------------------------------
the problem occurs when i call the function TakeDate
i use this code to call it
$Company = new Company();
$File =& $HTTP_POST_FILES['FileToUpload'];
$Company->TakeData($File, $Company_ID, $Destination);
$Message = $Company->Message;
the error i get is "Error In Importing Records To The Database" which
i defined as the error of mysql in the function.
i checked everything and found that the problem happens because i
can't retireve the values of
$this->Company_Referrer_Table and $this->Company_Visitor_Table by
calling the function CompanyInfo
from the function TakeData
can anyone advise me with the right way to call the CompanyInfo
function from the TakeData and get the values correctly?
--
Ahmed Abdel-Aliem
Web Developer
www.ApexScript.com
0101108551
registered Linux user number 382789
attached mail follows:
it shuold be:
$SQL_Query = "INSERT INTO ".$this->Company_Referrer_Table." ( Record_ID
, Record_Data ) VALUES ( '', '".$this->Record_Data."')";
just use the operator '.' to connect two string. I think php could
only identify simple car direcctly as $foo to be its value in a string
contain it. The reference to a class data member would not work well
in a string. So you should use the operator '.' to connect them.
On Sat, 19 Mar 2005 02:43:15 +0200, Ahmed Abdel-Aliem <me2resh
gmail.com> wrote:
> hi
>
> i am new to classes and i have a problem with a class i wrote
>
> here is the class
>
> -----------------------------------------------------------------------
> class Company {
>
> var $Company_Name;
> var $Company_Referrer_Table;
> var $Company_Visitor_Table;
> var $Company_ID;
> var $Message;
> var $File;
> var $FileName;
> var $Record_Data;
>
> function CompanyInfo (){
>
> $SQL_Query = mysql_query("SELECT * FROM company_list WHERE
> Company_ID = $this->Company_ID");
> $Record = mysql_fetch_array($SQL_Query);
>
> $this->Company_ID = $Record['Company_ID'];
> $this->Company_Name = $Record['Company_Name'];
> $this->Company_Referrer_Table = $Record['Company_Referrer_Table'];
> $this->Company_Visitor_Table = $Record['Company_Visitor_Table'];
>
> return $this->Company_Referrer_Table;
> return $this->Company_Visitor_Table;
>
> }
>
> function GenerateUniqueID(){
>
> return md5(uniqid(mt_rand(),TRUE));
>
> }
>
> function UploadFile($File) {
>
> $this->File = $File;
> $dst_file_name = $this->GenerateUniqueID();
> $arr = split("\.",$this->File['name']);
> $this->File['name'] = $dst_file_name;
> $this->File['name'] .= ".".$arr[count($arr)-1];
> $dest_dir = 'temp';
> $dest = $dest_dir . '/' .$this->File['name'];
> $r = move_uploaded_file($this->File['tmp_name'], $dest);
> $this->FileName = $this->File['name'];
> chmod("temp/".$this->FileName, 777);
>
> }
>
> function TakeData($File, $Company_ID, $Destination) {
>
> $this->Company_ID = $Company_ID;
>
> $this->CompanyInfo();
>
> if ($Destination == "Referrer"){
>
> $SQL_Query = "INSERT INTO $this->Company_Referrer_Table ( Record_ID
> , Record_Data ) VALUES ( '', '$this->Record_Data')";
>
> }elseif ($Destination == "Visitor"){
>
> $SQL_Query = "INSERT INTO $this->Company_Visitor_Table ( Record_ID
> , Record_Data ) VALUES ( '', '$this->Record_Data')";
>
> }
>
> $this->UploadFile($File);
>
> $fh = fopen("temp/".$this->FileName, "r");
> while (! feof($fh)) : $this->Record_Data = fgets($fh, 4096);
> mysql_query($SQL_Query)or die("Error In Importing Records To The Database");
> endwhile;
> fclose($fh);
>
> $this->Message = "Date Imported Successfully";
> return $this->Message;
>
> }
>
> }
>
> -------------------------------------------------------------------------------
>
> the problem occurs when i call the function TakeDate
>
> i use this code to call it
>
> $Company = new Company();
> $File =& $HTTP_POST_FILES['FileToUpload'];
> $Company->TakeData($File, $Company_ID, $Destination);
> $Message = $Company->Message;
>
> the error i get is "Error In Importing Records To The Database" which
> i defined as the error of mysql in the function.
>
> i checked everything and found that the problem happens because i
> can't retireve the values of
> $this->Company_Referrer_Table and $this->Company_Visitor_Table by
> calling the function CompanyInfo
> from the function TakeData
>
> can anyone advise me with the right way to call the CompanyInfo
> function from the TakeData and get the values correctly?
>
> --
> Ahmed Abdel-Aliem
> Web Developer
> www.ApexScript.com
> 0101108551
> registered Linux user number 382789
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--
Sincerely,
Forest Liu(刘云赟)
attached mail follows:
Hi everyone,
I have been very intrigued by the way Gentoo.org offers its
documentation. The documents are stored using a series of XML files and
are delivered via XSLT via some ruby scripts.
Are there any similar frameworks, solutions availble for the PHP world?
Devraj
--
Devraj Mukherjee (devraj
eternitytechnologies.com)
Eternity Technologies Pty. Ltd. ACN 107 600 975
P O Box 5949 Wagga Wagga NSW 2650 Australia
Voice: +61-2-69717131 / Fax: +61-2-69251039
http://www.eternitytechnologies.com/
- application/pgp-signature attachment: OpenPGP digital signature
- application/pgp-signature attachment: OpenPGP digital signature
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]