Jump to content

countnikon

Members
  • Posts

    19
  • Joined

  • Last visited

    Never

Posts posted by countnikon

  1. Here is Zend's anser to the problem:

    Hello Michael,

    What you will have to do is download the PHP 5.0.5 PHP binaries from php.net, extract them, locate the mysql.so file and copy it into the extension directory for Zend Core for Oracle, and then manually enable it via the php.ini file(extension=mysql.so). That will require a restart. This is not supported as it involves the use of a 3rd party driver. Newer versions of Zend Core for Oracle already come with the MySQL extension(disabled by default) and all you have to do is enable it.

    Please don't hesitate to contact us with any additional questions.

    -----------------------------------------------------------
    Thank you for contacting Zend Support Center.
  2. I'm trying to get the Oracle Instant Client working with PHP on FC4.  All the guides I see say that you need to reinstall PHP.  However, I still need MySQL on this server for certain internal applications that we don't want to use oracle for.  Does anybody know an easy way around this?  I really need to be able to run both.
  3. I am a programmer for a Gas Compressor Manufacturer. 

    I work with PHP, MySQL, AJAX, Oracle, and BaaN 4GL. 

    Currently I'm developing a sorta E-Commerce site, and building custom web applications to display information to people easier than in our ERP system. 
  4. I built this class for LDAP authentication and Schema Searches.  I thought you all might like it.  It also handle more than one OU which all the LDAP classes I've seen do not handle.  Here it is for what it's worth.

    [code]
    <?PHP
    /*
    ******************************************************************************************
    LDAP Class                                                                               
    Class Created 7-5-06                                                                     
    This class allows for LDAP searches and authentication against AD.                       
    You can use a foreach loop in your code that calls this class to display all entries     
    ------------------------------------------------------------------------------------------
    Example LDAP Search.                                                                     
    ------------------------------------------------------------------------------------------
    $ouArray = array('acct','sales','purchasing','exec','it');                                       
    $ldap = new ldap("dc.domain.com","389","dc=domain,dc=com"); 
    $ldap->ldapConn();                                                                       
    $bind=$ldap->ldapBind("ldapuser","ldappass");                                         
    if($bind==false)                                                                         
      echo "Bind Failed<br>";
    //This goes as follows
    //ldapSearch('what you want to pull','self explanitory','your ou array','what you are searching against')
    //you can search against anything in the schema.                                                               
    $description = $ldap->ldapSearch("description","$usrname",$ouArray,"samaccountname");   
    if($description)                                                                         
    {                                                                                       
      foreach($description as $output)                                                       
        $company=$output;                                                                   
    }                                                                                       
    ------------------------------------------------------------------------------------------
    Example Ldap Authenticate                                                               
    ------------------------------------------------------------------------------------------
    $usrname=$_POST['usrname'];                                                             
    $pass=$_POST['pass'];                                                                   
    $ldap = new ldap("dc.domain.com","389","dc=domain-systems,dc=com"); 
    $ldap->ldapConn();                                                                       
    $auth = $ldap->ldapAuthenticate("$usrname","$pass");                                     
    if($auth)                                                                               
      echo "Successful Authentication<br>";                                                 
    else                                                                                     
      echo "Authentication Failed.";                                                         
    ------------------------------------------------------------------------------------------
    Modifications                                                                           
    ------------------------------------------------------------------------------------------
    ******************************************************************************************
    */
    class ldap
    {
      var $ldapConn; //ldap connection storage variable
      var $ldapBind; //ldap bind storage variable
      var $entries;  //ldap entries variable
      var $ldapLookupUser;
      var $ldapLookupPass;
      var $server;
      var $port;
      var $by;
      var $search;
      var $baseDN;
      //Function to create the ldap object
      function ldap($server,$port,$baseDN)
      {
        $this->server=$server; //sets the dc server
        $this->port=$port; //sets the port to connect to AD
        $this->baseDN=$baseDN; //Sets the base DN for LDAP searches
      }
      //connects to the AD server
      function ldapConn()
      {
        //connects to AD server
        $this->ldapConn = @ldap_connect($this->server,$this->port);
        return $this->ldapConn;
      }
      //Binds to the AD server so you can do lookups against it
      function ldapBind($ldapLookupUser,$ldapLookupPass)
      {
        if(@ldap_bind($this->ldapConn,$ldapLookupUser,$ldapLookupPass))
        {
      $this->ldapBind = @ldap_bind($this->ldapconn,$ldapLookupUser,$ldapLookupPass);
      //returns true if you are able to bind
      return true;
    }
        else
          return false;
      }
      //Authenticates a User against AD
      function ldapAuthenticate($usrname,$password)
      {
        if(@ldap_bind($this->ldapConn,$username,$password))
          return true;
        else
          return false;
      }
      //Searches the ldap schema
      function ldapSearch($by,$search,$ous,$searchby)
      {
        $c=0;
        foreach($ous as $ou) //This foreach loop allows the searching through multiple OU's'
        {
          /*This line searches the AD Schema. 
          It is setup so that you can search for any schema item by any schema item.
          */
      $read=ldap_search($this->ldapConn,"ou=$ou,$this->baseDN", "$searchby=*$search*");
      //This line reads in the entries for output
          $entries = ldap_get_entries($this->ldapConn, $read);
          //Loops through the entries and puts them in the array values
          for ($i=0; $i<$entries["count"]; $i++)
          {
            if($entries[$i][$by][0])
              $values[$c]=$entries[$i][$by][0];
            $c++;
          }
    }
        return $values; //returns the values of the search
      }
    }
    ?>
    [/code]
  5. Hello Everybody,

    I'm having trouble with this class I'm making for doing LDAP authentication and Lookups.  However, I cannot output my results.  Can somebody shed some light on this please?

    [code]
    <?PHP
    class ldap
    {
      var $ldapconn; //ldap connection storage variable
      var $ldap_bind; //ldap bind storage variable
      var $entries;  //ldap entries variable
      var $dc = "my dc server";
      var $port = 389;
      var $ldapLookupUser = "ldaplookupuser";
      var $ldapLookupPass = "ldaplookup pass";
     
      function ldapConn()
      {
        $this->ldapconn = @ldap_connect($dc,$port);
      }
      function ldapBind()
      {
        $this->ldap_bind = @ldap_bind($this->ldapconn,$ldapLookupUser,$ldapLookupPass);
      }
      function ldapAuthenticate()
      {
        if(@ldap_bind($this->ldapconn,$username,$password))
          return true;
        else
          return false;
      }
      function ldapSearch($by,$search,$ou)
      {
        $read = @ldap_search($this->ldapconn, "ou=$ou,dc=mydc,dc=net", "samaccountname=*$search*");
        $entries = @ldap_get_entries($this->ldapconn, $read);
        for ($i=0; $i<$entries["count"]; $i++)
        {
          if($entries[$i][$by][0])
            $values = $values.$entries[$i][$by][0];
        }
        return $values;
      }
    }
    $ldap = new ldap;
    $ldap->ldapConn();
    $ldap->ldapBind();
    $results = $ldap->ldapSearch("mail","myusrname","myou");
    echo $results;
    ?>
    [/code]
    I know the ldap searches are working because it is not erroring out anymore.  Any help would be appreciated.
  6. [!--quoteo(post=379342:date=Jun 2 2006, 09:44 AM:name=Pudgemeister)--][div class=\'quotetop\']QUOTE(Pudgemeister @ Jun 2 2006, 09:44 AM) [snapback]379342[/snapback][/div][div class=\'quotemain\'][!--quotec--]
    Hi all i'm back!

    I have a new prob with my script-I am trying to work my way towards making my own login script.

    What I am trying to achieve atm is a register script that scans the database table to make sure the username entered in the form is not already used.

    I got so far but am stuck.

    These are the three pieces of code used:

    [b]dbinfo.inc.php[/b]

    [!--coloro:#3333FF--][span style=\"color:#3333FF\"][!--/coloro--]<?
    mysql_connect ("localhost", "username", "password") or die ('You cannot connect to the database because: ' . mysql_error());
    mysql_select_db('database') or die(mysql_error());
    ?>[!--colorc--][/span][!--/colorc--]
    [b]test_mysql.php[/b]

    [!--coloro:#3333FF--][span style=\"color:#3333FF\"][!--/coloro--]<?

    echo '<center>Game Testing</center><br><br><br>';
    //Register Form//
    echo 'Register';
    echo '<form action="register.php" method="post">';
    echo 'Username:<input type="text" name="username"><br>';
    echo 'Password:<input type="text" name="password"><br>';
    echo 'First Name:<input type="text" name="first_name"><br>';
    echo 'Last Name:<input type="text" name="last_name"><br>';
    echo '<input type="Submit"></form><br><br><br>';

    //Login Form//
    echo 'Login';
    echo '<form action="login.php" method="post">';
    echo 'Username:<input type="text" name="username"><br>';
    echo 'Password:<input type="text" name="password"><br>';
    echo '<input type="submit"></form>';

    ?>[!--colorc--][/span][!--/colorc--]
    [b]register.php[/b]

    [!--coloro:#3333FF--][span style=\"color:#3333FF\"][!--/coloro--]<?

    include ("dbinfo.inc.php");

    $username=$_POST['username'];
    $password=$_POST['password'];
    $first=$_POST['first_name'];
    $last=$_POST['last_name'];

    $query_1="SELECT $user FROM users";
    mysql_query($query_1) or die(mysql_error());

    if ($query_1==null){
    $query_2="INSERT INTO users VALUES('$username','$password','$first','$last','')";
    mysql_query($query_2) or die(mysql_error());
    mysql_close();
    }else{
    echo 'Sorry-This Username Has Already Been Registered';
    }

    ?>[!--colorc--][/span][!--/colorc--]
    Now I know that being me-there will be a veriety of errors in this-though the error I m curently getting from the browser is:

    "You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'FROM users' at line 1"

    Noob needing help again lol

    Pudgemeister

    P.S. Username, Pasword, and Database name are 100% correct this time-loleee
    [/quote]
    Why is your query statment SELECT $user FROM users? It should be SELECT usrname FROM users where usrname='$user'; I think that might get you.
  7. You have to use ajax for that. Go to [a href=\"http://www.ajaxfreaks.com\" target=\"_blank\"]http://www.ajaxfreaks.com[/a] for tutorials on how to use it. It's really pretty simple once you get your JavaScript down. If you need any help, email me at sheeran.michael at gmail.com. I've been doing a ton of AJAX Apps for the company I work for and would be more than happy to help.
  8. I tried it out and it was still a no go. I also tried moving the $cins=$_COOKIE['cins']; to after the header information and it still didn't work.

    Well after reading the PHP Manual, I read that the cookie is not available until the next page refresh. I figured out what I should do now. I should have read the manual first. Sorry ya'll.

    For future reference, here is what I had to do.
    [code]
    <?PHP
    if(isset($_GET['id']))
    {
      setcookie('cins','',time()-345600);
      setcookie('cins',$_GET['id'],time()+345600);
    }
    if(!isset($_GET['id']))
      $cins=$_COOKIE['cins'];
    else
      $cins=$_GET['id'];
    ?>
    [/code]
  9. I'm trying to set a cookie to hold a particular $_GET['id'] so that it holds a value for 4 days. The reason being is that I always want a value set for the site. Here's the code.

    [code]
    if(isset($_GET['id']))
    {
      setcookie('cins','',time()-345600);
      echo "Unset Cookie ".$_GET['id']." ".$_COOIKE['cins']."<br>";
      setcookie('cins',$_GET['id'],time()+345600);
      echo "Set Cookie ".$_GET['id']." ".$_COOKIE['cins']."<br>";
    }
    if(isset($_COOKIE['cins']))
      $cins=$_COOKIE["cins"];
    echo "Set CINS ".$cins."<br>";
    [/code]

    However, when I change id's this is what happens.
    [!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]
    Unset Cookie 400327
    Set Cookie 400327 810011
    Set CINS 810011
    [/quote]
    It unsets the cookie, sets the cookie to be the new value, and still uses the old cookie value to set $cins.
    any ideas what could be going on? I appreciate the help.
×
×
  • 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.