php-general Digest 1 Jun 2007 12:25:25 -0000 Issue 4823

2007-06-01 Thread php-general-digest-help

php-general Digest 1 Jun 2007 12:25:25 - Issue 4823

Topics (messages 255937 through 255964):

Re: Removing PHPSESSID - CGI Install
255937 by: Richard Lynch

Re: uploading really big files
255938 by: Richard Lynch

Re: local v remote
255939 by: Richard Lynch
255940 by: Richard Lynch

Re: Streaming download to IE doesn't work
255941 by: Richard Lynch

Re: using mysql_escape_string with implode() !!
255942 by: Richard Lynch
255949 by: Jim Lucas

Re: exec dont work for svn
255943 by: Richard Lynch

Re: preg_match() returns false but no documentation why
255944 by: Richard Lynch
255945 by: Richard Lynch
255946 by: Richard Lynch
255950 by: Stut

Re: find (matching) person in other table
255947 by: Richard Lynch
255948 by: Daevid Vincent

Re: How do YOU initialize the form variables?
255951 by: Richard Lynch

ZIP it :o)
255952 by: Auto-Deppe, C. Haensel
255953 by: Stut
255954 by: Jim Lucas
255955 by: Chris
255958 by: Tijnema
255959 by: Auto-Deppe, C. Haensel

PCRE Error/Issue...
255956 by: bruce

Strange Warning, PHP sessions
255957 by: Sachin mahajan

linking to an image with document_root
255960 by: blueboy
255961 by: Chris
255962 by: Shafiq Rehman
255963 by: clive

Re: [SPAM] Re: [PHP] Attempting to search a MySQL database from PHP not  working
255964 by: Jason Pruim

Administrivia:

To subscribe to the digest, e-mail:
[EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
[EMAIL PROTECTED]

To post to the list, e-mail:
[EMAIL PROTECTED]


--
---BeginMessage---
On Thu, May 31, 2007 5:55 am, Shaun wrote:
 I have PHP installed as a CGI module on my server. I want to stop
 PHPSESSID
 from appearing in the URL when a users cookies are turned for just one
 account. My hosting company says that this is impossible - they would
 have
 to change php.ini and that would affect every account on the server.
 Also if
 PHP is changed to an Apache module then they won't support it. Is
 there no
 other way around this?

Perhaps you can turn it off in .htaccess

Does CGI utilize .htaccess???

Perhaps you could get them to use suExec and run your CGI with a
different user and environment (i.e., different php.ini) if they don't
want to use Module.

 Removing PHPSESSID is very important for SEO
 purposes...

Really?

I'd expect that the search engine authors are smart enough to not be
messed up by something as common as PHPSESSID in a URL.

Can you provide any objective independent study reference to support
such a claim?

Much SEO information out there is utter crap...

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?
---End Message---
---BeginMessage---
On Thu, May 31, 2007 5:07 am, Angelo Zanetti wrote:
 thanks for the replies. But how does a site like:
 http://www.yousendit.com/ do the upload of really huge files?
 Normal upload?

I guess they've already worked through all the issues, assuming their
service actually works...

Or, perhaps, they don't really care about users on slow/flaky
connections, and simply refund anybody who is unhappy.

I dunno.

Ask them. :-)

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?
---End Message---
---BeginMessage---
On Thu, May 31, 2007 4:50 am, blueboy wrote:
 On my localhost this works fine

 $result= mysql_query(SELECT date_format(date, '%d/%m/%Y') as date,
 title,
 id, display FROM NEWS);
 while ($row = mysql_fetch_assoc($result)) {

 but on my remote i get a mysql_fetch_assoc(): supplied argument is not
 a
 valid MySQL result resource

 Can someone expalin the problem? PHP version problem?

The problem is probably that you never even managed to connect to the
MySQL database in the first place...

But it could be something else entirely.

We can't tell you, but you can find out by using the mysql_error()
function a lot.

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?
---End Message---
---BeginMessage---
On Thu, May 31, 2007 8:07 am, M. Sokolewicz wrote:
 In case you didn't know, 99% of code on this planet using mysql_query
 does not supply the secondary argument as most code-bases don't use 
 1
 connection in the same script.

That does not make it a Good Practice...

I spent days fixing somebody else's code who thought they were opening
a second connection (not) and then were closing it (yep) but they were
actually closing *MY* database connection, because they were too lazy
to type that second arg.

I personally think you 

[PHP] Strange Warning, PHP sessions

2007-06-01 Thread Sachin mahajan
Can anyone clarify this..

?php
/* Warning: Unknown: Your script possibly relies on a session side-effect which 
existed until PHP 4.2.3. Please be advised that the session extension does not 
consider global variables as a source of data, unless register_globals is 
enabled. You can disable this functionality and this warning by setting 
session.bug_compat_42 or session.bug_compat_warn to off, respectively. in 
Unknown on line 0 */
//CAN ANYONE HELP ME FINDOUT WHERES THE PROBLEM??!??
//WHEN I COMMENT EITHER LINE 2 OR 3, THERE IS NO WARNING
session_start();
$arrFormData = $_POST;
$_SESSION['arrFormData'] = $arr;//$arrFormData;//phpinfo();
?
form id=frmUser method=post
 First Name: input type=text name=fName / br/
 Last Name: input type=text name=lName / br/
 input type=submit name=btnAdd value=add /
/form


Regards,
Sachin
([EMAIL PROTECTED])

[PHP] PCRE Error/Issue...

2007-06-01 Thread bruce
Hi...

Trying to install/test a php app, and I get the following error'/issue...

Compilation failed: this version of PCRE is not compiled with PCRE_UTF8
support...

I'm not sure if this is an OS issue, a PHP issue, or from the app. I'd
prefer to not have to build php from source/scratch, as I might screw up
other apps/apache/etc...

Looking over the 'net hasn't really shed any light on this.

I have:
 Fedora 5
 PHP 5.1.6

Thanks for any thoughts/pointers/etc...

-bruce

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



Re: [PHP] ZIP it :o)

2007-06-01 Thread Tijnema

On 6/1/07, Chris [EMAIL PROTECTED] wrote:

Auto-Deppe, C. Haensel wrote:
 Morning guys,

 I have been trying to find an easy to use way to zip an archive on a linux
 box running PHP5. Now I've tried the zip-lib.php and others, but they
 always
 throw an error msg But that is not the question.

 I am looking to use exec(zip archive.zip $directory);  $directory has
 been
 tried with both full path and relative path ... but that doesn't work. I
 don't get an error, it just doesn't create the zip-file...

 So, after a day of Google-ing and trying, I thought I might ask you for
 help.

 Cheers for any answers and hints.

http://pear.php.net/package/Archive_Zip and/or
http://pear.php.net/package/File_Archive

and please create a *new* message instead of replying to an existing one
and changing the topic. It screws up message threading (in email clients
and in the archives).


Not in gmail :)

I had same problem lately, wanted also to create zip files from PHP, i
tried various build in functions, but i ended up with the exec way.
It has been said before, but PHP probably doesn't have the right
permissions to write the .zip file, so i would recommend you to write
to /tmp first.

Tijnema





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



Re: [PHP] linking to an image with document_root

2007-06-01 Thread Chris

blueboy wrote:

May be a stupid question but can I link to images with doscument root

$img_url= $_SERVER['DOCUMENT_ROOT'].'/images/holder.gif';

echo img src=\$img_url\ width=\250\ height=\163\/;


An image source is the URL to that image.

The server document root is the local location of that file (eg 
/home/user/file.gif) - which is never going to work as a URL.


--
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP] linking to an image with document_root

2007-06-01 Thread Shafiq Rehman

Hi,

You cannot use document_root to get the paths for images. You can write a
function to get the images url in your application.

function imageServer()
{
  return /images/;
}

--
Shafiq Rehman (ZCE)
http://www.phpgurru.com | http://shafiq.pk
Cell: +92 300 423 9385


On 6/1/07, Chris [EMAIL PROTECTED] wrote:


blueboy wrote:
 May be a stupid question but can I link to images with doscument root

 $img_url= $_SERVER['DOCUMENT_ROOT'].'/images/holder.gif';

 echo img src=\$img_url\ width=\250\ height=\163\/;

An image source is the URL to that image.

The server document root is the local location of that file (eg
/home/user/file.gif) - which is never going to work as a URL.

--
Postgresql  php tutorials
http://www.designmagick.com/

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




Re: [PHP] ZIP it :o)

2007-06-01 Thread Auto-Deppe, C. Haensel

Hi guys,

thanks to Jim, I made it :o) Here's the source I'm using for testing now... 
it works. I just need to make it less vulnerable ;o)


- SNIP -
?
$nr  = $_GET['nr'];
if(eregi(../, $nr)) {
die(Hier wird nicht rumgehackt);
}
$directory = '_kfz_images/'.$nr.'/full/';
$dir = opendir($directory);
$i = 1;
while($file = readdir($dir)) {
$dest = temp/Auto-Deppe-.$nr._.$i..jpg;
if(eregi(jpg, $file)) {
 copy($directory.$file, $dest);
 $i++;
}
}
$now = time();
header(Content-Type: application/force-download);
header('Content-Disposition: attachment; 
filename=Auto-Deppe-'.$now.'_Download.zip');

exec(zip .$now._archive.zip temp/* 21, $output);
readfile($now._archive.zip);
$tempdir = opendir(temp);
while($tempfile = readdir($tempdir)) {
if(eregi(jpg, $tempfile)) {
 unlink(temp/.$tempfile);
}
}
?
- SNAP -
So I am copying the files to a temp dir, and then zip em up, delete them 
afterwards. I copy them to the dir so I wouldn't have the whole 
/kfz_images/number/full/ structure in the zip).


Aaaanyhow, it works, it does work fast enough, and I am happy :o)

Thanks a bunch, guys, and have a great day!

This is Christian Haensel live from Extertal, Germany. Back to you.

-:oD)=


- Original Message - 
From: Tijnema [EMAIL PROTECTED]

To: Chris [EMAIL PROTECTED]
Cc: Auto-Deppe, C. Haensel [EMAIL PROTECTED]; 
php-general@lists.php.net

Sent: Friday, June 01, 2007 9:27 AM
Subject: Re: [PHP] ZIP it :o)



On 6/1/07, Chris [EMAIL PROTECTED] wrote:

Auto-Deppe, C. Haensel wrote:
 Morning guys,

 I have been trying to find an easy to use way to zip an archive on a 
 linux

 box running PHP5. Now I've tried the zip-lib.php and others, but they
 always
 throw an error msg But that is not the question.

 I am looking to use exec(zip archive.zip $directory);  $directory has
 been
 tried with both full path and relative path ... but that doesn't work. 
 I

 don't get an error, it just doesn't create the zip-file...

 So, after a day of Google-ing and trying, I thought I might ask you for
 help.

 Cheers for any answers and hints.

http://pear.php.net/package/Archive_Zip and/or
http://pear.php.net/package/File_Archive

and please create a *new* message instead of replying to an existing one
and changing the topic. It screws up message threading (in email clients
and in the archives).


Not in gmail :)

I had same problem lately, wanted also to create zip files from PHP, i
tried various build in functions, but i ended up with the exec way.
It has been said before, but PHP probably doesn't have the right
permissions to write the .zip file, so i would recommend you to write
to /tmp first.

Tijnema







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



[PHP] linking to an image with document_root

2007-06-01 Thread blueboy
May be a stupid question but can I link to images with doscument root

$img_url= $_SERVER['DOCUMENT_ROOT'].'/images/holder.gif';

echo img src=\$img_url\ width=\250\ height=\163\/;

I am certain the path is correct,

If not what are my alternatives?


R. 

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



Re: [PHP] linking to an image with document_root

2007-06-01 Thread clive

blueboy wrote:

May be a stupid question but can I link to images with doscument root

there are no stupid questions, only stupid answers.


$img_url= $_SERVER['DOCUMENT_ROOT'].'/images/holder.gif';


no you cant;

do this in a script on your server:

echo pre;
print_r($_SERVER);

and have look at the variables you can make use of, I would imagine 
$_SERVER[SERVER_NAME] might be the ones you want.


clive



echo img src=\$img_url\ width=\250\ height=\163\/;

I am certain the path is correct,

If not what are my alternatives?


R. 




--
Regards,

Clive.

Real Time Travel Connections


{No electrons were harmed in the creation, transmission or reading of 
this email. However, many were excited and some may well have enjoyed 
the experience.}


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



[PHP] Re: [SPAM] Re: [PHP] Attempting to search a MySQL database from PHP not working

2007-06-01 Thread Jason Pruim


On May 31, 2007, at 5:43 PM, Richard Lynch wrote:




On Thu, May 31, 2007 2:25 pm, Jason Pruim wrote:

Hi Everyone, I am attempting to setup a search field on a database
application I'm dinking around with and running into problems that
I'm hoping someone might be able to shed some light on.

Here is the code I am using to display the results of the search:

echo ('table border=1');
echo trthFirst Name/ththAuthor/ththPages/th/tr;

$result_row[] = mysql_query($query) or die(mysql_error());


I also have to wonder why you are building an array of query result
resources...

You probably could do this with just one SQL query and some order by
clauses to get what you want, without hitting the DB so much.


To use the newbie scape goat, I don't know how else to do it, and it  
seems to work :)


What would you recommend?

I am always open to find ways to make my code better/faster/more secure.

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



Re: [PHP] uploading really big files

2007-06-01 Thread clive

Angelo Zanetti wrote:

Dear all

We need to develop a system where we can upload really big files. IE 15 
- 25 Mb.


I know its not a php answer, but if you have ever uploaded a file with 
facebook then you will have seen the little applet they push down to 
your browser, perhaps investigating something like might prove useful, I 
doubt they wrote it themselves, then again maybe they did.



--
Regards,

Clive.

Real Time Travel Connections


{No electrons were harmed in the creation, transmission or reading of 
this email. However, many were excited and some may well have enjoyed 
the experience.}


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



Re: [PHP] uploading really big files

2007-06-01 Thread Angelo Zanetti



clive wrote:

Angelo Zanetti wrote:

Dear all

We need to develop a system where we can upload really big files. IE 
15 - 25 Mb.


I know its not a php answer, but if you have ever uploaded a file with 
facebook then you will have seen the little applet they push down to 
your browser, perhaps investigating something like might prove useful, 
I doubt they wrote it themselves, then again maybe they did.



yeah seen that its a Java applet was going to research it but didnt have 
time. Quite a cool component though!


Thanks

--

Angelo Zanetti
Systems developer


*Telephone:* +27 (021) 469 1052
*Mobile:*   +27 (0) 72 441 3355
*Fax:*+27 (0) 86 681 5885
*
Web:* http://www.zlogic.co.za
*E-Mail:* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED]

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



[PHP] Re: linking to an image with document_root

2007-06-01 Thread zerof

blueboy escreveu:

May be a stupid question but can I link to images with doscument root

$img_url= $_SERVER['DOCUMENT_ROOT'].'/images/holder.gif';

echo img src=\$img_url\ width=\250\ height=\163\/;

I am certain the path is correct,

If not what are my alternatives?


R. 

--
I think the best solution is to set the image path using de define function.

@define (PATHTOIMG, the_path/, true );

echo 'img src=' .
PATHTOIMG . 'image.png border=0 alt=image.png title=Image title /';

--
zerof
http://www.educar.pro.br/
Apache - PHP - MySQL - Boolean Logics - Project Management
--
Você deve, sempre, consultar uma segunda opinião!
--
Deixe todos saberem se esta informação foi-lhe útil.
--  
You must hear, always, one second opinion! In all cases.
--
Let the people know if this info was useful for you!
--

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



Re: [PHP] ZIP it :o)

2007-06-01 Thread Jim Lucas

Auto-Deppe, C. Haensel wrote:

Hi guys,

thanks to Jim, I made it :o) Here's the source I'm using for testing 
now... it works. I just need to make it less vulnerable ;o)


- SNIP -
?
$nr  = $_GET['nr'];
if(eregi(../, $nr)) {
die(Hier wird nicht rumgehackt);
}
$directory = '_kfz_images/'.$nr.'/full/';
$dir = opendir($directory);
$i = 1;
while($file = readdir($dir)) {
$dest = temp/Auto-Deppe-.$nr._.$i..jpg;
if(eregi(jpg, $file)) {
 copy($directory.$file, $dest);
 $i++;
}
}
$now = time();
header(Content-Type: application/force-download);
header('Content-Disposition: attachment; 
filename=Auto-Deppe-'.$now.'_Download.zip');

exec(zip .$now._archive.zip temp/* 21, $output);
readfile($now._archive.zip);
$tempdir = opendir(temp);
while($tempfile = readdir($tempdir)) {
if(eregi(jpg, $tempfile)) {
 unlink(temp/.$tempfile);
}
}
?
- SNAP -
So I am copying the files to a temp dir, and then zip em up, delete them 
afterwards. I copy them to the dir so I wouldn't have the whole 
/kfz_images/number/full/ structure in the zip).


Aaaanyhow, it works, it does work fast enough, and I am happy :o)

Thanks a bunch, guys, and have a great day!

This is Christian Haensel live from Extertal, Germany. Back to you.

-:oD)=


- Original Message - From: Tijnema [EMAIL PROTECTED]
To: Chris [EMAIL PROTECTED]
Cc: Auto-Deppe, C. Haensel [EMAIL PROTECTED]; 
php-general@lists.php.net

Sent: Friday, June 01, 2007 9:27 AM
Subject: Re: [PHP] ZIP it :o)



On 6/1/07, Chris [EMAIL PROTECTED] wrote:

Auto-Deppe, C. Haensel wrote:
 Morning guys,

 I have been trying to find an easy to use way to zip an archive on 
a  linux

 box running PHP5. Now I've tried the zip-lib.php and others, but they
 always
 throw an error msg But that is not the question.

 I am looking to use exec(zip archive.zip $directory);  $directory 
has

 been
 tried with both full path and relative path ... but that doesn't 
work.  I

 don't get an error, it just doesn't create the zip-file...

 So, after a day of Google-ing and trying, I thought I might ask you 
for

 help.

 Cheers for any answers and hints.

http://pear.php.net/package/Archive_Zip and/or
http://pear.php.net/package/File_Archive

and please create a *new* message instead of replying to an existing one
and changing the topic. It screws up message threading (in email clients
and in the archives).


Not in gmail :)

I had same problem lately, wanted also to create zip files from PHP, i
tried various build in functions, but i ended up with the exec way.
It has been said before, but PHP probably doesn't have the right
permissions to write the .zip file, so i would recommend you to write
to /tmp first.

Tijnema








Here's a link to the zip class that I use

http://www.phpclasses.org/browse/package/945.html

One thing though, your PHP install has to be compiled with --with-zlib

That was the only thing that I ran into with this.

Since you are creating files to download, with this class, you don't even need to write them to the 
filesystem.  You just create the archive in memory (given that you have enough RAM  php is allowed 
to consume as much memory as it would take the create the archive) and then dump it to the browser 
instead of using readfile().  You save the time/space/headaches of trying to write your zip file to 
the filesystem.




--
Jim Lucas

   Some men are born to greatness, some achieve greatness,
   and some have greatness thrust upon them.

Unknown

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



Re: [PHP] ini_set() security question

2007-06-01 Thread Samuel Vogel

I just tried it with php 5.2.3. Same behavior!

Do you agree that overwriting the value shouldn't be possible with 
ini_set() ?


I will file a bug report!

Richard Lynch schrieb:

File a bug report then, and see what happens...

But you may want to test with most recent versions if you are not
already on current PHP versions.

On Thu, May 31, 2007 2:46 pm, Samuel Vogel wrote:
  

There is no bug filed for this. There is only one older bug (
http://bugs.php.net/bug.php?id=38804 ) which makes me think
overwriting
with ini_set() shouldn't be possible!

Richard Lynch schrieb:


On Wed, May 30, 2007 3:34 pm, Samuel Vogel wrote:

  

And what happens if you try to allocate 3M of data?

$foo = str_repeat('.', 3145728);


  

Nothing. It does it without any errors. I can allocate up to 20MB
(well
a little bit less of course).



Check http://bugs.php.net and see if it's a known issue or an
exception to the php_admin_* rule or...


  



  


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



Re: [PHP] ZIP it :o)

2007-06-01 Thread Tijnema

On 6/1/07, Jim Lucas [EMAIL PROTECTED] wrote:

Auto-Deppe, C. Haensel wrote:
 Hi guys,

 thanks to Jim, I made it :o) Here's the source I'm using for testing
 now... it works. I just need to make it less vulnerable ;o)

 - SNIP -
 ?
 $nr  = $_GET['nr'];
 if(eregi(../, $nr)) {
 die(Hier wird nicht rumgehackt);
 }
 $directory = '_kfz_images/'.$nr.'/full/';
 $dir = opendir($directory);
 $i = 1;
 while($file = readdir($dir)) {
 $dest = temp/Auto-Deppe-.$nr._.$i..jpg;
 if(eregi(jpg, $file)) {
  copy($directory.$file, $dest);
  $i++;
 }
 }
 $now = time();
 header(Content-Type: application/force-download);
 header('Content-Disposition: attachment;
 filename=Auto-Deppe-'.$now.'_Download.zip');
 exec(zip .$now._archive.zip temp/* 21, $output);
 readfile($now._archive.zip);
 $tempdir = opendir(temp);
 while($tempfile = readdir($tempdir)) {
 if(eregi(jpg, $tempfile)) {
  unlink(temp/.$tempfile);
 }
 }
 ?
 - SNAP -
 So I am copying the files to a temp dir, and then zip em up, delete them
 afterwards. I copy them to the dir so I wouldn't have the whole
 /kfz_images/number/full/ structure in the zip).

 Aaaanyhow, it works, it does work fast enough, and I am happy :o)

 Thanks a bunch, guys, and have a great day!

 This is Christian Haensel live from Extertal, Germany. Back to you.

 -:oD)=


 - Original Message - From: Tijnema [EMAIL PROTECTED]
 To: Chris [EMAIL PROTECTED]
 Cc: Auto-Deppe, C. Haensel [EMAIL PROTECTED];
 php-general@lists.php.net
 Sent: Friday, June 01, 2007 9:27 AM
 Subject: Re: [PHP] ZIP it :o)


 On 6/1/07, Chris [EMAIL PROTECTED] wrote:
 Auto-Deppe, C. Haensel wrote:
  Morning guys,
 
  I have been trying to find an easy to use way to zip an archive on
 a  linux
  box running PHP5. Now I've tried the zip-lib.php and others, but they
  always
  throw an error msg But that is not the question.
 
  I am looking to use exec(zip archive.zip $directory);  $directory
 has
  been
  tried with both full path and relative path ... but that doesn't
 work.  I
  don't get an error, it just doesn't create the zip-file...
 
  So, after a day of Google-ing and trying, I thought I might ask you
 for
  help.
 
  Cheers for any answers and hints.

 http://pear.php.net/package/Archive_Zip and/or
 http://pear.php.net/package/File_Archive

 and please create a *new* message instead of replying to an existing one
 and changing the topic. It screws up message threading (in email clients
 and in the archives).

 Not in gmail :)

 I had same problem lately, wanted also to create zip files from PHP, i
 tried various build in functions, but i ended up with the exec way.
 It has been said before, but PHP probably doesn't have the right
 permissions to write the .zip file, so i would recommend you to write
 to /tmp first.

 Tijnema




Here's a link to the zip class that I use

http://www.phpclasses.org/browse/package/945.html

One thing though, your PHP install has to be compiled with --with-zlib

That was the only thing that I ran into with this.

Since you are creating files to download, with this class, you don't even need 
to write them to the
filesystem.  You just create the archive in memory (given that you have enough RAM 
 php is allowed
to consume as much memory as it would take the create the archive) and then 
dump it to the browser

Yes, but what happens when you try to create a 1GB archive with 512MB
RAM? (and no swap space too)
or if 100s of people call the same script that creates a 10-20MB file?
If you use the exec way, this will go fine :)

Tijnema

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



Re: [PHP] ZIP it :o)

2007-06-01 Thread Jim Lucas

Tijnema wrote:

On 6/1/07, Jim Lucas [EMAIL PROTECTED] wrote:

Auto-Deppe, C. Haensel wrote:
 Hi guys,

 thanks to Jim, I made it :o) Here's the source I'm using for testing
 now... it works. I just need to make it less vulnerable ;o)

 - SNIP -
 ?
 $nr  = $_GET['nr'];
 if(eregi(../, $nr)) {
 die(Hier wird nicht rumgehackt);
 }
 $directory = '_kfz_images/'.$nr.'/full/';
 $dir = opendir($directory);
 $i = 1;
 while($file = readdir($dir)) {
 $dest = temp/Auto-Deppe-.$nr._.$i..jpg;
 if(eregi(jpg, $file)) {
  copy($directory.$file, $dest);
  $i++;
 }
 }
 $now = time();
 header(Content-Type: application/force-download);
 header('Content-Disposition: attachment;
 filename=Auto-Deppe-'.$now.'_Download.zip');
 exec(zip .$now._archive.zip temp/* 21, $output);
 readfile($now._archive.zip);
 $tempdir = opendir(temp);
 while($tempfile = readdir($tempdir)) {
 if(eregi(jpg, $tempfile)) {
  unlink(temp/.$tempfile);
 }
 }
 ?
 - SNAP -
 So I am copying the files to a temp dir, and then zip em up, delete 
them

 afterwards. I copy them to the dir so I wouldn't have the whole
 /kfz_images/number/full/ structure in the zip).

 Aaaanyhow, it works, it does work fast enough, and I am happy :o)

 Thanks a bunch, guys, and have a great day!

 This is Christian Haensel live from Extertal, Germany. Back to you.

 -:oD)=


 - Original Message - From: Tijnema [EMAIL PROTECTED]
 To: Chris [EMAIL PROTECTED]
 Cc: Auto-Deppe, C. Haensel [EMAIL PROTECTED];
 php-general@lists.php.net
 Sent: Friday, June 01, 2007 9:27 AM
 Subject: Re: [PHP] ZIP it :o)


 On 6/1/07, Chris [EMAIL PROTECTED] wrote:
 Auto-Deppe, C. Haensel wrote:
  Morning guys,
 
  I have been trying to find an easy to use way to zip an archive on
 a  linux
  box running PHP5. Now I've tried the zip-lib.php and others, but 
they

  always
  throw an error msg But that is not the question.
 
  I am looking to use exec(zip archive.zip $directory);  $directory
 has
  been
  tried with both full path and relative path ... but that doesn't
 work.  I
  don't get an error, it just doesn't create the zip-file...
 
  So, after a day of Google-ing and trying, I thought I might ask you
 for
  help.
 
  Cheers for any answers and hints.

 http://pear.php.net/package/Archive_Zip and/or
 http://pear.php.net/package/File_Archive

 and please create a *new* message instead of replying to an 
existing one
 and changing the topic. It screws up message threading (in email 
clients

 and in the archives).

 Not in gmail :)

 I had same problem lately, wanted also to create zip files from PHP, i
 tried various build in functions, but i ended up with the exec way.
 It has been said before, but PHP probably doesn't have the right
 permissions to write the .zip file, so i would recommend you to write
 to /tmp first.

 Tijnema




Here's a link to the zip class that I use

http://www.phpclasses.org/browse/package/945.html

One thing though, your PHP install has to be compiled with --with-zlib

That was the only thing that I ran into with this.

Since you are creating files to download, with this class, you don't 
even need to write them to the
filesystem.  You just create the archive in memory (given that you 
have enough RAM  php is allowed
to consume as much memory as it would take the create the archive) and 
then dump it to the browser

Yes, but what happens when you try to create a 1GB archive with 512MB
RAM? (and no swap space too)
or if 100s of people call the same script that creates a 10-20MB file?
If you use the exec way, this will go fine :)

Tijnema

never said it would be the ops solution, but that it was my solution.

But isn't it nice to be able to know about different options that one might have to solve a given 
problem?


--
Jim Lucas

   Some men are born to greatness, some achieve greatness,
   and some have greatness thrust upon them.

Unknown

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



Re: [PHP] ZIP it :o)

2007-06-01 Thread Tijnema

On 6/1/07, Jim Lucas [EMAIL PROTECTED] wrote:

Tijnema wrote:
 On 6/1/07, Jim Lucas [EMAIL PROTECTED] wrote:
 Auto-Deppe, C. Haensel wrote:
  Hi guys,
 
  thanks to Jim, I made it :o) Here's the source I'm using for testing
  now... it works. I just need to make it less vulnerable ;o)
 
  - SNIP -
  ?
  $nr  = $_GET['nr'];
  if(eregi(../, $nr)) {
  die(Hier wird nicht rumgehackt);
  }
  $directory = '_kfz_images/'.$nr.'/full/';
  $dir = opendir($directory);
  $i = 1;
  while($file = readdir($dir)) {
  $dest = temp/Auto-Deppe-.$nr._.$i..jpg;
  if(eregi(jpg, $file)) {
   copy($directory.$file, $dest);
   $i++;
  }
  }
  $now = time();
  header(Content-Type: application/force-download);
  header('Content-Disposition: attachment;
  filename=Auto-Deppe-'.$now.'_Download.zip');
  exec(zip .$now._archive.zip temp/* 21, $output);
  readfile($now._archive.zip);
  $tempdir = opendir(temp);
  while($tempfile = readdir($tempdir)) {
  if(eregi(jpg, $tempfile)) {
   unlink(temp/.$tempfile);
  }
  }
  ?
  - SNAP -
  So I am copying the files to a temp dir, and then zip em up, delete
 them
  afterwards. I copy them to the dir so I wouldn't have the whole
  /kfz_images/number/full/ structure in the zip).
 
  Aaaanyhow, it works, it does work fast enough, and I am happy :o)
 
  Thanks a bunch, guys, and have a great day!
 
  This is Christian Haensel live from Extertal, Germany. Back to you.
 
  -:oD)=
 
 
  - Original Message - From: Tijnema [EMAIL PROTECTED]
  To: Chris [EMAIL PROTECTED]
  Cc: Auto-Deppe, C. Haensel [EMAIL PROTECTED];
  php-general@lists.php.net
  Sent: Friday, June 01, 2007 9:27 AM
  Subject: Re: [PHP] ZIP it :o)
 
 
  On 6/1/07, Chris [EMAIL PROTECTED] wrote:
  Auto-Deppe, C. Haensel wrote:
   Morning guys,
  
   I have been trying to find an easy to use way to zip an archive on
  a  linux
   box running PHP5. Now I've tried the zip-lib.php and others, but
 they
   always
   throw an error msg But that is not the question.
  
   I am looking to use exec(zip archive.zip $directory);  $directory
  has
   been
   tried with both full path and relative path ... but that doesn't
  work.  I
   don't get an error, it just doesn't create the zip-file...
  
   So, after a day of Google-ing and trying, I thought I might ask you
  for
   help.
  
   Cheers for any answers and hints.
 
  http://pear.php.net/package/Archive_Zip and/or
  http://pear.php.net/package/File_Archive
 
  and please create a *new* message instead of replying to an
 existing one
  and changing the topic. It screws up message threading (in email
 clients
  and in the archives).
 
  Not in gmail :)
 
  I had same problem lately, wanted also to create zip files from PHP, i
  tried various build in functions, but i ended up with the exec way.
  It has been said before, but PHP probably doesn't have the right
  permissions to write the .zip file, so i would recommend you to write
  to /tmp first.
 
  Tijnema
 
 
 
 
 Here's a link to the zip class that I use

 http://www.phpclasses.org/browse/package/945.html

 One thing though, your PHP install has to be compiled with --with-zlib

 That was the only thing that I ran into with this.

 Since you are creating files to download, with this class, you don't
 even need to write them to the
 filesystem.  You just create the archive in memory (given that you
 have enough RAM  php is allowed
 to consume as much memory as it would take the create the archive) and
 then dump it to the browser
 Yes, but what happens when you try to create a 1GB archive with 512MB
 RAM? (and no swap space too)
 or if 100s of people call the same script that creates a 10-20MB file?
 If you use the exec way, this will go fine :)

 Tijnema
never said it would be the ops solution, but that it was my solution.


Nope, you didn't but you noted the difference in speed for both, but
you didn't note any problems that could occur.


But isn't it nice to be able to know about different options that one might 
have to solve a given
problem?

--
Jim Lucas


Sure it is, but don't forget to note the negative things of the option.!

Tijnema

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



Re: [PHP] ini_set() security question

2007-06-01 Thread Tijnema

On 6/1/07, Samuel Vogel [EMAIL PROTECTED] wrote:

I just tried it with php 5.2.3. Same behavior!

Do you agree that overwriting the value shouldn't be possible with
ini_set() ?

I will file a bug report!


I don't think it should be allowed.
A comment from the ini_set page [1]:
If you set something using php_admin_value in httpd.conf it is then
not possible to be set the value at runtime, even if it's NOT
PHP_INI_SYSTEM. 

So, I guess it must be a bug.

Tijnema

[1] http://www.php.net/manual/en/function.ini-set.php#30424


Richard Lynch schrieb:
 File a bug report then, and see what happens...

 But you may want to test with most recent versions if you are not
 already on current PHP versions.

 On Thu, May 31, 2007 2:46 pm, Samuel Vogel wrote:

 There is no bug filed for this. There is only one older bug (
 http://bugs.php.net/bug.php?id=38804 ) which makes me think
 overwriting
 with ini_set() shouldn't be possible!

 Richard Lynch schrieb:

 On Wed, May 30, 2007 3:34 pm, Samuel Vogel wrote:


 And what happens if you try to allocate 3M of data?

 $foo = str_repeat('.', 3145728);



 Nothing. It does it without any errors. I can allocate up to 20MB
 (well
 a little bit less of course).


 Check http://bugs.php.net and see if it's a known issue or an
 exception to the php_admin_* rule or...







--
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] checkboxes problem

2007-06-01 Thread Roberto Mansfield
Richard Lynch wrote:
 
 On Wed, May 30, 2007 3:59 am, blueboy wrote:
 Hi,

 I have a checkbox array (about 20 lines)

 input name=\box\ type=\checkbox\ value=\$id\
 input name=\box\ type=\checkbox\ value=\$id\
 input name=\box\ type=\checkbox\ value=\$id\

 I do some client side checking with javascript however the javascript
 array

 name=\box\

 does not match the php version,

  name=\box[]\

  So either my client side stuff works or the php array only returns 1
 value
 when posted. Is there any way to for this to work?
 
 Let PHP use the NAME= attribute, and JS use the ID= attribute
 
 name=box[1] id=box1
 

Another JS approach I found recently:

Rather than refer to the checkbox as document.form_name.box[] (which
fails in javascript), use: document.form_name['box[]'].

-Roberto

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



Re: [PHP] ini_set() security question

2007-06-01 Thread Samuel Vogel



I don't think it should be allowed.
A comment from the ini_set page [1]:
If you set something using php_admin_value in httpd.conf it is then
not possible to be set the value at runtime, even if it's NOT
PHP_INI_SYSTEM. 

So, I guess it must be a bug.

Tijnema

[1] http://www.php.net/manual/en/function.ini-set.php#30424 
That's what I read too. I just wondered because many times there are 
only .htaccess and vhost mentioned.


I filed a bug at:
http://bugs.php.net/bug.php?id=41561

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



Re: [PHP] ZIP it :o)

2007-06-01 Thread Jim Lucas

Tijnema wrote:

On 6/1/07, Jim Lucas [EMAIL PROTECTED] wrote:

Tijnema wrote:
 On 6/1/07, Jim Lucas [EMAIL PROTECTED] wrote:
 Auto-Deppe, C. Haensel wrote:
  Hi guys,
 
  thanks to Jim, I made it :o) Here's the source I'm using for testing
  now... it works. I just need to make it less vulnerable ;o)
 
  - SNIP -
  ?
  $nr  = $_GET['nr'];
  if(eregi(../, $nr)) {
  die(Hier wird nicht rumgehackt);
  }
  $directory = '_kfz_images/'.$nr.'/full/';
  $dir = opendir($directory);
  $i = 1;
  while($file = readdir($dir)) {
  $dest = temp/Auto-Deppe-.$nr._.$i..jpg;
  if(eregi(jpg, $file)) {
   copy($directory.$file, $dest);
   $i++;
  }
  }
  $now = time();
  header(Content-Type: application/force-download);
  header('Content-Disposition: attachment;
  filename=Auto-Deppe-'.$now.'_Download.zip');
  exec(zip .$now._archive.zip temp/* 21, $output);
  readfile($now._archive.zip);
  $tempdir = opendir(temp);
  while($tempfile = readdir($tempdir)) {
  if(eregi(jpg, $tempfile)) {
   unlink(temp/.$tempfile);
  }
  }
  ?
  - SNAP -
  So I am copying the files to a temp dir, and then zip em up, delete
 them
  afterwards. I copy them to the dir so I wouldn't have the whole
  /kfz_images/number/full/ structure in the zip).
 
  Aaaanyhow, it works, it does work fast enough, and I am happy :o)
 
  Thanks a bunch, guys, and have a great day!
 
  This is Christian Haensel live from Extertal, Germany. Back to you.
 
  -:oD)=
 
 
  - Original Message - From: Tijnema [EMAIL PROTECTED]
  To: Chris [EMAIL PROTECTED]
  Cc: Auto-Deppe, C. Haensel [EMAIL PROTECTED];
  php-general@lists.php.net
  Sent: Friday, June 01, 2007 9:27 AM
  Subject: Re: [PHP] ZIP it :o)
 
 
  On 6/1/07, Chris [EMAIL PROTECTED] wrote:
  Auto-Deppe, C. Haensel wrote:
   Morning guys,
  
   I have been trying to find an easy to use way to zip an 
archive on

  a  linux
   box running PHP5. Now I've tried the zip-lib.php and others, but
 they
   always
   throw an error msg But that is not the question.
  
   I am looking to use exec(zip archive.zip $directory);  
$directory

  has
   been
   tried with both full path and relative path ... but that doesn't
  work.  I
   don't get an error, it just doesn't create the zip-file...
  
   So, after a day of Google-ing and trying, I thought I might 
ask you

  for
   help.
  
   Cheers for any answers and hints.
 
  http://pear.php.net/package/Archive_Zip and/or
  http://pear.php.net/package/File_Archive
 
  and please create a *new* message instead of replying to an
 existing one
  and changing the topic. It screws up message threading (in email
 clients
  and in the archives).
 
  Not in gmail :)
 
  I had same problem lately, wanted also to create zip files from 
PHP, i

  tried various build in functions, but i ended up with the exec way.
  It has been said before, but PHP probably doesn't have the right
  permissions to write the .zip file, so i would recommend you to 
write

  to /tmp first.
 
  Tijnema
 
 
 
 
 Here's a link to the zip class that I use

 http://www.phpclasses.org/browse/package/945.html

 One thing though, your PHP install has to be compiled with 
--with-zlib


 That was the only thing that I ran into with this.

 Since you are creating files to download, with this class, you don't
 even need to write them to the
 filesystem.  You just create the archive in memory (given that you
 have enough RAM  php is allowed
 to consume as much memory as it would take the create the archive) and
 then dump it to the browser
 Yes, but what happens when you try to create a 1GB archive with 512MB
 RAM? (and no swap space too)
 or if 100s of people call the same script that creates a 10-20MB file?
 If you use the exec way, this will go fine :)

Unless you have a disc quota that you come up against.

Now what?



 Tijnema
never said it would be the ops solution, but that it was my solution.


Nope, you didn't but you noted the difference in speed for both, but
you didn't note any problems that could occur.

But isn't it nice to be able to know about different options that one 
might have to solve a given

problem?

--
Jim Lucas


Sure it is, but don't forget to note the negative things of the option.!

imho, this is not a negative thing, it is more of a limitation.

imho, not all limitations are negative

limitations force you to think about a more creative way to solve the problem 
at hand



Tijnema




--
Jim Lucas

   Some men are born to greatness, some achieve greatness,
   and some have greatness thrust upon them.

Unknown

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



[PHP] How can I DomDocument-renameNode?

2007-06-01 Thread Eric Wiener
Apparently renameNode is not yet implemented into Dom, so how can I
rename a node without affecting its value and/or child nodes?

 

I have tried making a new node, inserting it before the old node then
removing the old node but I could not figure out how to get the
nodeValue to include the child nodes, so they get stripped out leaving
only the text value.



[PHP] Orphan functions?

2007-06-01 Thread Al

Does anyone have a utility or technique to find orphan functions?

I keep my functions together in an include file and occasionally create orphans
 when I change the main code stream so that they are no longer used.

It would be nice to be able parse all the functions in an include file to make 
certain the are used.
Obviously, the parser would need a list of files that possibly could use the 
functions.

Al...

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



Re: [PHP] Orphan functions?

2007-06-01 Thread Robert Cummings
On Fri, 2007-06-01 at 14:15 -0400, Al wrote:
 Does anyone have a utility or technique to find orphan functions?
 
 I keep my functions together in an include file and occasionally create 
 orphans
   when I change the main code stream so that they are no longer used.
 
 It would be nice to be able parse all the functions in an include file to 
 make certain the are used.
 Obviously, the parser would need a list of files that possibly could use the 
 functions.

http://ca.php.net/manual/en/ref.tokenizer.php

Cheers,
Rob.
-- 
..
| 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.  |
`'

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



Re: [PHP] Orphan functions?

2007-06-01 Thread Al
I appreciate the response and looked at the tokenizer doc; but, I'm missing your 
point.  Are you implying I should write a Tokenizer Function to do the job?


Al.

Robert Cummings wrote:

On Fri, 2007-06-01 at 14:15 -0400, Al wrote:

Does anyone have a utility or technique to find orphan functions?

I keep my functions together in an include file and occasionally create orphans
  when I change the main code stream so that they are no longer used.

It would be nice to be able parse all the functions in an include file to make 
certain the are used.
Obviously, the parser would need a list of files that possibly could use the 
functions.


http://ca.php.net/manual/en/ref.tokenizer.php

Cheers,
Rob.


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



Re: [PHP] Orphan functions?

2007-06-01 Thread Robert Cummings
On Fri, 2007-06-01 at 14:40 -0400, Al wrote:
 I appreciate the response and looked at the tokenizer doc; but, I'm missing 
 your 
 point.  Are you implying I should write a Tokenizer Function to do the job?

Nope, tokenizer function already exists. I'm suggesting it wouldn't be
too hard to write a script that traverses your source tree, parses the
scripts using PHP's tokenizer functions, traverses the tokens and tells
you exactly what you want to know :)

Just a matter of:

1. Recording declared functions/methods.
2. Tracking a counter for when the function is used.
3. After all is done, displaying functions/methods with 0 counter.

This won't catch eval'd uses of functions, or other dynamic calling of
functions. But it will probably give you a good idea where to look,
possibly using grep. Dynamically called functions are non-deterministic
and so the only way to catch their usage is via a profiler, and then
again, it'll only get counted if it actually gets used during run-time.

Cheers,
Rob.
-- 
..
| 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.  |
`'

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



Re: [PHP] Orphan functions?

2007-06-01 Thread Al
I gotcha now.  I misspoke about writing a tokenizer function, I understood that 
it would be a script.


That's for the suggestion.  Though, I was hoping to avoid reinventing something 
that already exists.


Robert Cummings wrote:

On Fri, 2007-06-01 at 14:40 -0400, Al wrote:
I appreciate the response and looked at the tokenizer doc; but, I'm missing your 
point.  Are you implying I should write a Tokenizer Function to do the job?


Nope, tokenizer function already exists. I'm suggesting it wouldn't be
too hard to write a script that traverses your source tree, parses the
scripts using PHP's tokenizer functions, traverses the tokens and tells
you exactly what you want to know :)

Just a matter of:

1. Recording declared functions/methods.
2. Tracking a counter for when the function is used.
3. After all is done, displaying functions/methods with 0 counter.

This won't catch eval'd uses of functions, or other dynamic calling of
functions. But it will probably give you a good idea where to look,
possibly using grep. Dynamically called functions are non-deterministic
and so the only way to catch their usage is via a profiler, and then
again, it'll only get counted if it actually gets used during run-time.

Cheers,
Rob.


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



Re: [PHP] Orphan functions?

2007-06-01 Thread Marc Weber
On Fri, Jun 01, 2007 at 03:01:48PM -0400, Al wrote:
 I gotcha now.  I misspoke about writing a tokenizer function, I understood 
 that it would be a script.
 
 That's for the suggestion.  Though, I was hoping to avoid reinventing 
 something that already exists.

There is another alternative. If you know C++ you can also use phc for
this task. (http://www.phpcompiler.org/)

Marc

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



[PHP] oem to ansi charset encoding!.

2007-06-01 Thread Fernando Viadero



Hello.-


i have some trouble.


i need to convert some string encoded in oem charset to ansi    php ;-)


could someone help me!


thanks in advance!

Fernando

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



Re: [PHP] oem to ansi charset encoding!.

2007-06-01 Thread Jim Lucas

Fernando Viadero wrote:



Hello.-


i have some trouble.


i need to convert some string encoded in oem charset to ansi    php ;-)


could someone help me!


thanks in advance!

Fernando


sorry, finger stuck on CTRL key  :)

Here is the link


--
Jim Lucas

   Some men are born to greatness, some achieve greatness,
   and some have greatness thrust upon them.

Unknown

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



Re: [PHP] oem to ansi charset encoding!.

2007-06-01 Thread Jim Lucas

Fernando Viadero wrote:



Hello.-


i have some trouble.


i need to convert some string encoded in oem charset to ansi    php ;-)


could someone help me!


thanks in advance!

Fernando


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

--
Jim Lucas

   Some men are born to greatness, some achieve greatness,
   and some have greatness thrust upon them.

Unknown

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



Re: [PHP] oem to ansi charset encoding!.

2007-06-01 Thread Jim Lucas

Fernando Viadero wrote:



Hello.-


i have some trouble.


i need to convert some string encoded in oem charset to ansi    php ;-)


could someone help me!


thanks in advance!

Fernando


man what a bad day  :(

--
Jim Lucas

   Some men are born to greatness, some achieve greatness,
   and some have greatness thrust upon them.

Unknown

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



Re: [PHP] oem to ansi charset encoding!.

2007-06-01 Thread Jim Lucas

Fernando Viadero wrote:



Hello.-


i have some trouble.


i need to convert some string encoded in oem charset to ansi    php ;-)


could someone help me!


thanks in advance!

Fernando


Check out


I see a number of examples on this page that might lead you down the road to 
enlightenment,
but no reference to 'oem' on the page.

But lots of talk about windows-1251/cp1251/UCS-2/ISO-8859-X/etc...

Maybe this will help you out.

--
Jim Lucas

   Some men are born to greatness, some achieve greatness,
   and some have greatness thrust upon them.

Unknown

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



Re: [PHP] oem to ansi charset encoding!.

2007-06-01 Thread Jim Lucas

Fernando Viadero wrote:



Hello.-


i have some trouble.


i need to convert some string encoded in oem charset to ansi    php ;-)


could someone help me!


thanks in advance!

Fernando


BTW - please don't hi-jack someone else's thread, please start your own

--
Jim Lucas

   Some men are born to greatness, some achieve greatness,
   and some have greatness thrust upon them.

Unknown

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



Re: [PHP] ini_set() security question

2007-06-01 Thread Richard Lynch
*I* agree, but my agreement don't mean much... :-v

On Fri, June 1, 2007 10:13 am, Samuel Vogel wrote:
 I just tried it with php 5.2.3. Same behavior!

 Do you agree that overwriting the value shouldn't be possible with
 ini_set() ?

 I will file a bug report!

 Richard Lynch schrieb:
 File a bug report then, and see what happens...

 But you may want to test with most recent versions if you are not
 already on current PHP versions.

 On Thu, May 31, 2007 2:46 pm, Samuel Vogel wrote:

 There is no bug filed for this. There is only one older bug (
 http://bugs.php.net/bug.php?id=38804 ) which makes me think
 overwriting
 with ini_set() shouldn't be possible!

 Richard Lynch schrieb:

 On Wed, May 30, 2007 3:34 pm, Samuel Vogel wrote:


 And what happens if you try to allocate 3M of data?

 $foo = str_repeat('.', 3145728);



 Nothing. It does it without any errors. I can allocate up to 20MB
 (well
 a little bit less of course).


 Check http://bugs.php.net and see if it's a known issue or an
 exception to the php_admin_* rule or...









-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] linking to an image with document_root

2007-06-01 Thread Richard Lynch
On Fri, June 1, 2007 3:16 am, blueboy wrote:
 May be a stupid question but can I link to images with doscument root

 $img_url= $_SERVER['DOCUMENT_ROOT'].'/images/holder.gif';

 echo img src=\$img_url\ width=\250\ height=\163\/;

 I am certain the path is correct,

 If not what are my alternatives?

You could try if faster than you'll get an answer here, but, yes, you
could do that.

You may even want to set up a variable called $IMAGE_ROOT and set it
to $_SERVER['DOCUMENT_ROOT'] in a config/include file, so that if you
ever want to move all your images somewhere else, you only change one
line of code.

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] Strange Warning, PHP sessions

2007-06-01 Thread Richard Lynch
$arr is coming out of nowhere, out of clean thin air...

That's the direct cause of the error message.

Your OTHER problem is that blindly shoving all POST data into your
SESSION is almost certainly a Bad Idea...

On Fri, June 1, 2007 2:15 am, Sachin mahajan wrote:
 Can anyone clarify this..

 ?php
 /* Warning: Unknown: Your script possibly relies on a session
 side-effect which existed until PHP 4.2.3. Please be advised that the
 session extension does not consider global variables as a source of
 data, unless register_globals is enabled. You can disable this
 functionality and this warning by setting session.bug_compat_42 or
 session.bug_compat_warn to off, respectively. in Unknown on line 0 */
 //CAN ANYONE HELP ME FINDOUT WHERES THE PROBLEM??!??
 //WHEN I COMMENT EITHER LINE 2 OR 3, THERE IS NO WARNING
 session_start();
 $arrFormData = $_POST;
 $_SESSION['arrFormData'] = $arr;//$arrFormData;//phpinfo();
 ?
 form id=frmUser method=post
  First Name: input type=text name=fName / br/
  Last Name: input type=text name=lName / br/
  input type=submit name=btnAdd value=add /
 /form


 Regards,
 Sachin
 ([EMAIL PROTECTED])


-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] ZIP it :o)

2007-06-01 Thread Richard Lynch


On Fri, June 1, 2007 12:30 am, Auto-Deppe, C. Haensel wrote:
 Morning guys,

 I have been trying to find an easy to use way to zip an archive on a
 linux
 box running PHP5. Now I've tried the zip-lib.php and others, but they
 always
 throw an error msg But that is not the question.

 I am looking to use exec(zip archive.zip $directory);  $directory
 has been
 tried with both full path and relative path ... but that doesn't work.
 I
 don't get an error, it just doesn't create the zip-file...

 So, after a day of Google-ing and trying, I thought I might ask you
 for
 help.

 Cheers for any answers and hints.

HINT:
I'd love to alter the PHP source so that the 2 optional args to exec()
are NOT optional anymore...

It would forestall a lot of 'exec' questions on this list... :-)

Use full paths everywhere, or you'll end up cursing again some other
day.  That includes the full path to the binary program 'zip' and the
file 'archive.zip' and the '$directory'

You also MUST understand that PHP runs as a specific user, which on
Apache is defined in httpd.conf, and is rarely the same user as your
SSH login user.  So what you can do in the command line has little
bearing on what that user can do in 'exec'

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] ZIP it :o)

2007-06-01 Thread Richard Lynch
On a busy server, with many many users, it is remotely possible that
your time() call will not be unique, and 2 users will end up
corrupting each others' zip files...

PHP has built-in functions for making temp files with unique names.

Use them.

On Fri, June 1, 2007 2:32 am, Auto-Deppe, C. Haensel wrote:
 Hi guys,

 thanks to Jim, I made it :o) Here's the source I'm using for testing
 now...
 it works. I just need to make it less vulnerable ;o)

 - SNIP -
 ?
 $nr  = $_GET['nr'];
 if(eregi(../, $nr)) {
  die(Hier wird nicht rumgehackt);
 }
 $directory = '_kfz_images/'.$nr.'/full/';
 $dir = opendir($directory);
 $i = 1;
 while($file = readdir($dir)) {
  $dest = temp/Auto-Deppe-.$nr._.$i..jpg;
  if(eregi(jpg, $file)) {
   copy($directory.$file, $dest);
   $i++;
  }
 }
 $now = time();
 header(Content-Type: application/force-download);
 header('Content-Disposition: attachment;
 filename=Auto-Deppe-'.$now.'_Download.zip');
 exec(zip .$now._archive.zip temp/* 21, $output);
 readfile($now._archive.zip);
 $tempdir = opendir(temp);
 while($tempfile = readdir($tempdir)) {
  if(eregi(jpg, $tempfile)) {
   unlink(temp/.$tempfile);
  }
 }
 ?
 - SNAP -
 So I am copying the files to a temp dir, and then zip em up, delete
 them
 afterwards. I copy them to the dir so I wouldn't have the whole
 /kfz_images/number/full/ structure in the zip).

 Aaaanyhow, it works, it does work fast enough, and I am happy :o)

 Thanks a bunch, guys, and have a great day!

 This is Christian Haensel live from Extertal, Germany. Back to you.

 -:oD)=


 - Original Message -
 From: Tijnema [EMAIL PROTECTED]
 To: Chris [EMAIL PROTECTED]
 Cc: Auto-Deppe, C. Haensel [EMAIL PROTECTED];
 php-general@lists.php.net
 Sent: Friday, June 01, 2007 9:27 AM
 Subject: Re: [PHP] ZIP it :o)


 On 6/1/07, Chris [EMAIL PROTECTED] wrote:
 Auto-Deppe, C. Haensel wrote:
  Morning guys,
 
  I have been trying to find an easy to use way to zip an archive
 on a
  linux
  box running PHP5. Now I've tried the zip-lib.php and others, but
 they
  always
  throw an error msg But that is not the question.
 
  I am looking to use exec(zip archive.zip $directory);
 $directory has
  been
  tried with both full path and relative path ... but that doesn't
 work.
  I
  don't get an error, it just doesn't create the zip-file...
 
  So, after a day of Google-ing and trying, I thought I might ask
 you for
  help.
 
  Cheers for any answers and hints.

 http://pear.php.net/package/Archive_Zip and/or
 http://pear.php.net/package/File_Archive

 and please create a *new* message instead of replying to an
 existing one
 and changing the topic. It screws up message threading (in email
 clients
 and in the archives).

 Not in gmail :)

 I had same problem lately, wanted also to create zip files from PHP,
 i
 tried various build in functions, but i ended up with the exec way.
 It has been said before, but PHP probably doesn't have the right
 permissions to write the .zip file, so i would recommend you to
 write
 to /tmp first.

 Tijnema




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




-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] Re: Re: Re: Re: preg_match() returns false but no documentation why

2007-06-01 Thread Richard Lynch


On Thu, May 31, 2007 9:31 pm, Stut wrote:
 Richard Lynch wrote:
 On Thu, May 31, 2007 7:26 am, Jared Farrish wrote:
 That's what the 'period' is called in British English.
 http://google.ca/search?q=define%3Afull+stop

 In English syntax period and full stop are synonymous, and the
 RegEx manual is throwing dot into the same bag.
 That's very confusing to call it 'Full Stop' when it doesn't seem
 to
 actually correlate to the regex meaning it identifies, don't you
 think?
 Maybe to a Brit or someone who understands Commonwealth English
 would
 know
 (I was aware of what it meant in CE, I just woudn't have imagined
 to
 apply
 it here, since it looks to be descriptive).

 Kind've like an elephant trainer calling her elephant's trunk a
 boot.

 @Brits: So is a comma or semi-colon called a Half Stop :-)

 No.

 @Americans: What did the letters s and u ever do to you?

As I child, I read a lot of British books, and to this day spell
things with 'u' a lot, if the first time I encountered the word was in
Brit book...

Human behaviour is so interesting, isn't it?

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] using mysql_escape_string with implode() !!

2007-06-01 Thread Richard Lynch
Seems to me you'd be better off then writing code to handle all of
these, with is_array() doing the walk, and erroring out for Object and
Resource

Actually, an object should get type-casted to a string, and there's
even that nifty thing in PHP 5 where you can control what string it
gets changed to...  At least, that's what I would expect, as a naive
user, if __to_string or whatever it is is supposed to work.

Ah well.

On Thu, May 31, 2007 6:25 pm, Jim Lucas wrote:
 Richard Lynch wrote:
 On Wed, May 30, 2007 9:55 pm, Jim Lucas wrote:
 Greg Donald wrote:
 On 5/30/07, Richard Lynch [EMAIL PROTECTED] wrote:
 You want to use mysql_escape_string, and NOT addslashes and NOT
 Magic
 Quotes.
 function slashes( $var )
 {
  if( is_array( $var ) )
  {
return array_map( 'slashes', $var );
  }
  else
  {
return mysql_real_escape_string( $var );
  }
 }
 Say I wanted to use this on something other than $_GET, $_POST, 
 $_COOKIE?

 Would it not be better practice to do this the other way around?

 function slashes ( $var ) {
 if ( is_scalar($var) ) {
  return mysql_real_escape_string( $var );
 } else {
  return array_map( 'slashes', $var );
 }
 }

 This way, even if someone passes something that is not an array,
 but
 still not processable by mysql_real_escape_string(), it won't foul
 up
 the processor.

 set_magic_quotes_runtime( 0 );

 if( get_magic_quotes_gpc() == 0 )
 {
  $_GET = isset( $_GET )
? array_map( 'slashes', $_GET )
: array();

  $_POST = isset( $_POST )
? array_map( 'slashes', $_POST )
: array();

  $_COOKIE = isset( $_COOKIE )
? array_map( 'slashes', $_COOKIE )
: array();
 }

 Well, if it's not a scalar, and it's not an array, and you call
 array_map on it, things could get very ugly very fast...

 I'm not sure what other datatypes you might try to pass in, that PHP
 won't type-juggle to a string when it goes to
 mysql_real_escape_string...

 Exactly what other data are you planning on calling 'slashes' on?


 Things that will work with mysql_real_escape_string()
   boolean, integer, double, float, string, NULL

 Things that won't work with mysql_real_escape_string()
   array, object, resource id


 --
 Jim Lucas

 Some men are born to greatness, some achieve greatness,
 and some have greatness thrust upon them.

 Unknown




-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



RE: [PHP] Re: find (matching) person in other table

2007-06-01 Thread Richard Lynch
I dunno.

I somehow thought HAVING needed a GROUP BY or somesuch...

Go ask the SQL guys or try it and find out. :-)

I pretty much just dink with the SQL until it works, myself... :-)

On Thu, May 31, 2007 6:03 pm, Daevid Vincent wrote:
 Jumping in late so forgive if I'm mistaken, but can't you just use
 HAVING in place of WHERE

  select member_id, first_name, last_name, email, ...,
  (5*(first_name='$first_name) +
 2*(first_name='$first_name')) as score
  from members
 HAVING score  0


 -Original Message-
 From: Richard Lynch [mailto:[EMAIL PROTECTED]
 Sent: Thursday, May 31, 2007 3:42 PM
 To: Afan Pasalic
 Cc: Jared Farrish; php-general@lists.php.net
 Subject: Re: [PHP] Re: find (matching) person in other table

 MySQL doesn't let you use the calculated values (score) in the where
 clause.

 PostgreSQL does, as I recall.

 Sorry.

 You may be able to get around that with:

 Do a GROUP BY on something unique, so the GROUP BY is pointless, but
 then you can use HAVING score  0

 Use a sub-query in MySQL 4.mumble or higher, and the outer query can
 use 'score' to get rid of the 0-point non-matches

 Build up the expression for $score and $where at the same time like:

 $where = ' 0 ';
 $score = ' 0 ';
 $where .=  OR lastname = '$lastname';
 $score .=  + 5 * (lastname = '$lastame' ) ;
 $where .=  OR firstname = '$firstname' ;
 $score .=  + 2 * (firstname = '$firstname' ) ;

 This gets tiresome to type, but is least confusing to
 non-programmers...

 On Thu, May 31, 2007 9:36 am, Afan Pasalic wrote:
 
 
  Jared Farrish wrote:
  On 5/30/07, Afan Pasalic [EMAIL PROTECTED] wrote:
  email has to match in total. [EMAIL PROTECTED] and
  [EMAIL PROTECTED]
  are NOT the same in my case.
 
  thanks jared,
 
  If you can match a person by their email, why not just SELECT by
  email
  only
  (and return the persons information)?
  'cause some members can be added to database by administrator and
  maybe
  they don't have email address at all. or several memebers
 can use the
  same email address ([EMAIL PROTECTED]) and then macthing
 last name
  is
  kind of required. that's how it works now and can't change it.
 
  Consider, as well, that each time you're calling a database,
 you're
  slowing
  down the response of the page. So, while making a bunch of small
  calls
  might
  not seem like that much, consider:
 
  ||| x |||
  ||| a |||
  ||| b |||
 
  Versus
 
  ||| x, a, b |||
 
  The letters represent the request/response data (what you're
 giving
  to
  get,
  then get back), and the pipes (|) are the overhead to
 process, send,
  receive
  (on DB), process (on DB), send (on DB), receive, process, return
 to
  code.
 
  The overhead and latency used to complete one request makes it a
  quicker,
  less heavy operation. If you did the first a couple hundred or
  thousand
  times, I would bet your page would drag to a halt while it
 loads...
  agree. now, I have to figure it out HOW? :-)
 
  I was looking at levenshtein, though, I think the richard's
 solution
  is
  just enough:
 
  select member_id, first_name, last_name, email, ...,
  (5*(first_name='$first_name) +
 2*(first_name='$first_name')) as score
  from members
  where score  0
 
  though, I'm getting error: Unknown column 'score' in where
 clause?!?
 
  thanks jared.
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 


 --
 Some people have a gift link here.
 Know what I want?
 I want you to buy a CD from some indie artist.
 http://cdbaby.com/browse/from/lynch
 Yeah, I get a buck. So?

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




-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] linking to an image with document_root

2007-06-01 Thread chris smith

On 6/2/07, Richard Lynch [EMAIL PROTECTED] wrote:

On Fri, June 1, 2007 3:16 am, blueboy wrote:
 May be a stupid question but can I link to images with doscument root

 $img_url= $_SERVER['DOCUMENT_ROOT'].'/images/holder.gif';

 echo img src=\$img_url\ width=\250\ height=\163\/;

 I am certain the path is correct,

 If not what are my alternatives?

You could try if faster than you'll get an answer here, but, yes, you
could do that.

You may even want to set up a variable called $IMAGE_ROOT and set it
to $_SERVER['DOCUMENT_ROOT'] in a config/include file, so that if you
ever want to move all your images somewhere else, you only change one
line of code.


How's that going to help when the OP is using a *file path* as an image source ?

--
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP] linking to an image with document_root

2007-06-01 Thread Tom Rogers
Hi,

Friday, June 1, 2007, 6:16:34 PM, you wrote:
b May be a stupid question but can I link to images with doscument root

b $img_url= $_SERVER['DOCUMENT_ROOT'].'/images/holder.gif';

b echo img src=\$img_url\ width=\250\ height=\163\/;

b I am certain the path is correct,

b If not what are my alternatives?


b R. 


You don't need anything other than the first slash and it will be from
the root of the web site. So all you need is:
$url = '/images/holder.gif';

and it will come from http://whatever.com/images/holder.gif

-- 
regards,
Tom

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



[PHP] Cant set info in DB...HELP

2007-06-01 Thread kvigor
Hello,

I'm using phpMyAdmin and I can't get any of my form data into the database. 
It returns message: MySQL returned an empty result set w/in phpMyAdmin 
GUI.

However I get no errors on screen when form info is submitted.

What I have done to solve issue: drop DB and create new.
Review form vars and SQL statements can't find errors...help

Please help...

//=FORM==
?php

echo div link href='css/SOS.css' rel='stylesheet' type='text/css' /
  form id='form1' method='post' action=''
 label for='select'/label
 label for='conName'span

class='style2'Consumer Information/spanbr /
 br /
 *Name:/label
  input type='text' name='conName' id='formPosition' size='100'

class='nameAddressCity_pos' value='{$_POST['conName']}'/
br /
br /
 label for='conAddress'*Address:/label
  input name='conAddress' type='text' class='nameAddressCity_pos'

id='textfield' value='{$_POST['conAddress']}' size='100' /
br /
br /
 label for='conCity'*City:/label
  input name='conCity' type='text'  class='nameAddressCity_pos'

id='textfield' value='{$_POST['conCity']}' /

 label for='conState' class='stateLabel'

*State:/label
  input name='conState' type='text'  class='state' id='textfield'

value='{$_POST['conState']}' /

 label for='conZip'

class='zipLabel'*Zip:/label
  input name='conZip' type='text' class='zip' id='textfield'

value='{$_POST['conZip']}' /
   br /
   br /
 label for='conPhone'*Phone:/label
  input name='conPhone' type='text' class='nameAddressCity_pos'

id='textfield' value='{$_POST['conPhone']}' /
   br /
   br /
   br /
span class='style2'School Nomination

Information /spanbr /
   br /
label for='schName'*Name:/label
  input name='schName' type='text' class='nameAddressCity_pos'

id='textfield' value='{$_POST['schName']}' size='100' /
   br /
   br /
label for='schAddress'*Address:/label
  input name='schAddress' type='text' class='nameAddressCity_pos'

id='textfield' value='{$_POST['schAddress']}' size='100' /
   br /
   br /
label for='schCity'*City:/label
  input name='schCity' type='text' class='nameAddressCity_pos'

id='textfield' value='{$_POST['schCity']}' /

label for='schState'

class='stateLabel'*State:/label
  input name='schState' type='text' class='state' id='textfield'

value='{$_POST['schState']}'/

label for='schZip'

class='zipLabel'*Zip:/label
  input name='schZip' type='text' class='zip' id='textfield'

value='{$_POST['schZip']}' /
   br /
   br /
span class='style2'br /
Store Shopped Atbr /
br /
/span
label for='strName'*Name:/label
  input name='strName' type='text' class='nameAddressCity_pos'

id='textfield' value='{$_POST['strName']}' size='100'/
   br /
   br /
   br /
label for='strCity'*City:/label
  input name='strCity' type='text'class='nameAddressCity_pos'

id='textfield' value='{$_POST['strCity']}' /

label for='strStat'

class='stateLabel'*State:/label
  input name='strState' type='text' class='state'  id='textfield'

value='{$_POST['strState']}' /
   br /
   br /
   br /
 label for='Reset'/label
  input type='reset' name='reset' value='Reset' id='Submit'/

 label for='Sumbit'/label
  input type='submit' name='submit' value='Submit' id='Reset'/
  /form/div;
//END==FORM

echo br /br /br /br /br /br /;
//===striptags=and=trim===
   $regName = trim(strip_tags($_POST['conName'])); $regAddress

= trim(strip_tags($_POST['conAddress']));
   $regCity = trim(strip_tags($_POST['conCity'])); $regState =

trim(strip_tags($_POST['conState']));
   $regZip = trim(strip_tags($_POST['conZip'])); $regPhone =

trim(strip_tags($_POST['conPhone']));

   $sclName = trim(strip_tags($_POST['schName'])); $sclAddress

= trim(strip_tags($_POST['schAddress']));
   $sclCity = trim(strip_tags($_POST['schCity'])); $sclState =

trim(strip_tags($_POST['schState']));
   $sclZip = trim(strip_tags($_POST['schZip']));

   $stoName = trim(strip_tags($_POST['strName'])); $stoCity =

trim(strip_tags($_POST['strCity']));
   $stoState = trim(strip_tags($_POST['strState']));
//==end=striptags=and=trim===

//==Begin dbPopulation of Form 
data

$dbserver = localhost;
$dbuser = root;
$dbpassword = ;
$dbname = theDB;

$connection = mysqli_connect($dbserver, $dbuser, $dbpassword, $dbname) or 
die

(Could not connect to the Server. Contact your Network Administrator or 
your Web

Programmer);

$insert_query = INSERT INTO contestants (conName, conAddress, conCity, 
conState,

conZip, conPhone, schName, schAddress, schCity, schState, schZip, strName, 
strCity,

strState) VALUES('$regName', 

Re: [PHP] Cant set info in DB...HELP

2007-06-01 Thread Stut

kvigor wrote:
$insert_query = INSERT INTO contestants (conName, conAddress, conCity, 
conState,


conZip, conPhone, schName, schAddress, schCity, schState, schZip, strName, 
strCity,


strState) VALUES('$regName', '$regAddress', '$regCity', '$regState', 
'$regZip',


'$regPhone', '$sclName', '$sclName', '$sclCity', '$sclState', '$sclZip', 
'$stoName',


'$stoCity', '$stoState');

mysqli_query($connection,$insert_query); ?


1) You need to use mysqli_real_escape_string on the vars you're putting 
into the SQL statement.


2) You need to check the return value from mysqli_query to see if the 
query failed. If it is failing I'm guessing actioning suggestion 1 might 
help.


-Stut

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