![](https://forums.phpfreaks.com/uploads/set_resources_1/84c1e40ea0e759e3f1505eb1788ddf3c_pattern.png)
LLLLLLL
-
Posts
306 -
Joined
-
Last visited
Posts posted by LLLLLLL
-
-
This may not be a my_sql question after all, but rather one about the input field and post messages. HTML Special Chars might be what I need:
http://www.php.net/manual/en/function.htmlspecialchars.php
But I don't necessarily want to convert it, I want to be sure it is not converted!
-
I have an input textbox on a form. If the user enters ' into the field, how can I store that exact string in the database? And then, how can I read that string back out?
As it is now, the text is being converted to an apostrophe. I assume that similar strings would also be translated. I need to store the string exactly as entered, because later that text will be used on a webpage (where the browser will translate it appropriately).
Ideas?
On MySQL 5.1.47, PHP 5.2.14
-
I kinda figured. Argh.
Related question: I've read that readfile() may not be the best option, especially for large files. Some of the files I'm providing are around 10MB. How would you change the code to handle that?
-
On PHP 5.2.14.
I want to make files downloadable from my website. This seems easy enough:
<?php $file = "downloads/someFile.txt"; // Set headers header( "Content-Description: File Transfer" ); header( "Content-Type: application/force-download"); header( "Content-Length: " . filesize( $filename ) ); header( "Content-Disposition: attachment; filename=$file"); // header( "Content-Transfer-Encoding: binary"); readfile( $file ); unlink( $file ); ?>
You'll notice, however, that I have "unlink" at the end of this file. That's exactly what I want: to remove the file from the server once it has been downloaded, to prevent anyone else from downloading it.
Here's the conundrum: When the user navigates to this URL, browsers offer the choice of Open/Save/Cancel. I don't want users to "open", and if the user presses "cancel", well then I probably don't really want the file deleted.
In short: I want the file SAVED, only. And I want to delete the file immediately after it has been downloaded.
Thoughts?
-
There really aren't. I've looked everywhere, and I only asked here because there was nothing to find.
As it is, I'm now using PHPMailer to attach real files -- not storing files in the database.
-
I've looked all around for the answer on this, and I still cannot find it. I'm most confused about getting the file out of the database and turning it into a stream of data to attach. fread() and fopen() don't work because they require file paths.
:'(
-
Hello again.
I had planned on using the standard "mail" function:
mail($to, $subject, $message, $from);
-
Right... could you provide an example of how to do this? Is it necessary to turn the BLOB into a file and then attach it, or can the BLOB be attached directly?
-
On MySQL 5.1.47, PHP 5.2.14
I have some PDFs stored in a database as BLOBs. Using PHP code, how can I attach these BLOBs to an email?
-
Well that sucks. But I do thank you for this information.
-
Ah. ENGINE=MyISAM
Does MyISAM support transactions?
-
I don't know. Can you tell me how to find out that info?
(FYI: my web host says transactions are supported.)
-
On MySQL 5.1.47, PHP 5.2.14
I have looked at every PHP and MySql website I can find, and I'm sure my syntax must be incorrect, but I don't know how, why, or where. All I want to do is put this information in a transaction. Many queries are being run, and I don't want one failure to screw up everything else. You'll notice that there aren't many queries here... most of them are in the classes themselves. Maybe that matters; not sure.
Anyway, for testing purposes I'm simply calling ROLLBACK at the end of all this. Alas, nothing is rolled back, and all the queries succeeded in adding information to the DB. Because of this, I'm convinced my transaction syntax is wrong. I've tried many ways, and this just happens to be the current syntax. Please help!
mysql_query( 'SET AUTOCOMMIT=0' ); mysql_query( 'BEGIN' ); $cust->findIdOrAdd( $adrs ); // add the order to the db $order->add(); // before adding products, we need to map the skus to ids $skumap = array(); $sql = 'select sku, id from products'; $result = mysql_query( $sql ); while ( $data = mysql_fetch_assoc( $result ) ) { $skumap[ $data[ 'sku' ] ] = $data[ 'id' ]; } // loop through all the items. set the orderid and custid, // and then call the add function, passing in the skumap foreach ( $order->products as $product ) { $product->add( $skumap ); } mysql_query( 'ROLLBACK' ); mysql_query( 'SET AUTOCOMMIT=1' );
How to encrypt form post data?
in PHP Coding Help
Posted
How can I encrypt POST data from a form? Basically, I want to ensure that the data on the form is not in plain text ever. Is this possible?
Basically, when this posts, I want to do a foreach on $_POST and see something like:
password = 1f3870be274f6c49b3e31a0c6728957f
and not
password = stringTheUserTyped
I hope what I'm asking for is clear.
(PHP 5.2.14)
Thanks!