php-general Digest 11 Jun 2006 00:22:39 -0000 Issue 4178

Topics (messages 237733 through 237745):

Curio
        237733 by: Dave Goodchild
        237737 by: Jay Blanchard
        237739 by: tedd

$B$"$s$?!"B;$7$F$k$h!#(B
        237734 by: saki

$B#1#0?M$r?)$($?!"$*$$$7$#%5%$%H!*!*!*(B
        237735 by: rika

Re: Restrict uploaded scripts
        237736 by: Mathias Bundgaard Svesson

Re: Mail sending program (beginner)
        237738 by: tedd

Re: Session puzzle... / why no new session?
        237740 by: Ryan A

HTML (php page) -> PDF recommendation
        237741 by: Ryan A
        237743 by: Frank Arensmeier

Re: Tables vs. databases
        237742 by: tedd

Re: order of elements in $_POST super global
        237744 by: Ben Liu

Re: How to re-order an array
        237745 by: Rafael

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:
        php-general@lists.php.net


----------------------------------------------------------------------
--- Begin Message ---
Just a question out of curiousity for the language lawyers out there. Why is
it illegal to begin a variable name with a number in php?

--
http://www.web-buddha.co.uk

dynamic web programming from Reigate, Surrey UK (php, mysql, xhtml, css)

look out for project karma, our new venture, coming soon!

--- End Message ---
--- Begin Message ---
[snip]
Just a question out of curiousity for the language lawyers out there.
Why is
it illegal to begin a variable name with a number in php?
[/snip]

This is fairly standard in programming languages. Years ago (sometime in
the 70's) the reasoning was given to me, but I have long since replaced
the data at that address with some other, probably trivial, fact. I
tried a quick Google, but no joy.

--- End Message ---
--- Begin Message ---
At 11:31 AM +0100 6/10/06, Dave Goodchild wrote:
>Just a question out of curiousity for the language lawyers out there. Why is
>it illegal to begin a variable name with a number in php?
>

I don't know why in they do it in php, but I would guess that it's one of those 
legacy things.

Back when I was programming with rocks, a language called FORTRAN came along 
(before FORTRAN started having Roman Numerals after its name).

The rules of this new language was that integers could only start with the 
letters I, J, K, L ,M, N (hence our custom to use $i , $j, $k for loops) and 
all other real number could start with any other character but those, and could 
not start numbers -- however, both variables could contain numbers but were 
limited to just six letters total. (But note we didn't have to start variables 
with a $ ).

As far as strings were concerned -- what the hell were those? If you wanted to 
print something, you use a FORMAT statement and therein you might find syntax 
that could start with a number, such as 4F5.0, but that was just to format a 
number for print -- it had nothing to do with a variable name.

In defense of the decision of the time, I doubt that many of you remember IBM 
punch cards (one card for every line of code in your program) but it was a 
*great* deal easier to review and edit your stack of code if you kept numbers 
and letters separate with different meanings.

So, my guess is it's legacy.

My question to you is, what are you passing on that in 40 years some young 
programmer will ask "Why is it illegal to..."  :-)

tedd

-- 
------------------------------------------------------------------------------------
http://sperling.com  http://ancientstones.com  http://earthstones.com

--- End Message ---
--- Begin Message ---
最近セフレを探す女の子が増えました!
その響きだけ聞けば「なんだかなぁ」って思う人もいると思います。
でも、実際は大多数の人とセックスをしないようになるので衛生的ですし、
恋人だと少々重く感じる人がいるからこういう関係が成り立つわけで、
一緒に買い物にいったり、映画を見たり、恋愛相談をできたりする
「仲のいい友達感覚」でお付き合いしている方が多いみたいです。
お互いの欲望を満たしあえる友達 . . . 。
いけない事なんてなにもない!!
あなたもここで素敵なお相手を見つけてください!!
http://vqlh.com/?hy04







拒否
[EMAIL PROTECTED]





--- End Message ---
--- Begin Message ---
ユーザー体験人気NO.1サイト!女性会員が日本最大級の圧巻サイトです。

恋人、不倫、セフレ、目的に沿って募集が可能。約60%程の女の子が写真を掲載している。

完全無料登録サイト
お試しあれ!!!!
http://vqlh.com/?hy03








拒否
[EMAIL PROTECTED]





--- End Message ---
--- Begin Message ---
Would it then be posible to restrict it in some other way, for example
using chroot? Or do I just have to make sure that the modules come from
a source that I trust or look through the code?

fre, 09 06 2006 kl. 10:47 -0400, skrev Jim Moseby:
> > 
> > Wouldn't it even be posible, if the script couldn't be run 
> > directly, but
> > had to be run through require or something like that?
> > 
> 
> Require just includes the code inline.  It still runs on the webserver as
> the server user as if it were one big script.  I think you would have to
> sanitize the uploaded code before allowing it to run.  Writing the
> sanitation algorithm to perform such a task would be a nightmare.
> 
> JM

--- End Message ---
--- Begin Message ---
At 10:54 AM +0530 6/10/06, aci india wrote:
>Dear group,
>
>Description:
>
>Following is the code which I tried for learning propuses. It is a mail
>sending program


-snip-

I read what you wanted, try this:

http://www.weberdev.com/get_example-503.html

hth's

tedd
-- 
------------------------------------------------------------------------------------
http://sperling.com  http://ancientstones.com  http://earthstones.com

--- End Message ---
--- Begin Message ---
Hey Chris,
Thanks for replying.

Dont worry about it, solved it, made a silly mistake
on my part but corrected it by just copying the code
from the session_destroy page on the
manual...destroyed the session and the cookie and all
works good now.

Thanks!
Ryan

 
> If you're logging straight back in after logging
> out, maybe not - the
> browser might remember the old session. If you log
> out, close the
> browser then go to the login page you should get a
> new id. If you want
> to guarantee a new id, use
> http://php.net/session_regenerate_id
> 
 


------
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

--- End Message ---
--- Begin Message ---
Hi,
can anybody give me a recommendation on a good
html->pdf converter. Checked google and there are
loads of classes, this one looks like one of the best
though (even in price):

http://www.rustyparts.com/pdf.php

Anybody else using this? if yes, would appreciate any
"cons" of using this class.
Or, if you are using another class to do the above and
think its the next best thing to sliced bread, I would
appreciate you sending me the link so that I may try
it out.

All I need is a pdf generator that will generate an
exact (or as close to exact) copy of the html page
(that was generated by php, not a static html page),
nothing fancy, no permissions etc

Thanks!
Ryan

------
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

--- End Message ---
--- Begin Message --- Depending on what you need (CSS support, good table support and so on) and which plattform you are working with it might be a good idea to have a look at: http://www.digitaljunkies.ca/dompdf/

There are also several on-line services available like: http:// www.pdfonline.com/

If you are on Mac OS X, I would definitely recommend looking at the Core Image functions within the Quartz 2D layer in Mac OS X. Core Image has also subroutines for PDF output (this is why you can save any document from any program in Mac OS X as a PDF file). You can access those APIs for example via Python.

http://developer.apple.com/documentation/GraphicsImaging/Conceptual/ drawingwithquartz2d/dq_python/chapter_17_section_1.html

This might give you some ideas where to start.

/frank

10 jun 2006 kl. 16.57 skrev Ryan A:

Hi,
can anybody give me a recommendation on a good
html->pdf converter. Checked google and there are
loads of classes, this one looks like one of the best
though (even in price):

http://www.rustyparts.com/pdf.php

Anybody else using this? if yes, would appreciate any
"cons" of using this class.
Or, if you are using another class to do the above and
think its the next best thing to sliced bread, I would
appreciate you sending me the link so that I may try
it out.

All I need is a pdf generator that will generate an
exact (or as close to exact) copy of the html page
(that was generated by php, not a static html page),
nothing fancy, no permissions etc

Thanks!
Ryan

------
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

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



--- End Message ---
--- Begin Message ---
At 10:40 PM +0530 6/9/06, Antonio Bassinger wrote:
>Hi gang,
>
>Situation:
>
>I've a HTTP server. I intend to run a file upload service. There could be up
>to 10000 subscribers. Each saving files up to 10 MB.
>
>I made a proof-of-concept service using PHP & MySQL, where there is a single
>database, but many tables - a unique table for each subscriber. But I
>realize that I may land in trouble with such a huge database. Would it be
>better to have a separate database for each subscriber?
>
>Which approach is better, many tables in 1 database, or many databases with
>1 or max 2 tables?
>
>Kindly suggest with pros and cons of each.
>
>Thanks & Regards,
>Bassinger

You might also ask the mysql group.

http://lists.nyphp.org/mailman/listinfo/mysql

hth's

tedd

-- 
------------------------------------------------------------------------------------
http://sperling.com  http://ancientstones.com  http://earthstones.com

--- End Message ---
--- Begin Message ---
Hi Richard,

I'm basically building a custom mysql table to delimited text file function for a membership site. So I've got a lot of typical demographic info fields like name, address, etc. The site owners would like to dump the membership information for their own purposes, but they don't always want a complete set of all data. So the form lists each field with a checkbox to determine whether it is desired in the exported text file. To simplify things, the names of the checkbox form fields correspond exactly to the names of the related fields in the mysql table. So if there is a field named home_address1, the form checkbox is also name="home_address1". When I capture the form data, I iterate through the $_POST variable and create a custom query based on the checkboxes that are checked. So the form presented looks like:

<snip>
                <input type="checkbox" value="1" name="prefix">Prefix</input><br 
/>
<input type="checkbox" value="1" name="first_name">First Name</ input><br /> <input type="checkbox" value="1" name="middle_name">Middle Name</ input><br /> <input type="checkbox" value="1" name="last_name">Last Name</ input><br />
                <input type="checkbox" value="1" name="suffix">Suffix</input><br 
/>
<input type="checkbox" value="1" name="home_addr1">Home Address (Street)</input><br /> <input type="checkbox" value="1" name="home_addr2">Home Address 2</ input><br />
</snip>

Since the form fields names correspond to mysql field names rather than just a plain index array, I can use the keys thus:

<snip>

$exp_format=array_shift($_POST);
        if ($exp_format=="tab") {$delimiter="\t"; $filesuffix=".txt";}
        if ($exp_format=="csv") {$delimiter=","; $filesuffix=".csv";}
        
/* reset three array elements in the POST superglobal, they are flags and
        should not be part of the custom query */
        $mem_activity=array_shift($_POST);
        $part_pref=$_POST['part_pref'];
        unset($_POST['part_pref']);
        
        $query="SELECT mem_id, ";
        
        foreach ($_POST as $key => $data) {
                $query.="$key, ";
        }
        /* chops off the last space and comma */
        $length=strlen($query);
        $query=substr($query, 0, $length-2);

</snip>
So what I really want to know is if there is some kind of best- practice method of rearranging the order of the items in a $_POST array without rearranging the elements on the original form, or post- processing them item by item.


        Thanks for any insights...

- Ben

The script that processes the form looks like:


On Jun 9, 2006, at 7:12 PM, Richard Lynch wrote:

name="bool[0][careers]"

might do what you want...

it's really quite difficult to say without a concrete example...

On Thu, June 8, 2006 10:20 am, Ben Liu wrote:
I probably should add some more details to my question:

The names of the form checkboxes could be changed from ie:
bool_careers, bool_speaking, bool_internship, etc. to a single array
bool_questions[], for instance. The problem with that is that I am
using the form checkbox names later to process related data.
Specifically, I am building a user-input based query. So if the form
checkbox names are the same as the names of the variables in the
database, it makes for easy creating of the query, since the names
become associative keys in the $_POST array. I iterate through the
$_POST array, checking each for true/false state. If the checkbox is
checked, I add the associative key name to the query. Eliminating the
checkbox names in favor of a numerical key only would make this more
complicated.

- Ben

On 6/8/06, Barry <[EMAIL PROTECTED]> wrote:

1. Use Keys in your form like a[1],a[2]
2. order the array by usort (alphabetically or whatever u prefer)

that way => 2: yes it is.

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




--
Like Music?
http://l-i-e.com/artists.htm



Attachment: smime.p7s
Description: S/MIME cryptographic signature


--- End Message ---
--- Begin Message --- Since you asked for some theory... theorically, you won't rely on javascript to prepare/validate/whatever some data to the server, that's what server-side scripts are for. Note: you may use JS to make things quicker if possible, or to pre-digest the data, but you shall not rely entirely on JS.

You say that not all browsers support the javascript functions you pretend to use, and that not all them support Ajax either. That sounds just like saying that not all browser will have javascript enabled --that's why you shouldn't rely on javascript

Although, this isn't a javascript list, why don't you send whatever you were trying to solve this issue? the code that uses JS functions not supported for all the browsers that will potentially run the script (as well as what these browsers are) Most likely someone will be able to help you this way.

jekillen wrote:
Hello;
i'm scratching my head with a difficulty.
The situation is this.
A script begins with one indexed array (not associative) and one other indexed array
with the same values in a different order, the final order.
I want to create an interim array and progressively re order the array until it matches slot for slot one of the original arrays. At this point the script is considered completed. One important factor is that I'm looking to write this in javascript and the interim
array will be altered by the actions of a web page user.
Why am I asking the php list? Because I have a better chance of getting an answer here. I'm not looking for help with javascript, specifically, just how one would go about this task. Answer with php code and some theory if you wish and I will try to translate
it into javascript.
Some javascript functions I might use aren't supported in all the browsers that will
potentially run the script.
I might resort to using Ajax and let php keep track for me. But, then again not all
browsers will do the Ajax either (as I understand it).
--
Atentamente / Sincerely,
J. Rafael Salazar Magaña

--- End Message ---

Reply via email to