php-general Digest 28 Nov 2006 08:07:11 -0000 Issue 4484
Topics (messages 245191 through 245208):
Re: Running AMP from CD
245191 by: Ryan A
245192 by: Ryan A
245196 by: Paul Scott
245203 by: Paul Scott
Re: getting around the undefined index
245193 by: Stut
245194 by: Eric Butera
245195 by: Paul Novitski
Re: Tidy HTML source?
245197 by: tedd
245202 by: Mark Kelly
245208 by: Frank Arensmeier
text only and text sizer
245198 by: Ross
245199 by: Paul Novitski
Re: mail header questions
245200 by: Manuel Lemos
func_get_args as a hash? (faster constructors)
245201 by: Kelly Jones
fput error
245204 by: Manoj Singh
Re: Please hack my app
245205 by: Jordan Forssman
ldap_sasl_bind & GSSAPI question.
245206 by: Back Ports
245207 by: Chris
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 ---
Hey Rich,
To be honest I thought of using WGET and if I remember correctly it was
suggested in the original old thread... but once i started reading up on wget,
the damn thing has sooooo many switches I got lost and gave up hope pretty soon.
Another thing that I am not sure if WGET will handle soo well is... there are
quite a few javascript popups on each page (basically icons on the side, when
clicked open a JS popup with the content of the main page in a different
language
for example:
the main page is in Swedish, when you click the language icon on the side it
opens a popup with the same content in Arabic or Spanish)
but these popups are calling php scripts with something like this:
get_popup_content.php?content_id=2354
But if you think this is the best solution, I am willing to start reading up on
WGET again to see if this time I get the hang of it..
Thanks!
Ryan
Richard Lynch <[EMAIL PROTECTED]> wrote: Another option might be to use
something like wget or htdig to just
rip through the whole site and generate a static site out of it...
I did something like that once for an educational CD, except I just
wrote the generator myself. I'm not sure wget existed back then, and
I'm pretty sure htdig didn't...
Had to put a bit of stuff into JavaScript for the "quiz" portion, but
it worked fairly well.
On Mon, November 27, 2006 10:51 am, Alberto Ferrer wrote:
> www.apachefriends.org have a "Lamp" on CD project.
>
> 2006/11/27, Ryan A :
>> Hello,
>>
>> A little while back there was a discussion on running Apache,MySql
>> and PHP from a CD... I can't seem to find that thread and i cant
>> seem to find the links i had from that thread, so....
>>
>> Can anybody suggest/recommend a way to run our project from CD?
>> Our project is made in PHP 4 with a MySql backend... so far its been
>> running on Apache..
>>
>> I have found some commercial alternatives via google(PortableWebAp
>> ,dwebpro,microweb to name a few) but if I remember correctly the
>> solution in the old thread was a freeware. The commercial solutions
>> offer a lot of bells and whistles and inter platform compatability
>> but all we need is for AMP to run on CD and on Windows 2000 onwards.
>>
>> Any help appreciated, even if its a one line link, thanks in
>> advance!
>> -Ryan
>>
>>
>> ------
>> - The faulty interface lies between the chair and the keyboard.
>> - Creativity is great, but plagiarism is faster!
>> - Smile, everyone loves a moron. :-)
>>
>> ---------------------------------
>> Cheap Talk? Check out Yahoo! Messenger's low PC-to-Phone call rates.
>>
>
>
> --
> bet0x - Barrahome
> http://www.barrahome.com.ar
>
> --
> 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 starving 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
------
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)
---------------------------------
Everyone is raving about the all-new Yahoo! Mail beta.
--- End Message ---
--- Begin Message ---
Hey Paul,
Now this is sounding promising!
Can you send me details on how/where I can download your package to give it a
go?
"Firefox launches on CD start and ........"
I hope just in this case FF is launched, because we have found that most of our
to be users are on IE... so this was designed mostly for IE and some of the JS
scripts look a bit funny in FF..
"if you are releasing the courses as free, I would really like to add it in
there "
I dont see any problem with that, but I dont know how much use it would be for
people outside of Sweden as the entire site is mostly Swedish... you can check
it out here:
http://matematik.sofiadistans.nu/index.htm
(Its still very much under construction)
Cheers!
R
> Sounds good but I dont think its right for this project because we are
> making educational pages that are presently online... but will later
> be distributed for free to students, mostly young ones at that...
> 10-15yrs old so it has to be as simple as possible.... for example:
>
Well, you are in luck then. Our system happens to be a fully fledged
e-learning system that does exactly that! :)
> User gets the cd and loads it into their comp
> Then either of these two:
> a) they click on clickme.html or clickme.exe etc
> or
Firefox launches on CD start and the elearning system is there and ready
to go in the context (course) of your choosing.
Check out http://elearn.uwc.ac.za/ as one of our e-learning site, and
http://avoir.uwc.ac.za for project details as well as mailing lists.
On an aside, we also are building a site of downloadable free
courseware, http://freecourseware.uwc.ac.za and if you are releasing the
courses as free, I would really like to add it in there, as well as make
it a demo downloadable course. A lot of our African partners (16
countries) roll out in primary schools, and I think that your stuff
could be really useful to them.
--Paul
All Email originating from UWC is covered by disclaimer
http://www.uwc.ac.za/portal/uwc2006/content/mail_disclaimer/index.htm
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
------
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)
---------------------------------
Cheap Talk? Check out Yahoo! Messenger's low PC-to-Phone call rates.
--- End Message ---
--- Begin Message ---
On Mon, 2006-11-27 at 11:41 -0800, Ryan A wrote:
> Now this is sounding promising!
> Can you send me details on how/where I can download your package to give it a
> go?
>
I will upload the ISO to our download site in the morning (I only get
3GB per month bandwidth from my home ADSL) and you can check it out. I
will send you the link as soon as it is done...
No matter if it is Swedish, we support all languages and character sets,
and all educational content (especially free content) is of use to
someone, somewhere, especially in Africa. Chances are it will be
translated over time to a myriad of African languages and we will all
benefit from it.
Thanks for your interest!
--Paul
All Email originating from UWC is covered by disclaimer
http://www.uwc.ac.za/portal/uwc2006/content/mail_disclaimer/index.htm
--- End Message ---
--- Begin Message ---
On Mon, 2006-11-27 at 11:41 -0800, Ryan A wrote:
> Hey Paul,
>
> Now this is sounding promising!
> Can you send me details on how/where I can download your package to
> give it a go?
>
The ISO image is now available at: http://fsiu.uwc.ac.za/iso/
--Paul
All Email originating from UWC is covered by disclaimer
http://www.uwc.ac.za/portal/uwc2006/content/mail_disclaimer/index.htm
--- End Message ---
--- Begin Message ---
Ross wrote:
I have not found a satisfactory way of doing this yet!!!!
$text = $_REQUEST['text_size'];
if ($text) {
echo $text;
}
I send the $text_size variable to the browser with lines like...
<a href="<? $_SERVER['PHP_SELF']; ?>?text_size=small" class="size1"
id="one">A</a>
When the page initially loads I get a undefined index error as it does not
exist but is there a way of wrapping in in a switch statement or funtion so
the variable is only used when $_REQUEST['text_size']; actually exists.
http://php.net/isset
-Stut
--- End Message ---
--- Begin Message ---
On 11/27/06, Ross <[EMAIL PROTECTED]> wrote:
I have not found a satisfactory way of doing this yet!!!!
$text = $_REQUEST['text_size'];
if ($text) {
echo $text;
}
I send the $text_size variable to the browser with lines like...
<a href="<? $_SERVER['PHP_SELF']; ?>?text_size=small" class="size1"
id="one">A</a>
When the page initially loads I get a undefined index error as it does not
exist but is there a way of wrapping in in a switch statement or funtion so
the variable is only used when $_REQUEST['text_size']; actually exists.
Ross
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Try this:
$text = (isset($_REQUEST['text_size']))
? preg_replace("/\W/", "", $_REQUEST['text_size'])
: 'your-default-value';
This will say $text equals a cleaned version of
$_REQUEST['text_size'] if it exists. If it does not exist then use
'your-default-value'.
If you use any data from external resources always remember to
sanitize the data. Otherwise you will end up with XSS vulnerabilities
in your scripts. This is _very_ important.
--- End Message ---
--- Begin Message ---
At 11/27/2006 11:21 AM, Ross wrote:
$text = $_REQUEST['text_size'];
if ($text) {
echo $text;
}
I send the $text_size variable to the browser with lines like...
<a href="<? $_SERVER['PHP_SELF']; ?>?text_size=small" class="size1"
id="one">A</a>
When the page initially loads I get a undefined index error as it does not
exist but is there a way of wrapping in in a switch statement or funtion so
the variable is only used when $_REQUEST['text_size']; actually exists.
Using isset() you can determine whether or not a variable has been
initialized (including an array element) before testing its value:
http://php.net/isset
By the way, I think you can simplify your href to:
<a href="?text_size=small" ...
By specifying just the querystring and not the file name, I believe
it will always simply reload the current page with the querystring attached.
Regards,
Paul
--- End Message ---
--- Begin Message ---
At 5:10 PM +0000 11/27/06, Mark Kelly wrote:
Hi.
In the stuff I do almost all the HTML is generated with PHP as basically
none of it is static (lots of tabular data, state-sensitive links, stuff
like that).
Am I crazy to make an extra effort in my code to make the generated HTML
pretty? By this I mean linebreaks, indentation etc. - stuff that is aimed
at readability rather than correctness. This is obviously above and beyond
simply making sure it validates. It's not a huge burden by any means, but
it *is* extra effort.
What do you guys do?
All my coding in all languages is pretty. To me ,it's simply an
addition to documentation.
Sure it takes more time, but if I ever have to reuse the code, it's a
snap to figure things out. Besides, it helps me organize and write
better code.
However, most of the pretty html stuff is covered by css -- but that
too (for my work) is generated by php. They all go together.
tedd
--
-------
http://sperling.com http://ancientstones.com http://earthstones.com
--- End Message ---
--- Begin Message ---
On Monday 27 November 2006 17:10, Mark Kelly wrote:
> Am I crazy to make an extra effort in my code to make the generated HTML
> pretty?
Thanks everyone for your thoughts on this - I'm quite relieved that I'm not
the only one who sits and tweaks so that the HTML is nice and readable.
It just struck me that trying to make my PHP spit out page source that
looks like it was made lovingly by hand was perhaps the work of an
obsessive.
Now I know that even if it is, I'm not alone :)
Cheers!
--- End Message ---
--- Begin Message ---
As Richard already pointed out, "ugly" code can be a real problem
occasionally. Besides that, I assume that you have some kind of
coding standrad for your PHP code already, right? Basically, why do
someone would make a difference between pretty styled PHP code and
pretty styled html/CSS? Be consistent!
/frank
28 nov 2006 kl. 04.13 skrev Mark Kelly:
On Monday 27 November 2006 17:10, Mark Kelly wrote:
Am I crazy to make an extra effort in my code to make the
generated HTML
pretty?
Thanks everyone for your thoughts on this - I'm quite relieved that
I'm not
the only one who sits and tweaks so that the HTML is nice and
readable.
It just struck me that trying to make my PHP spit out page source that
looks like it was made lovingly by hand was perhaps the work of an
obsessive.
Now I know that even if it is, I'm not alone :)
Cheers!
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
$text_only = isset($_GET['text_only']) ? $_GET['text_only'] : 1;
if ($text_only==1) {
?>
<a href="<?php echo $_SERVER['PHP_SELF'];?>?text_only=0">off</a>
// import css here
<?
}
else {
?>
<a href="<?php echo $_SERVER['PHP_SELF'];?>?text_only=1">on</a></span>
// import css here
<?
}
?>
secondly the text size links
<a href="<? $_SERVER['PHP_SELF']; ?>?text_size=medium" class="size1"
id="one">A</a>
<a href="<? $_SERVER['PHP_SELF']; ?>?text_size=larger" class="size2"
id="two">A</a>
<a href="<? $_SERVER['PHP_SELF']; ?>?text_size=largest" class="size3"
id="three">A</a>
<?
$text_size = isset( $_REQUEST['text_size'] ) ? $_REQUEST['text_size'] : '';
switch ($text_size) {
case "medium":
?>
<link href="css/medium.css" rel="stylesheet" type="text/css" />
<?
break;
case "larger":
?>
<link href="css/larger.css" rel="stylesheet" type="text/css" />
<?
break;
case "largest":
?>
<link href="css/largest.css" rel="stylesheet" type="text/css" />
<?
break;
}
?>
these work great independently but when I use one the other switches off.
any ideas how I can combine them?
Ross
--- End Message ---
--- Begin Message ---
At 11/27/2006 02:11 PM, Ross wrote:
$text_only = isset($_GET['text_only']) ? $_GET['text_only'] : 1;
if ($text_only==1) {
?>
<a href="<?php echo $_SERVER['PHP_SELF'];?>?text_only=0">off</a>
// import css here
<?
}
else {
?>
<a href="<?php echo $_SERVER['PHP_SELF'];?>?text_only=1">on</a></span>
// import css here
<?
}
?>
I'd begin by simplifying the logic and separating it from the HTML:
$text_only = isset($_GET['text_only']) ? $_GET['text_only'] : 1;
$onoff = ($text_only) ? 'on' : 'off';
echo <<<_
<a href="{$_SERVER['PHP_SELF']}?text_only=$text_only">$onoff</a>
_;
How can you import CSS after a hyperlink? Shouldn't it go in the
document head?
echo <<<_
<link href="textsize$text_only.css" rel="stylesheet" type="text/css" />
_;
That will link to either textsize0.css or textsize1.css depending on
the value of $text_only.
<?
$text_size = isset( $_REQUEST['text_size'] ) ? $_REQUEST['text_size'] : '';
switch ($text_size) {
case "medium":
?>
<link href="css/medium.css" rel="stylesheet" type="text/css" />
<?
break;
case "larger":
?>
<link href="css/larger.css" rel="stylesheet" type="text/css" />
<?
break;
case "largest":
?>
<link href="css/largest.css" rel="stylesheet" type="text/css" />
<?
break;
}
?>
Again, you don't need the switch block because the values you're
testing for map one-to-one with the values you're using in your output:
echo <<<_
<link href="css/$text_size.css" rel="stylesheet" type="text/css" />
_;
these work great independently but when I use one the other switches off.
any ideas how I can combine them?
If you need to remember two separate values through multiple
pageviews you can either:
a) include them both in each hyperlink so they're both refreshed each
time a link is clicked:
<a
href="{$_SERVER['PHP_SELF']}?text_only=$text_only&text_size=$text_size">$onoff</a>
b) or, more reasonably, store their values in the $_SESSION cookie so
you can read & write them as needed throughout the current session.
http://php.net/session
I use standard subroutines for getting their values, something like this:
if (isset($_GET[$argname]))
{
return $_GET[$argname];
}
elseif (isset($_SESSION[$argname]))
{
return $_SESSION[$argname];
}
In other words, if the value has been set by the last request from
the client, use that, otherwise fall back to the session value. In
other cases my fallback might be $_GET or $_POST to $_SESSION to $_COOKIE.
Regards,
Paul
--- End Message ---
--- Begin Message ---
Hello,
on 11/27/2006 05:14 PM Chantal Rosmuller said the following:
> I'm working on a mailform and it's kind of working but I still have 2
> problems:
>
> 1) I can't get the From header right, when I receive the test mail the sender
> is apache
There is From: and From . From is not a real header. It is just set by
some MTA to the return path address and is also used as separator in
mailbox files with multiple messages in the mbox format.
If you can set the Return-Path address, you will most likely change what
appears in the From header.
> 2) The BCC headers (there's more then one) are not stripped.
I suspect that the headers appear in the body. That may be due to wrong
line break for your platform.
You may want to try this using the MIME message composing and sending
class, that lets you set the Return-Path header and can also detect the
right line break sequence for your platform.
http://www.phpclasses.org/mimemessage
--
Regards,
Manuel Lemos
Metastorage - Data object relational mapping layer generator
http://www.metastorage.net/
PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/
--- End Message ---
--- Begin Message ---
If I define a function like this:
function foo ($x, $y, $z) {}
and then call: foo(1,2,"bar");
is there a function I can call inside foo() that yields this hash:
{"x" => 1, "y" => 2, "z" => "bar"}
In other words, gives me the values *and names* of the arguments to foo?
func_get_args just yields the values.
Having this function would make writing constuctors easier.
The normal way:
fuction ClassName ($x, $y, $z) {
$this->x = $x;
$this->y = $y;
$this->z = $z;
}
could be replaced with:
function ClassName ($x, $y, $z) {
foreach (magic_function_i_want() as $key=>$val) {
$this->$key =$val;
}
}
Obviously, it's more of a savings when you have a large number of parameters.
--
We're just a Bunch Of Regular Guys, a collective group that's trying
to understand and assimilate technology. We feel that resistance to
new ideas and technology is unwise and ultimately futile.
--- End Message ---
--- Begin Message ---
Hello all,
I am using ftp function to upload the file in server. But i am getting this
error:
"The filename, directory name, or volume label syntax is incorrect."
Can anyone help me?
Thanks & Regards
Manoj
--- End Message ---
--- Begin Message ---
Hi,
My name is Jordan Forssman, I am representing a company called Armorize
Technologies. We have developed a source code analysis platform for PHP,
called CodeSecure, which scans source code for SQL injection, cross site
scripting, command injection, etc, vulnerability. The tool will tell you
exactly which line the vulnerability is on, explain the propagation of
the tainted variables, and assist you in fixing the bug. I believe this
tool will help you verify the security of your application and will be
able to do so very quickly. At the moment we are scanning around 20 000
lines in under 5 minutes, or 1M in about 2 minutes, depending on the
application.
Currently we are accepting applications for trial accounts, if you would
like to use our tool to scan your code please log on to
http://www.armorize.com/events/trialapplication and submit the form.
We are just starting our sales and marketing effort so I hope you can
use our product and give us some feedback.
If you want to know more about our company and product you can find us
at: www.armorize.com , download our datasheets and whitepapers at
www.armorize.com/resources/download .
The trial is free and can be accessed over the Web, we are using the
trials as a test case for offering the product as a service and also to
promote the product. Once I receive your application I will send you an
e-mail with a quickstart guide and login details.
If you have any questions, please feel free to contact me anytime.
Best Regards,
Jordan Forssman
Sales Manager
Armorize Technologies
Tel. +886-2-6616-0100 ext. 201
Cell. +886-938-100-214
Fax. +886-2-6616-1100
Skype: jordan4z
[EMAIL PROTECTED]
[EMAIL PROTECTED]
-----Original Message-----
From: Ivo F.A.C. Fokkema [mailto:I.F.A.C. [EMAIL PROTECTED]
Sent: Monday, November 27, 2006 6:01 PM
To: php-general@lists.php.net
Subject: [PHP] Re: Please hack my app
On Wed, 22 Nov 2006 09:57:50 +0100, Ivo F.A.C. Fokkema wrote:
> Hi List,
>
> As this subject may start you wondering what the hell I'm thinking,
let me
> clearify:
>
> I've been rewriting an GPL'ed PHP/MySQL app from scratch for the last
12
> months or so. It facilitates storage of DNA mutations and the
> corresponding patient data. Because patient data is involved, privacy
is
> very important.
> Now of course I read lots of pages on SQL injection and whatnot, and I
> strongly believe my application is protected from this kind of abuse.
> However, believing is not enough. I've had some comments in the past
about
> security (previous version of the software) and although I didn't
agree to
> the critic, I want to be able to say the new app went though various
forms
> of attacks. This month, I want to release 2.0-alpha-01...
>
> *** THIS IS NOT ABOUT HACKING THE SERVER ***
> But about getting in the application when you're not allowed to!
>
> If you feel like helping me out, it's located at
> http://chromium.liacs.nl/LOVDv.2.0-dev/
>
> 1) Please try to get in. There's one account in the system, a database
> administrator, capable of doing anything. If you get in, you can
easily
> create a new user using the setup tab. This will be the prove of you
> breaking my security rules.
>
> 2) Can you manage to view unpublic data? Using the Variants tab, you
> can see there is currently one entry in the database (with two
mutations).
> This entry has a hidden column, called 'Patient ID'. There is a
> text-string in that column. If you can tell me what that string is,
you
> win :)
>
> 3) Feel free to register as a submitter to see if that gives you any
> rights that you shouldn't have. A submitter is only capable of adding
new
> data to the database (Submit tab), but that data will not be published
> immediately.
>
> 4) After a while, I will release login details of a curator account.
This
> user is allowed to see non-public data and handle the specific gene,
but
> NOT create new users or the like.
>
>
> If you have any questions, please ask. Thank you in advance for using
your
> expertise for the good cause :)
In case anyone is interested; I've created a low-level user
('untrusted')
in the system. Password is equal to username. Feel free to try and do
stuff you're not supposed to, like creating a new user or creating a
gene.
Ivo
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
Hi all,
Does anyone know if GSSAPI support based on patches mentioned in bug
report: 30819 (http://bugs.php.net/bug.php?id=30819) are still in CVS
(or part of php-5.2.0)?
If not, could someone kindly point me to the patch (if it's still out there).
Appreciate any input, thanks.
Mustafa.
--- End Message ---
--- Begin Message ---
Back Ports wrote:
Hi all,
Does anyone know if GSSAPI support based on patches mentioned in bug
report: 30819 (http://bugs.php.net/bug.php?id=30819) are still in CVS
(or part of php-5.2.0)?
If not, could someone kindly point me to the patch (if it's still out
there).
You will have to ask for that on the -internals list.
--
Postgresql & php tutorials
http://www.designmagick.com/
--- End Message ---