php-general Digest 5 Feb 2003 14:06:41 -0000 Issue 1865
Topics (messages 134364 through 134404):
Re: Array find a element
134364 by: Bobby Patel
134384 by: mattias.ballou.se
Printing
134365 by: Chris Kay
134367 by: Jason Sheets
php problem
134366 by: Aaron Downes
134368 by: Jason Sheets
134369 by: Jason k Larson
Sessions and Cookies
134370 by: acleave
134371 by: Leif K-Brooks
134372 by: Dmitri
134391 by: 1LT John W. Holmes
inserting datas through table
134373 by: kumar
Best way to include multi-lingual support in an application.
134374 by: JJ Harrison
134385 by: mattias.ballou.se
134386 by: rush
Re: Security question with PHP on Unix / Linux.
134375 by: Ananth Kesari
134376 by: Ananth Kesari
134398 by: Maxim Maletsky
Re: Making /something/blah work instead of /something.php/blah
134377 by: Jason Wong
Re: WYSIWYG Content Management system?
134378 by: Jason Wong
fputs / fwrites
134379 by: Lee Herron
134381 by: Jason Wong
Re: Protect Access to a Directory
134380 by: Jason Wong
134383 by: Adrian Portsmouth
Object oriented Programming
134382 by: Sascha Braun
Re: PhpMyADmin Help
134387 by: Simon
restricting acces to files
134388 by: Shams
PHP connecting to MS Access
134389 by: Phil Schwarzmann
134401 by: Maxim Maletsky
Re: Is there a way to retrieve an entire source code from a php file?
134390 by: Chris Hayes
problems with gzuncompress data from fsockopen (data error)
134392 by: akorthaus.web.de
Creating associative array
134393 by: PHP
134394 by: Leif K-Brooks
134396 by: Chris Hayes
134397 by: Jason Wong
Re: Problem with include PHP 4.3.0
134395 by: Jean-Pierre Gallou
writing to the db on close
134399 by: Edward Peloke
getting javascript string values
134400 by: Gilberto Garcia Jr.
134403 by: Chris Hayes
Execute at a defined time
134402 by: Miguel Brás
134404 by: Tom Rogers
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 ---
look at array_key_exists
"Narciso Miguel Rodrigues" <[EMAIL PROTECTED]> wrote in
message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Is possible to do something like
>
> if ($username in $users) ... or i need to do a foreach($user){...}
>
> Thks
>
> [MsR]
>
--- End Message ---
--- Begin Message ---
You can use in_array (http://www.php.net/function.in_array) for this.
--
Mattias
--|-----Original Message-----
--|From: Narciso Miguel Rodrigues
--|[mailto:[EMAIL PROTECTED]]
--|Sent: Wednesday, February 05, 2003 02:03
--|To: [EMAIL PROTECTED]
--|Subject: [PHP] Array find a element
--|
--|
--|Is possible to do something like
--|
--| if ($username in $users) ... or i need to do a foreach($user){...}
--|
--|Thks
--|
--|[MsR]
--|
--|
--|--
--|PHP General Mailing List (http://www.php.net/)
--|To unsubscribe, visit: http://www.php.net/unsub.php
--|
--|
--- End Message ---
--- Begin Message ---
I am thinking of running a print job from one system via the internet to
a network printer, this can be done...
Question 1.. Anyway had experience with a certain printer that would be
goof for this...
Question 2.. Could some one point me to the right place I may learn how
to print to a network printer with php on a RH 8.0 box
Thank you in advance
---------------------------------------------------------
Chris Kay (Systems Development)
Techex Communications
Website: www.techex.com.au Email: [EMAIL PROTECTED]
Telephone: 1300 88 111 2 - Fax: 1300 882 221
---------------------------------------------------------
--- End Message ---
--- Begin Message ---
If you have setup your printer with lpr then you can send print jobs
with PHP via lpr (using command line execution) to the printer.
You should be able to use other print systems that offer command line
printing as well.
Look at the PHP process execution functions for actually executing the
print command.
Jason
On Tue, 2003-02-04 at 21:09, Chris Kay wrote:
>
> I am thinking of running a print job from one system via the internet to
> a network printer, this can be done...
>
> Question 1.. Anyway had experience with a certain printer that would be
> goof for this...
>
> Question 2.. Could some one point me to the right place I may learn how
> to print to a network printer with php on a RH 8.0 box
>
> Thank you in advance
>
> ---------------------------------------------------------
> Chris Kay (Systems Development)
> Techex Communications
> Website: www.techex.com.au Email: [EMAIL PROTECTED]
> Telephone: 1300 88 111 2 - Fax: 1300 882 221
> ---------------------------------------------------------
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
Dear Sir/Madam,
trying to displaying records by php get error :
Parse error: parse error in /hsphere/local/home/ozhomene/ardownes.com/ViewContacts.php
on line 30
see below for code for ViewContacts.php :
<html>
<body>
<?
$connection=mysql_connect("localhost","",""); #am entering userID &password instead
of ,"","")
IF (!$connection) {
echo "Could not connect to mySQL server";
exit;
}
$db=mysql_select_db("test_holding",$connection);
if (!$db) {
echo "Could not change the database";
exit;
}
#sql="SELECT * FROM contacts"; # name of table "contacts" with below fields
#mysql_result=mysql_query($sql,$connection);
$num_rows=mysql_num_rows($mysql_result);
if ( $num_rows == 0 ) {
echo "Sorry, there is no information.";
} else {
#we have results
while ($rows=mysql_fetch_array($mysql_result)) {
$ID=row['ID']; # this
is line 30
$first_name=row['first_name'];
$surname=row['surname'];
$email=row['email'];
$comments=row['comments'];
# display results
echo "$fist_name : $surname $email $comments<br>";
}
} # end else
mysql_close($connection);
?>
</body>
</html>
Any help will be appreciated.
Best regards,
Aaron Downes
--- End Message ---
--- Begin Message ---
Hi Aaron,
I noticed several things, first you are fetching your database row into
$rows but you are referencing the data in $row, and second you do not
have a $ in front of your $row variable name, in order to get the
contents of a variable you must use $variable.
I've included modified code to demonstrate.
Jason
while ($rows=mysql_fetch_array($mysql_result)) {
$ID=row['ID'];
# this is line 30
$first_name=row['first_name'];
$surname=row['surname'];
$email=row['email'];
$comments=row['comments'];
needs to be
while ($row = mysql_fetch_array($mysql_result)) {
$ID=$row['ID']; # this is
line 30
$first_name=$row['first_name'];
$surname=$row['surname'];
$email=$row['email'];
$comments=$row['comments'];
On Tue, 2003-02-04 at 21:44, Aaron Downes wrote:
> Dear Sir/Madam,
>
> trying to displaying records by php get error :
> Parse error: parse error in
>/hsphere/local/home/ozhomene/ardownes.com/ViewContacts.php on line 30
>
> see below for code for ViewContacts.php :
>
> <html>
> <body>
>
> <?
>
> $connection=mysql_connect("localhost","",""); #am entering userID &password
>instead of ,"","")
>
> IF (!$connection) {
> echo "Could not connect to mySQL server";
> exit;
> }
>
> $db=mysql_select_db("test_holding",$connection);
>
> if (!$db) {
> echo "Could not change the database";
> exit;
> }
>
> #sql="SELECT * FROM contacts"; # name of table "contacts" with below
>fields
>
> #mysql_result=mysql_query($sql,$connection);
> $num_rows=mysql_num_rows($mysql_result);
>
> if ( $num_rows == 0 ) {
> echo "Sorry, there is no information.";
> } else {
> #we have results
> while ($rows=mysql_fetch_array($mysql_result)) {
> $ID=row['ID']; #
>this is line 30
> $first_name=row['first_name'];
> $surname=row['surname'];
> $email=row['email'];
> $comments=row['comments'];
> # display results
> echo "$fist_name : $surname $email $comments<br>";
> }
> } # end else
>
> mysql_close($connection);
>
> ?>
>
> </body>
> </html>
>
> Any help will be appreciated.
>
> Best regards,
> Aaron Downes
>
--- End Message ---
--- Begin Message ---
changed $rows to $row on line 29
added variable identifier $ to 'row' variables on others.
while ($row=mysql_fetch_array($mysql_result)) {
$ID=$row['ID']; # this is line 30
$first_name=$row['first_name'];
$surname=$row['surname'];
$email=$row['email'];
$comments=$row['comments'];
HTH,
Jason k Larson
Aaron Downes wrote:
Dear Sir/Madam,
trying to displaying records by php get error :
Parse error: parse error in /hsphere/local/home/ozhomene/ardownes.com/ViewContacts.php on line 30
see below for code for ViewContacts.php :
<html>
<body>
<?
$connection=mysql_connect("localhost","",""); #am entering userID &password instead of ,"","")
IF (!$connection) {
echo "Could not connect to mySQL server";
exit;
}
$db=mysql_select_db("test_holding",$connection);
if (!$db) {
echo "Could not change the database";
exit;
}
#sql="SELECT * FROM contacts"; # name of table "contacts" with below fields
#mysql_result=mysql_query($sql,$connection);
$num_rows=mysql_num_rows($mysql_result);
if ( $num_rows == 0 ) {
echo "Sorry, there is no information.";
} else {
#we have results
while ($rows=mysql_fetch_array($mysql_result)) {
$ID=row['ID']; # this is line 30
$first_name=row['first_name'];
$surname=row['surname'];
$email=row['email'];
$comments=row['comments'];
# display results
echo "$fist_name : $surname $email $comments<br>";
}
} # end else
mysql_close($connection);
?>
</body>
</html>
Any help will be appreciated.
Best regards,
Aaron Downes
--- End Message ---
--- Begin Message ---
I'm trying to use cookies in PHP4 (.whatever the latest release is). I want
to use them for validation (ensuring a user has logged in) but all I can find
is setcookie, which seems only to create the cookie. In trying to use PHP
sessions, I end up with odd errors.
When I try to use sessions I get the error message the header has already been
sent. I've pasted them below (I was getting different errors before I moved
the code before the < html > tag).
Warning: Cannot send session cookie - headers already sent by (output started
at /home/allan/public_html/sestest2.php:10) in
/home/allan/public_html/verifysession.php on line 6
Warning: Cannot send session cache limiter - headers already sent (output
started at /home/allan/public_html/sestest2.php:10) in
/home/allan/public_html/verifysession.php on line 6
My Questions:
If I create a cookie with set_cookie how do I read it/check it?
How do I use sessions if they can't be sent in the code?
What use are sessions if I can only mess with them in one place? What if I
need to do some processing first to decide what to do with them?
Any insight is welcome.
Allan Cleaveland
Webmaster and Computer Technician
Math Department
Univeristy of Arkansas
--- End Message ---
--- Begin Message ---
acleave wrote:
My Questions:
If I create a cookie with set_cookie how do I read it/check it?
$_COOKIE superglobal array.
How do I use sessions if they can't be sent in the code?
The session_start function has to be at the VERY top of the of the code,
below ANY output (even blank spaces and new lines).
What use are sessions if I can only mess with them in one place? What if I
need to do some processing first to decide what to do with them?
You can use them anywhere in your code, but the session_start function
has to be before any output (the rest can be anywhere).
--
The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law.
--- End Message ---
--- Begin Message ---
Well, that is natural - cookies can only be set before any output is
produced by the script. And since sessions in this case use cookies, it
follows that sessions can also be started before any output is produced.
Why is that? Because cookies are transmitted by means of http headers, and
http headers precede any content.
The approach I find works extremely well is using some kind of design of the
scripts, such that the script does some "analysis" of the situation at the
very beginning, processes, saves/loads any data and only then proceeds to
display the results.
Otherwise, you might want to use buffering. See manual for ob_start():
----
This function will turn output buffering on. While output buffering is
active no output is sent from the script (other than headers), instead the
output is stored in an internal buffer.
---
So you can use it at the beginning of your scripts.
Also, see the config file, php.ini, there is a directive that allows you to
enable it globally without modifying scripts:
---
; Output buffering allows you to send header lines (including cookies) even
; after you send body content, at the price of slowing PHP's output layer a
; bit. You can enable output buffering during runtime by calling the output
; buffering functions. You can also enable output buffering for all files
by
; setting this directive to On. If you wish to limit the size of the buffer
; to a certain size - you can use a maximum number of bytes instead of 'On',
as
; a value for this directive (e.g., output_buffering=4096).
output_buffering = On
---
Yours trully,
--Dmitri
----- Original Message -----
From: "acleave" <>
To: "php-general" <[EMAIL PROTECTED]>
Sent: Wednesday, February 05, 2003 12:01 AM
Subject: [PHP] Sessions and Cookies
> I'm trying to use cookies in PHP4 (.whatever the latest release is). I
want
> to use them for validation (ensuring a user has logged in) but all I can
find
> is setcookie, which seems only to create the cookie. In trying to use PHP
> sessions, I end up with odd errors.
>
> When I try to use sessions I get the error message the header has already
been
> sent. I've pasted them below (I was getting different errors before I
moved
> the code before the < html > tag).
>
> Warning: Cannot send session cookie - headers already sent by (output
started
> at /home/allan/public_html/sestest2.php:10) in
> /home/allan/public_html/verifysession.php on line 6
>
> Warning: Cannot send session cache limiter - headers already sent (output
> started at /home/allan/public_html/sestest2.php:10) in
> /home/allan/public_html/verifysession.php on line 6
>
>
> My Questions:
> If I create a cookie with set_cookie how do I read it/check it?
>
> How do I use sessions if they can't be sent in the code?
>
> What use are sessions if I can only mess with them in one place? What if
I
> need to do some processing first to decide what to do with them?
>
> Any insight is welcome.
>
> Allan Cleaveland
> Webmaster and Computer Technician
> Math Department
> Univeristy of Arkansas
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--- End Message ---
--- Begin Message ---
> I'm trying to use cookies in PHP4 (.whatever the latest release is). I
want
> to use them for validation (ensuring a user has logged in) but all I can
find
> is setcookie, which seems only to create the cookie. In trying to use PHP
> sessions, I end up with odd errors.
>
> When I try to use sessions I get the error message the header has already
been
> sent. I've pasted them below (I was getting different errors before I
moved
> the code before the < html > tag).
>
> Warning: Cannot send session cookie - headers already sent by (output
started
> at /home/allan/public_html/sestest2.php:10) in
> /home/allan/public_html/verifysession.php on line 6
>
> Warning: Cannot send session cache limiter - headers already sent (output
> started at /home/allan/public_html/sestest2.php:10) in
> /home/allan/public_html/verifysession.php on line 6
session_start() must be before <html>. Solve those problems first because
sessions are going to be a better solution than a cookie.
> My Questions:
> If I create a cookie with set_cookie how do I read it/check it?
Whatever you name the cookie, say 'MyCookie', on the following pages from
where you set it, you'll have a $_COOKIE['MyCookie'] variable with it's
value. Use that variable just like you would any other.
> How do I use sessions if they can't be sent in the code?
They must be started before output. You can use the values within your code
and set/change values within your code.
> What use are sessions if I can only mess with them in one place? What if
I
> need to do some processing first to decide what to do with them?
No problem, see above.
---John Holmes...
--- End Message ---
--- Begin Message ---
Dear Sir/Madam,
(B I have create table for reservation system in that table i need to save
(Ball the values
(Bbut it couldn`t save all the values it saves only the last value.
(B Please help me!
(B <html>
(B<?php
(Bif($submit)
(B{
(B$db = mysql_connect("localhost", "kumar","");
(Bmysql_select_db("Golf",$db);
(B$sql = "INSERT INTO personalmst (setdate,name, uid, password, bumon,email)
(BVALUES ('$setdate','$name', '$uid', '$password','$bumon','$email')";
(B$result = mysql_query($sql);
(B if(!($_POST['password'] == $_POST['confirmpassword'])) //Does their
(Bpasswords match?
(B{
(B echo " Your password do not match!";
(B}
(B echo "Thank you! Information entered.\n";
(B}
(Belse
(B{
(B?>
(B<form method="post" action="Master.php" >
(BSetdate:<input type="text" name="setdate"><br>
(BFirst name:<input type="Text" name="name"><br>
(BUserID:<input type="Text" name="uid"><br>
(BPassword:<input type="password" name="password"><br>
(B Confirm Password:<input type="text" name="confirmpassword"><br>
(BDepartment:<SELECT NAME="bumon">
(B<?php $db = mysql_connect("localhost", "kumar")
(BOR DIE("Unable to connect to database");
(Bmysql_select_db("Golf",$db);
(B$result = mysql_query("SELECT bumon FROM personalmst",$db);
(B echo("<option value=\"\"></option>");
(Bwhile($myrow = mysql_fetch_array($result))
(B {
(B printf("<option value=\"%s\">%s</option>\n",
(B$myrow["bumon"],$myrow["bumon"]);
(B }
(B?></SELECT><br>
(BE-mail:<input type="Text" name="email"><br>
(B<input type="Submit"name="submit" value="Register">
(B<input type="reset" name="cancel" value="cancel">
(B<input type="button" name=update value=update
(Bonclick="window.location='http://192.168.1.22/test/Master1.php'">
(B<td align="right"><a href="Bumon.php" align="right">MasterCheck</a>
(B</td>
(B</form>
(B<?
(B}
(B?>
(B</HTML>
--- End Message ---
--- Begin Message ---
I am currently planning an application. I would like to include multiple
language support so that I can have a german or french version down the
track if need be.
What are your views on the best way to include the ability to "add"
languages after it is complete?
--
---
JJ Harrison
[EMAIL PROTECTED]
--- End Message ---
--- Begin Message ---
There is gettext support in php for this. Haven't used it myself, but
check it out at http://www.php.net/ref.gettext
--
Mattias
--|-----Original Message-----
--|From: JJ Harrison [mailto:[EMAIL PROTECTED]]
--|Sent: Wednesday, February 05, 2003 06:56
--|To: [EMAIL PROTECTED]
--|Subject: [PHP] Best way to include multi-lingual support in
--|an application.
--|
--|
--|I am currently planning an application. I would like to
--|include multiple
--|language support so that I can have a german or french
--|version down the
--|track if need be.
--|
--|What are your views on the best way to include the ability to "add"
--|languages after it is complete?
--|
--|
--|--
--|---
--|JJ Harrison
--|[EMAIL PROTECTED]
--- End Message ---
--- Begin Message ---
"Jj Harrison" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> I am currently planning an application. I would like to include multiple
> language support so that I can have a german or french version down the
> track if need be.
>
> What are your views on the best way to include the ability to "add"
> languages after it is complete?
With TemplateTamer, you mark every item that needs to be translated as
{#WORDKEY}, and the framework will do a call back to your page class to get
a correct translation for the WORDKEY, and substitue translation in the
output. In your app you can then detect the current language setting, and
return appropriate translation.
rush
--
http://www.templatetamer.com/
--- End Message ---
--- Begin Message ---
Thanks for your inputs. Will proceed from here.
Well, if you did not know, NetWare is an operating system brought out
by Novell. We are working on porting PHP onto NetWare. In fact, we
already have ported PHP 4.2.3 onto NetWare and we have synched up our
souces for the 4.3 branch.
Thanks,
Ananth.
>>> Maxim Maletsky <[EMAIL PROTECTED]> 02/04/03 08:45PM >>>
"Ananth Kesari" <[EMAIL PROTECTED]> wrote... :
> I am working on porting PHP onto NetWare.
What exactly do you mean?
> I am newbie to Unix / Linux systems and at this point of time, I am
> trying to understand the way security is implemented for PHP on Unix
/
> Linux. I mean, how are the different users distinguished from Unix /
> Linux.
>From PHP's point of view, every PHP process will run as apache's
process, with apache's user. Most often `nobody' or `apache'.
> Do they get to login into the Unix / Linux system?
No.
> Do they have
> separate data space for each user?
No. Only sessions, if you use them. Sessions have their own unique IDs
and are stored in a certain directory by default. A database solution
can also be implemented.
> What is the API that is used to login to Unix / Linux.
There is no login to the Unix / Linux. You might write one on your
own,
if you wish, but that would be your thing. PHP as it is, logs nobody
to
the Linux, it runs everybody's request as Apache's user.
> User may enter his username and password on the
> browser, but how do they get translated onto the Unix / Linux box?
Whatever inputted to the broswer, is send to your script. Stays up to
you to decide what to do with the user/pass. Basically, you would
usually store the credentials in a database and then authenticate the
users against the database, not Linux Shell itself.
> Since I am a newbie, I may have misunderstood some concepts here.
Most of them. PHP is a programming language, not a shell interface or
something. Stays up to you what to do once user runs your PHP script.
--
Maxim Maletsky
[EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
Thanks for your inputs. Will proceed from here.
Well, I first posted this query on this list. But seeing no response, I
thought probably it should have gone into PHP-dev list. When I posted
there, I was discouraged to post such mails there. So, I came back to
the general list.
Thanks,
Ananth.
>>> Miles Thompson <[EMAIL PROTECTED]> 02/04/03 08:32PM
>>>
Ananth,
For starters, you are probably on the wrong list - the PHP developers
list
is probably where you should be asking this question.
Second, PHP runs through the web server, so the user is the same user
the
web server, usually "nobody", although that depends on the how the web
server is installed. No one is encouraged to all access to the
underlying
system through the web server, although the exec() function allows
execution of some commands.
I can't help you much more than that, and I believe the other list will
be
more fruitful.
Regards - Miles Thompson
At 07:54 AM 2/4/2003 -0700, Ananth Kesari wrote:
>Hi,
>
>I mailed this earlier, but got no response. Maybe it went unnoticed.
>So, resending it again. Please read below.
>
>Your help in this is appreciated.
>
>Thanks,
>Ananth.
>
>
>Hi,
>
>I am working on porting PHP onto NetWare.
>
>I am newbie to Unix / Linux systems and at this point of time, I am
>trying to understand the way security is implemented for PHP on Unix
/
>Linux. I mean, how are the different users distinguished from Unix /
>Linux. Do they get to login into the Unix / Linux system? Do they
have
>separate data space for each user? What is the API that is used to
login
>to Unix / Linux. User may enter his username and password on the
>browser, but how do they get translated onto the Unix / Linux box?
>
>Since I am a newbie, I may have misunderstood some concepts here. Can
>someone help me in understanding this correctly? Also, can you point
me
>to any documentation on PHP security on Unix systems. I want some
>in-depth technical stuff upto what calls are made etc.
>
>Your help in this is appreciated.
>
>Thanks,
>Ananth.
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
"Ananth Kesari" <[EMAIL PROTECTED]> wrote... :
> Thanks for your inputs. Will proceed from here.
>
> Well, if you did not know, NetWare is an operating system brought out
> by Novell.
I know :)
> We are working on porting PHP onto NetWare. In fact, we
> already have ported PHP 4.2.3 onto NetWare and we have synched up our
> souces for the 4.3 branch.
Interesting. Are you working with the php-dev team or on your own?
--
Maxim Maletsky
[EMAIL PROTECTED]
> >>> Maxim Maletsky <[EMAIL PROTECTED]> 02/04/03 08:45PM >>>
>
> "Ananth Kesari" <[EMAIL PROTECTED]> wrote... :
>
>
> > I am working on porting PHP onto NetWare.
>
> What exactly do you mean?
>
> > I am newbie to Unix / Linux systems and at this point of time, I am
> > trying to understand the way security is implemented for PHP on Unix
> /
> > Linux. I mean, how are the different users distinguished from Unix /
> > Linux.
>
> From PHP's point of view, every PHP process will run as apache's
> process, with apache's user. Most often `nobody' or `apache'.
>
> > Do they get to login into the Unix / Linux system?
>
> No.
>
> > Do they have
> > separate data space for each user?
>
> No. Only sessions, if you use them. Sessions have their own unique IDs
> and are stored in a certain directory by default. A database solution
> can also be implemented.
>
> > What is the API that is used to login to Unix / Linux.
>
> There is no login to the Unix / Linux. You might write one on your
> own,
> if you wish, but that would be your thing. PHP as it is, logs nobody
> to
> the Linux, it runs everybody's request as Apache's user.
>
> > User may enter his username and password on the
> > browser, but how do they get translated onto the Unix / Linux box?
>
> Whatever inputted to the broswer, is send to your script. Stays up to
> you to decide what to do with the user/pass. Basically, you would
> usually store the credentials in a database and then authenticate the
> users against the database, not Linux Shell itself.
>
> > Since I am a newbie, I may have misunderstood some concepts here.
>
> Most of them. PHP is a programming language, not a shell interface or
> something. Stays up to you what to do once user runs your PHP script.
>
>
> --
> Maxim Maletsky
> [EMAIL PROTECTED]
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
--- End Message ---
--- Begin Message ---
On Wednesday 05 February 2003 09:55, Andrew Brampton wrote:
> If I try
> www.mysite.com/something.php/blah/blah/blah
> It works as expected, but I don't really want to keep the .php in the URL
> (just to make things look prettier/smaller)....
> So I was wondering if anyone knows what I need to change on my default
> apache+php install. Here are my versions:
> WinXP + Apache 1.3.27 + PHP 4.3.0 (Works Here)
> FreeBSD 4.7 + Apache 1.3.27 + PHP 4.2.3 (Fails Here)
> WebHost some BSD + Apache 1.3.22 + PHP 4.1.0 (Works Here)
If you don't have too many of these something.php files then you can just use
symlinks:
ln -s something.php something
Otherwise you can use Apache's rewrite directive, or you can set Apache to
interpret ALL files as PHP.
--
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
------------------------------------------
/*
The best way to keep your friends is not to give them away.
*/
--- End Message ---
--- Begin Message ---
On Wednesday 05 February 2003 09:43, J J wrote:
> I've seen CMS systems like phpnuke but it's kind of
> overkill for what I need and almost more news like.
> I'm looking for something that would allow the user to
> change content, change/upload images, all in a wysiwyg
> style so it's easy to see and use.
>
> It'd be cool to be able to login to the admin area,
> select a page to edit, and it would allow you to
> preview the page just like it looks. Then you click
> on a text area or image you want to update.
>
> Is there a CMS that allows for WYSIWYG like editing
> but will work within specified headers/footers, style
> sheets, etc? Then the site content would all be
> generated on the fly from php/mysql.
All the major/popular ones would/should have been registered at freshmeat and
soureforge so check them out.
--
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
------------------------------------------
/*
You're already carrying the sphere!
*/
--- End Message ---
--- Begin Message ---
Okay, so I want to open a file, get a small number from it (less than 3
digits) then overwrite a new number (incremented the original by 1) and
close the file.
The goal is to do this in the fastest way possible .. it seems that there
should be a way of doing this without having to open and close the file
twice.
I've tried:
$cfile = fopen("lcnt.txt", 'r+');
$lcnt = fgets($cfile,10);
This results in $lcnt having a value of 1 (loaded from value within text
file)
Now, if I increment it:
$nc = $lcnt+1;
then write it back to the file:
$nul = fwrite($cfile, $nc);
It writes starting at where the last read left off -- I want to start at
zero offset so to overwrite the existing value. I can't find a method for
resetting the offset pointer without having to close the file and reopen it
with w+
There must be a simpler way to do this ...
--- End Message ---
--- Begin Message ---
On Wednesday 05 February 2003 15:00, Lee Herron wrote:
> Okay, so I want to open a file, get a small number from it (less than 3
> digits) then overwrite a new number (incremented the original by 1) and
> close the file.
>
> The goal is to do this in the fastest way possible .. it seems that there
> should be a way of doing this without having to open and close the file
> twice.
>
> I've tried:
> $cfile = fopen("lcnt.txt", 'r+');
> $lcnt = fgets($cfile,10);
>
> This results in $lcnt having a value of 1 (loaded from value within text
> file)
>
> Now, if I increment it:
>
> $nc = $lcnt+1;
>
> then write it back to the file:
>
> $nul = fwrite($cfile, $nc);
>
> It writes starting at where the last read left off -- I want to start at
> zero offset so to overwrite the existing value. I can't find a method for
> resetting the offset pointer without having to close the file and reopen it
> with w+
>
> There must be a simpler way to do this ...
RTFM -- rewind(), fseek().
--
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
------------------------------------------
/*
There is no act of treachery or mean-ness of which a political party
is not capable; for in politics there is no honour.
-- Benjamin Disraeli, "Vivian Grey"
*/
--- End Message ---
--- Begin Message ---
On Wednesday 05 February 2003 04:06, Pushpinder Singh Garcha wrote:
> Hi,
>
> I am using PHP and MySQL in my application. I have created a Login
> System for using "Sessions". The problem that I am facing is that I
> need to protect a large number of pages in my website. So I have tried
> to use this method and it works fine for me :
>
> <? session_start();
> if (session_is_registered("valid_user"))
> include ('guest.html');
> else include 'not_logged_in.php';
> ?>
>
> I get stumped here .... in order to be able to insert this code I have
> to write for each of the 400 html files, 400 php files with the same
> name. Most of the files are arranged in the form of directories. Is
> there a better way to be able to do this (Using PHP and MySQL). Thanks
> in advance !
I've answered a similar question yesterday. And many more people have done so
in the past -- search the archives!
--
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
------------------------------------------
/*
Every journalist has a novel in him, which is an excellent place for it.
*/
--- End Message ---
--- Begin Message ---
Try using htaccess authentication instead?
-Ade
www.phpscriptsearch.com
-----Original Message-----
From: Jason Wong [mailto:[EMAIL PROTECTED]]
Sent: 05 February 2003 07:06
To: [EMAIL PROTECTED]
Subject: Re: [PHP] Protect Access to a Directory
On Wednesday 05 February 2003 04:06, Pushpinder Singh Garcha wrote:
> Hi,
>
> I am using PHP and MySQL in my application. I have created a Login
> System for using "Sessions". The problem that I am facing is that I
> need to protect a large number of pages in my website. So I have tried
> to use this method and it works fine for me :
>
> <? session_start();
> if (session_is_registered("valid_user"))
> include ('guest.html');
> else include 'not_logged_in.php';
> ?>
>
> I get stumped here .... in order to be able to insert this code I
> have to write for each of the 400 html files, 400 php files with the
> same name. Most of the files are arranged in the form of directories.
> Is there a better way to be able to do this (Using PHP and MySQL).
> Thanks in advance !
I've answered a similar question yesterday. And many more people have
done so
in the past -- search the archives!
--
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
------------------------------------------
/*
Every journalist has a novel in him, which is an excellent place for it.
*/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
Hi,
I need a basic Tutorial on how to write objectoriented Scripts in PHP,
like classes and functions I can use at many places.
If there is something like that, please tell me where I can find it (Book
or Web).
Thank Ya'll
Sascha
--- End Message ---
--- Begin Message ---
Pushpinder Singh Garcha wrote:
Hello ,
I am using PhpMyAdmin to control my MySQL Database. Untill now I had
been using the Local Apache webserver to test my scripts, so I had
installed PhpMyAdmin in the 'Sites' Folder of my Mac. Now I need to beta
test the Application on the Live Server. Do I need to upload PhpMyAdmin
on to the remote site? Or can I let it remain sitting on the local server.
Also, I was wondering , what value should I assign to the
$cfg['PmaAbsoluteUri'] variable in the config.inc.php file.
Many Thanks,
Pushpinder
Pushpinder Singh Garcha
_________________________________
Web Architect
$cfg['PmaAbsoluteUri'] --- http://localhost/admin/ or /admin/
--- End Message ---
--- Begin Message ---
Hi,
i've written a secure PHP login script which will allow users to login to a
directory such as this:
smezone.com/members/index.php
however, how do I restrict people from accessing HTML files in that
directory (which they can easily do so by typing the URL into their
browser), such as:
smezone.com/members/document1.html
?
Since its a regular HTML files (and we have lots), I can't check whether the
user has a valid session as I would do in a PHP file.
Thanks for any help!
Shams
--- End Message ---
--- Begin Message ---
If a MS Access database and a PHP server were on the same machine, could
they connect without having to use something like MS SQL Server?
--- End Message ---
--- Begin Message ---
You could use ODBC
--
Maxim Maletsky
[EMAIL PROTECTED]
"Phil Schwarzmann" <[EMAIL PROTECTED]> wrote... :
> If a MS Access database and a PHP server were on the same machine, could
> they connect without having to use something like MS SQL Server?
>
--- End Message ---
--- Begin Message ---
There is a php file that retrieve the source code from the url www.url.com
and this source is treated and you get content from this file and show it
on the response page.
Is this possible? Can anyone show me the right direction?
yes, codeword is 'ripping', i found some hits on google with
php ripping html -audio -track -mp3
.
--- End Message ---
--- Begin Message ---
Hello!
Using the following script I try to get a html-page gzip-compressed, and
uncompress the body of the HTTP-message.
<?php
define(CRLF,"\xD\xA");
$host = "selfforum.teamone.de";
$path = "/";
$fp = fsockopen($host, 80);
$header = "GET ".$path." HTTP/1.0".CRLF;
$header .= "Accept-Encoding: gzip".CRLF;
$header .= "Host: ".$host.CRLF;
$header .= CRLF;
fputs($fp, $header);
while(!feof($fp)) {
$result .= fread($fp,1);
}
fclose($fp);
$compressed_result = explode(CRLF.CRLF, $result, 2);
echo "length: " strlen($compressed_result[1])."\n"; // length of compressed
message
// without header, to
compare
// with content-length
header
echo gzuncompress($compressed_result[1]);
?>
I get the following error:
Warning: gzuncompress: data error in /www/webseite/temp/sock2.php on line 32
Line 32: echo gzuncompress($compressed_result[1]);
>From server I get HTTP-response "contend-encoding: gzip", HTTP-Statuscode
"200",
the content-length in HTTP header is the same as my own echo "length: "
strlen($compressed_result[1]).";
$compressed_result[1] contains binary data, no plain-text.
gzcompress and gzuncompress usually work without problems in.
Server-OS: Linux 2.4
Webserver: Apache 1.3.26
PHP 4.2.3.(CGI)
Perhaps there are some charakters form binary gzip-code interpretet as
functional character, could I escape something here? Or some problems with
line-breaks, or blanks? I have no idea whats going wrong here. I hope
someone here knows what to do or where to look for errors!
Thank you,
Andreas
--- End Message ---
--- Begin Message ---
I am trying to create associative array in a while loop..
$image_array = array();
$image_array = array_push("$file_name"=>"$image_url");
what i am doing wrong??????
--- End Message ---
--- Begin Message ---
Try:
$image_array = array();
$image_array[$file_name] = $image_url;
PHP wrote:
I am trying to create associative array in a while loop..
$image_array = array();
$image_array = array_push("$file_name"=>"$image_url");
what i am doing wrong??????
--
The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law.
--- End Message ---
--- Begin Message ---
At 13:28 5-2-03, you wrote:
Try:
$image_array = array();
$image_array[$file_name] = $image_url;
PHP wrote:
I am trying to create associative array in a while loop..
$image_array = array(); $image_array =
array_push("$file_name"=>"$image_url");
i agree with the suggestion, but maybe (this may be a stupid newbie
comment) this will also work, if you insist on using array_push:
$image_array = array_push(array("$file_name"=>"$image_url"));
--- End Message ---
--- Begin Message ---
On Wednesday 05 February 2003 20:51, Chris Hayes wrote:
> At 13:28 5-2-03, you wrote:
> >Try:
> >$image_array = array();
> >$image_array[$file_name] = $image_url;
> >
> >PHP wrote:
> >>I am trying to create associative array in a while loop..
> >>
> >>$image_array = array(); $image_array =
> >>array_push("$file_name"=>"$image_url");
>
> i agree with the suggestion, but maybe (this may be a stupid newbie
> comment) this will also work, if you insist on using array_push:
>
> $image_array = array_push(array("$file_name"=>"$image_url"));
Please read the manual. array_push() does NOT work like that.
--
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
------------------------------------------
/*
And in the heartbreak years that lie ahead,
Be true to yourself and the Grateful Dead.
-- Joan Baez
*/
--- End Message ---
--- Begin Message ---
Goetz Lohmann wrote :
doc_root = /usr/local/www/htdocs
than maybe leave this blank !
No. In my case it's absolutely senseless to define doc_root in php.ini
since there are many virtual servers in httpd.conf, each with its own root.
It's also the reason why I don't want Apache to get a working dir from
the environment. So '.' and '..' don't mean anything either (for opening
files), but that seems OK to me. Maybe your server got a working dir
from its parent shell, so '.', '..', getcwd() and `pwd` work for you.
I didn't mention that I'm not the PHP programmer, but the Apache/PHP
manager, and this is a problem encountered by the webmaster of one of
the virtual servers when testing PHP 4.3.0. Their PHP application has
several include directories and many include()s within included files.
It's the reason why I'm looking for a way of getting their script
working properly with as few modification as possible (I can modify
php.ini or the server config).
if a file is parsed, all include files a relativ to this parsed file.
This seems true for 4.3.0, false for 4.2.1 (it's relative to the main
script PHP_SELF).
PHP_SELF /phpinfo.php
I have printed PHP_SELF from within testinclude.php and inc1.php. In
both cases, it's "/tests/testinclude.php"
echo exec('ls');
should print out not a empty string but
testinclude.php
and
echo exec('pwd');
should print "/usr/local/www/htdocs/tests"
Only if the server gets a working dir, which is not my case (ls and pwd
return nothing, which is normal IMHO). Webmasters can't set it with
chdir() since setting environment variables other than PHP_* is
forbidden in the recommended php.ini for security reason.
--- End Message ---
--- Begin Message ---
Hello,
I need a way to write a record to the db when the user closes their browser.
How can I do this? I looked last night at the onunload javascript event but
am not sure how that can trigger the php code to enter a row in the db. I
am using sessions so is there a way to write to the db when the session is
deleted?
Thanks,
Eddie
--- End Message ---
--- Begin Message ---
Hey Guys,
How can I get the value of an javascript string and pass it to a php variable?
i.e.
<script>
var x = "test";
</script>
<?
$x = ???? // need to get the value of x
?>
thanks
Iced Sun
--- End Message ---
--- Begin Message ---
How can I get the value of an javascript string and pass it to a php variable?
<script>
var x = "test";
</script>
<?
$x = ???? // need to get the value of x
?>
Well as you know, but just as a reminder, when you make a page with both
php and javascript in it, the PHP code is executed on the server and then
the resulting html plus javascript is send to the user, and the browser
executes the javascript.
So it is easy to fill in PHP-made variables into the javascript,
e.g.
<?PHP
$phpvar=3+8+31;
?>
<script language="javascript">
theanswer = <?PHP echo $phpvar; ?>
</script>
But to give javascript results to PHP you have to give it back to another
PHP page.
I can think of three ways:
- write a cookie with javascript and have the next page read the cookie
with PHP
- set a form element's value with javascript
(document.formname.elementname.value=(6*7)) then submit the form
(document.formname.submit()), In the following php page read
$_POST['elementname'] (PHP>=4.10)
- build the variable into the URL like
window.location.href='http://www.mysite.org/nextpage.php?variable1=' +
(50-8) +'&variable2='+theanswer . in the nextpage read $_GET['variable1'] and 2
In all cases make sure that you are very careful with inserting the result
in SQL queries or to include files. Imagine that [your favourite enemy]
tries to add some sql code or include a selfchosen file from the server.
--- End Message ---
--- Begin Message ---
Hi,
I was looking on PHP manual but didn't find anything about it.
How can I execute a script all days at the same time? I kno i must have
access to the CRON of the system, but don't know what function should I use
to make this happen (run the script).
Miguel
--- End Message ---
--- Begin Message ---
Hi,
Wednesday, February 5, 2003, 11:49:35 PM, you wrote:
MB> Hi,
MB> I was looking on PHP manual but didn't find anything about it.
MB> How can I execute a script all days at the same time? I kno i must have
MB> access to the CRON of the system, but don't know what function should I use
MB> to make this happen (run the script).
MB> Miguel
One simple way is with cron and a web page using lynx like this:
00 00 * * * /usr/bin/lynx -dump http://domain.com/countdown.php 1> /dev/null 2>
/dev/null
(-dump tells lynx to read the url, dump the page out and exit)
--
regards,
Tom
--- End Message ---