php-windows Digest 10 Feb 2005 22:38:13 -0000 Issue 2570
Topics (messages 25552 through 25561):
[suspicious - maybe spam] Re: [PHP-WIN] $_SERVER['PHP_SELF']
25552 by: Patrick Roane
mysql table rename
25553 by: Patrick Roane
25554 by: I.Cividanes
25555 by: Patrick Roane
form not parsing php code?
25556 by: Patrick Roane
25557 by: Randy Clamons
pg_connect requiressl
25558 by: Fernando Cardoso
system() on Windows 2003
25559 by: Jason Beaver
SESSION
25560 by: Vaibhav Sibal
25561 by: Jason Barnett
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 ---
Thanks for your input. I made the change that you
suggested and it worked!
In essence, my error was writing html code w/in a php
tag right? In the future if I want to do this, I just
have to proceed my html with the echo or print
statement.
--- Zareef Ahmed <[EMAIL PROTECTED]> wrote:
> On Wed, 9 Feb 2005 17:21:03 -0800 (PST), Patrick
> Roane
> <[EMAIL PROTECTED]> wrote:
> > I'm trying to execute my php code from w/in the
> same
> > page as my form. I've done this before, but
> recently
> > i've been getting some parse errors.
> >
> > Is there a certain way of writing the following so
> it
> > works with my form?
> >
> > For example, do I use:
> >
> > action="<?php print $_SERVER['PHP_SELF']?>
> >
> > or,
> >
> > action="{' . $_SERVER['PHP_SELF'] . '}">
> >
> > Currently, the error I get is:
> >
> > Parse error: syntax error, unexpected '<' in
> > c:\wamp\www\php_excercises\grabfile.php on line 13
> >
> > My code is below:
> >
> > <form enctype="multipart/form-data"
> > name="frmUploadFile" action="<?PHP echo $me;?>">
> >
> Error lies in these lines
>
> > <?php
> Your PHP tag is start.
> > <form method="post" action="<?php print
> but you write a normal html without a print or echo.
> > $_SERVER['PHP_SELF']?>">
> > /* action="{' . $_SERVER['PHP_SELF'] . '}">
> */
> >
> > ?>
>
> it must be like this
> <?php
> print "<form method='post'
> action='{$_SERVER['PHP_SELF']}'>";
> ?>
>
> or
>
> print "<form method='post' action='"; // Note single
> quotes before
> closing double quotes.
> print $_SERVER['PHP_SELF'];
> print "'>";
>
> Remember once you have started a PHP tag you must
> use php things only .
> Even if you want to write HTML then include it in
> print or echo statements.
>
> Zareef Ahmed
>
>
>
>
>
> >
> > <a href="http://www.devarticles.com">
> >
> > <img border="0"
> > src="http://www.devarticles.com/dlogo.gif">
> >
> > </a>
> >
> > <table border="0" cellpadding="0" cellspacing="0"
> > bordercolor="#111111" width="100%">
> >
> > <tr>
> >
> > <td width="100%" bgcolor="#FF9900" height="22"
> > colspan="2">
> >
> > <p style="margin-left: 10"><b><font face="Verdana"
> > size="2" color="#FFFFFF">
> >
> > Upload a File</font></b></td>
> >
> > </tr>
> >
> > <tr>
> >
> > <td width="100%" bgcolor="#FFE3BB" colspan="2">
> >
> > <p style="margin-left: 10; margin-right: 10"><font
> > face="Verdana" size="2">
> >
> > <br>Please select a file from your local computer
> to
> > upload to our web server
> >
> > for saving in our database. This file can be of
> any
> > type you like. Once you
> >
> > have chosen a file, please click on the
> "Upload
> > this file" button below.
> >
> > <br> </font></td>
> >
> > </tr>
> >
> > <tr>
> >
> > <td width="15%" bgcolor="#FFE3BB">
> >
> > <p style="margin-left: 10"><font face="Verdana"
> > size="2">
> >
> > File Description:</font></td>
> >
> > <td width="85%" bgcolor="#FFE3BB">
> >
> > <input type="text" name="strDesc" size="20"
> > maxlength="50"></td>
> >
> > </tr>
> >
> > <tr>
> >
> > <td width="15%" bgcolor="#FFE3BB">
> >
> > <p style="margin-left: 10"><font face="Verdana"
> > size="2">File Location:</font></td>
> >
> > <td width="85%" bgcolor="#FFE3BB">
> >
> > <font face="Verdana" size="2">
> >
> > <input type="file" name="fileUpload"
> > size="20"></font></td>
> >
> > </tr>
> >
> > <tr>
> >
> > <td width="33%" bgcolor="#FFE3BB">
> >
> > <p style="margin-left: 10"><font face="Verdana"
> > size="2">
> >
> > <br>
> >
> > <br>
> >
> > </font></td>
> >
> > <td width="67%" bgcolor="#FFE3BB">
> >
> > <font face="Verdana" size="2">
> >
> > <input type="submit" value="Upload this file"
> > name="cmdSubmit"></font></td>
> >
> > </tr>
> >
> > </table>
> >
> > </form>
> >
> > <?php
> > } else {
> > // GrabFile.php: Takes the details
> >
> > // of the new file posted as part
> >
> > // of the form and adds it to the
> >
> > // myBlobs table of our myFiles DB.
> >
> > global $strDesc;
> >
> > global $fileUpload;
> >
> > global $fileUpload_name;
> >
> > global $fileUpload_size;
> >
> > global $fileUpload_type;
> >
> > // Make sure both a description and
> >
> > // file have been entered
> >
> > if(empty($strDesc) || $fileUpload == "none")
> >
> > die("You must enter both a description and file");
> >
> > // Database connection variables
> >
> > $dbServer = "localhost";
> >
> > $dbDatabase = "myFiles";
> >
> > $dbUser = "";
> >
> > $dbPass = "";
> >
> > $fileHandle = fopen($fileUpload, "r");
> >
> > $fileContent = fread($fileHandle,
> $fileUpload_size);
> >
> > $fileContent = addslashes($fileContent);
> >
> > $sConn = mysql_connect($dbServer, $dbUser,
> $dbPass)
> >
> > or die("Couldn't connect to database server");
> >
> > $dConn = mysql_select_db($dbDatabase, $sConn)
> >
> > or die("Couldn't connect to database
> $dbDatabase");
> >
> > $dbQuery = "INSERT INTO myBlobs VALUES ";
> >
> > $dbQuery .= "(0, '$strDesc', '$fileContent',
> > '$fileUpload_type')";
> >
> > mysql_query($dbQuery) or die("Couldn't add file to
> > database");
> >
> > echo "<h1>File Uploaded</h1>";
> >
> > echo "The details of the uploaded file are shown
> > below:<br><br>";
> >
> > echo "<b>File name:</b> $fileUpload_name <br>";
> >
> > echo "<b>File type:</b> $fileUpload_type <br>";
> >
> > echo "<b>File size:</b> $fileUpload_size <br>";
> >
> > echo "<b>Uploaded to:</b> $fileUpload <br><br>";
> >
> > echo "<a href='uploadfile.php'>Add Another
> File</a>";
> >
> > ?>
> > </body>
> >
> > </html>
> >
> > =====
> > Patrick Roane
> > Web design and development
> > www.franklin-band.com
> > Fox River Grove, Il.
> >
> > --
> > PHP Windows Mailing List (http://www.php.net/)
> > To unsubscribe, visit:
> http://www.php.net/unsub.php
> >
> >
>
>
> --
> Zareef Ahmed :: A PHP Developer in India ( Delhi )
> Homepage :: http://www.zareef.net
>
=====
Patrick Roane
Web design and development
www.franklin-band.com
Fox River Grove, Il.
--- End Message ---
--- Begin Message ---
I am trying to rename my table, but I get a syntax
error.
ALTER TABLE myblobs RENAME myBlobs;
Can anyone tell me where the problem is here? I went
to the mysql ref. site and I think this is the right
way to do this.
thanks-
=====
Patrick Roane
Web design and development
www.franklin-band.com
Fox River Grove, Il.
--- End Message ---
--- Begin Message ---
Patrick Roane escribiÃ:
I am trying to rename my table, but I get a syntax
error.
ALTER TABLE myblobs RENAME myBlobs;
Can anyone tell me where the problem is here? I went
to the mysql ref. site and I think this is the right
way to do this.
thanks-
=====
Patrick Roane
Web design and development
www.franklin-band.com
Fox River Grove, Il.
This is a typical Windows problem. If you read carefully the paragraph
in MySQL docs, it says:
<< If you use ALTER TABLE tbl_name RENAME TO new_tbl_name without any
other options, MySQL simply renames any files that correspond to the
table tbl_name... >>
What's happening? It's easy to understand if you look at the words
"simply renames any files". As you know in Windows filesystems "myblobs"
and "myBlobs" are the same filename. So simply rename the table to any
other name and then rename it back to "myBlobs". I.e.
ALTER TABLE myblobs RENAME foo;
ALTER TABLE foo RENAME myBlobs;
That's all folks.
I.Cividanes (icividanes at gmail dot com)
PHP Developer
--- End Message ---
--- Begin Message ---
This has been solved. The problem was 'pilot error'.
This is indeed the right syntax to change a table
name.
--- Patrick Roane <[EMAIL PROTECTED]> wrote:
> I am trying to rename my table, but I get a syntax
> error.
>
> ALTER TABLE myblobs RENAME myBlobs;
>
>
> Can anyone tell me where the problem is here? I went
> to the mysql ref. site and I think this is the right
> way to do this.
>
> thanks-
>
> =====
> Patrick Roane
> Web design and development
> www.franklin-band.com
> Fox River Grove, Il.
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
=====
Patrick Roane
Web design and development
www.franklin-band.com
Fox River Grove, Il.
--- End Message ---
--- Begin Message ---
I don't think my form is parsing the php code. Though,
I'm not getting any errors, I should see a detailed
message confirming the file i've uploaded and I should
see my sql table updated with this information. If
anything, I should see mysql errors if there is a
connection problem. Niether of these things is
happening.
There is obviously a communication problem between the
html and the php. Can someone take a look here to see
if there is something missing?
<!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>Listing 13.1 Opening a Connection to a
Database</title>
</head>
<body>
<form enctype="multipart/form-data"
name="frmUploadFile" action="<?PHP echo $me;?>">
<?php
print "<form method='post'
action='{$_SERVER['PHP_SELF']}'>";
?>
<a href="http://www.devarticles.com">
<img border="0"
src="http://www.devarticles.com/dlogo.gif">
</a>
<table border="0" cellpadding="0" cellspacing="0"
bordercolor="#111111" width="100%">
<tr>
<td width="100%" bgcolor="#FF9900" height="22"
colspan="2">
<p style="margin-left: 10"><b><font face="Verdana"
size="2" color="#FFFFFF">
Upload a File</font></b></td>
</tr>
<tr>
<td width="100%" bgcolor="#FFE3BB" colspan="2">
<p style="margin-left: 10; margin-right: 10"><font
face="Verdana" size="2">
<br>Please select a file from your local computer to
upload to our web server
for saving in our database. This file can be of any
type you like. Once you
have chosen a file, please click on the "Upload
this file" button below.
<br> </font></td>
</tr>
<tr>
<td width="15%" bgcolor="#FFE3BB">
<p style="margin-left: 10"><font face="Verdana"
size="2">
File Description:</font></td>
<td width="85%" bgcolor="#FFE3BB">
<input type="text" name="strDesc" size="20"
maxlength="50"></td>
</tr>
<tr>
<td width="15%" bgcolor="#FFE3BB">
<p style="margin-left: 10"><font face="Verdana"
size="2">File Location:</font></td>
<td width="85%" bgcolor="#FFE3BB">
<font face="Verdana" size="2">
<input type="file" name="fileUpload"
size="20"></font></td>
</tr>
<tr>
<td width="33%" bgcolor="#FFE3BB">
<p style="margin-left: 10"><font face="Verdana"
size="2">
<br>
<br>
</font></td>
<td width="67%" bgcolor="#FFE3BB">
<font face="Verdana" size="2">
<input type="submit" value="Upload this file"
name="cmdSubmit"></font></td>
</tr>
</table>
</form>
<?php
//} else {
// GrabFile.php: Takes the details
// of the new file posted as part
// of the form and adds it to the
// myBlobs table of our myFiles DB.
global $strDesc;
global $fileUpload;
global $fileUpload_name;
global $fileUpload_size;
global $fileUpload_type;
// Make sure both a description and
// file have been entered
if(empty($strDesc) || $fileUpload == "none")
die("You must enter both a description and file");
// Database connection variables
$dbServer = "localhost";
$dbDatabase = "myfiles";
$dbUser = "";
$dbPass = "";
$fileHandle = fopen($fileUpload, "r");
$fileContent = fread($fileHandle, $fileUpload_size);
$fileContent = addslashes($fileContent);
$sConn = mysql_connect($dbServer, $dbUser, $dbPass)
or die("Couldn't connect to database server");
$dConn = mysql_select_db($dbDatabase, $sConn)
or die("Couldn't connect to database $dbDatabase");
$dbQuery = "INSERT INTO myBlobs VALUES ";
$dbQuery .= "(0, '$strDesc', '$fileContent',
'$fileUpload_type')";
mysql_query($dbQuery) or die("Couldn't add file to
database");
echo "<h1>File Uploaded</h1>";
echo "The details of the uploaded file are shown
below:<br><br>";
echo "<b>File name:</b> $fileUpload_name <br>";
echo "<b>File type:</b> $fileUpload_type <br>";
echo "<b>File size:</b> $fileUpload_size <br>";
echo "<b>Uploaded to:</b> $fileUpload <br><br>";
echo "<a href='uploadfile.php'>Add Another File</a>";
//}
?>
</body>
</html>
=====
Patrick Roane
Web design and development
www.franklin-band.com
Fox River Grove, Il.
--- End Message ---
--- Begin Message ---
Patrick,
Apparently this is only part of your php code. I see an 'else' but not an 'if'.
I also note you are sending two form tags. Most browsers will consider the
second form tag as ending the first form. Include the method attribute with the
first form tag, and delete the second tag. This should allow your users to
upload a file.
Randy Clamons
Systems Programming
Novaspace.com
> ------------Original Message------------
> From: Patrick Roane <[EMAIL PROTECTED]>
> To: [email protected]
> Date: Thu, Feb-10-2005 12:12 PM
> Subject: [PHP-WIN] form not parsing php code?
>
> I don't think my form is parsing the php code. Though,
> I'm not getting any errors, I should see a detailed
> message confirming the file i've uploaded and I should
> see my sql table updated with this information. If
> anything, I should see mysql errors if there is a
> connection problem. Niether of these things is
> happening.
>
>
> There is obviously a communication problem between the
> html and the php. Can someone take a look here to see
> if there is something missing?
>
> <!DOCTYPE html PUBLIC
> "-//W3C//DTD XHTML 1.0 Strict//EN"
> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
> <html>
> <head>
> <title>Listing 13.1 Opening a Connection to a
> Database</title>
> </head>
> <body>
> <form enctype="multipart/form-data"
> name="frmUploadFile" action="<?PHP echo $me;?>">
>
>
> <?php
>
> print "<form method='post'
> action='{$_SERVER['PHP_SELF']}'>";
> ?>
>
>
> <a href="http://www.devarticles.com">
>
> <img border="0"
> src="http://www.devarticles.com/dlogo.gif">
>
> </a>
>
> <table border="0" cellpadding="0" cellspacing="0"
> bordercolor="#111111" width="100%">
>
> <tr>
>
> <td width="100%" bgcolor="#FF9900" height="22"
> colspan="2">
>
> <p style="margin-left: 10"><b><font face="Verdana"
> size="2" color="#FFFFFF">
>
> Upload a File</font></b></td>
>
> </tr>
>
> <tr>
>
> <td width="100%" bgcolor="#FFE3BB" colspan="2">
>
> <p style="margin-left: 10; margin-right: 10"><font
> face="Verdana" size="2">
>
> <br>Please select a file from your local computer to
> upload to our web server
>
> for saving in our database. This file can be of any
> type you like. Once you
>
> have chosen a file, please click on the "Upload
> this file" button below.
>
> <br> </font></td>
>
> </tr>
>
> <tr>
>
> <td width="15%" bgcolor="#FFE3BB">
>
> <p style="margin-left: 10"><font face="Verdana"
> size="2">
>
> File Description:</font></td>
>
> <td width="85%" bgcolor="#FFE3BB">
>
> <input type="text" name="strDesc" size="20"
> maxlength="50"></td>
>
> </tr>
>
> <tr>
>
> <td width="15%" bgcolor="#FFE3BB">
>
> <p style="margin-left: 10"><font face="Verdana"
> size="2">File Location:</font></td>
>
> <td width="85%" bgcolor="#FFE3BB">
>
> <font face="Verdana" size="2">
>
> <input type="file" name="fileUpload"
> size="20"></font></td>
>
> </tr>
>
> <tr>
>
> <td width="33%" bgcolor="#FFE3BB">
>
> <p style="margin-left: 10"><font face="Verdana"
> size="2">
>
> <br>
>
> <br>
>
> </font></td>
>
> <td width="67%" bgcolor="#FFE3BB">
>
> <font face="Verdana" size="2">
>
> <input type="submit" value="Upload this file"
> name="cmdSubmit"></font></td>
>
> </tr>
>
> </table>
>
> </form>
>
> <?php
> //} else {
> // GrabFile.php: Takes the details
>
> // of the new file posted as part
>
> // of the form and adds it to the
>
> // myBlobs table of our myFiles DB.
>
>
>
> global $strDesc;
>
> global $fileUpload;
>
> global $fileUpload_name;
>
> global $fileUpload_size;
>
> global $fileUpload_type;
>
> // Make sure both a description and
>
> // file have been entered
>
> if(empty($strDesc) || $fileUpload == "none")
>
> die("You must enter both a description and file");
>
> // Database connection variables
>
> $dbServer = "localhost";
>
> $dbDatabase = "myfiles";
>
> $dbUser = "";
>
> $dbPass = "";
>
> $fileHandle = fopen($fileUpload, "r");
>
> $fileContent = fread($fileHandle, $fileUpload_size);
>
> $fileContent = addslashes($fileContent);
>
> $sConn = mysql_connect($dbServer, $dbUser, $dbPass)
>
> or die("Couldn't connect to database server");
>
> $dConn = mysql_select_db($dbDatabase, $sConn)
>
> or die("Couldn't connect to database $dbDatabase");
>
> $dbQuery = "INSERT INTO myBlobs VALUES ";
>
> $dbQuery .= "(0, '$strDesc', '$fileContent',
> '$fileUpload_type')";
>
>
>
> mysql_query($dbQuery) or die("Couldn't add file to
> database");
>
> echo "<h1>File Uploaded</h1>";
>
> echo "The details of the uploaded file are shown
> below:<br><br>";
>
> echo "<b>File name:</b> $fileUpload_name <br>";
>
> echo "<b>File type:</b> $fileUpload_type <br>";
>
> echo "<b>File size:</b> $fileUpload_size <br>";
>
> echo "<b>Uploaded to:</b> $fileUpload <br><br>";
>
> echo "<a href='uploadfile.php'>Add Another File</a>";
>
> //}
>
> ?>
> </body>
>
> </html>
>
> =====
> Patrick Roane
> Web design and development
> www.franklin-band.com
> Fox River Grove, Il.
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--- End Message ---
--- Begin Message ---
I am needing to have access the PostgreSQL I saw SSL I am using php-gtk for
that I saw pg_connect I do not give support for requiressl and ModSSL with that
I make to connect using SSL?
--- End Message ---
--- Begin Message ---
I have a script that calls:
system('copy /b prnfile lpt4:', $result);
or:
system('type prnfile > lpt4', $result);
the result is '1' and it doesn't send it to lpt4.
I have tried:
system('type prnfile', $result);
the result of that is '0' and it puts all the info in the file on the
browser screen.
I have tried a number of commands in there it seems that the commands that
only require 'read' permissions work but when they need to 'write' to
something it fails.
I think that this is a permissions issue but I can't figure out where to set
what permission
Has anyone had any experiance making PHP talk directly to a LPT port? so I
an avoid this problem all togeather?
I tried to do that when I wrote this script but was unsuccessful. this same
script works on a 2000 box but with 2003's new security it causes a problem
anyone have any ideas?
anyone have any ideas?
--- End Message ---
--- Begin Message ---
I wanted to ask, where is the Session information stored ? That is at
the server or on the client. Because I need to give the
session.save_path value in the php.ini. I would give it according to
people's reply of this question. Thank you.
Vaibhav
--- End Message ---
--- Begin Message ---
Vaibhav Sibal wrote:
I wanted to ask, where is the Session information stored ? That is at
the server or on the client. Because I need to give the
session.save_path value in the php.ini. I would give it according to
people's reply of this question. Thank you.
Vaibhav
session.save_path is located on the server. Session data is stored on
the server; typically the only thing that gets sent to the user is they
will have a cookie written (wherever the web browser writes its cookies).
--
Teach a man to fish...
NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-general&w=2
STFM | http://www.php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY |
http://mycroft.mozdev.org/download.html?name=PHP&submitform=Find+search+plugins
signature.asc
Description: OpenPGP digital signature
--- End Message ---