php-general Digest 18 Feb 2002 14:28:21 -0000 Issue 1179

Topics (messages 85141 through 85200):

Re: form opens a php window.
        85141 by: Gary

Re: Running php from shell - passing parameters
        85142 by: Greg Donald

phpmyadmin-mysql
        85143 by: jtjohnston
        85169 by: hugh danaher

Re: session password problems.
        85144 by: Greg Donald

Include file for MySQL insert rows
        85145 by: Paul Fowler
        85154 by: Janet Valade

Re: zend studio 2.0
        85146 by: Chris Lott

building dynamic pdf files?
        85147 by: Jeff D. Hamann
        85149 by: Martin Towell
        85150 by: Bradley Goldsmith
        85158 by: michael kimsal

Re: php4.1.1, oci8 functions, Oracle 9i and VARCHAR2 selects no t working
        85148 by: Bradley Goldsmith

Debate scripts
        85151 by: Tshering Norbu

help with Header call
        85152 by: Robbie Newton
        85155 by: Martin Towell

Re: storing arrays
        85153 by: Clark

Re: form submission error trapping
        85156 by: Navid Yar
        85174 by: Jill.Baker.aculab.com
        85182 by: Matt
        85193 by: Jason G.
        85194 by: Jason G.

Re: [PHP-DB] Updating Database at a specified time
        85157 by: Peter J. Schoenster

How to start a secure HTTP session?
        85159 by: gaukia 345
        85160 by: Janet Valade

Frustrating ?
        85161 by: jtjohnston
        85163 by: CC Zona
        85164 by: jtjohnston
        85165 by: CC Zona
        85166 by: Martin Lucas

Report generator for Linux
        85162 by: Todd Cary

Re: Text editor for linux
        85167 by: Josep Raurell
        85168 by: Alexander Weber
        85170 by: Billy S Halsey

implement yourname.mysite.com redirection
        85171 by: Adrian Murphy
        85186 by: Jason G.

upload problem...
        85172 by: Cristiano Canobbio

Q on php://stdin
        85173 by: Billy S Halsey

Sendmail, I've had enough of it!
        85175 by: Liam MacKenzie

no-cache headers
        85176 by: Phil Ewington
        85179 by: Matt

creating PDF. How to get the xpositioni of a text?
        85177 by: Andy

Re: What Do You Think?
        85178 by: Ford, Mike               [LSS]

convert TIFF to JPEG
        85180 by: Norbert Eder

preg_match vs ereg etc
        85181 by: DigitalKoala

Using Variable Variables from form values inside a function
        85183 by: Ron Dyck
        85184 by: Matt
        85185 by: Ron Dyck

exec()
        85187 by: Chad

Re: [PHP-DB] I cant get the logic for this...
        85188 by: Jason G.

Mysql_num_rows
        85189 by: Frank Miller
        85191 by: Niklas Lampén
        85200 by: Rick Emery

.htaccess login id
        85190 by: Dave

date problem
        85192 by: eoghan
        85196 by: Julio Nobrega Trabalhando
        85198 by: Niklas Lampén

how to test   ob_start("ob_gzhandler");
        85195 by: Rein Velt

readline() Fails in PHP for Win2000
        85197 by: Rick Emery

Re: Breadcrumbs in PHP
        85199 by: Matt Williams

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 ---


Webmaster Mbtradingco wrote:

> Hi, I have a form, that I need to control the parameters in the _blank 
> target once it is submitted.
> 
>  
> 
> Everything works, fine except the client wants the result of the poll in 
> a popup window, and I am not able to control the parameters on the new 
> window.
> 
>  
> 
> Can any one help me with this? Thanks.
> 
>  
> 
> E
> 

you are trying to use a server side language to do a client side task. 
You have two choices, write the form in javascript and pass it to the 
new window or use something like a cookie or database to collect and 
pass on the information to the page that resides in the window.

Gary


--- End Message ---
--- Begin Message ---
> I have to run php script from Linux shell.
>
> I have no trouble except with passing the parameters.
> What is the right sintax to pass them to the script?
>
> I would like to do something like this:
> /usr/local/bin/php ./test.php param=value


What you want is $argc and $argv as described in the predefined variables
documentation:

http://www.php.net/manual/en/language.variables.predefined.php

------------------------------------------------------------------------
Greg Donald - http://destiney.com/
http://phprated.com/ | http://phplinks.org/ | http://phptopsites.com/
------------------------------------------------------------------------

--- End Message ---
--- Begin Message ---
Hello,

I'm looking for code to display all my mysql databases in a <select>.
On change, I want to display all my tables in a <select>.
Finally, on change, it has to display all record of the table selected:

Print Record


        id YR   AU           BT
         1 1997 Fee, Margery Writing Orality: Interpreting Literature
 Display                     in English by Aboriginal Writers in North
                             America, Australia and New Zealand

Can someone give me a hand getting started?
I would normally use phpmyadmin, but I want to customise something they
don't offer.

--- End Message ---
--- Begin Message ---
Start with something like the following and add  mysql_list_dbs () to query
the system for the available databases.
Hugh

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Input Data Page</title>
<?php include ("css.txt"); ?>
</head>
<body bgcolor="#1D3E81" >
<h1><font color="#ffff33">DATABASE TABLES</font></h1>

<form action="<?php print $php_self?>" method="post">
<?php

print "<table cellpadding=7 border=1 bgcolor=#d5d5d5><tr><td>";
print "<h6>Database name:</h6><input type=text name=db STYLE=width:140px>
</td><td>";
print "<h6>Password:</h6><input type=text name=pass STYLE=width:140px>";
print "</td><td valign=middle align=center><input type=submit value=\" go
\">";
print "<input type=hidden name=start value=1>";
print "</td></tr></table></form><br>";
if ($start=="1")
 {
 $link=mysql_connect("localhost","","$pass");
 if (! $link) die("couldn't connect mysql");
 mysql_select_db($db,$link) or die ("couldn't open $db ".mysql_error());
 $tables=mysql_list_tables($db,$link);
 $num=mysql_num_rows($tables)-1;
 mysql_close($link);
 ?>
 <form action="<?php print $php_self?>" method="post">
 <?php
 print "<table cellpadding=7 border=1 bgcolor=#d5d5d5><tr><td>";
 print "<h6>Table Name: </h6><select type=text name=table
STYLE=width:140px><option>";

 for ($i=0;$i<=$num;$i++)
  {
  print "<option>".mysql_tablename($tables,$i);
  }
 print "</select>";

 print "</td><td><input type=submit value=\" go  \">";
 print "<input type=hidden name=start value=2>";

 print "<input type=hidden name=db value=$db>";
 print "<input type=hidden name=pass value=$pass>";
 print "</td></tr></table></form><br>";
 }

if ($start=="2")
 {
 $link=mysql_connect("localhost","","$pass");
 if (! $link) die("couldn't connect mysql");
 mysql_select_db($db,$link) or die ("couldn't open $db ".mysql_error());

 $results=mysql_query("select * from $table");
 $fields = mysql_list_fields("$db", "$table", $link);
 $columns = mysql_num_fields($fields);
 mysql_close($link);
 print "<table width=95% bgcolor=#d5d5d5 border=1 cellspacing=0
cellpadding=0><tr><td align=center><h3>$table</h3>";
 print "<table width=100% bgcolor=#d5d5d5 border=1 cellspacing=0
cellpadding=4>";
 print "<tr>";
 for ($i = 0; $i < $columns; $i++)
  {
  print "<td align=center bgcolor=#6c6c6c><h5><font
color=white>".mysql_field_name($fields, $i)."</font></h5></td>";
  }
 print "</tr>";
 print "<tr>";
 for ($i = 0; $i < $columns; $i++)
  {
  print "<td align=center bgcolor=#fbfbfb><h5>".mysql_field_type($results,
$i)."</h5></td>";
  }
 print "</tr>";
 while ($a_row=mysql_fetch_row($results))
  {
  print "<tr>";
  foreach($a_row as $field)
   {
   if ($field=="")
    {
    $field="&nbsp;";
    }
   print "<td align=center><h5>".$field."</h5></td>";
   }
  print "</tr>";
  }
 print "</table></td></tr></table>";
 }
?>
</body>
</html>


----- Original Message -----
From: "jtjohnston" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, February 17, 2002 7:34 PM
Subject: [PHP] phpmyadmin-mysql


> Hello,
>
> I'm looking for code to display all my mysql databases in a <select>.
> On change, I want to display all my tables in a <select>.
> Finally, on change, it has to display all record of the table selected:
>
> Print Record
>
>
>         id YR   AU           BT
>          1 1997 Fee, Margery Writing Orality: Interpreting Literature
>  Display                     in English by Aboriginal Writers in North
>                              America, Australia and New Zealand
>
> Can someone give me a hand getting started?
> I would normally use phpmyadmin, but I want to customise something they
> don't offer.
>
>

--- End Message ---
--- Begin Message ---
> I have a php user authorise script.
>
> I have 2 fields in a mysql database. user_name and user_password. Password
> is encrypted with the mysql password('$password') function.
>
> This is my PHP authorise section of the script.
>
> $sql_authorisation = "SELECT * FROM account_details WHERE
> account_name='$login_username' AND
> account_password=PASSWORD('$login_password');
> $sql_authorisation_result = mysql_query($sql_authorisation);
>
> if (!$sql_authorisation_result) {
> error("A Database Error Occurred while trying to authorise login
details");
> }
>
> if (mysql_num_rows($sql_authorisation_result) == 0) {
> session_unregister("login_username");
> session_unregister("login_password");
> ?>
>
> <HTML>
> <HEAD>
> <TITLE> Access Denied </TITLE>
> </HEAD>
> <BODY BGCOLOR=white>
> <H1> Access Denied </H1>
> <P> Your user ID and Password could not be verified. This could be an
> incorrect username or password, or you are not a registered user on this
> site. Try logging in again checking your details, or enter the signup
> process to join us</P>
> </BODY>
> </HTML>
> <?php
>
> exit;
> }
>
> ?>
>
> This script does NOT work.
>
> However if I change the sql function $sql_authorisation to
>
> $sql_authorisation = "SELECT * FROM account_details WHERE
> account_name='$login_username' );
>
> so that is only selects the username - it works. there for there is a
> problem with me selecting and comparing the password'd user_password.
>
> Any suggestions.

You have to use the query with mysql_num_rows(), not the result of the
query, try:

if (mysql_num_rows($sql_authorisation) == 0) {

And it woudl be better to test for a single row, not the fact that no rows
returned.  I would use:

if (mysql_num_rows($sql_authorisation) == 1) {
  $user_array = mysql_fetch_array($sql_authorisation_result);
  $login_username = $user_array[account_name];
  session_register("login_username");
}


------------------------------------------------------------------------
Greg Donald - http://destiney.com/
http://phprated.com/ | http://phplinks.org/ | http://phptopsites.com/
------------------------------------------------------------------------


--- End Message ---
--- Begin Message ---
I am very new at this and am having trouble migrating to php and mysql from
a different system (WebCatalog).

I want to start dumping files to text and let php use them to populate mysql
on the fly as I start migrating.

----------------snip-----------------------

$db  = mysql_pconnect("host", "user", "pass");
    
$query = "insert into catalogwinetmp values
        include("testsql")";
    
$result = mysql_query($query);

---------------end-snip--------------------

The contents of "testsql" look like this

(19, 38080, 'Senejac', 'Haut-Medoc / Cru Bourgeois', '', 12, 1995, 'Bottle -
.75L', 'LN, LE, CI', 135, '/collectors/images/bottles/38080.JPG'),
(20, 38780, 'Yquem', 'Sauternes / Premier Cru Superieur', '', 1, 1927,
'Bottle - .75L', 'TS, LP, CI', 465, '/collectors/images/bottles/38780.JPG');

Just with more lines (1-18).

But I can not get rid of errors in the
$query = "insert into catalogwinetmp values
        include("testsql")";
No matter what quotes and semi-colons I put in testsql or in this script.

If I try to set the contents of the include into a variable as in:

$rowsToAdd = include(testsql);

all I get is the value 1, I guess this is because it is successful.

If I could get a variable to contain the contents of the include I am not
sure if I could use it in the script.

I am not sure if I am even getting warm or if I am on another planet.


1. Any ideas how I can simply make php get a text file into the mysql
database?

2. Is there a way to set a (albeit maybe large) variable with the contents
of an include file?

Sorry to sound like such a php newbie, but I am.

Kind thanks,

Paul

--- End Message ---
--- Begin Message ---
INCLUDE is not really what you are looking for. INCLUDE is more to read in
files that contain PHP code. If I'm understanding correctly, what you want
to do is to read each line from your file and put each line into a separate
variable. Then, you can create the INSERT statement for each row.

It might go something like this:

$fp = fopen("testsql","r") ;
while ($row = fgets($fp,1024))
{
    $query = "INSERT INTO catalogwinetmp VALUES $row";
   $result = mysql_query($query);
}

It looks like there might be something at the end of each line that you need
to remove before you construct the query. A comma on the first line and a
semicolon on the second line.

Janet



----- Original Message -----
From: "Paul Fowler" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, February 17, 2002 8:17 PM
Subject: [PHP] Include file for MySQL insert rows


> I am very new at this and am having trouble migrating to php and mysql
from
> a different system (WebCatalog).
>
> I want to start dumping files to text and let php use them to populate
mysql
> on the fly as I start migrating.
>
> ----------------snip-----------------------
>
> $db  = mysql_pconnect("host", "user", "pass");
>
> $query = "insert into catalogwinetmp values
>         include("testsql")";
>
> $result = mysql_query($query);
>
> ---------------end-snip--------------------
>
> The contents of "testsql" look like this
>
> (19, 38080, 'Senejac', 'Haut-Medoc / Cru Bourgeois', '', 12, 1995,
'Bottle -
> .75L', 'LN, LE, CI', 135, '/collectors/images/bottles/38080.JPG'),
> (20, 38780, 'Yquem', 'Sauternes / Premier Cru Superieur', '', 1, 1927,
> 'Bottle - .75L', 'TS, LP, CI', 465,
'/collectors/images/bottles/38780.JPG');
>
> Just with more lines (1-18).
>
> But I can not get rid of errors in the
> $query = "insert into catalogwinetmp values
>         include("testsql")";
> No matter what quotes and semi-colons I put in testsql or in this script.
>
> If I try to set the contents of the include into a variable as in:
>
> $rowsToAdd = include(testsql);
>
> all I get is the value 1, I guess this is because it is successful.
>
> If I could get a variable to contain the contents of the include I am not
> sure if I could use it in the script.
>
> I am not sure if I am even getting warm or if I am on another planet.
>
>
> 1. Any ideas how I can simply make php get a text file into the mysql
> database?
>
> 2. Is there a way to set a (albeit maybe large) variable with the contents
> of an include file?
>
> Sorry to sound like such a php newbie, but I am.
>
> Kind thanks,
>
> Paul
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

--- End Message ---
--- Begin Message ---
> Well, as you said, no point in arguing.  Just that I think if someone
> really wants to develop they should learn some better tools than a
> GUI but it's a question of balance.

I think a definition of GUI might be in order. Homesite, for instance, is
just a big text editor. It has almost no GUI design features, drag  and drop
coding, that kind of thing. I think of a GUI as Dreamweaver, or something
where you are not using the code directly. Homesite and  the Zend Studio are
both code editors that provide the same kind of features as TextPad with PHP
libraries, clip books and syntax coloring files. Emacs, which I use a lot,
is in the same class (not GUI, I don't think).

I agree that with GUIs, by my definition at least, one should learn on tools
in which they are really working with the code. If they can insert the
skeleton of a control structure with one click or not doesn't impact their
development (either of themselves or their program) negatively.

c
--
Chris Lott
http://www.chrislott.org/

--- End Message ---
--- Begin Message ---
I'm currently working on a web based application (in php) and saw the power
of being able edit fields in the pdf document. I can see how to build the
pdf file by hand, but I have a few dozen forms (multiple pages of course)
that I wish I could scan in and have a rough pdf file to start working with.
I've been generating html code using php, and would like to directly
generate pdf files as they look much better. Is there software "out there"
that I can import an html file into, or excel, or word and spit out the pdf
code, or something usable?

Thanks,
Jeff.

--
Jeff D. Hamann
Hamann, Donald & Associates, Inc.
PO Box 1421
Corvallis, Oregon USA 97339-1421
Bus. 541-753-7333
Cell. 541-740-5988
[EMAIL PROTECTED]
www.hamanndonald.com



--- End Message ---
--- Begin Message ---
Adobe Acrobat 5 or 6 - whichever's the latest version - can grab web pages
and convert them to pdf.

Depends if you want to fork out to buy it

Martin


-----Original Message-----
From: Jeff D. Hamann [mailto:[EMAIL PROTECTED]]
Sent: Monday, February 18, 2002 3:39 PM
To: [EMAIL PROTECTED]
Subject: [PHP] building dynamic pdf files?


I'm currently working on a web based application (in php) and saw the power
of being able edit fields in the pdf document. I can see how to build the
pdf file by hand, but I have a few dozen forms (multiple pages of course)
that I wish I could scan in and have a rough pdf file to start working with.
I've been generating html code using php, and would like to directly
generate pdf files as they look much better. Is there software "out there"
that I can import an html file into, or excel, or word and spit out the pdf
code, or something usable?

Thanks,
Jeff.

--
Jeff D. Hamann
Hamann, Donald & Associates, Inc.
PO Box 1421
Corvallis, Oregon USA 97339-1421
Bus. 541-753-7333
Cell. 541-740-5988
[EMAIL PROTECTED]
www.hamanndonald.com




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---

Adobe distiller can do this (see abobe.com) - but there are cost/server
requirements.

-bcg


-----Original Message-----
From: Jeff D. Hamann [mailto:[EMAIL PROTECTED]]
Sent: Monday, February 18, 2002 3:39 PM
To: [EMAIL PROTECTED]
Subject: [PHP] building dynamic pdf files?


I'm currently working on a web based application (in php) and saw the power
of being able edit fields in the pdf document. I can see how to build the
pdf file by hand, but I have a few dozen forms (multiple pages of course)
that I wish I could scan in and have a rough pdf file to start working with.
I've been generating html code using php, and would like to directly
generate pdf files as they look much better. Is there software "out there"
that I can import an html file into, or excel, or word and spit out the pdf
code, or something usable?

Thanks,
Jeff.

--
Jeff D. Hamann
Hamann, Donald & Associates, Inc.
PO Box 1421
Corvallis, Oregon USA 97339-1421
Bus. 541-753-7333
Cell. 541-740-5988
[EMAIL PROTECTED]
www.hamanndonald.com




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
Jeff D. Hamann wrote:
> I'm currently working on a web based application (in php) and saw the power
> of being able edit fields in the pdf document. I can see how to build the
> pdf file by hand, but I have a few dozen forms (multiple pages of course)
> that I wish I could scan in and have a rough pdf file to start working with.
> I've been generating html code using php, and would like to directly
> generate pdf files as they look much better. Is there software "out there"
> that I can import an html file into, or excel, or word and spit out the pdf
> code, or something usable?

Seems a couple other answers pointed you to Adobe, but if you need to 
run this under Unix, you're kinda outta luck.  Adobe don't make current 
tools for Unix (as far as I can tell).

If you don't mind approximations, you might look at htmldoc (google 
search for HMTLDOC - I forget the address).  It'll take HTML files you 
generate and make PDFs from them.  Not bad for doing reports, etc.

txt2pdf is another one which isn't too bad, but I've not used much lately.

When you say 'start working with', what do you mean?  You want to 
further modify the PDF?  If so, with what tools?  Generally any produced 
PDF file is going to be 'done' - you won't be able to edit it 
programmatically.  PDFLIB has a PDI component which will let you modify 
preexisting PDFs, but it's not a cure all, and it costs about $1000.

If you need to discuss this further, shoot me an AIM tomorrow (mgkimsal) 
or another email with more specifics at [EMAIL PROTECTED]

Good luck...





--- End Message ---
--- Begin Message ---
Hi All,

        I have seen a lot of discussion about this - but no real solutions
:)

        I am getting a two task communication error whenever I try to select
a varchar2 element in a query in php4. I seem to be able to select any other
kinds of data without hassle.

        All of my environment variables are set correctly, and I have
experimented at length with different NLS_LANG values.

        The client machine is Mandrake Linux, running php 4.1.1 with oracle
and oci8 support compiled in. SQL*Net is able to query the remote db server
without any problems at all.

        Has *anyone* got any experience with Oracle9i and PHP that might be
able to help? I would rather use MySQL in a heartbeat, but Oracle9i is a
client requirement. 

Cheers,
Brad



--- End Message ---
--- Begin Message ---
Dear List,
Is there PHP scripts which I can use to conduct online debate at my website.
Say, I set a topic to debate on and people can post 'for' or 'against' it. I
think it needs to be different from the threaded discussion forum.

Could anyone suggest me where I can get it?

Thanks

NOBBY

--- End Message ---
--- Begin Message ---
Hello everyone,

This is my first post to this list, so I hope that someone is awake enough to help me 
out. 

I am new to PHP and I have a file that uses a command "header". It isn't working like 
it is supposed to but I can't seem to figure out why. Below is the last couple lines 
of the php file that is giving me trouble.

while ($row=mysql_fetch_row($result)) {
$II=$row[0];
}

Header("Location: $Relative/admin/upload.php?II=$II");

Basically all it does when the whole file is called is return page does not exist. The 
file that it refers to is there and the Var "$Relative" is used in many other scripts 
with no probs so I don't think that is it. Is passing the Var "$II" as part of the 
location incorrect? 

Any help is welcomed.

If you need to see more of the script to understand what I am talking about, I will 
post it.

TIA
-Robbie
--- End Message ---
--- Begin Message ---
make sure the url in the header("location:") is a full url and not a
relative url

Martin

-----Original Message-----
From: Robbie Newton [mailto:[EMAIL PROTECTED]]
Sent: Monday, February 18, 2002 4:06 PM
To: [EMAIL PROTECTED]
Subject: [PHP] help with Header call


Hello everyone,

This is my first post to this list, so I hope that someone is awake enough
to help me out. 

I am new to PHP and I have a file that uses a command "header". It isn't
working like it is supposed to but I can't seem to figure out why. Below is
the last couple lines of the php file that is giving me trouble.

while ($row=mysql_fetch_row($result)) {
$II=$row[0];
}

Header("Location: $Relative/admin/upload.php?II=$II");

Basically all it does when the whole file is called is return page does not
exist. The file that it refers to is there and the Var "$Relative" is used
in many other scripts with no probs so I don't think that is it. Is passing
the Var "$II" as part of the location incorrect? 

Any help is welcomed.

If you need to see more of the script to understand what I am talking about,
I will post it.

TIA
-Robbie
--- End Message ---
--- Begin Message ---
I'm having trouble storing my array to a text file, utilizing serialize()
and unserialize().  Could you please show a very basic layout of the proper
way to serialize and unserialize and store that to a file?  Thanks.

"Matt" <[EMAIL PROTECTED]> wrote in message
001e01c1b7c0$404d5be0$059aa8c0@Pooch">news:001e01c1b7c0$404d5be0$059aa8c0@Pooch...
>
> ----- Original Message -----
> From: "Clark" <[EMAIL PROTECTED]>
> Sent: Saturday, February 16, 2002 9:15 PM
>
>
> > Two questions:
> >
> > 1) Is it possible to write an array to a file?
>
> Yes, serialize it first with http://www.php.net/serialize.  You can also
> place this in a db text field because it will be a character
representation.
>
> > 2) Is it possible to specify the name of the key to each item of an
array
> > when you get the array using file().
>
> When retrieving the saved array, unserialize it, and you'll get the same
> array back.
>


--- End Message ---
--- Begin Message ---
Simply, to send a form to itself, you can use a special variable called
$PHP_SELF. Here's an example of how to use it:

if ($somevalue) {
   header("Location: $PHP_SELF");
} else {
   execute some other code...
}

Here, if $somevalue holds true, it will call itself and reload the same
script/file. This code is not very useful at all, but it gets the point
across. If you wanted to pass GET variables to this, then you could
easily say:

header("Location: $PHP_SELF?var=value&var2=value2&var3=value3");

...and so on. You can also use this approach with Sessions if you wanted
to turn the values back over to the form page, assuming you had two
pages: one for the form, and one for form checking and entry into a
database. There are several ways to check forms, whether you want it on
one page or span it out to several pages. You just need to be creative
in what tools are avaiable to you. Here is an example of how you can
pass session values:

header("Location: some_file.php?<?=SID?>");

Here, whatever variables you've registered in session_register() will be
passed to the php page you specify, in this case some_file.php. Hope
this helps. Have fun, and happy coding.  :)

--- End Message ---
--- Begin Message ---
Here's what I did.

$error = "";
if (error_in_field_1) $error .= "A";
if (error_in_field_2) $error .= "B";
if (error_in_field_3) $error .= "C";

and so on. Then, when displaying the form...

if (strstr($error,"A")) { echo "You forgot to fill in this field<br>\n"; }
echo "<input type=\"text\" name=\"Whatever\" value=\"$whatever\">";

etc.


> -----Original Message-----
> From: Jason Dulberg [SMTP:[EMAIL PROTECTED]]
> Sent: Sunday, February 17, 2002 23:40
> To:   Martin Towell
> Cc:   [EMAIL PROTECTED]
> Subject:      RE: [PHP] form submission error trapping
> 
> RE: [PHP] form submission error trappingThanks for the code.... Is there a
> way to keep track of what fields had the errors as its possible for people
> to have like 5 errors?
> 
> 
--- End Message ---
--- Begin Message ---
I think that mixing of html and php is too complex and leads to hard to
maintain scripts. I find it extremely difficult to understand a scripts
logic when it's spread out over hundreds of lines of php/html.

I use EasyTemplates that came in Web Applications Development with PHP 4.0
by Tobias Ratschiller and Till Gerkin. It looks like the source is
copyrighted and you have to buy the book to get it.  But it says it's based
on FastTemplates.  The book itself is at
http://www.amazon.com/exec/obidos/ASIN/0735709971/

You can see a sample of the method here
http://marc.theaimsgroup.com/?l=php-general&m=101371611609042&w=2

Notice that the form action handler is the same as the original form. This
is a simple example, but it does "remember" user input as you want.

I wrote a couple of helper functions that accept db names to build select
boxes and radio buttons.  They return strings of the html with the selected
value, and I just put them in a template container reserved for them (the
{TEMPLATE_ITEM} in the sample).

For tables with unknown number of rows, I have one template of the main
page, one for the table container, and one for each row itself.  I loop on
the row, using the row template and concatenate all of the rows of html into
a string.  I take that string and stick it into the table template, and
finally stick the table into the page template.  Very smooth, easy to read,
and no trouble with headers() since all output is done on the last
statement.  You have complete control over the script until then, and can
bail out to another page, or decide to use other templates and output
something else.

As for errors, I build an array of the messages such as:
if (!empty($thatsThere)) {
   $errors[] = "Don't put $thatsThere in  there";
}
if (empty($userName)) {
  $errors[] = "Username must be supplied";
}

Then you can tell if all is okay, with if (is_array($errors)).  If it is an
array, then something is wrong, so I  append the array contests into html
like this:
foreach($errors as $value) {
 $errorMsgs = $value . "<br>\n";
}
and then put $errorMsgs into the page template container you've reserved for
it.

----- Original Message -----
From: "Jason Dulberg" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>

> I am working on some error trapping for several forms on my site. After
> visiting a bunch of websites, I've noticed 2 common methods of displaying
> error messages.
>
> 1. display an error box on a new page and force the user to hit the <back>
> button
>
> 2. display the form again with appropriate error text and pre-filled
fields.
>
> I have part of the error on the new page working but I'm running into the
> infamous no contents in the form after going <back>.
>
> There are some useability issues with forcing the user to hit the back
> button -- some just don't want to bother.
>
> Is there a way to display the form w/original contents and error messages
> 'without' having to code the entire form twice? I have about 5 forms with
50
> fields or so each.
>
> What would be the best way to go about redrawing the form with the errors
> shown beside each field?
>
> Any suggestions are greatly appreciated.


--- End Message ---
--- Begin Message ---
Why do not you all just put all your PHP logic, db access, etc at the TOP 
of the script.  Once you have your results and variables created, then 
start into html.

This method produces MUCH cleaner scripts, and there is a very minimal 
amount of PHP interspersed within the HTML. Also, you have time to bail 
out, or redirect, etc...

------------------------------------------------------------
<?
         Connect to DB

         Are we to process the form?
                 Yes:
                 Validate fields
                 Generate Error Messages
                 break;
         No Error Messages?
                 Update the DB
                 Header("Location: bla.php?NEWID=$NEWID");
                 exit;

?>
<html>

Firstname: <? if(error) echo(error message); ?><br>
<input type="text" name="txtFIRSTNAME" value="<?= 
htmlspecialchars($txtFIRSTNAME); ?>"><br>
<br>
Lastname: <? if(error) echo(error message); ?><br>
<input type="text" name="txtLASTNAME" value="<?= 
htmlspecialchars($txtLASTNAME); ?>"><br>
<br>

</html>




At 08:35 AM 2/18/2002 -0500, Matt wrote:
>I think that mixing of html and php is too complex and leads to hard to
>maintain scripts. I find it extremely difficult to understand a scripts
>logic when it's spread out over hundreds of lines of php/html.
>
>I use EasyTemplates that came in Web Applications Development with PHP 4.0
>by Tobias Ratschiller and Till Gerkin. It looks like the source is
>copyrighted and you have to buy the book to get it.  But it says it's based
>on FastTemplates.  The book itself is at
>http://www.amazon.com/exec/obidos/ASIN/0735709971/
>
>You can see a sample of the method here
>http://marc.theaimsgroup.com/?l=php-general&m=101371611609042&w=2
>
>Notice that the form action handler is the same as the original form. This
>is a simple example, but it does "remember" user input as you want.
>
>I wrote a couple of helper functions that accept db names to build select
>boxes and radio buttons.  They return strings of the html with the selected
>value, and I just put them in a template container reserved for them (the
>{TEMPLATE_ITEM} in the sample).
>
>For tables with unknown number of rows, I have one template of the main
>page, one for the table container, and one for each row itself.  I loop on
>the row, using the row template and concatenate all of the rows of html into
>a string.  I take that string and stick it into the table template, and
>finally stick the table into the page template.  Very smooth, easy to read,
>and no trouble with headers() since all output is done on the last
>statement.  You have complete control over the script until then, and can
>bail out to another page, or decide to use other templates and output
>something else.
>
>As for errors, I build an array of the messages such as:
>if (!empty($thatsThere)) {
>    $errors[] = "Don't put $thatsThere in  there";
>}
>if (empty($userName)) {
>   $errors[] = "Username must be supplied";
>}
>
>Then you can tell if all is okay, with if (is_array($errors)).  If it is an
>array, then something is wrong, so I  append the array contests into html
>like this:
>foreach($errors as $value) {
>  $errorMsgs = $value . "<br>\n";
>}
>and then put $errorMsgs into the page template container you've reserved for
>it.
>
>----- Original Message -----
>From: "Jason Dulberg" <[EMAIL PROTECTED]>
>To: <[EMAIL PROTECTED]>
>
> > I am working on some error trapping for several forms on my site. After
> > visiting a bunch of websites, I've noticed 2 common methods of displaying
> > error messages.
> >
> > 1. display an error box on a new page and force the user to hit the <back>
> > button
> >
> > 2. display the form again with appropriate error text and pre-filled
>fields.
> >
> > I have part of the error on the new page working but I'm running into the
> > infamous no contents in the form after going <back>.
> >
> > There are some useability issues with forcing the user to hit the back
> > button -- some just don't want to bother.
> >
> > Is there a way to display the form w/original contents and error messages
> > 'without' having to code the entire form twice? I have about 5 forms with
>50
> > fields or so each.
> >
> > What would be the best way to go about redrawing the form with the errors
> > shown beside each field?
> >
> > Any suggestions are greatly appreciated.
>
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php

--- End Message ---
--- Begin Message ---
Why do not you all just put all your PHP logic, db access, etc at the TOP 
of the script.  Once you have your results and variables created, then 
start into html.

This method produces MUCH cleaner scripts, and there is a very minimal 
amount of PHP interspersed within the HTML. Also, you have time to bail 
out, or redirect, etc...

------------------------------------------------------------
<?
         Connect to DB

         Are we to process the form?
                 Yes:
                 Validate fields
                 Generate Error Messages
                 break;
         No Error Messages?
                 Update the DB
                 Header("Location: bla.php?NEWID=$NEWID");
                 exit;

?>
<html>

Firstname: <? if(error) echo(error message); ?><br>
<input type="text" name="txtFIRSTNAME" value="<?= 
htmlspecialchars($txtFIRSTNAME); ?>"><br>
<br>
Lastname: <? if(error) echo(error message); ?><br>
<input type="text" name="txtLASTNAME" value="<?= 
htmlspecialchars($txtLASTNAME); ?>"><br>
<br>

</html>




At 08:35 AM 2/18/2002 -0500, Matt wrote:
>I think that mixing of html and php is too complex and leads to hard to
>maintain scripts. I find it extremely difficult to understand a scripts
>logic when it's spread out over hundreds of lines of php/html.
>
>I use EasyTemplates that came in Web Applications Development with PHP 4.0
>by Tobias Ratschiller and Till Gerkin. It looks like the source is
>copyrighted and you have to buy the book to get it.  But it says it's based
>on FastTemplates.  The book itself is at
>http://www.amazon.com/exec/obidos/ASIN/0735709971/
>
>You can see a sample of the method here
>http://marc.theaimsgroup.com/?l=php-general&m=101371611609042&w=2
>
>Notice that the form action handler is the same as the original form. This
>is a simple example, but it does "remember" user input as you want.
>
>I wrote a couple of helper functions that accept db names to build select
>boxes and radio buttons.  They return strings of the html with the selected
>value, and I just put them in a template container reserved for them (the
>{TEMPLATE_ITEM} in the sample).
>
>For tables with unknown number of rows, I have one template of the main
>page, one for the table container, and one for each row itself.  I loop on
>the row, using the row template and concatenate all of the rows of html into
>a string.  I take that string and stick it into the table template, and
>finally stick the table into the page template.  Very smooth, easy to read,
>and no trouble with headers() since all output is done on the last
>statement.  You have complete control over the script until then, and can
>bail out to another page, or decide to use other templates and output
>something else.
>
>As for errors, I build an array of the messages such as:
>if (!empty($thatsThere)) {
>    $errors[] = "Don't put $thatsThere in  there";
>}
>if (empty($userName)) {
>   $errors[] = "Username must be supplied";
>}
>
>Then you can tell if all is okay, with if (is_array($errors)).  If it is an
>array, then something is wrong, so I  append the array contests into html
>like this:
>foreach($errors as $value) {
>  $errorMsgs = $value . "<br>\n";
>}
>and then put $errorMsgs into the page template container you've reserved for
>it.
>
>----- Original Message -----
>From: "Jason Dulberg" <[EMAIL PROTECTED]>
>To: <[EMAIL PROTECTED]>
>
> > I am working on some error trapping for several forms on my site. After
> > visiting a bunch of websites, I've noticed 2 common methods of displaying
> > error messages.
> >
> > 1. display an error box on a new page and force the user to hit the <back>
> > button
> >
> > 2. display the form again with appropriate error text and pre-filled
>fields.
> >
> > I have part of the error on the new page working but I'm running into the
> > infamous no contents in the form after going <back>.
> >
> > There are some useability issues with forcing the user to hit the back
> > button -- some just don't want to bother.
> >
> > Is there a way to display the form w/original contents and error messages
> > 'without' having to code the entire form twice? I have about 5 forms with
>50
> > fields or so each.
> >
> > What would be the best way to go about redrawing the form with the errors
> > shown beside each field?
> >
> > Any suggestions are greatly appreciated.
>
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php

--- End Message ---
--- Begin Message ---
On 17 Feb 2002, at 21:01, Jennifer Downey wrote:

> Would someone please help? I have looked everywhere and can not find
> how to update a database at a certain time.
> 
> I am trying to get this to update at midnight instead of every time
> the browser refreshes. My hosting service has cron jobs but I don't
> understand how to set them up. Is there a way to set this code up to
> do what I need?

I don't know how to run php code as a freestanding executable but it can be 
done. For cron, heck, I never remember the syntax either and my gui is no 
help so I always go this page that my host put up:

http://www.viaverio.com/support/virtual/admin/unix/cron.cfm

Rule is not to run anything at a give time.

So the following should probably at set to a different time. See above link 
for breakdown of fields (what they mean etc.).

Be sure that the "time" you think it is is actually the time it will run. My 
server for instance runs on GMT not my CST or even the EST where the 
server is located.

# Execute the "vnukelog" command at 12:00 midnight (0 0) on August 19
# (8) (aug).  
0 0 19 8 *  /usr/local/bin/vnukelog

You can always do a "man cron" to see info for your system.

Any hosting company worth anything will help you with at least once.

I'm not sure where STDOUT goes, I always have it sent to me via email by 
putting my email at the top of the cronfile (see above url of info on that).  
You seem to be printing to STDOUT  in the PHP snippet you sent.

I think you only want to do the update in your PHP script. I'm sure 
someone will show you how to do this via PHP, I don't know, I use Perl for 
this stuff.  Here's how I'd do it in Perl (MyDBI is a private module).

I suggest you check to make sure that your cron job runs properly (you'll be 
suprised at the number of times something happens where it doesn't).


use strict;
use MyDBI;

eval {
        my $dbh = MyDBI->new(
                data_source =>  'dbi:mysql:database=x;host=x',
                username    =>  '',
                password    =>  ''',
        );

        my $sql = "SELECT Subject,body,article_id,Born FROM news WHERE 
visibility is NULL ORDER BY article_id LIMIT 500";
        my $sth = $dbh->{dbh}->prepare($sql);
        $sth->execute();
};

if($@) {
        print "This script no go: $@";
}

exit;




Peter




http://www.readbrazil.com/
Answering Your Questions About Brazil
--- End Message ---
--- Begin Message ---
I heard from my coursemates it's just typing https:// instead of http://.

1) To enable secure http (SSL) session, what extensions should I install? To 
which one: Apache or PHP or Linux?
2) How do I know if my Apache and/or Linux and/or PHP support SSL?

Thanx


_________________________________________________________________
Send and receive Hotmail on your mobile device: http://mobile.msn.com

--- End Message ---
--- Begin Message ---
To have a secure HTTP session, you must be communicating with a secure web
server. This is apache. It has nothing to do with PHP or Linux.

You classmate was right. The only difference for SSL is that you use https
instead of http. To find out if your server can communicate using SSL, try
it. If you try to access a web page using https and the server is not a
secure server, you will get an error message. Page connot be displayed.

If you are using Apache and you installed it yourself, if you did not do
extra stuff to make it SSL, then it is not. For more info, go to main apache
web site, www.apache.org, and follow links to apache-ssl and mod_ssl.

Janet

----- Original Message -----
From: "gaukia 345" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, February 18, 2002 5:43 AM
Subject: [PHP] How to start a secure HTTP session?


> I heard from my coursemates it's just typing https:// instead of http://.
>
> 1) To enable secure http (SSL) session, what extensions should I install?
To
> which one: Apache or PHP or Linux?
> 2) How do I know if my Apache and/or Linux and/or PHP support SSL?
>
> Thanx
>
>
> _________________________________________________________________
> Send and receive Hotmail on your mobile device: http://mobile.msn.com
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--- End Message ---
--- Begin Message ---
Heres's a frustrating, and maybe not so stupid question?

I'm getting "Warning: Supplied argument is not a valid MySQL result
resource" on this line:

while ($mydata = mysql_fetch_object($news))

So what am I doing wrong here:

$where = "id like $id";
$news = mysql_query('select * from ccl where '.$where.' order by AU
desc'); //desc => z-a

 while ($mydata = mysql_fetch_object($news))
      {
 echo "<tr bgcolor=\"#CCCCCC\"><td align=center><a
href=\"index.html?id=$mydata->id\">Print
View</a></td><td>$mydata->id</td><td>$mydata->AU</td><td>$mydata->ST</td><td>$mydata->BT</td></tr>\n";

      }#end of while

I've tried variations like:

$news = mysql_query('select * from ccl where id like $id order by AU
desc');
$news = mysql_query("select * from ccl where id like $id order by AU
desc");

$id checks out ok. I use index.html?id=4
AU exists; ok. So ... ?

John

--- End Message ---
--- Begin Message ---
In article <[EMAIL PROTECTED]>,
 [EMAIL PROTECTED] (Jtjohnston) wrote:

> Heres's a frustrating, and maybe not so stupid question?
> 
> I'm getting "Warning: Supplied argument is not a valid MySQL result
> resource" on this line:
> 
> while ($mydata = mysql_fetch_object($news))
> 
> So what am I doing wrong here:
> 
> $where = "id like $id";
> $news = mysql_query('select * from ccl where '.$where.' order by AU
> desc'); //desc => z-a

A) Have you already confirmed that a valid database connection was made?

B) String values in mysql have to be quoted.  For example, "where 
foo='bar'" or "where foo like 'bar%'".

C) Error checking on database operations is a really good idea.  Even just 
a short "or die()" on the mysql_* calls can help you track down problems 
much more effectively.  For example:

$result=mysql_query($sql) or die("MySQL reports error: ". mysql_error() . " 
for query " . htmlentities($sql));

For more sophisticated error handling, see 
<http://www.php.net/manual/en/ref.errorfunc.php>.

-- 
CC
--- End Message ---
--- Begin Message ---
> > while ($mydata = mysql_fetch_object($news))
> > So what am I doing wrong here:
> > $where = "id like $id";
> > $news = mysql_query('select * from ccl where '.$where.' order by AU desc');
> //desc => z-a

> A) Have you already confirmed that a valid database connection was made?

Yes. A copy and paste of working code:
$news = mysql_query("select * from ccl ORDER by AU asc");
Connection was made.

So I do?

$news = mysql_query("select * from ccl where '.$where.' order by AU desc");

or ?

$news = mysql_query("select * from ccl where '.%$where%.' order by AU desc");

The % are not necessary? because id is an auto_increment number from 0 to
1,000+.

Why the ' inside " ?

--- End Message ---
--- Begin Message ---
In article <[EMAIL PROTECTED]>,
 [EMAIL PROTECTED] (Jtjohnston) wrote:

> > > $where = "id like $id";
<snip>
> So I do?
> 
> $news = mysql_query("select * from ccl where '.$where.' order by AU desc");
> 
> or ?
> 
> $news = mysql_query("select * from ccl where '.%$where%.' order by AU desc");

Neither.  Where $id==1, these would interpolate to:

select * from ccl where '.id like 1.' order by AU desc
select * from ccl where '.%id like 1%.' order by AU desc

This is why <repeat>error checking with an echo of your query to the 
browser</repeat> is valuable.  You can see exactly what the complete query 
string looks like, and also copy/paste it to the commandline for further 
testing.

> The % are not necessary? because id is an auto_increment number from 0 to
> 1,000+.

The "like" keyword is used with a wildcard operator, either "%" or "_".  If 
you're matching against an exact value, then use the "=" operator instead 
of "like".  See the MySQL manual for more info on the "like" keyword and 
wildcards.

If id has a numerical field type instead of one of the string types, you 
don't need to quote $id. See the MySQL manual for more info on quoting 
string values.

-- 
CC
--- End Message ---
--- Begin Message ---
hi john,
maybe this is the right way

$where="id like ".$id;
$query="select * from ccl where '".$where."' order by AU desc";
$result=mysql_query($query);



regards
martin

> -----Ursprüngliche Nachricht-----
> Von: jtjohnston [mailto:[EMAIL PROTECTED]]
> Gesendet: Montag, 18. Februar 2002 08:00
> An: [EMAIL PROTECTED]
> Betreff: [PHP] More: Frustrating ?
> 
> 
> > > while ($mydata = mysql_fetch_object($news))
> > > So what am I doing wrong here:
> > > $where = "id like $id";
> > > $news = mysql_query('select * from ccl where '.$where.' 
> order by AU desc');
> > //desc => z-a
> 
> > A) Have you already confirmed that a valid database 
> connection was made?
> 
> Yes. A copy and paste of working code:
> $news = mysql_query("select * from ccl ORDER by AU asc");
> Connection was made.
> 
> So I do?
> 
> $news = mysql_query("select * from ccl where '.$where.' order 
> by AU desc");
> 
> or ?
> 
> $news = mysql_query("select * from ccl where '.%$where%.' 
> order by AU desc");
> 
> The % are not necessary? because id is an auto_increment 
> number from 0 to
> 1,000+.
> 
> Why the ' inside " ?
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
--- End Message ---
--- Begin Message ---
I use Interbase on the Linux and NT servers and I would like to have a
report generator that can take the results of a query and produce that
can be converted into a PDF file.

Does anyone have some suggestions on how I can best achieve this goal?

Todd

--
Dr. Todd Cary
Ariste Software
707-773-4523
[EMAIL PROTECTED]

"It is a worthy thing to fight for one's freedom;
 it is another sight finer to fight for another man's"

 Mark Twain


--- End Message ---
--- Begin Message ---
Quoting Torkil Johnsen <[EMAIL PROTECTED]>:

> Anyone know of a good text editor for linux, WITH syntax highlighting for
> php/html + other languages?
> 
> - TOrkil
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 


jedit

www.jedit.org
--- End Message ---
--- Begin Message ---
Josep Raurell wrote:
> 
> Quoting Torkil Johnsen <[EMAIL PROTECTED]>:
> 
> > Anyone know of a good text editor for linux, WITH syntax highlighting for
> > php/html + other languages?
> >
> > - TOrkil

vi
--- End Message ---
--- Begin Message ---
I used to use JEdit and Nedit -- both were satisfactory, but recently 
I've become a nut for GVim (or Vim if you're only only on a tty). If 
you'd like, I can send you my .vimrc file, which sets things up very 
nicely the way I like them.

-bsh :-)

Josep Raurell wrote:

>Quoting Torkil Johnsen <[EMAIL PROTECTED]>:
>
>>Anyone know of a good text editor for linux, WITH syntax highlighting for
>>php/html + other languages?
>>
>>- TOrkil
>>
>>
>>-- 
>>PHP General Mailing List (http://www.php.net/)
>>To unsubscribe, visit: http://www.php.net/unsub.php
>>
>
>
>jedit
>
>www.jedit.org
>

-- 

=======================================================================
Billy S Halsey                              Software Problem Resolution
                                                   ESP Solaris Software
Email [EMAIL PROTECTED]                        Sun Microsystems, Inc
                           -NO DAY BUT TODAY-
=======================================================================



--- End Message ---
--- Begin Message ---
Hi,
I'd like to implement a system whereby people have a subdomain on my site like so:
yourname.mysite.com
I've been reading the apache docs that say you can do this via virtual hosts.
Can I do it so 'yourname' can be anything - where all requests are sent
to the same page where i can parse the uri and query a db based on 'yourname'.
any reason why my isp might be reluctant to do this.I'm presuming I can't
do it via .htaccess?
as a side note what are the affects of this kind of redirection as far as search 
engines
go.I've heard that doing this kind of thing on a 404 page is a bad idea.
--- End Message ---
--- Begin Message ---
Hi, Look into mod_rewrite with Apache.

We use it to capture www.univo.biz/yourname and display a page about you.

However, my experience is very limited.  I would imagine you could figure 
it out though.

-Jason Garber
IonZOft.com


At 09:47 AM 2/18/2002 +0000, Adrian Murphy wrote:
>Hi,
>I'd like to implement a system whereby people have a subdomain on my site 
>like so:
>yourname.mysite.com
>I've been reading the apache docs that say you can do this via virtual hosts.
>Can I do it so 'yourname' can be anything - where all requests are sent
>to the same page where i can parse the uri and query a db based on 'yourname'.
>any reason why my isp might be reluctant to do this.I'm presuming I can't
>do it via .htaccess?
>as a side note what are the affects of this kind of redirection as far as 
>search engines
>go.I've heard that doing this kind of thing on a 404 page is a bad idea.

--- End Message ---
--- Begin Message ---
hi my name is Cristiano and I've a question:

why the function "is_uploaded_file" return "1"?

my example file is index.php

thanks

<?php
 function carica() {
 global $userfile;
 echo "<br>FUNZIONE is_uploaded_file (č un boolean 0 - vero, 1 - falso)-->
".is_uploaded_file ($userfile);
}

echo ""
."<form action=\"index.php?op=carica\" method=\"post\" "
."enctype=\"multipart/form-data\">"
."<input type=\"hidden\" name=\"MAX_FILE_SIZE\" value=\"2000000\">"
."File: <input name=\"userfile\" type=\"file\">"
;

echo ""
."<input type=\"submit\" value=\"invia\" name=\"B1\">"
."</form>"

."<a href=index.php>clear form</a>"
;
?>


--- End Message ---
--- Begin Message ---
Hi all,

I've been trying for the last three hours to do something like this:

    #!/usr/local/bin/php -q
    <?php
        $fp = fopen("php://stdin", "r");
        while (!feof($fp)) {
            $line = fgets($fp, 4096);
            print $line;
        }
        fclose($fp);
    ?>

And then calling it with something like:

    cat foo.txt | ./echofile.php

The problem is, it will print the first line of foo.txt, and then exit. 
No matter what I do, I can't get it to read the next line. I've even 
added a test after the print command to see if it's at EOF, and it's 
not. I've also changed it to do this:

    while (($buf = fgets($fp, 4096)) != FALSE) {
        print $buf;
    }

Still won't read more than one line of the file. The only thing I've 
been able to do that seems to work is this:

    $fp = fopen("/dev/fd/0", "r");
    while (!feof($fp)) ......

[The code snippets I've quoted above are just rough sketches ... I 
really am checking the return value from fopen() to make sure I open the 
file, etc.]

I'm using PHP 4.1.1 on Solaris 8. Can somebody PLEASE tell me what the 
problem is? What stupid mistake am I making?

Thanks.

-bsh :-)

-- 

=======================================================================
Billy S Halsey                              Software Problem Resolution
                                                   ESP Solaris Software
Email [EMAIL PROTECTED]                        Sun Microsystems, Inc
                           -NO DAY BUT TODAY-
=======================================================================


--- End Message ---
--- Begin Message ---
ARGH!!!

I'm seriously sick of this!  I've spent days on end reading 
documentation, trying settings, seeking help, and it still 
won't bloody work!  So I've taken the ultimate step, and 
applied the trusty rm -rf command to everything that has 
to do with sendmail!

In other words, sendmail is no longer on my systems.  
Screw it, causes more bad than good!  

Ok, now surprisingly enough I do have a final question 
regarding PHP/Mail (And I mean final!)

How can I get PHP to send mail through a local SMTP
server?

I'm running Linux RedHat 7.1, latest Apache and PHP.
I have eXtremail installed locally.  It's a POP3/SMTP 
server.  Works fine - fact.

There's 3 configuration options in php.ini that I've been 
playing with, no matter what the combination is, I don't 
really see it doing anything different.

I've read everything relevant on php.net and still can't
find anything.  I'm sorry if this is a really stupid question.

Thanks soooo much for all your help!

Liam
--- End Message ---
--- Begin Message ---
Hi,

I am new to PHP and am having problems with no-cache headers, I have the
following code added as the first line of code in the page...

<?
header("Expires: Mon, 01 Jan 1997 00:00:00 GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Pragma: no-cache");
?>

A combination of no-cache headers usually does the trick, well in ColdFusion
anyway :o), yet this code still shows the wrong images after an upload until
a refresh of the browser is performed. Have I done something wrong or are
headers not very reliable in PHP?

TIA

-----------------------------------
Phil Ewington - Technical Director
-----------------------------------
43 PLC
35 Broad Street, Wokingham
Berkshire RG40 1AU
-----------------------------------
T: +44 (0)118 978 9500
F: +44 (0)118 978 4994
W: http://www.43plc.com
-----------------------------------

--- End Message ---
--- Begin Message ---
----- Original Message -----
From: "Phil Ewington" <[EMAIL PROTECTED]>

> I am new to PHP and am having problems with no-cache headers, I have the
> following code added as the first line of code in the page...
>
> <?
> header("Expires: Mon, 01 Jan 1997 00:00:00 GMT");
> header("Cache-Control: no-store, no-cache, must-revalidate");
> header("Pragma: no-cache");
> ?>
>
> A combination of no-cache headers usually does the trick, well in
ColdFusion
> anyway :o), yet this code still shows the wrong images after an upload
until
> a refresh of the browser is performed. Have I done something wrong or are
> headers not very reliable in PHP?


Those are fine.  I also add:
<meta content="no-cache">
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="Expires" content="Mon, 06 Jan 1990 00:00:01 GMT">

If you just added the cache control, then have you cleared the browser
cache?  Once the page is cached, the browser will return it regardless of
the cache-control.


--- End Message ---
--- Begin Message ---
Hi there,

I would like to create a pdf file and place a heading in the center of the
page.
pdf_get_value should do the job, but it does not work out. Does anybody know
how to get
this thing working?

Thanx for help

ANdy

Code:

pdf_set_font($dokument, "Times-Roman", 35, "winansi");
$heading_width = pdf_get_value($dokument,textx, $country[0]);
#echo $heading_width.'test';
pdf_show_xy($dokument,$country[0], ($page_height - $heading_widht) /2 ,
700);


--- End Message ---
--- Begin Message ---
> -----Original Message-----
> From: Erik Price [mailto:[EMAIL PROTECTED]]
> Sent: 15 February 2002 19:52
> 
> Not only can I hardly find a place with Tetley's on tap, I can hardly 
> find it in stores!
> 
> LOVE Tetley's.

Er -- should I mention here that I live and work within walking distance of the Tetley 
brewery?  And that I have often drunk in the closest pub to it (about 50 yards away!)?

Cheers!

Mike

---------------------------------------------------------------------
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730      Fax:  +44 113 283 3211 
--- End Message ---
--- Begin Message ---
hi everybody!

is there a chance to convert a tiff group 4 image to an jpeg-images
via php? i haven't found anything.. so maybe you know something that way..

greets


--------------------------------------------
Norbert Eder
Open.IT Informationsmanagement GmbH & CoKG
Styria Medien AG
Schönaugasse 64
A-8010 Graz
Tel.: +43 (316) 875 3945
Fax.: +43 (316) 875 3094
Mail: [EMAIL PROTECTED]
Web : http://www.open-it.at
--------------------------------------------

--- End Message ---
--- Begin Message ---
hi folks,

I was just wondering what your opinions were on using preg_match, preg_split
instead of ereg and explode?

I have to write a  script to parse a lot of html and text files.. and I'm
looking to use the fastest possible functions to do this...

Many thanks for all your input!

dk


--- End Message ---
--- Begin Message ---
Is it possible to use variable variables from form values inside a function.

For example when submitting form values,  this works fine:

foreach($_POST as $key=>$value) {

    if (empty($$key)) {
        print "empty value $key<br>";
    }

}

but, this doesn't:

function myFunction() {
 foreach($_POST as $key=>$value) {

     if (empty($$key)) {
         print "empty value $key<br>";
     }

 }
}

Anyone dealt with this?

=======================
      Ron Dyck
      WebbTech
      www.webbtech.net
      [EMAIL PROTECTED]
      905 734-1164

--- End Message ---
--- Begin Message ---

----- Original Message -----
From: "Ron Dyck" <[EMAIL PROTECTED]>

> but, this doesn't:
>
> function myFunction() {
>  foreach($_POST as $key=>$value) {
>
>      if (empty($$key)) {
>          print "empty value $key<br>";
>      }
>
>  }
> }

Since php variable scope is local unless you define it global, that won't
work that way.  You might try (just guessing here):
 function myFunction() {
   foreach($_POST as $key=>$value) {
       global $$key;
       if (empty($$key)) {
          print "empty value $key<br>";
      }
   }
 }


--- End Message ---
--- Begin Message ---
> > but, this doesn't:
> >
> > function myFunction() {
> >  foreach($_POST as $key=>$value) {
> >
> >      if (empty($$key)) {
> >          print "empty value $key<br>";
> >      }
> >
> >  }
> > }
>
> Since php variable scope is local unless you define it global, that won't
> work that way.  You might try (just guessing here):
>  function myFunction() {
>    foreach($_POST as $key=>$value) {
>        global $$key;
>        if (empty($$key)) {
>           print "empty value $key<br>";
>       }
>    }
>  }

That did it.
I assumed that since $_POST was global, the key/value pair would be. Guess
not :-|

Thanks!

ron

--- End Message ---
--- Begin Message ---
Does anyone know if I can exec a perl script from a php script even if my isp doesn't 
allow me to run perl scripts from the command line?

--- End Message ---
--- Begin Message ---
$nWidth = 3;
$oRow = TRUE;

while($oRow)
{
         //Write tr here
         for($i=0; $i<$nWidth; $i++)
         {
                 $oRow = mysql_fetch_object($dbResult);
                 //Write <td></td> here
         }
         //write /tr here
}

At 12:06 PM 2/18/2002 +0000, you wrote:
>Hi all,
>
>I want to display return results from my query (which works fine)
>In I tidy way on screen.
>
>So my result returns say seven results, I have a table, and I want to
>show
>3 results per row of the table... I.e.:
>
>Table
>TR
>TD = result1 /TD  TD result2 /TD TD = result3 /TD
>/TD
>/TR
>TR
>TD = result4 /TD  TD result5 /TD TD = result6 /TD
>/TD
>/TR
>TR
>TD = result7 /TD  TD resultempty /TD TD = resultempty /TD
>/TD
>/TR
>/table
>
>The last two td in row 3 are empty because result found 7 results.
>
>This cant be fixed so echo statements wont work as the result could
>Be 3 or 10 or 56 or whatever.....
>
>As Always your help and or guidance in this matter is appreciated.
>
>Dave Carrera
>Php / MySql Development
>Web Design
>Site Marketing
>http://www.davecarrera.com
>
>
>
>
>--
>PHP Database Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php

--- End Message ---
--- Begin Message ---
Thanks to everyone that helped me with my last problem I've run into 
another problem and was wondering if someone here could offer any help or 
suggestions.  The project I'm working on is an event calender. It does 
several things but the problem I've run into is when I click a date on the 
calendar if there are no events for that day I want to print a message on 
the web page saying as much.  I've read the documentaion that said if I'm 
using a select statement to use mysql_num_rows and that it returns an 
integer. Here is a snippet of my code

$query = "SELECT *,TIME_FORMAT(eventtime, '%l:%i %p')AS eventtime, 
DATE_FORMAT(dateofevent,'%M %e, %Y') AS fdateofevent  FROM tamutevents 
where refid=$refid";

$result = mysql_query($query,$connection) or die("Error in Query");
$num = mysql_num_rows($result);


Next I say  if ($num == 0)
{
      echo " There are no events scheduled today!";
}
else
     {
         echo "blah, blah, blah";
}

The problem is if there are no records that match the select then it always 
goes to the  else part.  I've tried printing the value of $num and it works 
if there is something scheduled but when there is nothing scheduled $num 
shows nothing on the screen.

I'm using Mysql 3.23.38 and php 4.06 on a windows test machine but it works 
the same on php 4.06 and Mysql 3.23.46 on my Linux server.

Has anyone else run into this and if so can you tell me what to do about it.

Thanks in advance - Frank


Frank Miller
Computer Specialist and Webmaster
Technology and Distance Education
Texas A&M University-Texarkana
2600 North Robison Rd
Texarkana, Texas 75501

Phone:  903-223-3156
Fax:      903-223-3139
Office:   165

--- End Message ---
--- Begin Message ---
Maybe you can round the problem with

if ($num < 1)
        echo "Nothing today!";
else
        echo "Something to do today!";

if (!isset($num) || $num == 0)...


Niklas


-----Original Message-----
From: Frank Miller [mailto:[EMAIL PROTECTED]] 
Sent: 18. helmikuuta 2002 16:05
To: [EMAIL PROTECTED]
Subject: [PHP] Mysql_num_rows


Thanks to everyone that helped me with my last problem I've run into 
another problem and was wondering if someone here could offer any help
or 
suggestions.  The project I'm working on is an event calender. It does 
several things but the problem I've run into is when I click a date on
the 
calendar if there are no events for that day I want to print a message
on 
the web page saying as much.  I've read the documentaion that said if
I'm 
using a select statement to use mysql_num_rows and that it returns an 
integer. Here is a snippet of my code

$query = "SELECT *,TIME_FORMAT(eventtime, '%l:%i %p')AS eventtime, 
DATE_FORMAT(dateofevent,'%M %e, %Y') AS fdateofevent  FROM tamutevents 
where refid=$refid";

$result = mysql_query($query,$connection) or die("Error in Query"); $num
= mysql_num_rows($result);


Next I say  if ($num == 0)
{
      echo " There are no events scheduled today!";
}
else
     {
         echo "blah, blah, blah";
}

The problem is if there are no records that match the select then it
always 
goes to the  else part.  I've tried printing the value of $num and it
works 
if there is something scheduled but when there is nothing scheduled $num

shows nothing on the screen.

I'm using Mysql 3.23.38 and php 4.06 on a windows test machine but it
works 
the same on php 4.06 and Mysql 3.23.46 on my Linux server.

Has anyone else run into this and if so can you tell me what to do about
it.

Thanks in advance - Frank


Frank Miller
Computer Specialist and Webmaster
Technology and Distance Education
Texas A&M University-Texarkana
2600 North Robison Rd
Texarkana, Texas 75501

Phone:  903-223-3156
Fax:      903-223-3139
Office:   165


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

--- End Message ---
--- Begin Message ---
Please show your exact code, because your code snippet looks right.

Then, again, maybe it's because it's an Aggie machine...<GRIN>

-----Original Message-----
From: Niklas Lampén [mailto:[EMAIL PROTECTED]]
Sent: Monday, February 18, 2002 8:11 AM
To: Php-General
Subject: RE: [PHP] Mysql_num_rows


Maybe you can round the problem with

if ($num < 1)
        echo "Nothing today!";
else
        echo "Something to do today!";

if (!isset($num) || $num == 0)...


Niklas


-----Original Message-----
From: Frank Miller [mailto:[EMAIL PROTECTED]] 
Sent: 18. helmikuuta 2002 16:05
To: [EMAIL PROTECTED]
Subject: [PHP] Mysql_num_rows


Thanks to everyone that helped me with my last problem I've run into 
another problem and was wondering if someone here could offer any help
or 
suggestions.  The project I'm working on is an event calender. It does 
several things but the problem I've run into is when I click a date on
the 
calendar if there are no events for that day I want to print a message
on 
the web page saying as much.  I've read the documentaion that said if
I'm 
using a select statement to use mysql_num_rows and that it returns an 
integer. Here is a snippet of my code

$query = "SELECT *,TIME_FORMAT(eventtime, '%l:%i %p')AS eventtime, 
DATE_FORMAT(dateofevent,'%M %e, %Y') AS fdateofevent  FROM tamutevents 
where refid=$refid";

$result = mysql_query($query,$connection) or die("Error in Query"); $num
= mysql_num_rows($result);


Next I say  if ($num == 0)
{
      echo " There are no events scheduled today!";
}
else
     {
         echo "blah, blah, blah";
}

The problem is if there are no records that match the select then it
always 
goes to the  else part.  I've tried printing the value of $num and it
works 
if there is something scheduled but when there is nothing scheduled $num

shows nothing on the screen.

I'm using Mysql 3.23.38 and php 4.06 on a windows test machine but it
works 
the same on php 4.06 and Mysql 3.23.46 on my Linux server.

Has anyone else run into this and if so can you tell me what to do about
it.

Thanks in advance - Frank


Frank Miller
Computer Specialist and Webmaster
Technology and Distance Education
Texas A&M University-Texarkana
2600 North Robison Rd
Texarkana, Texas 75501

Phone:  903-223-3156
Fax:      903-223-3139
Office:   165


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
Hi,

I currently have a directory of my web site access protected using .htaccess
and .htpasswd.

Is there any way of retrieving the user ID in PHP after the person
successfully logs in?

Thanks in advance
Dave



--- End Message ---
--- Begin Message ---
hello

i am running into some trouble with a very basic problem.
i want to insert the current date/time into my db. i have 
the field set up as a datetime field. when i submit info,
i just get a blank date, i mean it all zeros, like
0000-00-00 00.00:00:00. how do i insert the current datetime
into my db? i tried using a hidden field with a foramtted
gmt date value, but its not working... any help

thanks - eoghan
--- End Message ---
--- Begin Message ---
  Mysql?

INSERT INTO table VALUES (NOW());

--

Julio Nobrega.

Um dia eu chego lá:
http://sourceforge.net/projects/toca

Ajudei? Salvei? Que tal um presentinho?
http://www.submarino.com.br/wishlistclient.asp?wlid=664176742884


"Eoghan" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> hello
>
> i am running into some trouble with a very basic problem.
> i want to insert the current date/time into my db. i have
> the field set up as a datetime field. when i submit info,
> i just get a blank date, i mean it all zeros, like
> 0000-00-00 00.00:00:00. how do i insert the current datetime
> into my db? i tried using a hidden field with a foramtted
> gmt date value, but its not working... any help
>
> thanks - eoghan


--- End Message ---
--- Begin Message ---
date() is your answer, use it in the piece of code generating the query.
$DateTime = date("Y-m-d H:i:s); // "2002-02-18 16:10:43"


Niklas


-----Original Message-----
From: eoghan [mailto:[EMAIL PROTECTED]] 
Sent: 18. helmikuuta 2002 16:14
To: [EMAIL PROTECTED]
Subject: [PHP] date problem


hello

i am running into some trouble with a very basic problem.
i want to insert the current date/time into my db. i have 
the field set up as a datetime field. when i submit info,
i just get a blank date, i mean it all zeros, like
0000-00-00 00.00:00:00. how do i insert the current datetime into my db?
i tried using a hidden field with a foramtted gmt date value, but its
not working... any help

thanks - eoghan

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

--- End Message ---
--- Begin Message ---
Dear PHP coders,

i am using ob_start("ob_gzhandler")  to compress all html output.
Is there any way to check if the output is really compressed? (and how
much)?

Thanks in advance,

Rein Velt


--- End Message ---
--- Begin Message ---
What do I need to do to allow the readline functions to work?

The following short program fails when run from the command line:

<?php
$line = readline("Input data: ");
print $line;
?>

Execution command and error message:

C:\>php -q myscript.php
<br>
<b>Fatal error</b>:  Call to undefined function:  readline() in
<b>C:\myscript.php</b>
 on line <b>2</b><br>

My system:
Windows 2000
PHP version 4.1.1
I installed PHP from binaries.

--- End Message ---
--- Begin Message ---
Hi Laurie

Not really looked at the script there. But I wrote one a while back which is
similar.

http://oozoo.co.uk/nobba/php-here.php

Have look at that and see if you have the same problems

m:

> I was trying out this breadcrumbs code found at evolt.org:
>
> http://www.evolt.org/article/Breadcrumbs_for_PHP_Lovers/17/4455/
>
> and tried it on my site. The same problem as documented on that page
> exists on my page, being that it doesn't include any directories between
> the "home" and the current page, such as:
>
> home > about us > contact us.
>
> Instead it shows as
>
> home > contact us
>
> I've made some changes as recommended by the postings below, such as
> changing SCRIPT_URL to PATH_INFO, but still no changes.
>
> Has anyone had any experience and workaroudn with this particular script,
> or if there's a better script that I can use for breadcrumbs?
>
>
> --
> Laurie Landry
> [EMAIL PROTECTED] - email
> (604) 693-1120 - voicemail/fax
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--- End Message ---

Reply via email to