php-general Digest 24 Nov 2003 03:41:07 -0000 Issue 2433
Topics (messages 170719 through 170756):
Re: is it safe to store username and password for mysql connection in session
variables?
170719 by: Comex
170752 by: Justin French
A Tricky Time Calculation
170720 by: Shaun
170734 by: Eugene Lee
Re: A loop for the hours in a working day
170721 by: Shaun
170725 by: Kelly Hallman
170730 by: David Otton
170751 by: Justin French
170753 by: Kelly Hallman
Re: SQLITE
170722 by: Curt Zirzow
php daemon
170723 by: Jon Hill
xml parser und bestehende variablen - multilinguale app
170724 by: Merlin
170735 by: Evan Nemerson
Re: ldap_search() question
170726 by: Kelly Hallman
170746 by: Daniel Baird
Re: function that appends dollar symbol
170727 by: zerof
Advice: GET vs. POST vs. SESSION
170728 by: Jed R. Brubaker
170729 by: Robert Cummings
Re: PHP Encoders
170731 by: Ira Baxter
PHP with Java extension
170732 by: Panos Konstantinidis
secure query string before sending it to mysql
170733 by: anders thoresson
basic auth question
170736 by: Dennis Gearon
170739 by: Dennis Gearon
170740 by: Dennis Gearon
String returned from forms and such
170737 by: Robin Kopetzky
170738 by: David Otton
User/Pwd Management Package?
170741 by: Jonathan Rosenberg
170742 by: Al
String Manip. - Chop Equivalent
170743 by: Jed R. Brubaker
170744 by: Terence
170745 by: Al
170748 by: Robert Cummings
preg_replace() issue
170747 by: Darkstar
PHP to get mail headers
170749 by: Scott St. John
170754 by: Al
download from mysql script
170750 by: Anthony Ritter
Duplicate Images
170755 by: Erin
when to use \n in forms
170756 by: Joffrey Leevy
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 ---
<[EMAIL PROTECTED]>
Anders Thoresson:
> Hi,
>
> In the ini-files for my php-projects, I store various settings. Two
> of them is username and password for my mysql-connections.
>
> Is it safe to load these two into session variables when a user
> logs in to my application? Or is it better to access the ini-file
> each time a mysql-connection is needed?
>
> What I don't understand, and hence the questions, is wether session
> variables are accessible by my website's visitors, or just to the
> php-scripts on the server.
AFAIK only to the scripts. But then again it's always good to be secure.
Read the ini file.
--
Comex
--- End Message ---
--- Begin Message ---
On Monday, November 24, 2003, at 01:54 AM, anders thoresson wrote:
Is it safe to load these two into session variables when a user logs
in to my application? Or is it better to access the ini-file each time
a mysql-connection is needed?
I include the file with unames and passwords as needed. I believe
session information should be used for storing user-specific data. If
you have 100 sessions open on the server, that's 100 copies of your
MySQL username and password being stored as session data -- it just
doesn't make sense.
What I don't understand, and hence the questions, is wether session
variables are accessible by my website's visitors, or just to the
php-scripts on the server.
Session variables are stored on the server, and are only made visible
to the user if you choose to do so. In theory, this should alleviate
your concerns, but the catch is how well you build your scripts... for
example, you might have put a print_r($_SESSION) somewhere in your
script for debugging purposes, which would spew the entire contents of
their session onto the screen -- this is obviously bad.
So, IMHO, that's two reasons why your MySQL u/p details shouldn't be in
the session :)
Justin French
--- End Message ---
--- Begin Message ---
Hi,
Given the time range: 09:15 - 17:30 how can I tell how many 15 minute
intervals occur between these two times? Obviously here I can work it out,
but I need a calculation that will perform the maths for any two time
ranges...
Thanks for your help
--- End Message ---
--- Begin Message ---
On Sun, Nov 23, 2003 at 03:42:58PM -0000, Shaun wrote:
:
: Given the time range: 09:15 - 17:30 how can I tell how many 15 minute
: intervals occur between these two times? Obviously here I can work it out,
: but I need a calculation that will perform the maths for any two time
: ranges...
$time1 = '09:15';
$time2 = '17:30';
$intervals = floor((strtotime($time2) - strtotime($time1)) / 900);
--- End Message ---
--- Begin Message ---
Sorry,
worked it out, here it is if anyone needs it :)
$minutes = array("00", "15", "30", "45");
$hours = array("07", "08", "09", "10", "11", "12", "13", "14", "15", "16",
"17", "18", "19");
for ($x = 0; $x < 13; $x++ ) {
for ($y = 0; $y < 4; $y++ ) {
echo "
<tr>
<td>".$hours[$x].'.'.$minutes[$y]."</td>
</tr>";
}
}
"Shaun" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi,
>
> I need a loop that will print the hours in a day separated by every
fifteen
> minutes between 0700 and 1900 e.g.
>
> 07:00
> 07:15
> 07:30
> 07:45
> 08:00
> 08:15
> ...
> 19:00
>
> How could I do this?
>
> Thanks for your help
--- End Message ---
--- Begin Message ---
On Sun, 23 Nov 2003, Shaun wrote:
> Sorry, worked it out, here it is if anyone needs it :)
> $minutes = array("00", "15", "30", "45");
> $hours = array("07", "08", "09", "10", "11", "12", "13", "14", "15", "16",
> "17", "18", "19");
> for ($x = 0; $x < 13; $x++ ) {
> for ($y = 0; $y < 4; $y++ ) {
> echo "<tr><td>".$hours[$x].'.'.$minutes[$y]."</td></tr>"; } }
That works, but it's a little unweildy.. especially if you want to change
the range later (changing the array may not be so bad, but then you've
got to figure out how many iterations your loops must do, etc).
How about something like this:
$hstart = 7; $hend = 19; $interval = 15;
for($h=$hstart; $h < $hend; $h++) {
for($m=0; $m < 60; $m += $interval) {
echo sprintf("%d:%02d",$h,$m); } }
Used sprintf in order to make 0 minutes display as 00. This would be a
great candidate for something to make into a function...
--
Kelly Hallman
// Ultrafancy
--- End Message ---
--- Begin Message ---
On Sun, 23 Nov 2003 10:49:58 -0800 (PST), you wrote:
>That works, but it's a little unweildy.. especially if you want to change
>the range later (changing the array may not be so bad, but then you've
>got to figure out how many iterations your loops must do, etc).
>
>How about something like this:
>
>$hstart = 7; $hend = 19; $interval = 15;
>
>for($h=$hstart; $h < $hend; $h++) {
> for($m=0; $m < 60; $m += $interval) {
> echo sprintf("%d:%02d",$h,$m); } }
>
>Used sprintf in order to make 0 minutes display as 00. This would be a
>great candidate for something to make into a function...
Couple of suggestions on top:
replace "echo sprintf" with a simple "printf".
the above won't work across midnight, and returns time values in only one
format ("hh:mm").
If I was going to bother to use a function here, I'd work with unix
timestamps and strftime() (http://www.php.net/strftime) so my function would
return values in pretty much any format, and at 1 second resolution. Eg:
<?
$now = time();
print_r (time_array ($now - 14400, $now, 15*60, '%H%M'));
print_r (time_array ($now - 14400, $now, 15*60, '%I:%M %p'));
function time_array ($start, $end, $interval, $format)
{
$output = array();
while ($start < $end)
{
$output [] = strftime ($format, $start);
$start = $start + $interval;
}
return ($output);
}
?>
Anyone want to suggest some more embellishments? The ability to return
blocks of time, maybe: "12:45 - 13:00", "13:00 - 13:15", etc.
--- End Message ---
--- Begin Message ---
On Monday, November 24, 2003, at 02:34 AM, Shaun wrote:
Hi,
I need a loop that will print the hours in a day separated by every
fifteen
minutes between 0700 and 1900 e.g.
07:00
07:15
07:30
07:45
08:00
08:15
...
19:00
How could I do this?
<?
$start = 7;
$end = 19;
$h = $start;
while($h <= $end)
{
if($h != $end)
{
echo "{$h}:00\n";
echo "{$h}:15\n";
echo "{$h}:30\n";
echo "{$h}:45\n";
}
else
{
echo "{$h}:00\n";
}
$h++;
}
?>
There's plenty of ways, this is just one to get your head on the right
track :)
Justin
--- End Message ---
--- Begin Message ---
On Sun, 23 Nov 2003, David Otton wrote:
> >How about something like this:
> >$hstart = 7; $hend = 19; $interval = 15;
> >for($h=$hstart; $h < $hend; $h++) {
> > for($m=0; $m < 60; $m += $interval) {
> > echo sprintf("%d:%02d",$h,$m); } }
>
> Couple of suggestions on top:
> replace "echo sprintf" with a simple "printf".
Yes.. I thought it would be more illustrative to use sprintf, as printf
alone might look more foreign and is less versatile in this case
(especially were it made into a function)...
> If I was going to bother to use a function here, I'd work with unix
> timestamps and strftime() (http://www.php.net/strftime) so my function
> would return values in pretty much any format, and at 1 second res...
Well, sure.. but that would be overkill for a simple select list
of the type described. As for coding it as a function, I was only trying
to suggest this is the type of thing that makes a good function--not that
what I put down there would make the ultimate function of this type.
I thought taking it further and making it into a function myself
1) might seem like I was trying to be showy and 2) feared the example
would start losing it's demonstrative value with extra functionality.
--
Kelly Hallman
// Ultrafancy
--- End Message ---
--- Begin Message ---
* Thus wrote Bronislav Kluèka ([EMAIL PROTECTED]):
> Hi, I've got questions:
>
> I've got sqlite like PHP module (under windows). I tried this:
> a)execute script 1 (selecting from some table), it tooks 2 minutes
> b)execute script 2 , it tooks 3 minutes
> c)execute them both at the same time (from different browser windows), both
> of them stopped also at the same time and it tooks 5 minutes
Read the sqlite faq:
http://sqlite.org/faq.html#q7
Curt
--
"My PHP key is worn out"
PHP List stats since 1997:
http://zirzow.dyndns.org/html/mlists/
--- End Message ---
--- Begin Message ---
I have just been trying to work out the behaviour of running a php programm
from BASH.
If i execute
./my_program.php >> /var/log/mylog 2>&1 &
and then terminate the controlling terminal I get a background process which
has no controlling terminal, a parent process id of 1 and the process
becomes a session leader and process group leader. Everything looks in order
as far as this being a proper daemon. So, my question is, is this all
correct and the same as running a daemon in say C? Just opening a discussion
really to help in my education.
regards
Jon
--- End Message ---
--- Begin Message ---
Hallo zusammen,
ich möchte gerne meine bestehende app in mehreren Sprachen anbieten.
Dazu habe ich mir ein xml parser package installiert welches in der Lage
ist aus xml dateien inhalte einzufügen.
Zum Bsp sieht das xml file so aus:
<en>example</en>
<de>beispiel</de>
Das funktioniert so weit. Das PROBLEM allerdings is, wenn ich eine
varible innerhalb dieses textes habe und nicht alles zerstückeln möchte,
parst php diese inhalte nicht.
Beispiel: $no = 10;
<en>example '.$no.'</en>
<de>beispiel '.$no.'</de>
In diesem Fall bekommt man den Inhalt der Variable nicht angegeben,
sondern einfahc den '.$no.' string.
Was kann man da tun? Ich kann unmöglich alle texte aufsplitten. Das
auslagern in eine xml datei ist ganz praktisch vor allem wenn es mehrere
Sprachen werden.
Hat hier jemand einen guten Tipp?
vielen Dank im voraus,
Andy
--- End Message ---
--- Begin Message ---
How are you parsing the XML? If you read the values into a PHP variable, and
you're confident in the contents of the string, you could use eval()... Also,
preg_replace_callback() may be useful.
If you provide a bit more example, it may be more easy to help. In any case, I
think your variable variables are a bit out of whack. Read
http://us3.php.net/manual/en/language.variables.variable.php
That may be your problem if it's outputting something like 'beispiel ', and
not 'beispiel $no'. Try doing error_reporting(E_ALL) and see what happens.
-------------
Babelfish says...
(my reply:)
Wie analysieren Sie das XML? Wenn Sie die Werte in eine PHP Variable lesen und
Sie im Inhalt der Zeichenkette überzeugt sind, konnten Sie eval() benutzen...
Auch preg_replace_callback() kann nützlich sein.
Wenn Sie eine Spitze mehr Beispiel zur Verfügung stellen, zu helfen kann
einfacher sein. In jedem möglichem Fall denke ich, daß Ihre variablen
Variablen eine Spitze aus whack heraus sind. Lesen Sie
http://us3.php.net/manual/en/language.variables.variable.php
Das kann Ihr Problem, wenn es etwas wie ' beispiel ' ausgibt, und nicht '
beispiel $no'. Versuchen Sie, error_reporting(E_ALL) zu tun und sehen Sie,
was geschieht.
(orignal message:)
Hello together,
I would like to offer gladly my existing app in several languages. In addition
I have me xml more parser package installed a which in the situation am out
xml files of contents to be inserted.
To the Bsp xml the file looks in such a way:
<en>example</en>
<de>beispiel</de>
Functions so far. The PROBLEM however is, if I have a varible within this text
and not everything to carve up liked, does not parst php these contents.
Example: $$no = 10;
<en>example ' $no.'</en>
<de>beispiel ' $no.'</en>
In this case one gets the contents of the variable not indicated, but einfahc
the ' $no.' stringer.
What there can one do? I can not possibly all write the text split up. That
out page into one xml file is completely practically above all if it several
languages become.
Here does someone have a good taps?
thank you in advance,
Andy
--
Evan Nemerson
[EMAIL PROTECTED]
http://coeusgroup.com/en
--
"If there is no higher reason--and there is none--then my own reason must be
the supreme judge of my life."
-Leo Nikolaevich Tolstoy
--- End Message ---
--- Begin Message ---
On Sat, 22 Nov 2003, Schechter, Ricky wrote:
> Do I use ldap_search to authenticate users in LDAP? I can successfully
> search the LDAP and retrieve user's data based on a search criteria like
> (cn=something). If I use (password=somepass) or (userPassword=somepass)
> in the search criteria it comes back with no hits. How should this be
> done? Do I have to encrypt the password somehow?
You probably need to use ldap_compare() to verify the password. Most LDAP
servers won't send back the password field contents. Hope that helps!
--
Kelly Hallman
// Ultrafancy
--- End Message ---
--- Begin Message ---
"Schechter, Ricky" <[EMAIL PROTECTED]> wrote:
Do I use ldap_search to authenticate users in LDAP?
I can successfully search the LDAP and retrieve user's data based on a
search criteria like (cn=something).
If I use (password=somepass) or (userPassword=somepass) in the search
criteria it comes back with no hits.
How should this be done? Do I have to encrypt the password somehow?
Thank you!
Hi Ricky,
Apologies if someone's already answered this, I get php-general in digest
form and havn't seen an answer yet.
Dunno if this is the standard way of authenticating via LDAP, but where I
am I try to bind to the LDAP directory using the user's name and
password. If it works, they're a valid user -- I can then release the
binding, reconnect anonymously, and get the info I want about them..
Eventually I plan on moving to LiveUser (all these great packages weren't
around when I built my system!)
Cheers
Daniel
--
= Daniel Baird ============================ JCU Bookshop =
= Systems Administrator James Cook University =
= [EMAIL PROTECTED] Townsville Q 4811 =
= http://bookshop.jcu.edu.au ================= Australia =
--- End Message ---
--- Begin Message ---
Please, see:
http://www.php.net/manual/en/function.localeconv.php
and
http://www.php.net/manual/en/function.setlocale.php
-----
zerof
-----
"Joffrey Leevy" <[EMAIL PROTECTED]> escreveu na mensagem
news:[EMAIL PROTECTED]
> The money_format function does not do it for me. Is there a simple php function
> which
appends the '$'
> symbol to a string value. Example
----------
--- End Message ---
--- Begin Message ---
I was hoping that some of you would be able to give me some advice.
I have started creating a web application that makes heavy use of URL GET
variables in order to solve a problem that I have had with POST in the
past - namely, having to refresh the document and repost the variables when
you use the browser's back button.
So I enthusiastically have embraced GET variables, but am now having a
struggle editing the URL variable string.
So this is my question: is using URL GET variables that best way to avoid
that browser back button effect?
I have thought about using session variable extensively, but that I am going
to have to be unsetting them all over the place.
So - anyone have any advice?
Thanks in advance!
--- End Message ---
--- Begin Message ---
On Sun, 2003-11-23 at 14:27, Jed R. Brubaker wrote:
> I was hoping that some of you would be able to give me some advice.
>
> I have started creating a web application that makes heavy use of URL GET
> variables in order to solve a problem that I have had with POST in the
> past - namely, having to refresh the document and repost the variables when
> you use the browser's back button.
>
> So I enthusiastically have embraced GET variables, but am now having a
> struggle editing the URL variable string.
>
> So this is my question: is using URL GET variables that best way to avoid
> that browser back button effect?
It can be a good way, but I believe the spec for GET based parameters
only guarantee processing of 1024 characters (this may be the wrong
number but there is a limit on the guarantee).
> I have thought about using session variable extensively, but that I am going
> to have to be unsetting them all over the place.
If you are worried about unsetting them all, maybe it would help to use
a two level array to hold your form data. Perhaps the following:
$_SESSION['formName']['email'] = $_POST[['email'];
Then when you want to clear the form you can do a simple:
unset( $_SESSION['formName'] );
HTH,
Rob.
--
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting |
| a powerful, scalable system for accessing system services |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for |
| creating re-usable components quickly and easily. |
`------------------------------------------------------------'
--- End Message ---
--- Begin Message ---
"Jerry" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> I have always been a little bit reluctant to use obfuscators since the
> source code does not actually disappear and it should not be too
> difficult to find the correct patterns and algorythms to map and
> restore the scrambled code. One could possibly write a good piece of
> code that would do exactly that.
I don't know what you mean by "restore the scrambled code" after
obfuscation. The comments are gone, so no tool or person
can restore them without essentially simply guessing.
The identifier names are meaningless, and restoring them
to something sensible means you pretty have much have
to understand what the code is doing in order to choose
a good name.
So I don't think you can write a "tool" to do this at all.
(Another poster observed that you *can* use a tool
to reformat obfuscated text so its block structure is visible.
Our tool also can format and so can be used for that purpose too,
but the real value in the obfsucation is the removal of comments
and scrambling of names).
If you have a really small applicaiton, obfuscation won't "hide"
it very well. If you have a really big application, in our opinion,
the number of names that have to regenerated becomes pretty
daunting for would-be reverse-engineer.
> Instead the e.g. ioncube encoder really encodes the scripts and
> requires only one file (the "runtime-loader") to be uploaded along
> with the encrypted scripts onto the server to make the scripts
> executable. Since the scripts run as a compiled application they are
> even faster than unencrypted PHP scripts. So, this seems an
> interesting alternative to me.
"Encoding" the script doesn't prevent reverse engineering.
It just raises the effort level required to decode it.
(I'll cheerfully admit it raises it somewhat higher than
obfuscated source.)
Ultimately, if somebody wants to reverse engineer your code,
they can. So the real question is, what's enough protection?
Most people don't use a bank vault locks on their front door.
Deadbolts are good enough for the majority.
> Costs: Your obfuscator costs US$150.00. The ioncube encoder starts at
> US$199.00 Personally, I find it's worth the difference.
OK. Everybody makes their choice.
We chose to provide source obfuscation because while
you may have a customer for your PHP source code,
you can't always tell your customer what he must run on his server.
Of course, if your customer *wants* to run with a PHP compiler,
he can do that with obfuscated source, too, but now
it is his choice, not yours.
> What is your take on that?
> Thank you for your help and opinion.
>
> Jerry
--
Ira D. Baxter, Ph.D., CTO 512-250-1018
Semantic Designs, Inc. www.semdesigns.com
--- End Message ---
--- Begin Message ---
Hello, I am completely new to PHP and due to some
disparate components in our system I am trying to
integrate PHP with Java. I have followed the
instructions in the README file (under the ext/java
folder in the PHP bundle) but I have hit a snag two
days now.
I have done several changes in my php.ini file but
none of them seems to work. Apache seems to be able to
find the JVM butu nfortunatelly the page does not
load.
With Opera 6.1 it just goes into a spastic fit and
tries to connect and reconnect all the time (a problem
similar to this URL:
http://www.phpbuilder.com/annotate/message.php3?id=1014708.)
with no error messages on the apache logs. If I use
Netscape I just get the error message that the browser
cannot load an empty document. If I use Mozilla it
loads the page up fine but when I do view source it is
an empty document (only the <html> and <body> tags are
there, nothing else). I have tried every hack
described on php.net and phpbuilder.com but to no
avail, so you are my last hope.
Any ideas and recommendations are more than welcome.
Additional info:
php.ini:
extension_dir=/usr/local/lib/php/extensions/no-debug-non-zts-20020429
extension=libphp_java.so
java.class.path=/usr/local/apache/php/lib/php/php_java.jar
java.home=/homa/panos/java/j2sdk1.4.0
java.library=/home/panos/java/j2sdk1.4.0/jre/lib/i386/server/libjvm.so
java.library.path=/usr/local/lib/php/extensions/no-debug-non-zts-20020429
php file I am using for testing:
<?php
print "testing...";
$systemInfo = new Java("java.lang.System");
print "Total seconds since January 1,
1970:".$systemInfo->currentTimeMillis();
?>
os: Mandrake Linux 8.1 with kernel 2.4.8-26mdk
php: 4.3.1
apache: 2.0.43
java: 1.4.0
Thank you.
__________________________________
Do you Yahoo!?
Free Pop-Up Blocker - Get it now
http://companion.yahoo.com/
--- End Message ---
--- Begin Message ---
Hi,
I'm working on a database class of my own. I've got the following method:
/**
* query() performs a query on the selected database
*/
function query($dbQuery)
{
if (is_string($dbQuery))
$this->dbQuery = $dbQuery;
else
die("The submitted query isn't a string");
$this->queryResult = mysql_query($this->dbQuery)
or die("Couldn't perform the query: " . mysql_error());
}
In the best of all words, variables that are part of the query string has
been validated before going into the query. But if I sometimes forget to
verify that user input doesn't contain dangerous code, I want to add some
validating mechanism into the method above as well.
$dbQuery will be query string like "INSERT INTO $article_table SET
a_header = '$a_header'". Is there anything I can do, inside the method, to
increase security?
--
anders thoresson
--- End Message ---
--- Begin Message ---
Please CC me, I am on digest
----------------------------------
If I have a directory like:
$HOME/www/ (document root)
It has a auth section in the .htaccess file
$HOME/www/.htaccess
another directory like:
$HOME/www/want_to_be_public/
How can I defeat the auth section in the
$HOME/www/.htaccess
file by commands in the:
$HOME/www/want_to_be_public/.htaccess
file?
--- End Message ---
--- Begin Message ---
Please CC me, I am on digest
----------------------------------
If I have a directory like:
$HOME/www/ (document root)
It has a auth section in the .htaccess file
$HOME/www/.htaccess
another directory like:
$HOME/www/want_to_be_public/
How can I defeat the auth section in the
$HOME/www/.htaccess
file by commands in the:
$HOME/www/want_to_be_public/.htaccess
file?
--- End Message ---
--- Begin Message ---
Please CC me, I am on digest
----------------------------------
If I have a directory like:
$HOME/www/ (document root)
It has a auth section in the .htaccess file
$HOME/www/.htaccess
another directory like:
$HOME/www/want_to_be_public/
How can I defeat the auth section in the
$HOME/www/.htaccess
file by commands in the:
$HOME/www/want_to_be_public/.htaccess
file?
--- End Message ---
--- Begin Message ---
Good afternoon.
I'm having a problem handling strings with spaces being passed from a form
by HREF to a PHP program.
Example:
<A HREF="buttons.php?state_name=New Mexico">button code</A>
When the 'New Mexico' gets to phpinfo, it says the string is 'New+Mexico'
and that's not what I need. I used htmlspecialchars to add the %20 to the
string but didn't get it. What am I doing wrong or missing??
Any help is VERY appreciated!!
Robin 'Sparky' Kopetzky
Black Mesa Computers/Internet Service
Grants, NM 87020
--- End Message ---
--- Begin Message ---
On Sun, 23 Nov 2003 15:19:23 -0700, you wrote:
>When the 'New Mexico' gets to phpinfo, it says the string is 'New+Mexico'
>and that's not what I need. I used htmlspecialchars to add the %20 to the
>string but didn't get it. What am I doing wrong or missing??
That sounds like the behaviour of urlencode, not htmlspecialchars.
Try rawurlencode.
BTW, there is a urldecode function...
http://www.php.net/manual/en/ref.url.php
--- End Message ---
--- Begin Message ---
Friends,
I'm interesting in finding a PHP package that implements functions for
managing user names & passwords & controlling access to specific parts of a
site.
Of course, free is best. But cheap is good. And, even not-so-cheap is
fine, as long as it provides good functionality.
Any pointers appreciated.
--
Jonathan Rosenberg
President & Founder, Tabby's Place
http://www.tabbysplace.org/
--- End Message ---
--- Begin Message ---
There are a number of open-source PEAR packages that can help you manage
usernames, passwords, and user preferences.
Check out: http://pear.php.net/packages.php?catpid=1&catname=Authentication
Hope it helps,
Al
"Jonathan Rosenberg" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Friends,
>
> I'm interesting in finding a PHP package that implements functions for
> managing user names & passwords & controlling access to specific parts of
a
> site.
>
> Of course, free is best. But cheap is good. And, even not-so-cheap is
> fine, as long as it provides good functionality.
>
> Any pointers appreciated.
>
> --
> Jonathan Rosenberg
> President & Founder, Tabby's Place
> http://www.tabbysplace.org/
>
--- End Message ---
--- Begin Message ---
Does PHP have an equivalent to PERL's chop - that is, a way to get rid of
the last character in a string?
"Hello World" to "Hello Worl"
Thanks in advance.
--- End Message ---
--- Begin Message ---
Jed R. Brubaker wrote:
Does PHP have an equivalent to PERL's chop - that is, a way to get rid of
the last character in a string?
"Hello World" to "Hello Worl"
Thanks in advance.
this might work, haven't tested it...
second param is optional
function chop($strSubject, $intWastage = 1) {
$strRes = "";
$len = strlen($strSubject);
if($intWastage <= $len && $intWastage >= ($len * (-1)))
$strRes = substr($strSubject,0,$len - $intWastage);
return $strRes;
}
--- End Message ---
--- Begin Message ---
>From the PHP Manual notes (http://us2.php.net/manual/en/function.chop.php):
$string = substr("$string", 0, -1);
Al
"Jed R. Brubaker" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Does PHP have an equivalent to PERL's chop - that is, a way to get rid of
> the last character in a string?
>
> "Hello World" to "Hello Worl"
>
> Thanks in advance.
--- End Message ---
--- Begin Message ---
On Sun, 2003-11-23 at 20:02, Al wrote:
> >From the PHP Manual notes (http://us2.php.net/manual/en/function.chop.php):
>
> $string = substr("$string", 0, -1);
You'd be better off with:
$string = substr( $string, 0, -1 );
to avoid unnecessary interpolation overhead.
Cheers,
Rob.
--
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting |
| a powerful, scalable system for accessing system services |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for |
| creating re-usable components quickly and easily. |
`------------------------------------------------------------'
--- End Message ---
--- Begin Message ---
1)
function filter() {
if($this->post['a'] == "savenews") {
$this->post['summary'] = preg_replace("!\[url\](.*)\[/url\]!","<a
href=\"\\1\">\\1</a>", $this->post['summary']);
}
-----------------------
2)
global $nwedst;
$nwedst = str_replace("<br>\n", '', $dat->summary);
nwedst = preg_replace("!\<a
href=\"http://(.*)\">(.*)\</a>!","[url]http://\\1[/url]", $nwedst);
1 takes a full news post and changes [url]...[/url] into <a
href="...">...</a> and saves the news post
2 takes the full news post and recalls it, changes <a href="...">...</a>...
into [url]...[/url]
1 is used when making a new news post, 2 is used when editing a news post
(making the post user friendly and easy to edit)
2 seems to only replace the first <a href="..."> and the last </a> when
there are multiple links. That's the first of my problems. The second is
that I would like to change my code so that it changes [url="$1]$2[/url]
into <a href="$1">$2</a> and back again but i don't know how to change
multiple things with preg_replace().
plz help,
Darkstar
--- End Message ---
--- Begin Message ---
I run a small ISP and am looking at ways to automate grabbing the headers
from email. I currently copy all email to a BSD box, then use Pine in
header mode to get the IP addresses from which I build my spam filters.
A search did not yield much in what I am trying to do:
1)Open the mailbox and extract the Received, From and Subject headers.
2)Drop those into a database that I can manage from the browser.
Sounds simple enough and I am sure I am making it harder than it really
is, but if you know of a project please let me know.
Thanks!
-Scott
--- End Message ---
--- Begin Message ---
"Scott St. John" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> A search did not yield much in what I am trying to do:
> 1)Open the mailbox and extract the Received, From and Subject headers.
> 2)Drop those into a database that I can manage from the browser.
There are two PEAR packages that can help you with this:
1) Mail_Mbox will parse and manipulate mbox files so you can traverse your
mail file and pull out individual messages.
http://pear.php.net/package/Mail_Mbox
2) Mail_Mime contains classes for decoding and parsing individual messages.
http://pear.php.net/package/Mail_Mime
Hope it helps.
Al
--- End Message ---
--- Begin Message ---
I'm trying to receive data from a mysql database through php.
Using the command line at mysql listed below gives me a result set.
I am able to connect to the database through php, however, when using the
following script, I receive no data when the data is in the table called
pictures in the db called sitename.
<?
if($ID) {
@MYSQL_CONNECT("localhost","root","thepassword");
@mysql_select_db("sitename");
$query = "select bin_data,filetype from pictures where ID=$ID";
$result = @MYSQL_QUERY($query);
$data = @MYSQL_RESULT($result,0,"bin_data");
$type = @MYSQL_RESULT($result,0,"filetype");
Header( "Content-type: $type");
echo $data;
}
?>
// In browser window it reads:
// http://localhost/download.php?filename=7
//...and on the Command Line using the following query:
// SELECT filetype FROM pictures where ID=$ID
// gives me a image/pjpeg as the result set.
--- End Message ---
--- Begin Message ---
Hi All,
Please give me a hand with this, ive been trying to do this for the best
part of today but i have got no where!
I have two arrays both have 161 elements, each has a list of filenames on my
server (images) now the idea here is to take the image name from array 1
copy it and re-name it to that of array 2.
for example
$array_A[$i] = 123097
$array_B[$i] = 684547
I need to keep the original image as well as duplicate it & rename.
Many thanks
R
--- End Message ---
--- Begin Message ---
Hi:
Can someone shed some light on this please? To me
when doing a form in php using \n or not using \n
makes no difference. I still get the form in my
browser to work.
For instance,
<?php
echo"<form action='processform_2b.php'
method='post'>\n
<select name='animal'>\n
<OPTION value='cat'>cat\n
<OPTION value='dog'>dog\n
<OPTION value='rat'>rat\n
etc.............
and
<?php
echo"<form action='processform_2b.php'
method='post'>\n
<select name='animal'>
<OPTION value='cat'>cat
<OPTION value='dog'>dog
<OPTION value='rat'>rat
etc.............
produce the same select menu in my browser. So is
using "\n" really that critical for this case?
Thanks
__________________________________
Do you Yahoo!?
Free Pop-Up Blocker - Get it now
http://companion.yahoo.com/
--- End Message ---