php-general Digest 2 Dec 2001 09:38:07 -0000 Issue 1028

Topics (messages 76323 through 76340):

Re: Getting the filesize of an image?
        76323 by: faeton
        76324 by: Matt McClanahan
        76325 by: faeton

SAPI
        76326 by: Obasi Adande George
        76331 by: Fred

Cause of:`T_OLD_FUNCTION' or `T_FUNCTION' or `T_VAR'
        76327 by: Jason G.
        76332 by: Fred

how to get multiple checkbox values in a results page?
        76328 by: Ivan Carey
        76329 by: Philip Hallstrom

Re: Strange problem...
        76330 by: Edgardo Rossetto

Updating parts of files without rewriting them
        76333 by: Jeff Lewis
        76334 by: Fred

Re: Testing Alert: Significant changes to DOM-XML
        76335 by: Markus Fischer

Few quick questions on php 4.1
        76336 by: Joelmon2001.aol.com

HTTP_SESSION_VARS != Work
        76337 by: Andrew Forgue
        76338 by: Fred

database problem?
        76339 by: christian.donhofer.chello.at

Mercantec Payment Module
        76340 by: John Monfort

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]


----------------------------------------------------------------------
--- Begin Message ---
Hello Matt,

Of course it does not, but as i've already said file() with strlen()
can be used. :)

MM> If you want the size of a remote file, you'll have to download it; HTTP
MM> doesn't provide a way to query a remote file's size.  FTP does, if you have
MM> FTP access.


------------------------------------------------
Ivan 'Faeton aka xetrix' Danishevsky
ICQ(240266) [EMAIL PROTECTED] www.xemichat.com

--- End Message ---
--- Begin Message ---
On Sat, Dec 01, 2001 at 11:05:51PM +0200, faeton wrote:

> Hello Matt,
> 
> Of course it does not, but as i've already said file() with strlen()
> can be used. :)
> 
> MM> If you want the size of a remote file, you'll have to download it; HTTP
> MM> doesn't provide a way to query a remote file's size.  FTP does, if you have
> MM> FTP access.

Not on binary files.  For an image that's 4494 bytes, file/join/strlen gives
me 3512.  And since file() on a remote file is downloading it anyway, you
might as well do it right:

$fp = fopen('http://example.com/image.jpg','r');
while (!feof($fp))
        $image .= fread($fp,1024);
echo strlen($image);

Matt
--- End Message ---
--- Begin Message ---
Hello Matt,

So does that problem have a solution?

MM> Not on binary files.  For an image that's 4494 bytes, file/join/strlen gives
MM> me 3512.  And since file() on a remote file is downloading it anyway, you
MM> might as well do it right:
MM> $fp = fopen('http://example.com/image.jpg','r');
MM> while (!feof($fp))
MM>         $image .= fread($fp,1024);
MM> echo strlen($image);
MM> Matt


------------------------------------------------
Ivan 'Faeton aka xetrix' Danishevsky
ICQ(240266) [EMAIL PROTECTED] www.xemichat.com

--- End Message ---
--- Begin Message ---
I have been trying to get apache2 to load the php4 module for a while now, but after 
consulting the bug report page, i was directed to seek assistance from you all. Is 
there any further files I may need to have this program p and running.

Thank You For Your Assistance in this matter
Obasi Adande George
--- End Message ---
--- Begin Message ---
What is not working?  Are you getting an error message?

Fred

Obasi Adande George <[EMAIL PROTECTED]> wrote in message
000801c17ab6$5d77bf90$b6d45ed1@tbird">news:000801c17ab6$5d77bf90$b6d45ed1@tbird...
I have been trying to get apache2 to load the php4 module for a while now,
but after consulting the bug report page, i was directed to seek assistance
from you all. Is there any further files I may need to have this program p
and running.

Thank You For Your Assistance in this matter
Obasi Adande George



--- End Message ---
--- Begin Message ---
Hello all,

I have ran across this error a number of times, and for those of you who 
are or will pulling out your hair, read on.

When you get a:

Parse error: parse error, expecting `T_OLD_FUNCTION' or `T_FUNCTION' or 
`T_VAR' or `'}'' in your_script.php on line 2149

Check to see if you have all of you { and } intact.
The error could be thousands of lines away, but the error message may point 
to the end of your file.

I notice this behavior when I am working on class definitions and forget to 
open close a block (switch, for, while) in a method in the class somewhere.

Hope it helps someone.

-Jason Garber
IonZoft.com



--- End Message ---
--- Begin Message ---
A couple of more pointers:

Check the line right before the parse error for missing }) or ;

Always close your curley braces right after you open them and then insert
your code lines between the braces. {}  This will prevent you from
forgetting to close your braces.

Never write a single script with 2149 lines of code ;)

Fred

Jason G. <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hello all,
>
> I have ran across this error a number of times, and for those of you who
> are or will pulling out your hair, read on.
>
> When you get a:
>
> Parse error: parse error, expecting `T_OLD_FUNCTION' or `T_FUNCTION' or
> `T_VAR' or `'}'' in your_script.php on line 2149
>
> Check to see if you have all of you { and } intact.
> The error could be thousands of lines away, but the error message may
point
> to the end of your file.
>
> I notice this behavior when I am working on class definitions and forget
to
> open close a block (switch, for, while) in a method in the class
somewhere.
>
> Hope it helps someone.
>
> -Jason Garber
> IonZoft.com
>
>
>
>


--- End Message ---
--- Begin Message ---
Hello,
I have a form with multiple checkboxes.
Their names are the same ie all are befname and their values are dynamically filled 
from a data base.
When I check multiple boxes I expect that an array of the values with the array named 
befname is sent to the results page. In my example the form action is inschk.php

If an array is sent to inschk.php how may I get the multiple values out of it.

If this can be done I then will insert the different values into a database.

At present if I check multiple checkboxes I can only see the value of the last 
checkbox that is checked.

Thanks,
Ivan
--- End Message ---
--- Begin Message ---
Rename your form name to "befname[]"  Then you'll get them all... this is
in the manual somewhere if you need more info on it... don't remember
exactly where.

-philip

On Sun, 2 Dec 2001, Ivan Carey wrote:

> Hello,
> I have a form with multiple checkboxes.
> Their names are the same ie all are befname and their values are dynamically filled 
>from a data base.
> When I check multiple boxes I expect that an array of the values with the array 
>named befname is sent to the results page. In my example the form action is inschk.php
>
> If an array is sent to inschk.php how may I get the multiple values out of it.
>
> If this can be done I then will insert the different values into a database.
>
> At present if I check multiple checkboxes I can only see the value of the last 
>checkbox that is checked.
>
> Thanks,
> Ivan
>

--- End Message ---
--- Begin Message ---
Hola Daniel:

Te escribo en castellano ya que veo que el inglés no es tu idioma natural.

Creo que el error se produce al concatenar las variables, acordate que para
indicar que las variables con cadenas tenés que encerrarlas entre "", yo lo
definiría así:

$user_birthdate = "$birth_year-$birth_month-$birth_day"; // 1982-12-08

Saludos

Edgardo

"Daniel alsén" <[EMAIL PROTECTED]> escribió en el mensaje
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hi,
>
> i have a strange problem.
>
> I get a users birthdate with three dropdown menus (year, month and day of
> month). I get these values into one string with:
>
> $user_birthdate = $birth_year . $birth_month . $birth_day;
>
> If i echo $user_birthdate after this it is correct (yyyymmdd). But when i
> insert the value of $user_birthdate into MySql it gets the value
'8388607'.
> It doesn´t matter what value $user_birthdate had originally - it always
> inserts as 8388607.
>
> Any ideas???
>
>
>
> The db question looks like this btw:
>
> $query = "INSERT INTO users ";
>
> $query .= "(user_name, user_birthdate, user_city, user_mail, user_icq,
> user_msn, user_www, user_login, user_password) ";
>
> $query .= " values('$user_name', '$user_birthdate', '$user_city',
> '$user_mail', '$user_icq', '$user_msn', '$user_www', '$user_login',
> '$user_password')";
>
>
> Regards
> # Daniel Alsén    | www.mindbash.com #
> # [EMAIL PROTECTED]  | +46 704 86 14 92 #
> # ICQ: 63006462   | +46 8 694 82 22  #
> # PGP: http://www.mindbash.com/pgp/  #
>


--- End Message ---
--- Begin Message ---
I have a file that contains settings and there are a lot of comments in
there and a lot of variables.  An excerpt of the file looks like below.  My
question is, is it possible to change only certain variables?  For example,
I want to set just the db variables, is it possible for me to input the new
values in a form and replace only those in the file without having to
rewrite the entire file?

$mailtype = 0;     # 0 - sendmail, 1 - SMTP

########## Database Info ##########
$db_name = "name";
$db_user = "user";
$db_passwd = "pass";
$db_server = "localhost";

########## Directories/Files ##########
# Note: directories other than $imagesdir do not have to be changed unless
you move things

$boarddir = ".";     # The absolute path to the folder (usually can be left
as '.')
$sourcedir = "./Sources";           # Directory with source files


--- End Message ---
--- Begin Message ---
You cannot make changes to a file without writing the entire contents of the
file to disk.  On the other hand, you do not need to manually re-create the
entire contents.  Simple read the file into a variable and use regular
expressions to replace the old lines with new ones and then write the file
to disk.  For what its worth, I cannot think of a justification for keeping
any settings other than database settings in a file.  I would recommend
keeping all settings, other than database access settings, in a database.
This makes accessing and updating the settings much easier.  The only reason
database settings must be in a file is because you obviously cannot access
the database without them (unless you use default settings in the php.ini
file).

Fred

Jeff Lewis <[EMAIL PROTECTED]> wrote in message
002801c17ad9$7ec8b820$0100a8c0@cr983033a">news:002801c17ad9$7ec8b820$0100a8c0@cr983033a...
> I have a file that contains settings and there are a lot of comments in
> there and a lot of variables.  An excerpt of the file looks like below.
My
> question is, is it possible to change only certain variables?  For
example,
> I want to set just the db variables, is it possible for me to input the
new
> values in a form and replace only those in the file without having to
> rewrite the entire file?
>
> $mailtype = 0;     # 0 - sendmail, 1 - SMTP
>
> ########## Database Info ##########
> $db_name = "name";
> $db_user = "user";
> $db_passwd = "pass";
> $db_server = "localhost";
>
> ########## Directories/Files ##########
> # Note: directories other than $imagesdir do not have to be changed unless
> you move things
>
> $boarddir = ".";     # The absolute path to the folder (usually can be
left
> as '.')
> $sourcedir = "./Sources";           # Directory with source files
>
>


--- End Message ---
--- Begin Message ---
    [This mail goes out to php-dev, php-qa and php-general and
    has its Reply-To: set to php-dev!]

    Hi Zak,

    thanks for the mail, I was thinking about writing such a mail
    myself but was to tired I guess.


    Yep, the CVS note to the latest ext/domxml changes state it
    clearly:

        # Testers/patches/contribs welcome.

    The actual changelog can be found here [1].


    Also for anyone out there who has no idea about CVS: It won't
    help me anything filing bug reports against any released
    source code of PHP out there. Please use the HEAD branch when
    filing bug reports. See CVS instructions at
    http://www.php.net/anoncvs.php how to achive this.


    Although I don't expect a rush on this ;) I want to give out
    some simple rules for anyone helping us getting domxml more
    stable:

        .) If you have a reproduceable crash with small
           self-containing script with no other external
           dependencies than loading a file ->

                don't forget to use the bug reporting system!

           Do not mail me privately about it!

           No, I'm not lazy or whatever but I wan't to broaden
           the audience reading about the bugs (two eyes see less
           than more eyes) and it also helps me keeping track of
           all the problems.

        .) If you have a reproduceable crash but can't create a
           small self-containing script, there are three options:

            1) still try to create one (prefered)

            2) Provide backtrace in your bug report
               ('bt full' command, not normal bt)

            3) give me access to your devel system
               (no, no joke. This has worked in the past, it can
               in the future) But no promises.

        .) Before reporting, try creating a testcase which is
           suiteable to run on the command line of PHP (read:
           with the CGI version).

           Apache is nice but it adds some extra work when
           handling the bugs I prefer the reproduceable scripts
           which use the CGI version for testing and don't
           contain any fancy <br /> tags but newlines and such
           instead. The find bug/fix it cycle is much faster
           without apache.

           Again, I'm not lazy, but I'm also using MSVC for
           debugging and although I'm not a windows fan I've seen
           myself being faster chasing down bugs with it then
           with gdb (doh!).

        .) Patches can go directly to me; but please also tell me
           why and what and give a testing script and not only
           send a diff to me.

           Of cousre, anyone with the proper karma is encouraged
           to fix it himself (you might want to check back if I'm
           not currently working on it).

        .) NEW FEATURES

           No, I do NOT plan to add now featuers. I'm just
           interesting in making the current version more stable
           but time doesn't permit to expand this scope.

           But you're still encouraged to use the bug report
           system to put your feature requests there or do it
           yourself.


    What I wrote done seems normal to me and I do not explicetely
    prefer this for domxml but anything else too. Saves mit quite
    lot of time.


On Sat, Dec 01, 2001 at 08:19:47PM -0700, Zak Greant wrote : 
> Marcus Fischer has made [...]

    Yo, and its still MarKKKKKKKus ;-)

    - Markus

[1] http://cvs.php.net/cvs.php/php4/ext/domxml/php_domxml.c

-- 
Please always Cc to me when replying to me on the lists.
--- End Message ---
--- Begin Message ---
I saw a download for it a few days ago but I am curious to know:

A.) how stable is it
B.) Is there offically a known 'make' one must have on linux to install it?
3.7.7 ok? (Freetype I found out 3.7.8 or higher according to a developer of 
freetype)
C.) what are the new features and when is it officially up from php.net?

Unless I am a picklehead and I missed it was released like today or yesterday

Thanks 
Joel
--- End Message ---
--- Begin Message ---
Hello,

Slight Problem:

----------
This piece of code:

session_start();
unset($testvar);
session_register("testvar"); $HTTP_SESSION_VARS["testvar"] = "testval";
print "Global: $testvar | Track_var: " . $HTTP_SESSION_VARS["testvar"] . ".<br>";
$testvar = "testglobalassign";
print "Global: $testvar | Track_var: " . $HTTP_SESSION_VARS["testvar"] . ".<br>";

Produces this output:

Global: | Track_var:
Global: testglobalassign | Track_var:

--------

Now, The other HTTP_*_VARS works just fine. I dont know where to go to fix this. The 
Php.ini file says:

register_globals: on
and I compiled it with --enable-track-vars (even though it should be on by default) 

PHP version is 4.0.6 with apache 1.3.22

Anyone seen this problem or know how to fix?

Thanks, 
Andrew





--- End Message ---
--- Begin Message ---
It looks like it is working as expected.  You must note two things.

First, session variables are updated to new values only when you explicitly
call session_register or when the script ends.  When you call
session_register, the session variable will have the value that the global
variable had at the time the session_register is called.  In your case the
variable is not set so the session variable is empty.  When the script ends
the session variable is assigned the value held by the global variable when
the script ends.  This is why you get "" when you try to print the session
variables.  They have never been updated.

Second, the HTTP_SESSION_VARS array is read only.  You cannot assign values
to session variables this way.  You can only assign values to session
variables by assigning values to the global variable that has been
registered with the session.  This is why neither the global or session
variable was changed in the first part of your example.

Fred

Andrew Forgue <[EMAIL PROTECTED]> wrote in message
002c01c17af4$a765f390$6701a8c0@ajf">news:002c01c17af4$a765f390$6701a8c0@ajf...
Hello,

Slight Problem:

----------
This piece of code:

session_start();
unset($testvar);
session_register("testvar"); $HTTP_SESSION_VARS["testvar"] = "testval";
print "Global: $testvar | Track_var: " . $HTTP_SESSION_VARS["testvar"] .
".<br>";
$testvar = "testglobalassign";
print "Global: $testvar | Track_var: " . $HTTP_SESSION_VARS["testvar"] .
".<br>";

Produces this output:

Global: | Track_var:
Global: testglobalassign | Track_var:

--------

Now, The other HTTP_*_VARS works just fine. I dont know where to go to fix
this. The Php.ini file says:

register_globals: on
and I compiled it with --enable-track-vars (even though it should be on by
default)

PHP version is 4.0.6 with apache 1.3.22

Anyone seen this problem or know how to fix?

Thanks,
Andrew








--- End Message ---
--- Begin Message ---
hi all!

i have the following problem:

1.im loading 5 colums from a mysql-table into an array: 

$threads = db_query("SELECT title, date, body, poster, board_posts_ID FROM board_posts 
WHERE msgkind = 'thr' 
           ORDER BY date DESC");

everything fine so far...

2.im trying to list them line by line:

while (list ($title, $date, $body, $poster, $msgID) = mysql_fetch_array($threads)){
print (" <tr>\n".
           "  <td><a href=\"view_thread.php&parent=".$msgID. 
           "  \">$title</a></td>\n".
           "  <td>$poster</td>\n".
           "  <td>$date</td>\n".        
           "  </tr>\n");

}
here is the problem:
there's always one line(row) missing (i.e. if there are 17 rows in the db, 16 are 
being displayed in the browser).i've tried the same code with mysql_fetch_row()...no 
difference in the outcome.

please reply to this msg if you can help,
thx in advance, Chris



--- End Message ---
--- Begin Message ---

 Has anyone here worked with the Mercantec Merchant Account?

 If so, do you have (or know where I can get) a payment module? Or,
 information on how I can process cards myself?

 I'm looking for something like AuthorizeNet offers.

 Please help.

 -john


__________John Monfort_________________
_+-----------------------------------+_
     P E P I E  D E S I G N S
       www.pepiedesigns.com
"The world is waiting, are you ready?"
-+___________________________________+-


--- End Message ---

Reply via email to