Jump to content

LLLLLLL

Members
  • Posts

    306
  • Joined

  • Last visited

Posts posted by LLLLLLL

  1. 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?

    <form method="post">
    <input type="text" name="email" size="40">
    <input type="password" name="password"/>
    ...
    

     

    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!

  2. I have an input textbox on a form. If the user enters &#39; 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

  3. 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?

  4. :shrug:

     

    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' );
    

     

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.