Что такое Подарочные сертификаты?
PHP web-programming
Hello Guest
  
  • Login
• Register…
• Start blog
  • Who, Where, When
• What is interesting here?
• Duels
  • Polls
• Avatars
• Interests
  • Cities and Countries
• Random blog
• Users search
  • Search
• Games
• Tests
• QAIX
  • Сообщества
• Talxy Chat
• Horoscope
• Online
 
Register!

QAIX > PHP web-programmingGo to page: « previous | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | next »

  Top users: 
  Recent blog posts: 
  Forums:   
  Discuss: 
  Recent forum topics: 
  Recent forum comments:
  Модератор:
Thursday, 25 January 2007
[PHP-DEV] technical question Oliver Block 00:39:13
 Hello,

As far as I understood, php loads requires modules at startup. Which impact
does that have on which function a developer can call from within an
extension. I mean, is it possible to call functions from other extensions
besides ext/standard? And how?

Regards,

Oliver

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/­unsub.php


comment 1 answer | Add comment
Regular Expression Problem Martin Clifford 00:39:13
 Hey all!

I'm trying to get this darn eregi_replace() to work, but it doesn't produce any results at all.

I want it to find all occurances of PHP variables. Here is the regexp

$output = eregi_replace("^[\$]{1,­2}[a-zA-Z][0-9]+$", "<b>\\1</b>", $var);

As you might guess this is for a syntax highlighting function I am trying to write. Anyone have any ideas why it's not working? Please copy me directly, as I'm on the digest. Thanks!

Martin


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


comment 21 answer | Add comment
Wednesday, 24 January 2007
To many connections error message Kevin Murphy 22:13:51
 I'm working with my host to resolve why I am getting these error
messages, but in the meantime, I am getting this message on the website:

Warning: mysql_connect(): Too many connections in /path/number/user/
code/connect.php on line 10
Sorry: Could not connect to database. Please contact the webmaster at
murphy63@wncc.edu

Where my connection code is:

$con = mysql_connect($host­, $dbuser, $pw)
or die("Sorry: Could not connect to database. Please contact the
webmaster at murphy63@wncc.edu")­;
@mysql_select_db($d­b,$con);

The questions is, since I don't have error reporting turned on, why
am I getting an error message that includes the complete path to my
connect script.... something I would like to not be telling the
general public? Is there a way to suppress that?

--
Kevin Murphy
Webmaster: Information and Marketing Services
Western Nevada Community College
www.wncc.edu
775-445-3326


comment 4 answer | Add comment
[PHP-DEV] [Patch] mysql_set_charset for mysql ext Scott MacVicar 20:51:37
 Hi,

Attached is a patch that adds a mysql_set_charset function to the MySQL
extension, its for all branches at the moment and ideally it should be
applied to all.

Before anyone starts advocating that everyone upgrades to PHP5 and use
MySQLi its not always realistic for some and other people are just stubborn.

The reason for the patch is that the mysql_set_character­_set function
provided by the MySQL API sets the internal MySQL character set for the
connection which is referenced by functions such as
mysql_real_escape_s­tring.

Without the ability to change the character set on the connection users
use the SET NAMES 'charset' query which lacks the ability to update the
internal character set.

In certain cases this can lead to an SQL Injection. I'll simply refer
everyone to a blog entry by Ilia
http://ilia.ws/arch­ives/103-mysql_real_­escape_string-versus­-Prepared-Statements­.html

I'd like this consider this a security issue and get it applied to the
PHP 4 branch even though active development is more or less finished.

Cheers,
Scott


Index: ext/mysql/php_mysql­.c
===================­====================­====================­========
RCS file: /repository/php-src­/ext/mysql/php_mysql­.c,v
retrieving revision 1.226
diff -u -r1.226 php_mysql.c
--- ext/mysql/php_mysql­.c8 Oct 2006 13:34:22 -00001.226
+++ ext/mysql/php_mysql­.c18 Oct 2006 12:09:40 -0000
@@ -94,6 +94,10 @@
#define MYSQL_HAS_YEAR
#endif

+#if (MYSQL_VERSION_ID > 40112 && MYSQL_VERSION_ID < 50000) || MYSQL_VERSION_ID > 50005
+#define MYSQL_HAS_SET_CHARS­ET
+#endif
+
#define MYSQL_ASSOC1<<0
#define MYSQL_NUM1<<1
#define MYSQL_BOTH(MYSQL_AS­SOC|MYSQL_NUM)
@@ -166,6 +170,9 @@
PHP_FE(mysql_thread­_id,NULL)
PHP_FE(mysql_client­_encoding,NULL)
PHP_FE(mysql_ping,N­ULL)
+#ifdef MYSQL_HAS_SET_CHARS­ET
+PHP_FE(mysql_set_c­harset,NULL)
+#endif
#ifdef HAVE_GETINFO_FUNCS
PHP_FE(mysql_get_cl­ient_info,NULL)
PHP_FE(mysql_get_ho­st_info,NULL)
@@ -1119,6 +1126,48 @@
/* }}} */
#endif

+#ifdef MYSQL_HAS_SET_CHARS­ET
+/* {{{ proto bool mysql_set_charset(s­tring csname [, int link_identifier])
+ sets client character set */
+PHP_FUNCTION(mysql­_set_charset)
+{
+zval **cs_name, **mysql_link;
+int id;
+php_mysql_conn *mysql;
+
+switch(ZEND_NUM_AR­GS()) {
+case 1:
+if (zend_get_parameter­s_ex(1, &cs_name)==FAILURE)­ {
+RETURN_FALSE;
+}
+id = php_mysql_get_defau­lt_link(INTERNAL_FUN­CTION_PARAM_PASSTHRU­);
+CHECK_LINK(id);
+break;
+case 2:
+if (zend_get_parameter­s_ex(2, &cs_name, &mysql_link)==FAILU­RE) {
+RETURN_FALSE;
+}
+id = -1;
+break;
+default:
+WRONG_PARAM_COUNT;­
+break;
+}
+
+
+ZEND_FETCH_RESOURC­E2(mysql, php_mysql_conn *, mysql_link, id, "MySQL-Link", le_link, le_plink);
+
+convert_to_string_­ex(cs_name);
+
+if (!mysql_set_charact­er_set(&mysql->conn,­ Z_STRVAL_PP(cs_name­))) {
+RETURN_TRUE;
+} else {
+RETURN_FALSE;
+}
+}
+/* }}} */
+#endif
+
#ifndef NETWARE/* The below two functions not supported on NetWare */
#if MYSQL_VERSION_ID < 40000
/* {{{ proto bool mysql_create_db(str­ing database_name [, int link_identifier])
Index: ext/mysql/php_mysql­.h
===================­====================­====================­========
RCS file: /repository/php-src­/ext/mysql/php_mysql­.h,v
retrieving revision 1.38
diff -u -r1.38 php_mysql.h
--- ext/mysql/php_mysql­.h1 Jan 2006 13:09:52 -00001.38
+++ ext/mysql/php_mysql­.h18 Oct 2006 12:10:02 -0000
@@ -91,6 +91,9 @@
PHP_FUNCTION(mysql_­thread_id);
PHP_FUNCTION(mysql_­client_encoding);
PHP_FUNCTION(mysql_­ping);
+#if (MYSQL_VERSION_ID > 40112 && MYSQL_VERSION_ID < 50000) || MYSQL_VERSION_ID > 50005
+PHP_FUNCTION(mysql­_set_charset);
+#endif

ZEND_BEGIN_MODULE_G­LOBALS(mysql)
long default_link;


Index: ext/mysql/php_mysql­.c
===================­====================­====================­========
RCS file: /repository/php-src­/ext/mysql/php_mysql­.c,v
retrieving revision 1.174.2.29.2.2
diff -u -r1.174.2.29.2.2 php_mysql.c
--- ext/mysql/php_mysql­.c1 Jan 2006 13:46:55 -00001.174.2.29.2.2­
+++ ext/mysql/php_mysql­.c18 Oct 2006 11:54:02 -0000
@@ -93,6 +93,10 @@
#define MYSQL_HAS_YEAR
#endif

+#if (MYSQL_VERSION_ID > 40112 && MYSQL_VERSION_ID < 50000) || MYSQL_VERSION_ID > 50005
+#define MYSQL_HAS_SET_CHARS­ET
+#endif
+
#define MYSQL_ASSOC1<<0
#define MYSQL_NUM1<<1
#define MYSQL_BOTH(MYSQL_AS­SOC|MYSQL_NUM)
@@ -162,6 +166,9 @@
PHP_FE(mysql_thread­_id,NULL)
PHP_FE(mysql_client­_encoding,NULL)
PHP_FE(mysql_ping,N­ULL)
+#ifdef MYSQL_HAS_SET_CHARS­ET
+PHP_FE(mysql_set_c­harset,NULL)
+#endif
#ifdef HAVE_GETINFO_FUNCS
PHP_FE(mysql_get_cl­ient_info,NULL)
PHP_FE(mysql_get_ho­st_info,NULL)
@@ -1123,6 +1130,48 @@
/* }}} */
#endif

+#ifdef MYSQL_HAS_SET_CHARS­ET
+/* {{{ proto bool mysql_set_charset(s­tring csname [, int link_identifier])
+ sets client character set */
+PHP_FUNCTION(mysql­_set_charset)
+{
+zval **cs_name, **mysql_link;
+int id;
+php_mysql_conn *mysql;
+
+switch(ZEND_NUM_AR­GS()) {
+case 1:
+if (zend_get_parameter­s_ex(1, &cs_name)==FAILURE)­ {
+RETURN_FALSE;
+}
+id = php_mysql_get_defau­lt_link(INTERNAL_FUN­CTION_PARAM_PASSTHRU­);
+CHECK_LINK(id);
+break;
+case 2:
+if (zend_get_parameter­s_ex(2, &cs_name, &mysql_link)==FAILU­RE) {
+RETURN_FALSE;
+}
+id = -1;
+break;
+default:
+WRONG_PARAM_COUNT;­
+break;
+}
+
+
+ZEND_FETCH_RESOURC­E2(mysql, php_mysql_conn *, mysql_link, id, "MySQL-Link", le_link, le_plink);
+
+convert_to_string_­ex(cs_name);
+
+if (!mysql_set_charact­er_set(&mysql->conn,­ Z_STRVAL_PP(cs_name­))) {
+RETURN_TRUE;
+} else {
+RETURN_FALSE;
+}
+}
+/* }}} */
+#endif
+
#ifndef NETWARE/* The below two functions not supported on NetWare */
#if MYSQL_VERSION_ID < 40000
/* {{{ proto bool mysql_create_db(str­ing database_name [, int link_identifier])
Index: ext/mysql/php_mysql­.h
===================­====================­====================­========
RCS file: /repository/php-src­/ext/mysql/php_mysql­.h,v
retrieving revision 1.33.2.2.4.1
diff -u -r1.33.2.2.4.1 php_mysql.h
--- ext/mysql/php_mysql­.h1 Jan 2006 13:46:55 -00001.33.2.2.4.1
+++ ext/mysql/php_mysql­.h18 Oct 2006 11:41:37 -0000
@@ -91,6 +91,9 @@
PHP_FUNCTION(mysql_­thread_id);
PHP_FUNCTION(mysql_­client_encoding);
PHP_FUNCTION(mysql_­ping);
+#if (MYSQL_VERSION_ID > 40112 && MYSQL_VERSION_ID < 50000) || MYSQL_VERSION_ID > 50005
+PHP_FUNCTION(mysql­_set_charset);
+#endif

ZEND_BEGIN_MODULE_G­LOBALS(mysql)
long default_link;


Index: ext/mysql/php_mysql­.c
===================­====================­====================­========
RCS file: /repository/php-src­/ext/mysql/php_mysql­.c,v
retrieving revision 1.213.2.6.2.5
diff -u -r1.213.2.6.2.5 php_mysql.c
--- ext/mysql/php_mysql­.c2 Aug 2006 10:04:11 -00001.213.2.6.2.5
+++ ext/mysql/php_mysql­.c18 Oct 2006 12:05:41 -0000
@@ -101,6 +101,10 @@
#define MYSQL_HAS_YEAR
#endif

+#if (MYSQL_VERSION_ID > 40112 && MYSQL_VERSION_ID < 50000) || MYSQL_VERSION_ID > 50005
+#define MYSQL_HAS_SET_CHARS­ET
+#endif
+
#define MYSQL_ASSOC1<<0
#define MYSQL_NUM1<<1
#define MYSQL_BOTH(MYSQL_AS­SOC|MYSQL_NUM)
@@ -173,6 +177,9 @@
PHP_FE(mysql_thread­_id,NULL)
PHP_FE(mysql_client­_encoding,NULL)
PHP_FE(mysql_ping,N­ULL)
+#ifdef MYSQL_HAS_SET_CHARS­ET
+PHP_FE(mysql_set_c­harset,NULL)
+#endif
#ifdef HAVE_GETINFO_FUNCS
PHP_FE(mysql_get_cl­ient_info,NULL)
PHP_FE(mysql_get_ho­st_info,NULL)
@@ -1126,6 +1133,48 @@
/* }}} */
#endif

+#ifdef MYSQL_HAS_SET_CHARS­ET
+/* {{{ proto bool mysql_set_charset(s­tring csname [, int link_identifier])
+ sets client character set */
+PHP_FUNCTION(mysql­_set_charset)
+{
+zval **cs_name, **mysql_link;
+int id;
+php_mysql_conn *mysql;
+
+switch(ZEND_NUM_AR­GS()) {
+case 1:
+if (zend_get_parameter­s_ex(1, &cs_name)==FAILURE)­ {
+RETURN_FALSE;
+}
+id = php_mysql_get_defau­lt_link(INTERNAL_FUN­CTION_PARAM_PASSTHRU­);
+CHECK_LINK(id);
+break;
+case 2:
+if (zend_get_parameter­s_ex(2, &cs_name, &mysql_link)==FAILU­RE) {
+RETURN_FALSE;
+}
+id = -1;
+break;
+default:
+WRONG_PARAM_COUNT;­
+break;
+}
+
+
+ZEND_FETCH_RESOURC­E2(mysql, php_mysql_conn *, mysql_link, id, "MySQL-Link", le_link, le_plink);
+
+convert_to_string_­ex(cs_name);
+
+if (!mysql_set_charact­er_set(&mysql->conn,­ Z_STRVAL_PP(cs_name­))) {
+RETURN_TRUE;
+} else {
+RETURN_FALSE;
+}
+}
+/* }}} */
+#endif
+
#ifndef NETWARE/* The below two functions not supported on NetWare */
#if MYSQL_VERSION_ID < 40000
/* {{{ proto bool mysql_create_db(str­ing database_name [, int link_identifier])
Index: ext/mysql/php_mysql­.h
===================­====================­====================­========
RCS file: /repository/php-src­/ext/mysql/php_mysql­.h,v
retrieving revision 1.37.2.1
diff -u -r1.37.2.1 php_mysql.h
--- ext/mysql/php_mysql­.h1 Jan 2006 12:50:09 -00001.37.2.1
+++ ext/mysql/php_mysql­.h18 Oct 2006 12:02:50 -0000
@@ -91,6 +91,9 @@
PHP_FUNCTION(mysql_­thread_id);
PHP_FUNCTION(mysql_­client_encoding);
PHP_FUNCTION(mysql_­ping);
+#if (MYSQL_VERSION_ID > 40112 && MYSQL_VERSION_ID < 50000) || MYSQL_VERSION_ID > 50005
+PHP_FUNCTION(mysql­_set_charset);
+#endif

ZEND_BEGIN_MODULE_G­LOBALS(mysql)
long default_link;



--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/­unsub.php
comment 5 answers | Add comment
Re: Encoding issue with Tedd 19:17:50
 At 5:55 PM +0000 1/23/07, Dave Goodchild wrote:>This may be more of a mysql issue, but I am using php for my app so here>goes...>
I have a fee field in the database, and when users post events they can>specify entrance fee in . In some, not all, of the fields I am getting, for>example, 7 rather than . Is this an encoding issue?

My guess is that it is. There are difference
between browsers, OS's, and thus support for
multilingual code-points. Not all allow the user
to submit those types of characters and worse
yet, some allow to them to be submitted
incorrectly.

As such, if it were me and I wanted a form for
the end user to indicate what currency s/her was
entering, I would make it a selection control of
some type and thereby control the user's input.

My $0.02.

tedd
--
-------
http://sperling.com­ http://ancientstone­s.com http://earthstones.­com

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


comment 5 answers | Add comment
HTML Input - Auto Format URL's Chris 17:10:02
 Hi,

I'm currently looking into the best way to approach this.

Users will be allowed to enter HTML, but I want to add the ability to
automatically format URL's and e-mail addresses.
The problem here is before formatting URL's we need to ignore URL's that are
already used in HTML tags and that are already formatted as hyperlinks.

First I am thinking if its possible to achieve this with various regular
expression patterns.
Another is to do a first pass of the input and find out what to ignore, then
on a second pass with format the links that were determined to be formatted.

I am welcome to any suggestions about this.

Thanks.

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


Add comment
PHP IMAP with Attachments!? Andy 16:49:38
 Hi to all,

I need a class that reads emails from a server and reads the attachments from the mail.

The mailservers is an IMAP for mail reading.

The attachment types can be: images/pdf/text documents.

Any suggestions?

On phpclasses.org did not find any which works well.


Regards,
Andy.
comment 4 answer | Add comment
php-gtk on winx64 Anthony Ettinger 13:59:25
 i am having trouble installing...i got php5 on fine.

but when i go to command line, and type "php demos\phpgtk2-demo.­php"
I get the following error:
"Please load the php-gtk2 module in your php.ini"

I didn't see anything obvious, it looked ok to me, any ideas would be
appreciated.

------- begin php.ini ----------
[PHP]

;;;;;;;;;;;;;;;;;;;­;;;;;;;;;;;;;
; About the php.ini in PHP-GTK ;
;;;;;;;;;;;;;;;;;;;­;;;;;;;;;;;;;
;
; This file introduces the php.ini settings that you will need in order to
; run PHP-GTK on your system. You may also need other settings from PHP's
; standard php.ini file, e.g. to load further extensions or otherwise control
; PHP's behaviour in matters such as error reporting. Please add those in
; the upper part of this file, in the PHP section.

; You should use PHP's CLI executable to run PHP-GTK. This php.ini file
; should be in the same directory as the PHP executable, to avoid conflict
; with any other copies of PHP that may be installed on your machine.

; The first thing you will need to do is tell PHP where you want it to look
; for the PHP extension libraries (php_*.dll or php_*.so files) on your system.

extension_dir = "./"

; Make sure that php-gtk2.dll under Windows, or php-gtk2.so under Unix, is in
; the directory named in extension_dir alongside any other shared PHP extensions
; you intend to use, and tell PHP to load it.

extension = php-gtk2.dll
;extension = php_pdo.**
;extension = php_sqlite.**
;extension = php_pdo_sqlite.**

[Date]
; Defines the default timezone used by the date functions
date.timezone = Europe/London

[PHP-GTK]

;;;;;;;;;;;;;;;;;;;­;;;
; PHP-GTK extensions ;
;;;;;;;;;;;;;;;;;;;­;;;

; Extensions written for PHP-GTK are in the format php_gtk_*.dll (Windows) or
; php_gtk_*.so (Unix), written here as a comma-separated list. The library
; files need to be in the same directory as the PHP-GTK library, along with
; any other PHP extensions you are using.

php-gtk.extensions = php_gtk_libglade2.d­ll

;;;;;;;;;;;;;
; Code Page ;
;;;;;;;;;;;;;

; The string variables used for titles and other text values in GTK+ are
; encoded in UTF-8 internally. A code page is needed so that PHP-GTK 'knows'
; which character set is being used, and can convert it to UTF-8 as necessary.

; If your environment uses UTF-8 already, you can set the codepage directive
; to UTF-8 to skip the conversions.

; The default codepage setting in PHP-GTK 2 is ISO-8859-1, but you can also
; use either OEM (e.g. 850) or Windows Code Pages (e.g. CP1250) here, so
; long as the encoding format you choose is capable of iconv conversion. See
; http://www.microsof­t.com/globaldev/refe­rence/cphome.mspx for a list of
; the code pages and character sets that are supported on Windows systems.

php-gtk.codepage = CP1250


-------------- end php.ini -----------

--
Anthony Ettinger
Ph: 408-656-2473
http://chovy.dyndns­.org/resume.html
http://utuxia.com/c­onsulting

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


comment 5 answers | Add comment
Splitting long text Skip Evans 10:40:45
 Hey all,

I have a requirement to take a large amount of
text, a story submitted to a competition, and
split into displayable chunks of 600 words each.

I'd like some feedback on the best way to this.

Thanks!
Skip

--
Skip Evans
Big Sky Penguin, LLC
61 W Broadway
Butte, Montana 59701
406-782-2240
http://bigskypengui­n.com
=-=-=-=-=-=-=-=-=-=­
Check out PHPenguin, a lightweight and
versatile PHP/MySQL development framework.
http://phpenguin.bi­gskypenguin.com/

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


comment 5 answers | Add comment
re: having trouble with is_file() and is_dir() on 5.1.2; solved Jekillen 08:25:44
 Thanks all.

**> As far as I know is_dir and is_file require a full path , ...

This did the trick. I kind of assumed that the path info would be
understood by is_file() and is_dir().
But explicitly adding the path info solved the problem.
Now I have a beautiful array with 38 items just as I need them.
JK

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


Add comment
smsSend Marcelo Ferrufino Murillo 08:16:10
 Hi guys, I m beginner in php, so I need some help. I have to make a
script to send SMS to moviles phones, can you give some ideas how to
make it please... Thank you

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


comment 3 answer | Add comment
[HELP] Fatal error when uploading large files! Jay Paulson 08:09:29
 Hi everyone,

Hopefully you all can help! I m at a loss as to what to do next. I m
running PHP 5.1.2 with Apache 2.0.55 on RedHat ES4 and I keep getting the
following PHP error when trying to upload a larger file. I have
AllowOverride turned on in the httpd.conf file so my .htaccess file is below
as well. When I look at phpinfo() it reflects the changes in the .htaccess
file but yet still I get the following PHP fatal error. Anyone have any
ideas what could be going on? Could it be the Zend Memory Manager
(something that I know nothing about)? Or anything else I may not be aware
of?

Any help would be greatly appreciated!


Fatal error: Allowed memory size of 20971520 bytes exhausted (tried to
allocate 19590657 bytes) in /path/to/php/file on line 979

LimitRequestBody 0
php_value memory_limit 40M
php_value post_max_size 30M
php_value upload_max_filesize­ 30M
php_value display_errors On
php_value max_execution_time 300
php_value max_input_time 300
comment 5 answers | Add comment
exec('make') Q Guest 08:05:03
 Here's a simple makefile I want PHP's exec to execute make on:

KEYLIST := keylist.txt
DEPS := $(wildcard *.txt)
FILES := *.txt

$(KEYLIST): $(DEPS)
grep ^keywords $(FILES) > $@

now when I use make from command line, it works as expected,
the keylist.txt file is created. however, when I use PHP exec
to run make on the makefile, the keylist.txt file is not generated.

* if keylist.txt does not need updating, PHP exec make works,
make says keylist.txt is up to date.
* if i remove redirection, PHP exec make shows that grep is
making the same matches as make from commandline.

Why does the redirection of the grep command (within the makefile)
only work when I execute make from the commandline but not from
PHP exec||shell_exec?

One sollution is to abandon redirection and get the output from
grep into a string and then get PHP to create keylist.txt, but
why do that?

Any help appreciated.
Cheers,
James.

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


comment 3 answer | Add comment
using return in include files Aaron Axelsen 07:53:46
 I'm trying to figure out what the desired behavior is of using the
return function to bail out of an include page.

I did some testing, and this is what I concluded.

First, I created the following file:

<?php
if (defined('TEST_LOAD­ED')) {
return;
}
define('TEST_LOADED­',true);
echo "blah blah blah blah<br/>";
?>

I then called it as follows:
include('test.php')­;
include('test.php')­;
include('test.php')­;

The output is:
blah blah blah blah

Second, I changed the test.php file to be the following:

<?php
if (defined('TEST_LOAD­ED')) {
return;
}
define('TEST_LOADED­',true);
echo "blah blah blah blah<br/>";

function myFunc($test) {

}
?>

When I load the page now, it throws the following error: PHP Fatal
error: Cannot redeclare myfunc()

It appears that if there are functions in the include page that you
can't use return to bail out. What is the desired functionality in this
case? Is this a bug in how php handles it? or was return never designed
to be used this way?

Any thoughts are appreciated.

--
Aaron Axelsen
lists@frozenpc.net

Great hosting, low prices. Modevia Web Services LLC -- http://www.modevia.­com

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


comment 4 answer | Add comment
having trouble with is_file() and is_dir() on 5.1.2 Jekillen 07:48:07
 Hello php developers:
I am having a problem with the following code:
OS: FreeBSD v6.0
Apache 1.3.34
php 5.1.2
-> $cont is an array produced from opening and reading a
directory:
for($i = 0; $i < count($cont); $i++)
{
print $cont[$i].'<br>';
if(is_file($cont[$i]))
{
print "is file: ".$cont[$i].'<br>';
//array_push($files­, $cont[$i]);
}
else if(is_dir($cont[$i]))
{
print "is dir: ".$cont[$i]."<br>";
//array_push($dirs,­ $cont[$i]);
}
}

The print statements produce the following:

collections
groups
in
index.php
lists.php
new_multi.php
new_single.php
out
pref_code
pref_funct.php
process.php
requests
rlists
routing.php
send.php
steps.php
store
templates

is dir: templates <- only directory recognized (extra line breaks
added here for readability)

usr_config.php
usr_pref.php

everything without an extension is a directory
You will notice that the only directory detected
by this code is templates. There are no files
detected by this code. Does this have something
to do with stat cache? I want to make one array
with directories and one array with files. I can't
see any syntax or logic problems.
Thanks in advance;
JK

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


comment 9 answers | Add comment
creating an api-which protocol do you use? Blackwater Dev 07:44:58
 I need to create some webservices for our web app and am really torn as to
which route to go...SOAP, XML_RPC, etc.? I like the looks of REST but many
of our partners that will be using our services use cold fusion and I think
that has build in SOAP support.

Which protocol would you use?

Thanks!
comment 1 answer | Add comment
Compiling PHP 5.2.0 on 64 bit Windows (using MS Visual Studio 2005) Ted Byers 07:38:48
 Has anyone done this? If so, any suggestions that may save me time and
trouble?

Ted

--
R.E. (Ted) Byers, Ph.D., Ed.D.
R & D Decision Support Solutions
http://www.randddec­isionsupportsolution­s.com/

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


Add comment
[PHP-DEV] Is this what Stefan Esser was referring to ...? Jochem Maas 04:20:26
 whilst reading the thread on security issues in response to
the article on the theregister.co.uk I came accross a remark
by Stefan Esser aimed at Chris Shiftlett which I didn't
understand, is this what he was referring to when he pointed
a/the violation of the php license?:

http://phpsec.org/i­mages/phpsecinfo_ss.­png

1. I don't feel strongly about the problem.
2. I don't want to stir any animosity towards phpsec or Chris Shiftlett
(Im very grateful for all the things I have learnt form them/him)
3. Stefan Essers apparent feeling of ill treatment may be colouring his
manner in terms of communicating this (and other) issue(s)

BUT ... doesn't Stefan have a valid point with regards to the
violation?

if not I guess my understanding of the PHP licence and the
PHP Group's policy is incorrect (I will make a go of rereading to correct
that mistake) but I would have thought that someone would have, very quickly,
offered up the reason(s) as to why there was no violation.

if yes then I'm rather surprised that:

a. the point was glossed over in favour of tackling Stefan's manner.
b. Chris Shiflett (and/or phpsec) didn't spot the 'problem' and
correct it proactively (I'm guessing, given his standing within the php
community, Chris know where his towel is, so to speak)
c. an amicable, behind the scenes solution was not crafted and implemented
(I gather Chris is good friends with more than one of the members/founders
of the PHP group) - in the spirit of portraying a consistent image/message
to the outside world - at the end of the day changing a logo and colour
scheme for the output of the tool in question is a rather minor technical
challenge (it seems to me).

I ask purely out of an insatiable curiosity with regard to anything that
has to do with php, I'd be very for any comments anyone offer
on this issue.

It has not been my intention to offend anyone so I apologize in advance
if I have inadvertently done so.

kind regards,
Jochem

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/­unsub.php


comment 32 answer | Add comment
[PHP-DEV] CVS Account Request: schmidt Christian Schmidt 00:43:38
 I intend to work on the OLE package and help with the Spreadsheet_Excel_W­riter package and the proposed Spreadsheet_Excel_R­eader package.

Arnaud Limbourg <arnaud@limbourg.co­m> wrote:>That would be great indeed. Do not hesitate to apply for a>pear-account and a cvs account if you don't have one. I'll>give you maintainer status.

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/­unsub.php


Add comment
Tuesday, 23 January 2007
[PHP-DEV] Giving Globals the CV treatment [WAS: Runtime JIT Proposals] Sara Golemon 21:06:36
 
The solution I'm tempted to pursue for this is to back up yet another > step and make autoglobals be CVs by extending the zend_compiled_varia­ble > struct to contain a flag indicating how the var should be fetched (the > determination for which happens during fetch_simple_var during the > compilation. This would then yield an opcode stack like the following:>
Okay, here's a shockingly simple patch for allowing auto globals to be
treated as CVs. The one question mark I've got in here is: Why the last
check in fetch_simple_var_ex­() for the ZEND_BEGIN_SILENCE opcode? This
seems completely unnecessary from what I can tell and shouldn't bar a
variable (global or not) from being treated as a CV...

Am I missing something really obvious?

-Sara


Index: Zend/zend_compile.h­
===================­====================­====================­========
RCS file: /repository/ZendEng­ine2/zend_compile.h,­v
retrieving revision 1.352
diff -u -p -r1.352 zend_compile.h
--- Zend/zend_compile.h­10 Jan 2007 15:59:55 -00001.352
+++ Zend/zend_compile.h­15 Jan 2007 22:48:24 -0000
@@ -174,6 +174,7 @@ typedef struct _zend_compiled_vari­able {
zstr name;
int name_len;
ulong hash_value;
+zend_uint fetch_type;
} zend_compiled_varia­ble;

struct _zend_op_array {
Index: Zend/zend_compile.c­
===================­====================­====================­========
RCS file: /repository/ZendEng­ine2/zend_compile.c,­v
retrieving revision 1.735
diff -u -p -r1.735 zend_compile.c
--- Zend/zend_compile.c­10 Jan 2007 15:59:55 -00001.735
+++ Zend/zend_compile.c­15 Jan 2007 22:48:24 -0000
@@ -267,7 +267,7 @@ static zend_uint get_temporary_varia­ble(
return (op_array->T)++ * sizeof(temp_variabl­e);
}

-static int lookup_cv(zend_op_a­rray *op_array, zend_uchar type, zstr name, int name_len)
+static int lookup_cv(zend_op_a­rray *op_array, zend_uchar type, zstr name, int name_len TSRMLS_DC)
{
int i = 0;
ulong hash_value = zend_u_inline_hash_­func(type, name, name_len+1);
@@ -290,6 +290,7 @@ static int lookup_cv(zend_op_a­rray *op_a
op_array->vars[i].name­ = name; /* estrndup(name, name_len); */
op_array->vars[i].name­_len = name_len;
op_array->vars[i].hash­_value = hash_value;
+op_array->vars[i].fet­ch_type = zend_u_is_auto_glob­al(type, name, name_len TSRMLS_CC) ? ZEND_FETCH_GLOBAL : ZEND_FETCH_LOCAL;
return i;
}

@@ -380,13 +381,12 @@ void fetch_simple_variab­le_ex(znode *res
if (varname->op_type == IS_CONST &&
(Z_TYPE(varname->u.­constant) == IS_STRING ||
Z_TYPE(varname->u.c­onstant) == IS_UNICODE) &&
- !zend_u_is_auto_glo­bal(Z_TYPE(varname->­u.constant), Z_UNIVAL(varname->u­.constant), Z_UNILEN(varname->u­.constant) TSRMLS_CC) &&
!(Z_UNILEN(varname-­>u.constant) == (sizeof("this")-1) &&
ZEND_U_EQUAL(Z_TYPE­(varname->u.constant­), Z_UNIVAL(varname->u­.constant), Z_UNILEN(varname->u­.constant), "this", sizeof("this")-1)) &&
(CG(active_op_array­)->last == 0 ||
CG(active_op_array)­->opcodes[CG(active_op_array)->last-1].opcode != ZEND_BEGIN_SILENCE)­) {
result->op_type = IS_CV;
-result->u.var = lookup_cv(CG(active­_op_array), Z_TYPE(varname->u.c­onstant), Z_UNIVAL(varname->u­.constant), Z_UNILEN(varname->u­.constant));
+result->u.var = lookup_cv(CG(active­_op_array), Z_TYPE(varname->u.c­onstant), Z_UNIVAL(varname->u­.constant), Z_UNILEN(varname->u­.constant) TSRMLS_CC);
result->u.EA.type = 0;
return;
}
Index: Zend/zend_execute.c­
===================­====================­====================­========
RCS file: /repository/ZendEng­ine2/zend_execute.c,­v
retrieving revision 1.757
diff -u -p -r1.757 zend_execute.c
--- Zend/zend_execute.c­10 Jan 2007 15:59:55 -00001.757
+++ Zend/zend_execute.c­15 Jan 2007 22:48:24 -0000
@@ -226,8 +226,9 @@ static inline zval *_get_zval_ptr_cv(z­no
if (!*ptr) {
zend_compiled_varia­ble *cv = &CV_DEF_OF(node->u.­var);
zend_uchar utype = UG(unicode)?IS_UNIC­ODE:IS_STRING;
+HashTable *symbol_table = (cv->fetch_type == ZEND_FETCH_GLOBAL) ? &EG(symbol_table) : EG(active_symbol_ta­ble);

-if (zend_u_hash_quick_­find(EG(active_symbo­l_table), utype, cv->name, cv->name_len+1, cv->hash_value, (void **)ptr)==FAILURE) {
+if (zend_u_hash_quick_­find(symbol_table, utype, cv->name, cv->name_len+1, cv->hash_value, (void **)ptr)==FAILURE) {
switch (type) {
case BP_VAR_R:
case BP_VAR_UNSET:
@@ -296,8 +297,9 @@ static inline zval **_get_zval_ptr_ptr­_c
if (!*ptr) {
zend_compiled_varia­ble *cv = &CV_DEF_OF(node->u.­var);
zend_uchar utype = UG(unicode)?IS_UNIC­ODE:IS_STRING;
+HashTable *symbol_table = (cv->fetch_type == ZEND_FETCH_GLOBAL) ? &EG(symbol_table) : EG(active_symbol_ta­ble);

-if (zend_u_hash_quick_­find(EG(active_symbo­l_table), utype, cv->name, cv->name_len+1, cv->hash_value, (void **)ptr)==FAILURE) {
+if (zend_u_hash_quick_­find(symbol_table, utype, cv->name, cv->name_len+1, cv->hash_value, (void **)ptr)==FAILURE) {
switch (type) {
case BP_VAR_R:
case BP_VAR_UNSET:



--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/­unsub.php
comment 15 answers | Add comment
Encoding issue with ё Dave Goodchild 20:55:08
 This may be more of a mysql issue, but I am using php for my app so here
goes...

I have a fee field in the database, and when users post events they can
specify entrance fee in ё. In some, not all, of the fields I am getting, for
example, бё7 rather than ё. Is this an encoding issue?

Many thanks in advance...

--
http://www.web-budd­ha.co.uk
Add comment
no database selected Ross 20:39:30
 I am using this to connect remotely but I get a no database selected error.
The table is contacts but there is not a parameter for database name
according to the documentation. How do I delect my database when conencting
this way?

$link = mysql_connect('xxxx­.org:3306', 'my_username', 'mypass');

echo 'Connected successfully';

$query = "SELECT * FROM contacts";

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


comment 2 answer | Add comment
[PHP-DEV] easter_date() II Oliver Block 20:34:10
 Hello,

easter_date() returns a timestamp produced by C's mktime().
(ext/calendar/easte­r.c:111):

Z_LVAL_P(return_val­ue) = mktime(&te);

AFAIK mktime() (time.h) is different to php's mktime() as it does not consider
php's timezones, i,e, C's mktime does always return a timestamp of the local
timezone. At least I conclude that from own tests.
PHP's date functions on the other hand interpret the timestamp with respect to
the php (default?) timezone.

This leads to the wrong test results of easter_date.phpt as described in my
posting from 22. Jan.

Regards,

Oliver

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/­unsub.php


comment 3 answer | Add comment
[PHP-DEV] Comments on PHP security Alain Williams 20:18:24
 This has just appeared:

http://www.theregis­ter.co.uk/2007/01/11­/php_apps_security/

--
Alain Williams
Linux Consultant - Mail systems, Web sites, Networking, Programmer, IT Lecturer.
+44 (0) 787 668 0256 http://www.phcomp.c­o.uk/
Parliament Hill Computers Ltd. Registration Information: http://www.phcomp.c­o.uk/contact.php
#include <std_disclaimer.h>

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/­unsub.php


comment 95 answers | Add comment

Add new topic:

How:  Register )
 
Login:   Password:   
Comments by: Premoderation:
Topic:
  
 
Пожалуйста, относитесь к собеседникам уважительно, не используйте нецензурные слова, не злоупотребляйте заглавными буквами, не публикуйте рекламу и объявления о купле/продаже, а также материалы нарушающие сетевой этикет или законы РФ. Ваш ip-адрес записывается.


QAIX > PHP web-programmingGo to page: « previous | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | next »

see also:
Looking for an inexpensive desktop
Does your D-link product need to be on…
i-RAM
pass tests:
see also:
Thought at Walkman's 30th birthday: why…
Review Some Popular Conversion Tools…

  Copyright © 2001—2010 QAIX
Идея: Монашёв Михаил.
Авторами текстов, изображений и видео, размещённых на этой странице, являются пользователи сайта.
See Help and FAQ in the community support.qaix.com.
Write in the community about the bugs you have noticedbugs.qaix.com.
Write your offers and comments in the communities suggest.qaix.com.
Information for parents.
Пишите нам на .
If you would like to report an abuse of our service, such as a spam message, please .
Если Вы хотите пожаловаться на содержимое этой страницы, пожалуйста .