Jump to content

ober

Staff Alumni
  • Posts

    5,327
  • Joined

  • Last visited

Posts posted by ober

  1. I'm just trying to determine if the user is logged into a Joomla site and inside the Session, they have objects that hold the information.  But how do I access those objects?

     

    $_SESSION['__default'][$user->$username];

     

    ?  Nothing I try seems to work.

     

    Here is the structure of the dump from $_SESSION:

    Array
    (
        [__default] => Array
            (
                [session.counter] => 3
                [session.timer.start] => 1308682834
                [session.timer.last] => 1308682837
                [session.timer.now] => 1308682837
                [session.client.browser] => Mozilla/5.0 (Windows NT 6.1; rv:5.0) Gecko/20100101 Firefox/5.0
                [registry] => JRegistry Object
                    (
                        [_defaultNameSpace] => session
                        [_registry] => Array
                            (
                                [session] => Array
                                    (
                                        [data] => stdClass Object
                                            (
                                            )
    
                                    )
    
                            )
    
                        [_errors] => Array
                            (
                            )
    
                    )
    
                [user] => JUser Object
                    (
                        [id] => 0
                        [name] => 
                        [username] => 
                        [email] => 
                        [password] => 
                        [password_clear] => 
                        [usertype] => 
                        [block] => 
                        [sendEmail] => 0
                        [gid] => 0
                        [registerDate] => 
                        [lastvisitDate] => 
                        [activation] => 
                        [params] => 
                        [aid] => 0

     

    There is more to it but I need to access the stuff in the 'user' object.

  2. You're basically just generating a series of forms.  The first collects information about the database they want to use (will need to be setup already), and the next step would be just running the SQL queries to create the tables.  Then you populate the tables with whatever information is necessary, including the login information they provide.  Walking you through the entire process is kind of a lot to ask.

  3. I'm using the PHPActiveRecord ORM and trying to create a basic query and I would have this same problem if I was writing direct SQL.  How do I pass a database function to a query and have it be parsed correctly?

     

    $trail = new AuditTrail();
    $trail->aid = "TABLESEQ.nextval";
    $trail->uname = $usr;
    $trail->adatetime = date("n/j/Y h:i:s A");
    $trail->acat = $cat;
    $trail->aaction = $action;
    $trail->contract_id = $contract;
    $trail->save(); 

    The 'TABLESEQ.nextval' is an Oracle database 'autonumber' type functionality.  I tried doing it with single quotes, double quotes, no quotes.  How do I get it to recognize it as a DB function?

     

    The SQL query would look like: "INSERT INTO TABLE (aid, uname, adatetime, acat, aaction, contract_id) VALUES (TABLESEQ.nextval, '$usr', '".date(n/j/Y h:i:s A)."', '$cat', '$action', '$contract')"

     

    Any ideas what I'm doing wrong?

  4. Ok, got it figured out.  I swear I added the path to the oracle instant client to the windows PATH previously but I guess not.  So here are the steps needed if anyone else needs to do this on Windows:

     

    1) Follow this tutorial with the latest versions of Apache/PHP: http://www.vertstudios.com/blog/php-apache-installation-tutorial/

    2) Follow the notes here: http://www.oracle.com/technetwork/articles/technote-php-instant-084410.html, specifically this section: Enabling the PHP OCI8 Extension on Windows

    3) Make sure the OCI8 and the PDO OCI extensions are enabled in PHP.

    4) Profit (or something).

     

    :D

  5. I am trying to get Apache 2.2 and PHP 5.3.6 up and going and connected to an Oracle database.

     

    I have Apache and PHP playing nicely at this point.  My problem is the PDO driver for Oracle.  I've uncommented the php_pdo_oci extension in php.ini and it seems to be adding it in after an Apache restart but the driver isn't there.

     

    The weird part is that this is in the configure command in phpinfo:

     

    "--with-pdo-oci=D:\php-sdk\oracle\instantclient10\sdk,shared" "--with-oci8=D:\php-sdk\oracle\instantclient10\sdk,shared" "--with-oci8-11g=D:\php-sdk\oracle\instantclient11\sdk,shared" "

     

    Those paths don't even exist.  I don't even have a D drive.  I think maybe if I could change those it would work.

     

    OH, and I'm trying to use PHPActiveRecord, which only has a PDO extension for Oracle... which is why I'm trying to get PDO working.

     

    But when I go to a page that actually calls for a connection using PDO, it just says that it can't find the driver.

     

    Can anyone help me??  I've been stuck on this for 2 days!

  6. OK, so replacing all newline characters in the data in the database cleared the problem, so I just did that and now I'm replacing them as they're imported as well.  Problem solved.

  7. So if I do this:

     

    SELECT object, HEX(object) FROM table

     

    The duplicates are being caused by an additional '0D' on the objects that are otherwise similar.  Now I have to figure out how to strip those.

     

    I don't think it's necessarily an encoding thing anymore.

  8. OK, it's not a problem with the query.  If I select two rows from the same object and do nothing but save them, it updates the name of the object on one of them and the output magically works again.

     

    So now I'm wondering if the problem is an encoding problem?  That column is current set to a collation of latin1_swedish_c1.  Should I change it?

     

    The data is coming from 2 different sources so it is possible that the encoding on one of them could be different.

  9. I have data stored like this:

     

    object1 | typeA

    object1 | typeB

    object2 | typeA

     

    etc.

     

    I want the output to be as follows:

                  typeA | typeB

    object1      X    |    X

    object2      X

     

    Instead, I'm getting:

     

                  typeA | typeB

    object1      X    | 

    object1            |    X

    object2      X

     

    My query is as follows:

     

    SELECT object, MAX( IF(datatype='SCH','X','') ) AS 'SCH', MAX( IF(datatype='VV','X','') ) AS 'VV', MAX( IF(datatype='RS','X','') ) AS 'RS', MAX( IF(datatype='SP','X','') ) AS 'SP', MAX( IF(datatype='VL','X','') ) AS 'VL', MAX( IF(datatype='Blah','X','') ) AS 'Blah', MAX( IF(datatype='CT','X','') ) AS 'CT', MAX( IF(datatype='MltEdg','X','') ) AS 'MltEdg', MAX( IF(datatype='TW','X','') ) AS 'TW', MAX( IF(datatype='TG','X','') ) AS 'TG', MAX( IF(datatype='Argus','X','') ) AS 'Argus', MAX( IF(datatype='CS','X','') ) AS 'CS', MAX( IF(datatype='ND','X','') ) AS 'ND', MAX( IF(datatype='SIP','X','') ) AS 'SIP', MAX( IF(datatype='QVM','X','') ) AS 'QVM', MAX( IF(datatype='PR','X','') ) AS 'PR', MAX( IF(datatype='YF','X','') ) AS 'YF', MAX( IF(datatype='BC','X','') ) AS 'BC', MAX( IF(datatype='SC','X','') ) AS 'SC', MAX( IF(datatype='MS','X','') ) AS 'MS' FROM table WHERE datatype != 'sy' AND datatype != 'st' AND datatype != 'ry' GROUP BY object ORDER BY object

     

    The MAX/IF statement is for each 'type' mentioned above.  Is there any way to do this without doing more looping and running more queries?

  10. <?php
    header('Cache-Control: no-cache, no-store, max-age=0, must-revalidate');
    header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); // Date in the past
    header('Pragma: no-cache');
    header('Cache-Control: private',false);
    header('Content-Type: binary'); // plain text file
    $filename = 'test.dat';
    header("Content-Disposition: attachment; filename=\"".$filename."\";" );
    header("Content-Length: ".filesize($filename));
    readfile("$filename");
    ?>

     

    Well, I wrote the results to a .dat file and now it is serving it appropriately.  WEIRD.  Oh well, all is well that ends well.

  11. Nope, IIS.  And here's the weird thing.  When I browse on the server and go to the properties of the folder, the 'read only' checkbox is 'half-checked', if you know what I mean.  I uncheck it, hit ok, come back in and it's back to 'half-checked'... like I never touched it.

     

    But the weird thing is, the temp folder where I was able to write to also has the same setting.

  12. I can't do that because the file isn't in the web server's path.  I'm actually grabbing it from outside of the public access.  So I have to be able to do this.  I guess my other option would be to copy it to another location after processing it, but it seems to be insane that this isn't possible.  It works great in FF...  :'(

  13. I am generating a snapshot of some data and giving the users the ability to download that snapshot.  I am trying to serve that file to the users and it works great in Firefox, but the IE users just get a blank file.  I'm using the following:

     

    <?php
    header('Cache-Control: no-cache, no-store, max-age=0, must-revalidate');
    header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); // Date in the past
    header('Pragma: no-cache');
    header('Content-Type: text/plain; charset=ISO-8859-1'); // plain text file
    $filename = 'C:\WINDOWS\Temp\snapshot.txt';
    header("Content-Disposition: attachment; filename=\"".$filename."\";" );
    header("Content-Length: ".filesize($filename));
    readfile("$filename");
    ?>

     

    I've changed multiple items several times and each works in FF, but none work in IE.  Is anyone aware of any IE specific headers that need to be sent?  It's just a plain text file, nothing fancy.

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