php-general Digest 23 Nov 2003 15:34:15 -0000 Issue 2432
Topics (messages 170697 through 170718):
Re: Execute programs
170697 by: Eric Wood
Re: $_GET String Edit
170698 by: Chris Shiflett
170699 by: Jed R. Brubaker
170701 by: Chris Shiflett
ldap_search() question
170700 by: Schechter, Ricky
function that appends dollar symbol
170702 by: Joffrey Leevy
170703 by: John Nichel
170704 by: Robert Cummings
170709 by: Ryan A
Why MySql doesn't free space when erasing BLOB fields?
170705 by: M
170707 by: Nigel Jones
170713 by: Marek Kilimajer
Temporarily signing off
170706 by: Becoming Digital
Re: Certificate failure for (IMAP)
170708 by: Jason Wong
170712 by: QT
170714 by: QT
Re: passthru gives error in httpd/error_log
170710 by: Jason Wong
PHP Program as Daemon
170711 by: Nigel Jones
Detecting Server API (CGI or Apache) at runtime?
170715 by: Richard Cyganiak
file paths and binaries
170716 by: Anthony Ritter
is it safe to store username and password for mysql connection in session variables?
170717 by: anders thoresson
A loop for the hours in a working day
170718 by: Shaun
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 ---
----- Original Message -----
> > If you start a program using this function and want to leave it running
in
> > the background, you have to make sure that the output of that program is
> > redirected to a file or some other output stream or else PHP will hang
until
> > the execution of the program ends.
Use system() and background it with &:
$cmd = "tail -f /var/log/messages &";
system($cmd);
-eric
--- End Message ---
--- Begin Message ---
--- "Jed R. Brubaker" <[EMAIL PROTECTED]> wrote:
> I am trying to make a page navigation menu (we have all seen them,
> "Page: 1 2 3..."), and I would like to continue doing this via the
> URL variables. Right now, each of the page numbers is a hyper link
> is set like this:
>
> "page.php?".$_SERVER["QUERY_STRING"]."&more variables here."
>
> The problem, however, is that those variables are a string. If the
> variables that the menu defines are already in the string, it
> doesn't update them, it just adds more definitions to the URL.
I had a hard time interpreting your question, but I think you're saying
that you are generating URLs like this:
/page.php?foo1=bar1&foo2=bar2&foo1=bar3&foo2=bar4
And, you're wanting to not duplicate variables in your URL, correct?
You could always keep your query string in an array or something. This
would allow you to update values in the array prior to the end of your
script. You can start this array using $_GET:
$query = $_GET;
Of course, you might want to rather filter this data on each page, so that
you don't spread tainted data more than necessary. Regardless, this will
allow you to update values in your query string. If you want to update
foo1, you don't have to care whether it's already set:
$query['foo1'] = 'newvalue';
Hope that helps.
Chris
=====
Chris Shiflett - http://shiflett.org/
PHP Security Handbook
Coming mid-2004
HTTP Developer's Handbook
http://httphandbook.org/
RAMP Training Courses
http://www.nyphp.org/ramp
--- End Message ---
--- Begin Message ---
Sorry for the confusing initial request.
You were correct in assuming that I am generating URLs like:
page.php?foo1=bar1&foo2=bar2&foo1=bar3&foo2=bar4
So I suppose the consise follow-up question is how can I get a hyperlink to
change one of those varibles in the string.
In the past I have just tacked a varible on to the end of the string, but I
don't want to be redundant.
Thanks again.
"Chris Shiflett" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> --- "Jed R. Brubaker" <[EMAIL PROTECTED]> wrote:
> > I am trying to make a page navigation menu (we have all seen them,
> > "Page: 1 2 3..."), and I would like to continue doing this via the
> > URL variables. Right now, each of the page numbers is a hyper link
> > is set like this:
> >
> > "page.php?".$_SERVER["QUERY_STRING"]."&more variables here."
> >
> > The problem, however, is that those variables are a string. If the
> > variables that the menu defines are already in the string, it
> > doesn't update them, it just adds more definitions to the URL.
>
> I had a hard time interpreting your question, but I think you're saying
> that you are generating URLs like this:
>
> /page.php?foo1=bar1&foo2=bar2&foo1=bar3&foo2=bar4
>
> And, you're wanting to not duplicate variables in your URL, correct?
>
> You could always keep your query string in an array or something. This
> would allow you to update values in the array prior to the end of your
> script. You can start this array using $_GET:
>
> $query = $_GET;
>
> Of course, you might want to rather filter this data on each page, so that
> you don't spread tainted data more than necessary. Regardless, this will
> allow you to update values in your query string. If you want to update
> foo1, you don't have to care whether it's already set:
>
> $query['foo1'] = 'newvalue';
>
> Hope that helps.
>
> Chris
>
> =====
> Chris Shiflett - http://shiflett.org/
>
> PHP Security Handbook
> Coming mid-2004
> HTTP Developer's Handbook
> http://httphandbook.org/
> RAMP Training Courses
> http://www.nyphp.org/ramp
--- End Message ---
--- Begin Message ---
--- "Jed R. Brubaker" <[EMAIL PROTECTED]> wrote:
> Sorry for the confusing initial request. You were correct in assuming
> that I am generating URLs like:
>
> page.php?foo1=bar1&foo2=bar2&foo1=bar3&foo2=bar4
>
> So I suppose the consise follow-up question is how can I get a
> hyperlink to change one of those varibles in the string.
>
> In the past I have just tacked a varible on to the end of the string,
> but I don't want to be redundant.
To make this easy, I really think you need to not use a string like you
keep suggesting and use some other data structure. I mentioned an array,
simply because I think one of PHP's strengths is its rich collection of
array functions.
You can build your query string as the very last step, prior to using it
in a link. While you are constructing it, I think you will find using a
string to be about the most cumbersome approach possible.
Hope that helps.
Chris
=====
Chris Shiflett - http://shiflett.org/
PHP Security Handbook
Coming mid-2004
HTTP Developer's Handbook
http://httphandbook.org/
RAMP Training Courses
http://www.nyphp.org/ramp
--- End Message ---
--- Begin Message ---
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!
--- End Message ---
--- Begin Message ---
Hi all:
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
$money = 30
$money = some_php_function($money)
echo $money
//should show $30
thanks
__________________________________
Do you Yahoo!?
Free Pop-Up Blocker - Get it now
http://companion.yahoo.com/
--- End Message ---
--- Begin Message ---
Joffrey Leevy wrote:
Hi all:
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
$money = 30
$money = some_php_function($money)
echo $money
//should show $30
thanks
How 'bout...
$money = '$' . 30;
--
By-Tor.com
It's all about the Rush
http://www.by-tor.com
--- End Message ---
--- Begin Message ---
On Sat, 2003-11-22 at 23:35, John Nichel wrote:
> Joffrey Leevy wrote:
> > Hi all:
> >
> > 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
> >
> > $money = 30
> > $money = some_php_function($money)
> > echo $money
> >
> > //should show $30
> >
> >
> > thanks
>
> How 'bout...
>
> $money = '$' . 30;
Hmmm, that's prepending... how about:
$money = 30.'$';
or if he wants it at the beginning:
$money = strrev( strrev( '30' ).'$' );
*heheh*
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 ---
/*
Hmmm, that's prepending... how about:
$money = 30.'$';
or if he wants it at the beginning:
$money = strrev( strrev( '30' ).'$' );
*heheh*
Rob.
*/
Pretty damn good and didnt require the installation of Interjinn either!!!
Hehehe
Peace.
-Ryan
--- End Message ---
--- Begin Message ---
Hello, sorry this mysql question here, but I cant't answer this one.
I have database with BLOB fields to hold pictures (60-90 kb each).
Actually I am erasing these BLOB fields (move '' into and update rcord)
to free some space from my DB, but space is not released by mysql. I
verified BLOB fields really were erased.
How can I tell mysql recover these space?
Thanks
Miguel
--- End Message ---
--- Begin Message ---
ummm Flush maybe
_________________
Nigel Jones
[EMAIL PROTECTED]
>> -----Original Message-----
>> From: M [mailto:[EMAIL PROTECTED]
>> Sent: Sunday, November 23, 2003 5:57 PM
>> To: [EMAIL PROTECTED]
>> Subject: [PHP] Why MySql doesn't free space when erasing BLOB fields?
>>
>>
>> Hello, sorry this mysql question here, but I cant't answer this one.
>>
>> I have database with BLOB fields to hold pictures (60-90 kb each).
>> Actually I am erasing these BLOB fields (move '' into and update rcord)
>> to free some space from my DB, but space is not released by mysql. I
>> verified BLOB fields really were erased.
>>
>> How can I tell mysql recover these space?
>>
>> Thanks
>>
>> Miguel
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
--- End Message ---
--- Begin Message ---
OPTIMIZE TABLE tbl_name
M wrote:
Hello, sorry this mysql question here, but I cant't answer this one.
I have database with BLOB fields to hold pictures (60-90 kb each).
Actually I am erasing these BLOB fields (move '' into and update rcord)
to free some space from my DB, but space is not released by mysql. I
verified BLOB fields really were erased.
How can I tell mysql recover these space?
Thanks
Miguel
--- End Message ---
--- Begin Message ---
Unfortunately, I just can't keep up with the list traffic right now so I'll be
unsubscribing for a bit. If anyone needs to reach me, please use this address.
Thanks for all the help.
Edward Dudlik
Becoming Digital
www.becomingdigital.com
--- End Message ---
--- Begin Message ---
On Sunday 23 November 2003 18:49, QT wrote:
> I try to connect to email inbox via IMAP but I am getting folowing error:
>
> Certificate failure for xxxxxx self signed certificate:
> /C=--/ST=SomeState/L=SomeCity
What code are you using? And have you studied the examples for imap_open()?
--
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
17. ...and if we just swap these two disc controllers like _this_...
--Top 100 things you don't want the sysadmin to say
*/
--- End Message ---
--- Begin Message ---
Dear Jason,
I am using following code;
require "classes.php";
$u = $_GET['u'];
$p = $_GET['p'];
$uex = explode("@", $u);
$u = $uex[0];
$domain = $uex[1];
require "vars.php";
$MainSettings = new GlobalInit();
$TransIDEnabled = $MainSettings->INIGet('session.use_trans_sid');
session_start();
if ((!isset($_SESSION['sess_u'])) && (!isset($_SESSION['sess_p']))) {
$newlogin = 1;
$_SESSION['sess_u'] = $u;
$_SESSION['sess_p'] = $p;
$newsession['sess_u'] = $u;
$newsession['sess_p'] = $p;
}
else {
$newsession = $_SESSION;
}
$IMAPConnection = new WM_IMAPConnection(
$newsession,
$servertype,
$IMAPPort,
$defaultIMAP,
$WAPimapserver
);
$OutputWML = new SetWML();
echo ("<wml>
<head>\n");
$OutputWML->SetHead();
echo ("</head>\n");
$OutputWML->SetCard();
$mailbox = $IMAPConnection->WM_IMAPConnect();
if (!$mailbox) {
$servererrors = implode("<br/>\n", $IMAPConnection->_mailboxerror);
if (strstr($servererrors, "invalid remote specification")) {
$servererrors .= "<br/><br/>It's possible that this server does not
support this protocol";
}
echo ("<p>\n");
echo ("Error: Sorry your login failed. Your server reported:
$servererrors</p>\n");
echo ("</card></wml>\n");
exit;
}
$numberofmessages = $IMAPConnection->WM_IMAPNumMessages2();
echo ("<p>W-mail lite<br/></p>\n");
echo ("<p><a href=\"mailbox.php");
$MainSettings->SessAppend($TransIDEnabled, 1);
echo ("\">INBOX</a> " . $numberofmessages->Nmsgs . " (" .
$numberofmessages->Recent . " new)</p>\n");
echo ("<p><a href=\"index.php?do=logout");
$MainSettings->SessAppend($TransIDEnabled, 0);
echo ("\">Exit</a></p>\n");
$IMAPConnection->WM_IMAPClose();
echo ("</card>\n</wml>");
"Jason Wong" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> On Sunday 23 November 2003 18:49, QT wrote:
>
> > I try to connect to email inbox via IMAP but I am getting folowing
error:
> >
> > Certificate failure for xxxxxx self signed certificate:
> > /C=--/ST=SomeState/L=SomeCity
>
> What code are you using? And have you studied the examples for
imap_open()?
>
> --
> Jason Wong -> Gremlins Associates -> www.gremlins.biz
> Open Source Software Systems Integrators
> * Web Design & Hosting * Internet & Intranet Applications Development *
> ------------------------------------------
> Search the list archives before you post
> http://marc.theaimsgroup.com/?l=php-general
> ------------------------------------------
> /*
> 17. ...and if we just swap these two disc controllers like _this_...
>
> --Top 100 things you don't want the sysadmin to say
> */
--- End Message ---
--- Begin Message ---
Dear Jason,
I try your advise which is imap open sample like follows and I get;
Warning: imap_open(): Couldn't open stream {mail.smsavantaj.com:110/pop3
$mbox = imap_open ("{mail.test.com:110}", "[EMAIL PROTECTED]", "1234");
echo "<p><h1>Mailboxes</h1>\n";
$folders = imap_listmailbox ($mbox, "{mail.smsavantaj.com:110}", "*");
if ($folders == false) {
echo "Call failed<br>\n";
} else {
while (list ($key, $val) = each ($folders)) {
echo $val."<br>\n";
}
}
echo "<p><h1>Headers in INBOX</h1>\n";
$headers = imap_headers ($mbox);
if ($headers == false) {
echo "Call failed<br>\n";
} else {
while (list ($key,$val) = each ($headers)) {
echo $val."<br>\n";
}
}
imap_close($mbox);
"Jason Wong" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> On Sunday 23 November 2003 18:49, QT wrote:
>
> > I try to connect to email inbox via IMAP but I am getting folowing
error:
> >
> > Certificate failure for xxxxxx self signed certificate:
> > /C=--/ST=SomeState/L=SomeCity
>
> What code are you using? And have you studied the examples for
imap_open()?
>
> --
> Jason Wong -> Gremlins Associates -> www.gremlins.biz
> Open Source Software Systems Integrators
> * Web Design & Hosting * Internet & Intranet Applications Development *
> ------------------------------------------
> Search the list archives before you post
> http://marc.theaimsgroup.com/?l=php-general
> ------------------------------------------
> /*
> 17. ...and if we just swap these two disc controllers like _this_...
>
> --Top 100 things you don't want the sysadmin to say
> */
--- End Message ---
--- Begin Message ---
On Friday 21 November 2003 08:53, Jesper Hansen wrote:
> I'm trying to run a super simple command through passthru.
>
> Here's my test.php file:
>
> <html><body>
> <? passthru('ls -l'); ?>
> </body></html>
>
>
> It works if run directly with "php test.php".
> When this is run from the browser, there is no output, and the
> following error is logged in /var/log/httpd/error_log :
> sh: /ls: No such file or directory
What does the php error log say?
> What does this mean ? Any command I try instead of "ls -l",
> gives a similar error.
>
> The funky thing is that it HAS worked, but now it doesn't, and
> I have no idea what happened.
Find out what funky thing it was that you did to make it stop working.
Are you using safe mode and is "safe_mode_exec_dir" set appropriately?
--
Jason Wong -> Gremlins Associates -> www.gremlins.biz
/*
What is research but a blind date with knowledge?
-- Will Harvey
*/
--- End Message ---
--- Begin Message ---
I would like to know how to run a PHP Program as a Daemon on my Linux Box.
What I am planing to make is a Server that will make use of the Wonderful
sockets
_________________
Nigel Jones
[EMAIL PROTECTED]
--- End Message ---
--- Begin Message ---
Hi all,
is there a way to tell at runtime if PHP is running as an Apache module or
through CGI?
phpinfo() shows this piece of information ("Server API" on the first page).
But is it available as a server variable or a constant or whatever?
I want to know this because I want to set the HTTP status code for a PHP
script, and AFAICT this has to be done differently, depending on the server
API:
header("HTTP/1.1 304 Not modified"); for the Apache module
header("Status: 304 Not modified"); for the CGI interface
If this can be done with the same PHP code on both server APIs, that would
solve my problem too.
Thanks in advance,
Richard
--- End Message ---
--- Begin Message ---
Greetings all,
I'm looking for a tutorial or some assistance in explaning how store and
then open and read a binary file using php/mysql.
I've got a few tutorials about storing the binary data _within_ a mysql
table from Kevin Yank, phpbuilder, etc. but I've heard that it's sometime
better to keep your binaries on the server and not in the database.
Thus, if the developer just keeps the file path in a VARCHAR column like:
C:\apache\images\house.jpg
C:\apache\images\tree.jpg
etc...
and then directs that file be
fopen()
fread(), etc.
it will work without the added overhead.
I'm a bit lost in what happens after the filepaths are inserted into the
database and what steps follow in the script so that they can be opened and
read.
Any help, URL's or tutorials will be of assistance.
Thank you.
TR
--- End Message ---
--- Begin Message ---
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.
--
anders thoresson
--- End Message ---
--- Begin Message ---
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 ---