Jump to content

LLLLLLL

Members
  • Posts

    306
  • Joined

  • Last visited

Posts posted by LLLLLLL

  1. I just found code that does this:

    			orig = orig.replace( "<br>", "<br>" );
    			orig = orig.replace( "<BR>", "<br>" );
    			orig = orig.replace( "<bR>", "<br>" );
    			orig = orig.replace( "<Br>", "<br>" );
    

    I see why it's done this way (to encompass any caps variation on the BR) but since .replace() will only get the first instance, this is just bad all the way around. Also, there's no way to do a toLowerCase() because that will mess up the rest of the string.

     

    Is there some sort of JS regex way to replace all instances of <br> regardless of the caps? 

     

    Thanks!

  2. You cited the load errors list for:

     

    1) If the php.ini post size ( 8 ) is smaller than the max file size (16), $_POST is empty and so is $_FILES. There's no way to get an error

     

     

    But that doesn't really help answer the question. There IS NO ERROR because $_POST and $_FILES are empty. I realize this is potentially a server issue, but a customer had this issue. Is there any way to know that a post was attempted?

  3. I tried to edit the original post to no avail. Here's clearer information:

     

    My test for now is simple... test upload a small image file, it's fine. But I have set my max file size to 16MB in php.ini, and I'm intentionally uploading a 19MB file. What is the expected result?

     

    Here's what I've found:

    1) If the php.ini post size ( 8 ) is smaller than the max file size (16), $_POST is empty and so is $_FILES. There's no way to get an error

    2) If the php.ini post size (20) is larger than the max file size (20), $_FILES[ 'whatever' ][ 'file' ] gives me a correct result.

     

    Is there a way to get an error that helps a user in scenario #1?

  4. I'm trying to test error conditions for file uploads, but when a file intentionally fails, I'm not even sure how to access the code. Here's a snippet:
    
    	$file_arr = $_FILES[ 'digifile' ];
    	$fn       = $file_arr[ 'name' ];
    	$temp     = $file_arr[ 'tmp_name' ];
    	$error    = $file_arr[ 'error' ];
    	error_log( 'the error is: ' . $error ); // ** SEE NOTE BELOW
    	
    	if ( $error > 0 ) {
    		$ui->upload_message = "Error during file upload. ";
    		
    		// try to switch the error to show a relevant message
    
    
    	} else {			
    		if ( move_uploaded_file( $temp, $full_path ) )
    			// something
    	}
    

    My test for now is simple... test a small image file, it's fine. But I have set my max file size to 16MB in php.ini, and I'm intentionally uploading a 19MB file. What is the expected result?

     

    Well I can tell you that the result is this code IS NOT REACHED AT ALL! How is that possible? error_log() doesn't get reached. I don't really know what happens when there is an error, but I'd like to show a customer a relevant message if this happened in the real world. There's no boolean result of move_uploaded_file, either, since like I said THE CODE ISN'T REACHED.

     

    I really don't understand. Any help is appreciated.

     

  5. Sorry, another question on this, because I'm not sure I asked it correctly the first time: The database column is currently latin1_swedish BUT the encoding used by the application's mysql connection is UTF-8.

     

    This is why I was wondering about needing to convert data before converting the column.

  6. I've been given a database where some text columns are using latin encoding (or swedish? ugh). I want to update these columns to utf encoding while preserving the data to be accessed correctly after the column type is changed. What are the steps? Do I convert the data FIRST and then alter the column encoding type? Or vice-versa? Or something else?

     

    Also, is this the best way to update the data?

    convert(cast(convert(column_name using latin1) as binary) using utf8)

     

    Thanks

  7. I'm using http://api.jqueryui.com/sortable/ and I'd like my table to be unsortable by default, a user clicks something, and then it's sortable, then they click something else and it's not sortable.

     

    I thought I could use these two functions:

    function enable_sort() {
    	$( ".btf_table tbody:first" ).sortable({
    	    helper: fixHelperModified,
    	    stop: updateIndex,
    	    axis: "y"
    	    //handle: '.handle'
    	}).disableSelection();
    }
    
    function disable_sort() {
    	$( ".btf_table tbody:first" ).off();
    }
    

    I can use them, but then I cannot use "enable_sort" again after "disable_sort" is called. I'm sure I'm mis-uisng the "off" function but I'm not sure what I'm supposed to be calling instead, or with which parameters.

  8. The HTML is below. I'm struggling to find an easy jQuery way to scroll to a given row (classes abc, def, xyz). I've tried various versions of scrollTop, offset, offsetParent, and more. All to no avail.

     

    The cart_item_wrapper is 150px tall, and it exists to allow the "cart_items_table" to show its items in a scrollable manner. What is the best way to scroll to a div in a div?

    <div id="cart_item_wrapper">
    	<table id="cart_items_table">				
    	<tbody>
    		<tr class="abc" style=" ">
    			<td class="icon_col"></td>
    		</tr>
    		<tr class="def">
    			<td class="icon_col"></td>
    		</tr>
    		<tr class=”xyz”>
    			<td class="icon_col"></td>
    		</tr>
    		<tr>
    			<td class="icon_col"></td>
    		</tr>
    		<tr>
    			<td class="icon_col"></td>
    		</tr>
    	</tbody>
    	</table>
    </div>
    
  9. How can I declare the name of the output column with a "show tables" command?

     

    The default result is Tables_in_your_database_name

     

    How can I change it to be something else? "show tables as TBL" doesn't work. Is there something similar?

  10. I don't think magic_quotes was ever turned on because the customer is using HostGator and they generally have that ridiculous option turned off.

     

    There's not a chance it's a stripslashes coding issue because there's no code that changes every TEXT column in the entire database; the fact that everything changed at once seems to lead me to some sort of export/restore thing.

     

    Not sure what the guy did. I guess it is a mystery to us all.

  11. A customer of mine has a database that is now filled with "rn" characters all over the place. These characters exist where the fields in question used to have blank lines.

     

    I'm assuming the customer did some sort of backup/restore or something. The problem isn't isolated to a single table or column; it is every text column in every table.

     

    At this point it's all fixup, but I'm wondering how this happened. The customer "has no idea" but I think they are afraid to admit the problem was self-inflicted.

     

    But out of my own curiosity, I'd like to know how this type of damage is even possible. Do you think there is some bad setting on the export or import that would have done this? Any other ideas how someone created this issue?

  12. I need to import a customer database from their site -- with magic quotes enabled -- to my system, where magic quotes are disabled.

     

    When I export the customer DB from their site, obviously all the data contains the magic quotes.

     

    What is the best way to get rid of the quotes?

    1) Import into my system and then run [something]?

    2) Do some massaging of the export text file prior to import?

    3) Something else?

     

    For what it's worth, I'm using a standard cPanel with PHP MySQL Admin tools.

×
×
  • 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.