php-general Digest 28 Aug 2004 09:22:16 -0000 Issue 2962
Topics (messages 194964 through 194991):
Sessions & session_start() & my problem
194964 by: Pahlevanzadeh Mohsen
194966 by: Jasper Howard
194967 by: Pahlevanzadeh Mohsen
194969 by: Jasper Howard
schemaValidate()
194965 by: Greg Beaver
Browser back button
194968 by: Michael Gale
194970 by: Greg Donald
194971 by: Matthew Sims
194974 by: Vail, Warren
Dynamic Function with return?
194972 by: bskolb
194975 by: Pahlevanzadeh Mohsen
194977 by: Jennifer Goodie
Re: changed number_format function
194973 by: Justin Patrin
SOLVED RE: [PHP] Dynamic Function with return?
194976 by: bskolb
an error before register a session
194978 by: Pahlevanzadeh Mohsen
Re: Need Help for Session
194979 by: S. Kang
194980 by: Pahlevanzadeh Mohsen
PHP/MySQL fatal error
194981 by: gc
194984 by: Jason Wong
attach an ICO file to a text file...then downloading to the user
194982 by: grahama.siren.cc
Re: PHP Oficial Certification OT
194983 by: Curt Zirzow
Dynamic HTML Creation
194985 by: Sam Hobbs
194986 by: Justin Patrin
194987 by: Ramil Sagum
194988 by: Jason Davidson
Re: backslashes
194989 by: Thomas Goyne
Open a stream to the shell..
194990 by: Joel Kitching
Re: Problem with sessions
194991 by: gregosh
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 ---
Dears,I have 3 files.
k.php :
<?
session_start();
$S_userk=$HTTP_POST_VARS['u'];
$S_pass=$HTTP_POST_VARS['p'];
//echo $S_pass;
session_register('S_userk');
session_register('S_passk');
include 'http://1.1.1.1/membership/login.php?g=0';
?>
login.php:
define("HOST","localhost");
define("USER","root");
define("PASS"," ");
define("DB","mem");
///////////////////////////////////////
session_start();
if ($HTTP_GET_VARS['g']==1)
{
$username=$S_username;
$password=$S_password;
//print $username;
}
else if ($HTTP_GET_VARS['g']==0)
{
$password=$S_passk;
$username=$S_userk;
}
$S_username=$username;
$S_password=$password;
if(empty($S_username) && empty($S_password) )
{
mysql_connect(HOST,USER) or die("connect");
mysql_select_db(DB) or die("db");
$result=mysql_query("SELECT count(*) as numfound
FROM usernames where user='$username' and
pass='$password'") or die("jjjjjjjgar");
$result_ar=mysql_fetch_array($result);
if($result_ar['numfound'] < 1 )
{
//echo "ffdsfsfsdvfdsfdssc";
//curl_exec(curl_init('http://1.1.1.1/membership/index.html'));
header('Location: index.html');
exit;
}
session_register('S_username');
session_register('S_password');
echo "Logged in successfully!";
But when i loggin in my site,I recv following
warnings:
Warning: session_start(): Cannot send session cookie -
headers already sent by (output started at
/var/www/html/membership/k.php:2) in
/var/www/html/membership/k.php on line 3
Warning: session_start(): Cannot send session cache
limiter - headers already sent (output started at
/var/www/html/membership/k.php:2) in
/var/www/html/membership/k.php on line 3
Please explaine me on my warnings.....
Yours,Mohsen.
=====
---------DIGITAL SIGNATURE-------------------
///Mohsen Pahlevanzadeh////////
Network administrator & programmer
My work phone is : +98216054096-7
My home phone is: +98213810146
My emails is
[EMAIL PROTECTED]
My website is: http://webnegar.net
----------------------------------------------------------------
__________________________________
Do you Yahoo!?
New and Improved Yahoo! Mail - 100MB free storage!
http://promotions.yahoo.com/new_mail
--- End Message ---
--- Begin Message ---
that was a bit confusing, but it looks like you call session_start() more
than once in a script. You only need to call it once, and you need to call
it before any headers get sent, at the top of the script is a good place. If
you're scripts are already setup like that just ignore me. Oh, also, if you
include a file that has session_start() in it you'll get that warning too.
--
-------------------------------------------------------------->>
Jasper Howard :: Database Administration
Velocity7
1.530.470.9292
http://www.Velocity7.com/
<<--------------------------------------------------------------
"Pahlevanzadeh Mohsen" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Dears,I have 3 files.
> k.php :
> <?
> session_start();
> $S_userk=$HTTP_POST_VARS['u'];
> $S_pass=$HTTP_POST_VARS['p'];
> //echo $S_pass;
> session_register('S_userk');
> session_register('S_passk');
> include 'http://1.1.1.1/membership/login.php?g=0';
> ?>
> login.php:
> define("HOST","localhost");
> define("USER","root");
> define("PASS"," ");
> define("DB","mem");
> ///////////////////////////////////////
>
> session_start();
> if ($HTTP_GET_VARS['g']==1)
> {
> $username=$S_username;
> $password=$S_password;
> //print $username;
> }
> else if ($HTTP_GET_VARS['g']==0)
> {
> $password=$S_passk;
> $username=$S_userk;
>
> }
>
> $S_username=$username;
> $S_password=$password;
> if(empty($S_username) && empty($S_password) )
> {
> mysql_connect(HOST,USER) or die("connect");
> mysql_select_db(DB) or die("db");
> $result=mysql_query("SELECT count(*) as numfound
> FROM usernames where user='$username' and
> pass='$password'") or die("jjjjjjjgar");
>
>
> $result_ar=mysql_fetch_array($result);
> if($result_ar['numfound'] < 1 )
> {
> //echo "ffdsfsfsdvfdsfdssc";
>
> //curl_exec(curl_init('http://1.1.1.1/membership/index.html'));
> header('Location: index.html');
> exit;
> }
>
>
> session_register('S_username');
> session_register('S_password');
> echo "Logged in successfully!";
>
> But when i loggin in my site,I recv following
> warnings:
> Warning: session_start(): Cannot send session cookie -
> headers already sent by (output started at
> /var/www/html/membership/k.php:2) in
> /var/www/html/membership/k.php on line 3
>
> Warning: session_start(): Cannot send session cache
> limiter - headers already sent (output started at
> /var/www/html/membership/k.php:2) in
> /var/www/html/membership/k.php on line 3
>
>
> Please explaine me on my warnings.....
> Yours,Mohsen.
>
> =====
> ---------DIGITAL SIGNATURE-------------------
> ///Mohsen Pahlevanzadeh////////
> Network administrator & programmer
> My work phone is : +98216054096-7
> My home phone is: +98213810146
> My emails is
> [EMAIL PROTECTED]
> My website is: http://webnegar.net
> ----------------------------------------------------------------
>
>
>
>
> __________________________________
> Do you Yahoo!?
> New and Improved Yahoo! Mail - 100MB free storage!
> http://promotions.yahoo.com/new_mail
>
--- End Message ---
--- Begin Message ---
I have deleted session_start() at login.php
Thus i have 1 session_start()
But i receive them yet.
Yours,Mohsen
--- Jasper Howard <[EMAIL PROTECTED]> wrote:
> that was a bit confusing, but it looks like you call
> session_start() more
> than once in a script. You only need to call it
> once, and you need to call
> it before any headers get sent, at the top of the
> script is a good place. If
> you're scripts are already setup like that just
> ignore me. Oh, also, if you
> include a file that has session_start() in it you'll
> get that warning too.
>
> --
>
>
>
-------------------------------------------------------------->>
> Jasper Howard :: Database Administration
> Velocity7
> 1.530.470.9292
> http://www.Velocity7.com/
>
<<--------------------------------------------------------------
> "Pahlevanzadeh Mohsen" <[EMAIL PROTECTED]>
> wrote in message
>
news:[EMAIL PROTECTED]
> > Dears,I have 3 files.
> > k.php :
> > <?
> > session_start();
> > $S_userk=$HTTP_POST_VARS['u'];
> > $S_pass=$HTTP_POST_VARS['p'];
> > //echo $S_pass;
> > session_register('S_userk');
> > session_register('S_passk');
> > include
> 'http://1.1.1.1/membership/login.php?g=0';
> > ?>
> > login.php:
> > define("HOST","localhost");
> > define("USER","root");
> > define("PASS"," ");
> > define("DB","mem");
> > ///////////////////////////////////////
> >
> > session_start();
> > if ($HTTP_GET_VARS['g']==1)
> > {
> > $username=$S_username;
> > $password=$S_password;
> > //print $username;
> > }
> > else if ($HTTP_GET_VARS['g']==0)
> > {
> > $password=$S_passk;
> > $username=$S_userk;
> >
> > }
> >
> > $S_username=$username;
> > $S_password=$password;
> > if(empty($S_username) && empty($S_password) )
> > {
> > mysql_connect(HOST,USER) or die("connect");
> > mysql_select_db(DB) or die("db");
> > $result=mysql_query("SELECT count(*) as numfound
> > FROM usernames where user='$username' and
> > pass='$password'") or die("jjjjjjjgar");
> >
> >
> > $result_ar=mysql_fetch_array($result);
> > if($result_ar['numfound'] < 1 )
> > {
> > //echo "ffdsfsfsdvfdsfdssc";
> >
> >
>
//curl_exec(curl_init('http://1.1.1.1/membership/index.html'));
> > header('Location: index.html');
> > exit;
> > }
> >
> >
> > session_register('S_username');
> > session_register('S_password');
> > echo "Logged in successfully!";
> >
> > But when i loggin in my site,I recv following
> > warnings:
> > Warning: session_start(): Cannot send session
> cookie -
> > headers already sent by (output started at
> > /var/www/html/membership/k.php:2) in
> > /var/www/html/membership/k.php on line 3
> >
> > Warning: session_start(): Cannot send session
> cache
> > limiter - headers already sent (output started at
> > /var/www/html/membership/k.php:2) in
> > /var/www/html/membership/k.php on line 3
> >
> >
> > Please explaine me on my warnings.....
> > Yours,Mohsen.
> >
> > =====
> > ---------DIGITAL SIGNATURE-------------------
> > ///Mohsen Pahlevanzadeh////////
> > Network administrator & programmer
> > My work phone is : +98216054096-7
> > My home phone is: +98213810146
> > My emails is
> > [EMAIL PROTECTED]
> > My website is: http://webnegar.net
> >
>
----------------------------------------------------------------
> >
> >
> >
> >
> > __________________________________
> > Do you Yahoo!?
> > New and Improved Yahoo! Mail - 100MB free storage!
> > http://promotions.yahoo.com/new_mail
> >
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
=====
---------DIGITAL SIGNATURE-------------------
///Mohsen Pahlevanzadeh////////
Network administrator & programmer
My home phone is: +98213810146
My email address is
m_pahlevanzadeh at yahoo dot com
My website is: http://webnegar.net
----------------------------------------------------------------
__________________________________
Do you Yahoo!?
New and Improved Yahoo! Mail - Send 10MB messages!
http://promotions.yahoo.com/new_mail
--- End Message ---
--- Begin Message ---
is this php script at the top of the page, there is nothing before it?
--
-------------------------------------------------------------->>
Jasper Howard :: Database Administration
Velocity7
1.530.470.9292
http://www.Velocity7.com/
<<--------------------------------------------------------------
"Pahlevanzadeh Mohsen" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> I have deleted session_start() at login.php
> Thus i have 1 session_start()
> But i receive them yet.
> Yours,Mohsen
> --- Jasper Howard <[EMAIL PROTECTED]> wrote:
>
> > that was a bit confusing, but it looks like you call
> > session_start() more
> > than once in a script. You only need to call it
> > once, and you need to call
> > it before any headers get sent, at the top of the
> > script is a good place. If
> > you're scripts are already setup like that just
> > ignore me. Oh, also, if you
> > include a file that has session_start() in it you'll
> > get that warning too.
> >
> > --
> >
> >
> >
> -------------------------------------------------------------->>
> > Jasper Howard :: Database Administration
> > Velocity7
> > 1.530.470.9292
> > http://www.Velocity7.com/
> >
> <<--------------------------------------------------------------
> > "Pahlevanzadeh Mohsen" <[EMAIL PROTECTED]>
> > wrote in message
> >
> news:[EMAIL PROTECTED]
> > > Dears,I have 3 files.
> > > k.php :
> > > <?
> > > session_start();
> > > $S_userk=$HTTP_POST_VARS['u'];
> > > $S_pass=$HTTP_POST_VARS['p'];
> > > //echo $S_pass;
> > > session_register('S_userk');
> > > session_register('S_passk');
> > > include
> > 'http://1.1.1.1/membership/login.php?g=0';
> > > ?>
> > > login.php:
> > > define("HOST","localhost");
> > > define("USER","root");
> > > define("PASS"," ");
> > > define("DB","mem");
> > > ///////////////////////////////////////
> > >
> > > session_start();
> > > if ($HTTP_GET_VARS['g']==1)
> > > {
> > > $username=$S_username;
> > > $password=$S_password;
> > > //print $username;
> > > }
> > > else if ($HTTP_GET_VARS['g']==0)
> > > {
> > > $password=$S_passk;
> > > $username=$S_userk;
> > >
> > > }
> > >
> > > $S_username=$username;
> > > $S_password=$password;
> > > if(empty($S_username) && empty($S_password) )
> > > {
> > > mysql_connect(HOST,USER) or die("connect");
> > > mysql_select_db(DB) or die("db");
> > > $result=mysql_query("SELECT count(*) as numfound
> > > FROM usernames where user='$username' and
> > > pass='$password'") or die("jjjjjjjgar");
> > >
> > >
> > > $result_ar=mysql_fetch_array($result);
> > > if($result_ar['numfound'] < 1 )
> > > {
> > > //echo "ffdsfsfsdvfdsfdssc";
> > >
> > >
> >
> //curl_exec(curl_init('http://1.1.1.1/membership/index.html'));
> > > header('Location: index.html');
> > > exit;
> > > }
> > >
> > >
> > > session_register('S_username');
> > > session_register('S_password');
> > > echo "Logged in successfully!";
> > >
> > > But when i loggin in my site,I recv following
> > > warnings:
> > > Warning: session_start(): Cannot send session
> > cookie -
> > > headers already sent by (output started at
> > > /var/www/html/membership/k.php:2) in
> > > /var/www/html/membership/k.php on line 3
> > >
> > > Warning: session_start(): Cannot send session
> > cache
> > > limiter - headers already sent (output started at
> > > /var/www/html/membership/k.php:2) in
> > > /var/www/html/membership/k.php on line 3
> > >
> > >
> > > Please explaine me on my warnings.....
> > > Yours,Mohsen.
> > >
> > > =====
> > > ---------DIGITAL SIGNATURE-------------------
> > > ///Mohsen Pahlevanzadeh////////
> > > Network administrator & programmer
> > > My work phone is : +98216054096-7
> > > My home phone is: +98213810146
> > > My emails is
> > > [EMAIL PROTECTED]
> > > My website is: http://webnegar.net
> > >
> >
> ----------------------------------------------------------------
> > >
> > >
> > >
> > >
> > > __________________________________
> > > Do you Yahoo!?
> > > New and Improved Yahoo! Mail - 100MB free storage!
> > > http://promotions.yahoo.com/new_mail
> > >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
>
>
> =====
> ---------DIGITAL SIGNATURE-------------------
> ///Mohsen Pahlevanzadeh////////
> Network administrator & programmer
> My home phone is: +98213810146
> My email address is
> m_pahlevanzadeh at yahoo dot com
> My website is: http://webnegar.net
> ----------------------------------------------------------------
>
>
>
> __________________________________
> Do you Yahoo!?
> New and Improved Yahoo! Mail - Send 10MB messages!
> http://promotions.yahoo.com/new_mail
>
--- End Message ---
--- Begin Message ---
Hi,
I'm trying to design a new validation method for an xml parsing package
that will be ported to PHP5. I've gotten schemaValidate() to work
successfully, but the error messages are nearly useless.
If an extra element is found inside another, I get a message like:
"Element channel content check failed"
when the <channel> element has incorrect content.
No information on what the exact failure was seems to be accessible. Is
this the state of affairs with libxml2 (I'm using PHP 5.0.1 on windows)?
Greg
--- End Message ---
--- Begin Message ---
Hello,
I am sure this has been asked more then a few times but ... I have a web site
where almost every page is dynamically
created. So if at some point in the site if you hit your browsers back button a popup
window occurs and asks if you want
to resubmit the data. Upon clicking yes the page is properly displayed.
That is a pain in the a$$ and I get many user complaints -- so far I have thought
about saving the requested URL and
query string in a session variable and loading a back button on every page.
This seems to work create if the previous page can be loaded using a GET request but
if the previous page was loaded
using a HTTP POST it seems I an up the creek with out a paddle :(
Any one have any ideas ...
Thanks ..
--
Michael Gale
Network Administrator
Utilitran Corporation
--- End Message ---
--- Begin Message ---
On Fri, 2004-08-27 at 16:20, Michael Gale wrote:
> Hello,
>
> I am sure this has been asked more then a few times but ...
So why not search the archives then? :)
> I have a web site where almost every page is dynamically
> created. So if at some point in the site if you hit your browsers back button a
> popup window occurs and asks if you want
> to resubmit the data. Upon clicking yes the page is properly displayed.
>
> That is a pain in the a$$ and I get many user complaints -- so far I have thought
> about saving the requested URL and
> query string in a session variable and loading a back button on every page.
>
> This seems to work create if the previous page can be loaded using a GET request but
> if the previous page was loaded
> using a HTTP POST it seems I an up the creek with out a paddle :(
>
> Any one have any ideas ...
Some options I've used previously, some kinda yucky I admit.
1) Use the GET method. You can send data this way as long as the url
isn't very long. Don't forget to urlencode() if required.
2) Add a 0 second meta refresh on the POST'd-to page. If the user hits
back they will go to your intermittent page just after the form, not the
form page itself.
3) Use a header() call to send the user to a totally new page after the
POST.
--
Greg Donald
--- End Message ---
--- Begin Message ---
> Hello,
>
> I am sure this has been asked more then a few times but ... I have a web
> site where almost every page is dynamically
> created. So if at some point in the site if you hit your browsers back
> button a popup window occurs and asks if you want
> to resubmit the data. Upon clicking yes the page is properly displayed.
>
> That is a pain in the a$$ and I get many user complaints -- so far I have
> thought about saving the requested URL and
> query string in a session variable and loading a back button on every
> page.
>
> This seems to work create if the previous page can be loaded using a GET
> request but if the previous page was loaded
> using a HTTP POST it seems I an up the creek with out a paddle :(
>
> Any one have any ideas ...
>
> Thanks ..
>
> --
> Michael Gale
What I usually do is when requesting a new page, I check to see if there
are any $_POST data using the isset() function. If so, I assign all $_POST
data to $_SESSION vars at the top of the page. Once that's done, I do a
header redirect to the same page. That'll clear out all $_POST data and
you'll still have your vars sitting in $_SESSION.
Web page is index.php:
<?php
sesson_start;
if (isset($_POST["var"])) {
$_SESSION["var"] = $_POST["var"];
header("Location: index.php");
}
?>
...webpage stuff here...
--
--Matthew Sims
--<http://killermookie.org>
--- End Message ---
--- Begin Message ---
I struggled with this one as well and the solution is quite simple;
1. Every PHP module that is reached via the action field in a form where
the method is POST (most of mine are) never outputs any html except a http
redirect (it will edit values, update the database, save session data, then
does a redirect).
header("Location:.....");
2. Every PHP module that is reached via a hotlink or redirect (above) is
free to output html to the browser, acting on or displaying data from the
database, using session data, or data coded in the URL parameter list;
Mymodule.php?parm1=aaaa&parm2=bbbb&parm3=cccc
$a = $_GET["parm1"]; // like this
$b = $_GET["parm2"];
$c = $_GET["parm3"];
With these two types of modules, you can build your entire application. I
believe the cause of this problem is that most browsers don't save "POST"
data in the history stack, when you click the back button and the browser
detects that the previous page was entered via a "POST" is knows it doesn't
have enough saved information to reconstruct the page (passed data is
missing, and complains). I also believe the browser replaces an entry in
the history stack (i.e. your form POST) when it receives a redirect url,
effectively removing all url's that had been entered with a POST from the
history stack and replacing them with "GET" requests.
Good luck,
Warren Vail
-----Original Message-----
From: Michael Gale [mailto:[EMAIL PROTECTED]
Sent: Friday, August 27, 2004 2:21 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Browser back button
Hello,
I am sure this has been asked more then a few times but ... I have a
web site where almost every page is dynamically created. So if at some point
in the site if you hit your browsers back button a popup window occurs and
asks if you want to resubmit the data. Upon clicking yes the page is
properly displayed.
That is a pain in the a$$ and I get many user complaints -- so far I have
thought about saving the requested URL and query string in a session
variable and loading a back button on every page.
This seems to work create if the previous page can be loaded using a GET
request but if the previous page was loaded using a HTTP POST it seems I an
up the creek with out a paddle :(
Any one have any ideas ...
Thanks ..
--
Michael Gale
Network Administrator
Utilitran Corporation
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
Sample Code:
//================================
<?PHP // version 4.3.6
function testFunction($foo) {
return $foo=="TEST";
}
function wrapper($foofunc, $foovar) {
return eval("return $foofunc($foovar);");
}
echo wrapper("testFunction", "TEST");
?>
//================================
This code works. It calls the function and
receives the appropriate return value.
But, is there a better way of doing this?
It seems a bit round-a-bout.
Thanks!
--- End Message ---
--- Begin Message ---
1 way is here.You can use object & OOP.
--- bskolb <[EMAIL PROTECTED]> wrote:
> Sample Code:
>
> //================================
> <?PHP // version 4.3.6
> function testFunction($foo) {
> return $foo=="TEST";
> }
>
> function wrapper($foofunc, $foovar) {
> return eval("return $foofunc($foovar);");
> }
>
> echo wrapper("testFunction", "TEST");
> ?>
> //================================
>
> This code works. It calls the function and
> receives the appropriate return value.
>
> But, is there a better way of doing this?
> It seems a bit round-a-bout.
>
>
> Thanks!
>
=====
---------DIGITAL SIGNATURE-------------------
///Mohsen Pahlevanzadeh////////
Network administrator & programmer
My home phone is: +98213810146
My email address is
m_pahlevanzadeh at yahoo dot com
My website is: http://webnegar.net
----------------------------------------------------------------
__________________________________
Do you Yahoo!?
New and Improved Yahoo! Mail - Send 10MB messages!
http://promotions.yahoo.com/new_mail
--- End Message ---
--- Begin Message ---
> -----Original Message-----
> From: bskolb [mailto:[EMAIL PROTECTED]
> Sent: Friday, August 27, 2004 3:59 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP] Dynamic Function with return?
>
>
> Sample Code:
>
> //================================
> <?PHP // version 4.3.6
> function testFunction($foo) {
> return $foo=="TEST";
> }
>
> function wrapper($foofunc, $foovar) {
> return eval("return $foofunc($foovar);");
> }
>
> echo wrapper("testFunction", "TEST");
> ?>
> //================================
>
> This code works. It calls the function and
> receives the appropriate return value.
>
> But, is there a better way of doing this?
> It seems a bit round-a-bout.
Did you already try this?
function wrapper($foofunc, $foovar){
return $foofunc($foovar);
}
http://us3.php.net/manual/en/functions.variable-functions.php
Maybe I'm missing something, but I don't see the need for the eval since PHP supports
variable function names.
--- End Message ---
--- Begin Message ---
On Fri, 27 Aug 2004 18:48:16 +0200, Marek Kilimajer <[EMAIL PROTECTED]> wrote:
> Justin Patrin wrote:
> > number_format($number, 2);
> >
>
> Does not work. Desired results:
>
> >>
> >>1000 should return 1,000
> >>1000.5 should return 1,000.5
> >>1000.25 should return 1,000.25
> >>so on.
>
> Actual results:
>
> 1000 => 1,000.00
> 1000.5 => 1,000.50
> 1000.25 => 1,000.25
>
OIC. Yep, I don't think you can do that with number_format.
--
DB_DataObject_FormBuilder - The database at your fingertips
http://pear.php.net/package/DB_DataObject_FormBuilder
paperCrane --Justin Patrin--
--- End Message ---
--- Begin Message ---
Thanks for the quick reply, I wasn't aware that passing a variable for the
object would work.
New code:
class testClass {
function testFunction($foo) {
return $foo=="TEST";
}
}
$testObj = new testClass;
$testFunc = "testFunction";
echo $testObj->$testFunc("TEST");
-----Original Message-----
From: Pahlevanzadeh Mohsen [mailto:[EMAIL PROTECTED]
Sent: Friday, August 27, 2004 7:24 PM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: Re: [PHP] Dynamic Function with return?
1 way is here.You can use object & OOP.
--- bskolb <[EMAIL PROTECTED]> wrote:
> Sample Code:
>
> //================================
> <?PHP // version 4.3.6
> function testFunction($foo) {
> return $foo=="TEST";
> }
>
> function wrapper($foofunc, $foovar) {
> return eval("return $foofunc($foovar);"); }
>
> echo wrapper("testFunction", "TEST");
> ?>
> //================================
>
> This code works. It calls the function and receives the appropriate
> return value.
>
> But, is there a better way of doing this?
> It seems a bit round-a-bout.
>
>
> Thanks!
>
=====
---------DIGITAL SIGNATURE------------------- ///Mohsen
Pahlevanzadeh////////
Network administrator & programmer
My home phone is: +98213810146
My email address is
m_pahlevanzadeh at yahoo dot com
My website is: http://webnegar.net
----------------------------------------------------------------
__________________________________
Do you Yahoo!?
New and Improved Yahoo! Mail - Send 10MB messages!
http://promotions.yahoo.com/new_mail
--
PHP General Mailing List (http://www.php.net/) To unsubscribe, visit:
http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
Dears,When i run "rm -rf /tmp/sess_*" ,It are meaning
that i clean every session.
When i want to my program,I receive following warning
:
Warning: Unknown(): Your script possibly relies on a
session side-effect which existed until PHP 4.2.3.
Please be advised that the session extension does not
consider global variables as a source of data, unless
register_globals is enabled. You can disable this
functionality and this warning by setting
session.bug_compat_42 or session.bug_compat_warn to
off, respectively. in Unknown on line 0
But,When i regist at least 1 session,I don't recv it.
Please guide me....
Yours,Moshen
=====
---------DIGITAL SIGNATURE-------------------
///Mohsen Pahlevanzadeh////////
Network administrator & programmer
My home phone is: +98213810146
My email address is
m_pahlevanzadeh at yahoo dot com
My website is: http://webnegar.net
----------------------------------------------------------------
_______________________________
Do you Yahoo!?
Win 1 of 4,000 free domain names from Yahoo! Enter now.
http://promotions.yahoo.com/goldrush
--- End Message ---
--- Begin Message ---
Afzal Hussain ) wrote:
Sir,
I am afzal hussain from bangladesh. Acually i am getting some problem using session in
php. This is the sample code that i have written,
session_start();
//>>$vbl="This variable is registered";
//>>session_register('vbl');
$_SESSION['vb1'] = "This variable is registered";
//>>echo $vbl;
echo $_SESSION['vb1'];
?>
it shows this output.
Warning: Cannot send session cookie - headers already sent by (output started at
c:/program files/abria merlin/apache/htdocs/session.php:3) in c:/program files/abria
merlin/apache/htdocs/session.php on line 4
Warning: Cannot send session cache limiter - headers already sent (output started at
c:/program files/abria merlin/apache/htdocs/session.php:3) in c:/program files/abria
merlin/apache/htdocs/session.php on line 4
Warning: open(/tmp\sess_178d4e9e23a4d7b1f061f93e7f172496, O_RDWR) failed: m (2) in c:/program files/abria merlin/apache/htdocs/session.php on line 4
This variable is registered
Finding no other way i am sending this email to u. Could u pls tell me what s\could be
the problem. and How i can i solve that problem.
thanks you very much.
afzal Hussian
---------------------------------
Do you Yahoo!?
Win 1 of 4,000 free domain names from Yahoo! Enter now.
--- End Message ---
--- Begin Message ---
1.You must call session_start before making a HTML for
client.
2.Please use if (!session_is_registered('vb1'))
session_register('vb1');
--- "S. Kang" <[EMAIL PROTECTED]> wrote:
>
>
> Afzal Hussain ) wrote:
>
> >
> >
> >
> >
> >>Sir,
> >>I am afzal hussain from bangladesh. Acually i am
> getting some problem using session in php. This is
> the sample code that i have written,
> >>
> >>>session_start();
> >>
> //>>$vbl="This variable is registered";
> //>>session_register('vbl');
>
> $_SESSION['vb1'] = "This variable is registered";
>
> //>>echo $vbl;
>
> echo $_SESSION['vb1'];
>
> >>?>
> >>it shows this output.
> >>
> >>
> >>Warning: Cannot send session cookie - headers
> already sent by (output started at c:/program
> files/abria merlin/apache/htdocs/session.php:3) in
> c:/program files/abria
> merlin/apache/htdocs/session.php on line 4
> >>
> >>Warning: Cannot send session cache limiter -
> headers already sent (output started at c:/program
> files/abria merlin/apache/htdocs/session.php:3) in
> c:/program files/abria
> merlin/apache/htdocs/session.php on line 4
> >>
> >>Warning:
> open(/tmp\sess_178d4e9e23a4d7b1f061f93e7f172496,
> O_RDWR) failed: m (2) in c:/program files/abria
> merlin/apache/htdocs/session.php on line 4
> >>This variable is registered
> >>
> >>Finding no other way i am sending this email to u.
> Could u pls tell me what s\could be the problem. and
> How i can i solve that problem.
> >>
> >>thanks you very much.
> >>afzal Hussian
> >
> >
> >
> >
> > ---------------------------------
> > Do you Yahoo!?
> > Win 1 of 4,000 free domain names from Yahoo! Enter
> now.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
=====
---------DIGITAL SIGNATURE-------------------
///Mohsen Pahlevanzadeh////////
Network administrator & programmer
My home phone is: +98213810146
My email address is
m_pahlevanzadeh at yahoo dot com
My website is: http://webnegar.net
----------------------------------------------------------------
__________________________________
Do you Yahoo!?
Yahoo! Mail - 50x more storage than other providers!
http://promotions.yahoo.com/new_mail
--- End Message ---
--- Begin Message ---
Hi all,
I'm Gene Candelaria and I'm a PHP and MySQL newbie.
I have a feeling a lot of you have seen this before. I'm teaching myself
PHP/MySQL trying to setup a guestbook. I'm running latest versions of
Apache, PHP and MySql on my WIN2k machine. I have them working, except, I
get the messages:
"Fatal error: Call to undefined function mysql_connect() "
"Fatal error: Call to undefined function mysql_pconnect() "
when serving two of my php docs (code snippets below). I've been reading and
searching and trying all sorts of things to fix this and nothing works. I've
removed the comment from the line "extension=php_mysql.dll" in php.ini.
(Below is the MySQL section of php.ini. It's pretty standard, I'm using
defaults.) I edited my Apache config file with the needed lines:
### Section 4: PHP 5 Module
#
ScriptAlias /cgi-bin/ "C:/Program Files/Apache Group/Apache2/cgi-bin/"
LoadModule php5_module php/php5apache2.dll
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
PHPIniDir "C:/Program Files/Apache Group/Apache2/PHP"
When I run my test.php doc, MySQL is not listed. Do I need to enable it in
the configure command? How do I edit the configure command. Per my test.php,
It now reads:
Configure Command cscript /nologo configure.js "--with-gd=shared"
"--enable-snapshot-build"
Online I read these comments:
Ok, your php.ini file is set to 'on' for mysql.allow_persistent, but is
mysql really enabled? Does your configure command look something like
this?
'./configure' '--with-mysql=/usr/local/mysql'
............................................
If you don't have --with-mysql it means that you cannot use mysql functions,
so compile PHP again
with this option.
How do I edit that pesky configure command. I searched, but couldn't find an
answer. So, where am I going wrong? Thanks for reading and big thanks for
any help.
gene
[EMAIL PROTECTED]
php.ini snippet (comments removed for easier reading:
[MySQL]
mysql.allow_persistent = On
mysql.max_persistent = -1
mysql.max_links = -1
mysql.default_port =
mysql.default_socket =
mysql.default_host =
mysql.default_user =
mysql.default_password =
mysql.connect_timeout = 60
mysql.trace_mode = Off
guest.php code snippet:
//connect
// change localhost to your db host name
mysql_pconnect( "http://aulon.dyndns.org/", "$username", "$password")
or die( "Unable to connect to SQL server");
mysql_select_db( "$db_name") or die( "Unable to select database");
guestbook.php code snippet:
// Connect to DB
$li = mysql_connect($dbHost, $dbUser, $dbPass) or die("Could not connect");
mysql_select_db($dbDatabase, $li) or die ("could not select DB");
--- End Message ---
--- Begin Message ---
On Saturday 28 August 2004 09:43, gc wrote:
> Hi all,
>
> I'm Gene Candelaria and I'm a PHP and MySQL newbie.
You have started a new thread by taking an existing posting and replying to
it while you changed the subject.
That is bad, because it breaks threading. Whenever you reply to a message,
your mail client generates a "References:" header that tells all recipients
which posting(s) your posting refers to. A mail client uses this information
to build a threaded view ("tree view") of the postings.
With your posting style you successfully torpedoed this useful feature; your
posting shows up within an existing thread it has nothing to do with.
Always do a fresh post when you want to start a new thread. To achieve this,
click on "New message" instead of "Reply" within your mail client, and enter
the list address as the recipient. You can save the list address in your
address book for convenience.
--- End Message ---
--- Begin Message ---
is it possible to add a custom icon to a text file on the server
side......and then download the completed file to the user's desktop
would you put some type of AddType into the htacccess folder to do this
?
like AddType image/x-icon .ico
can php do something like this ?
many thanks
g
--- End Message ---
--- Begin Message ---
* Thus wrote John Nichel:
> John Holmes wrote:
>
> >From: "Jay Blanchard" <[EMAIL PROTECTED]>
> >
> >>Probably Holmes.
> >
> >
> >Not officially. Might look into it, though, but this is really just a
> >hobby for me. :)
> >
> >I think that if you've been on the list for over a year, you should be
> >certified automatically. heh...
> >
> >---John Holmes...
>
> WooHoo....I found posts from me dating back to 2002 on this list. Funny
> though, I know I've been posting here since '99 or '00. Might have been
> under a different email address. Ah, well.
did you look in the php.version4 list? it was the interum list for
the transition between php3 and php4 dated from May 1999 to Jun
2000, this list was started in Jan of 2000.
http://zirzow.dyndns.org/html/mlists/
ps. the layout is totally under construction ;)
Curt
--
First, let me assure you that this is not one of those shady pyramid schemes
you've been hearing about. No, sir. Our model is the trapezoid!
--- End Message ---
--- Begin Message ---
Is it possible to use the DOM to add (HTML) elements to a page at the time
the page is being shown? The HTML and VBScript shown below is a simplified
version of what I need to do but of course I need to do it in PHP. Since PHP
is server-side (right?) perhaps it is not possible.
<HTML>
<HEAD>
<Title>Dynamic Table Demo</Title>
</HEAD>
<Script Language=VBScript>
Sub Window_Onload
Set NewRow = document.createElement("TR")
Set NewCell = document.createElement("TD")
NewCell.innerText = "Cell Text"
NewRow.appendChild NewCell
TableBody.appendChild NewRow
End Sub
</Script>
<Body>
<h1>Dynamic Table Demo</h1>
<Table Id=NewTable Cols=1 border=1 Width=50%>
<TBody Id=TableBody>
</TBody>
</Table>
</Body>
</HTML>
--- End Message ---
--- Begin Message ---
On Fri, 27 Aug 2004 23:17:29 -0700, Sam Hobbs <[EMAIL PROTECTED]> wrote:
> Is it possible to use the DOM to add (HTML) elements to a page at the time
> the page is being shown? The HTML and VBScript shown below is a simplified
> version of what I need to do but of course I need to do it in PHP. Since PHP
> is server-side (right?) perhaps it is not possible.
>
You're right, it's not possible. You'd have to create the whole page
with DOM and output it at the end.
You may be able to use DOM to make a specific piece and inject it....
You could always just use JavaScript to inject things as wel.
> <HTML>
> <HEAD>
> <Title>Dynamic Table Demo</Title>
> </HEAD>
>
> <Script Language=VBScript>
> Sub Window_Onload
> Set NewRow = document.createElement("TR")
> Set NewCell = document.createElement("TD")
> NewCell.innerText = "Cell Text"
> NewRow.appendChild NewCell
> TableBody.appendChild NewRow
> End Sub
> </Script>
>
> <Body>
> <h1>Dynamic Table Demo</h1>
>
> <Table Id=NewTable Cols=1 border=1 Width=50%>
> <TBody Id=TableBody>
> </TBody>
> </Table>
>
> </Body>
> </HTML>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
> !DSPAM:412fc78a52836398416238!
>
>
--
DB_DataObject_FormBuilder - The database at your fingertips
http://pear.php.net/package/DB_DataObject_FormBuilder
paperCrane --Justin Patrin--
--- End Message ---
--- Begin Message ---
On Fri, 27 Aug 2004 23:17:29 -0700, Sam Hobbs <[EMAIL PROTECTED]> wrote:
> Is it possible to use the DOM to add (HTML) elements to a page at the time
> the page is being shown? The HTML and VBScript shown below is a simplified
> version of what I need to do but of course I need to do it in PHP. Since PHP
is server-side (right?) perhaps it is not possible.
---------------
Yes, it is possible. And you are right, PHP is a server side
language. In addition to PHP,
use a client-side scripting language (like JavaScript). JavaScript
also has functions for accessing the DOM (createElement and
getElementByID).
HTH
----
ramil
http://ramil.sagum.net
--- End Message ---
--- Begin Message ---
its possible to add HTML elements with DOM, im not sure what it has to
do with php though?
Jason
"Sam Hobbs" <[EMAIL PROTECTED]> wrote:
>
> Is it possible to use the DOM to add (HTML) elements to a page at the time
> the page is being shown? The HTML and VBScript shown below is a simplified
> version of what I need to do but of course I need to do it in PHP. Since PHP
> is server-side (right?) perhaps it is not possible.
>
>
> <HTML>
> <HEAD>
> <Title>Dynamic Table Demo</Title>
> </HEAD>
>
> <Script Language=VBScript>
> Sub Window_Onload
> Set NewRow = document.createElement("TR")
> Set NewCell = document.createElement("TD")
> NewCell.innerText = "Cell Text"
> NewRow.appendChild NewCell
> TableBody.appendChild NewRow
> End Sub
> </Script>
>
> <Body>
> <h1>Dynamic Table Demo</h1>
>
> <Table Id=NewTable Cols=1 border=1 Width=50%>
> <TBody Id=TableBody>
> </TBody>
> </Table>
>
> </Body>
> </HTML>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--- End Message ---
--- Begin Message ---
On Fri, 27 Aug 2004 18:29:50 -0400, Ryan Schefke <[EMAIL PROTECTED]>
wrote:
Thomas,
I'm not sure what your point is. Please expand.
Ryan
Do you really see nothing wrong with announcing to all users that they
can
run arbitrary SQL with your script?
well, the where clause in mysql is relativly safe, but suppose the user
changes giftprint.php?passid=1&sort=WHERE thankyou='Not Sent' ORDER BY
cash ASC to, say.. giftprint.php?passid=1&sort=OR 1, as the absolute most
basic example. PHP no longer supports
sending multiple queries with one mysql_query to make this not as bad,
but if you put SQL in the url or in a form, you are just begging to have
it changed. At the very least have sort=cash. Idealy the query should
look something like:
$sarr = array('name', 'event', 'description', 'cash', 'action',
'thankyou', );
$query = 'SELECT `name`, `event`, `description`, `cash`, `action`,
`thankyou` FROM `gifts` WHERE customerID=' . intval($_GET['passid'] . ' '
. $sarr[intval($_GET['sort'])];
--
Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/
--- End Message ---
--- Begin Message ---
Hello, is it possible to open a stream in which I can write commands
and read output from them to a shell like bash? I want to do this
because this program can not be completed with just a `backtick` or
shell_exec() command, as it's somewhat user-interactive.
As an example, let's say I want to get cdecl to explain to me what
"char *horse" means. I would type:
# <i>cdecl</i>
Type `help' or `?' for help
cdecl> <i>explain char *horse</i>
declare horse as pointer to char
cdecl> <i>exit</i>
...where input is surrounded by <i>these</i>. This would be difficult
or impossible to do with shell_exec, especially if halfway-through you
have to do some calculating before you can know what to ask cdecl
next.
So I want to know whether you can somehow open a stream to a shell,
and execute commands there. Like...
$fp = fopen('/bin/bash', 'rw');
$output = fgets($fp);
fputs($fp, 'cdecl');
$output = fgets($fp);
$output = fgets($fp);
fputs($fp, 'explain char *horse');
$expl = fgets($fp);
/* Right now you could do some calculations and figure out what to do next. */
$output = fgets($fp);
fputs($fp, 'exit');
$output = fgets($fp);
fclose($fp);
Now this obviously wouldn't work, as it would overwrite the bash
executable if you had proper access, but it's just to get the idea
across.
So, does anyone know how I can do this?
--
Joel Kitching
http://midgardmanga.keenspace.com/
--- End Message ---
--- Begin Message ---
Yes, that indeed was a typo but only in my message above. It's not the
problem with the script
Uzytkownik "Andre Dubuc" <[EMAIL PROTECTED]> napisal w wiadomosci
news:[EMAIL PROTECTED]
> Hi,
>
> Looking at your code, I noticed that either you're missing the closing
double
> quote to close off the Location expression, or you're ending it early with
a
> double quote at http://".
>
> Shouldn't it read:
>
> header("Location: http://' . $_SERVER['HTTP_HOST']
> ^
> . dirname($_SERVER['PHP_SELF'])
> . '/b.php?'.SID'");
> ^^
>
> Perhaps that's the problem. I'm no expert . . .
> Hth,
> Andre
>
>
> On Friday 27 August 2004 07:47 am, gregosh wrote:
> > > you sure the cookie is being set? try this
> > >
> > > header("Location: http://" . $_SERVER['HTTP_HOST']
> > > . dirname($_SERVER['PHP_SELF'])
> > > . '/b.php?'.SID);
> >
> > I had tried this before - no result. The cookie is set in the \temp dir
> > where it is intended. And that's where the other cookie with new session
is
> > located too. This really is a strange problem.
--- End Message ---