Jump to content

thepip3r

Members
  • Posts

    289
  • Joined

  • Last visited

    Never

Posts posted by thepip3r

  1. right... but this *hack* allows you to specify the FROM value in the PHP mail() function.  Isn't that what you're looking to do? ...get a copy of the email as well as though it appears from the original sender? 

     

    If so, just use this hack and the mail() function to shoot an email to you when you write all of the pertinent values to the database.

  2. i have a script reading a CSV file into an array.  sometimes (based on the software version generating the CSV), there are blank cells which result in blank array elements which make the processing off.  i've tried to remove those blank elements using unset() which does work but it doesn't reorder the array:

     

    so where i'm expecting $array[20], in the CSV with blank entries, the value i'm looking for is at $array[21] with $array[20] being blank.  using unset, i've been able to wipe out this blank entry but my question is this:  is there an inherent SORT or other function that will reorder the array as well based off of the keys?  i've looked at ksort() etc but they all seem to maintain index association. 

     

    i am fine for creating my own, i'd just rather use the PHP version if there is one.  TIA!

     

     

    Edit:  let me try to make this a bit more clear:

     

    so in my ideal form, the array looks similar to:

        [20] => Monday - November 16, 2009
        [21] => 11/16/2009  12:00
        [22] => 3

     

    my problem array looks like:

        [20] => Monday - November 16, 2009
        [22] => 11/16/2009  12:00
        [23] => 3
    

     

    this most recent set is of data is after the unset of the blank field was done on [21].  with this last array, is there a sort function i can pass so that it will reorder the keys so they are in order again with [22] with the date then becomes [21] and so on...

     

    does that clear it up?

  3. PHP 5.3.1

    Windows 2003/IIS 6

    MySQL ??

     

    I'm building a page that will import some information into a database that is programatically generated so I don't have any control over how the archives are presented.

     

    Basically, I'm trying to use the Zlib reading functions in order to parse these files and archives that contain more files to extract data I need and write it to a database.  The problem is that because there are nested archives within the parent archive, when I've tried to parse that parent file with gzfile() or gzdecode(), it starts opening the text files underneath, but once it hits the other gz files, it shows garbled/encoded information.  I know it's not much but this is what I've tried so far:

     

    <?php
    include("func.php");
    ?>
    <html>
    <body>
    <pre>
    <?php 
    $target = "tmp_dbg/"; 
    $target = $target . basename( $_FILES['debug']['name']) ; 
    $ok=1; 
    if(move_uploaded_file($_FILES['debug']['tmp_name'], $target)) 
    {
    	echo "The file ". basename( $_FILES['debug']['name']). " has been uploaded<br />";
    } 
    else {
    	echo "Sorry, there was a problem uploading your file.";
    }
    
    $file_name = $target;
    
    $lines = gzfile($file_name);
    
    //$lines = gzdecode($lines);
    //print_r($lines);
    
    foreach ($lines as $line) {
    	echo $line;
    }	
    
    ?> 
    </pre>
    </form>
    </body>
    </html>

     

    Can anyone offer any guidance on how I would recursively parse a parent GZ file and read all files (including embedded GZ files and their associated content) so I can start parsing this data?

     

    TIA!

  4. rajiv,

     

    that seemed like it was going to work but didn't... the array resorted to:

     

    [EPS] => Array
                    (
                        [0] => Array
                            (
                                [uts] => 1259755200
                                [amount] => 1.6
                            )
    
                        [1] => Array
                            (
                                [uts] => 1259751600
                                [amount] => 14.63
                            )
    
                        [2] => Array
                            (
                                [uts] => 1259748000
                                [amount] => 20.29
                            )
    
                        [3] => Array
                            (
                                [uts] => 1259744400
                                [amount] => 20.54
                            )
    
                        [4] => Array
                            (
                                [uts] => 1259737200
                                [amount] => 155.22
                            )
    
                        [5] => Array
                            (
                                [uts] => 1259733600
                                [amount] => 155.54
                            )
    
                        [6] => Array
                            (
                                [uts] => 1259730000
                                [amount] => 156.28
                            )
    
                        [7] => Array
                            (
                                [uts] => 1259726400
                                [amount] => 154.57
                            )
    
                        [8] => Array
                            (
                                [uts] => 1259722800
                                [amount] => 152.06
                            )
    
                        [9] => Array
                            (
                                [uts] => 1259719200
                                [amount] => 107.6
                            )
    
                        [10] => Array
                            (
                                [uts] => 1259715600
                                [amount] => 103.93
                            )
    
                        [11] => Array
                            (
                                [uts] => 1259712000
                                [amount] => 108.37
                            )
    
                        [12] => Array
                            (
                                [uts] => 1259708400
                                [amount] => 111.47
                            )
    
                        [13] => Array
                            (
                                [uts] => 1259704800
                                [amount] => 107.03
                            )
    
                        [14] => Array
                            (
                                [uts] => 1259701200
                                [amount] => 102.17
                            )

     

    any thoughts?

  5. I'm trying to use array_multisort() to sort an array's 3rd dimension by it's 5th dimension.  The code I'm trying is:

     

    array_multisort($_SESSION['data']['EPS'], $_SESSION['data']['EPS'][0]['amount'], SORT_NUMERIC, SORT_ASC);

     

    and the array looks like:

     

    [EPS] => Array
                    (
                        [0] => Array
                            (
                                [uts] => 1259744400
                                [amount] => 20.54
                            )
    
                        [1] => Array
                            (
                                [uts] => 1259748000
                                [amount] => 20.29
                            )
    
                        [2] => Array
                            (
                                [uts] => 1259751600
                                [amount] => 14.63
                            )
    
                        [3] => Array
                            (
                                [uts] => 1259755200
                                [amount] => 1.6
                            )
    
                        [4] => Array
                            (
                                [uts] => 1259672400
                                [amount] => 98.02
                            )
    
                        [5] => Array
                            (
                                [uts] => 1259676000
                                [amount] => 104.65
                            )
    
                        [6] => Array
                            (
                                [uts] => 1259679600
                                [amount] => 101.4
                            )

     

    and obviously the 1.6 should be first.  please advise...

  6. i have a page that collects a supplied file, uploads it, and processes it.  this works fine on my hosted web server.  i'm trying to move this page/site locally, so i installed php 5.3.1 on win2k3/iis6 and while my phpinfo() works fine indcating that its' set up and running correctly, when I run my site/page it was built for, the initial page loads with no errors but much (but not all) of my PHP code is written to the page. 

     

    any thoughts?

  7. if i have an array that looks like:

     

    [EPM] => Array
                    (
                        [0] => Array
                            (
                                [uts] => 1255849200
                                [amount] => 6.45
                            )
    
                        [1] => Array
                            (
                                [uts] => 1255852800
                                [amount] => 7.32
                            )
    
                        [2] => Array
                            (
                                [uts] => 1255856400
                                [amount] => 7.12
                            )
    
                        [3] => Array
                            (
                                [uts] => 1255860000
                                [amount] => 7.03
                            )
    
                        [4] => Array
                            (
                                [uts] => 1255863600
                                [amount] => 7.38
                            )

     

    ...how can i sort "EPM" based off of the ['EPM'][$x]['amount'] value?  any pointers?

  8. PHP 5.3.1

    Win 2K3-64bit/IIS 6

     

    I used the MSI installer to install PHP and selected IIS6 with the non-fast IIS installer.  I've done the following actions since then:

     

    -  Installed PHP to C:\PHP. 

    -  Copied php.ini to C:\Windows. 

    -  Created Virtual Directory for my test-site

    -  Enabled default.php and index.php for the VD

    -  Created an website extension for PHP pointing to the php-cgi.exe and set to Allowed

    -  Restarted IISAdmin

     

    Every time I access the page, http://localhost/mysite/test.php, the php files is attempted to be downloaded.  test.html runs fine but when i change it to test.php, it tries to download the php file.

     

    any thoughts?

     

    why is the Windows install of PHP always so problematic?  I've never had it work right "right out of the box." 

     

    Edit:  I followed http://www.php.net/manual/en/install.windows.installer.msi.php and the comments.

  9. patronizing people trying to help you doesn't help your cause Gayner.  you need to read up on:

     

    http://us2.php.net/manual/en/function.mktime.php

    and

    http://us2.php.net/manual/en/function.date.php

     

    but to be more direct since you're offering no constructive feedback, take this for example:

     

    $ptime = "9/20/2009 10:20:59";
    
    $tempArray = explode(" ", $ptime); #break string up by the space char
    $dateArray = explode("/", $tempArray[0]); #break date fragment up by "/"
    $timeArray = explode(":", $tempArray[1]); #break time fragment by ":"
    
    #convert to unix timestamp
    $timestamp = mktime($timeArray[0], $timeArray[1], $timeArray[2], $dateArray[0], $dateArray[1], $dateArray[2]);
    
    #now u can convert to any date/time format you want since u have the unix timestamp
    echo date("d m y h:i:s", $timestamp);
    

     

    Edit: and since you can't seem to offer constructive answers to people trying to help you, this will be the last time i help you.  best of luck.

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