Jump to content

johntp

Members
  • Posts

    95
  • Joined

  • Last visited

    Never

Everything posted by johntp

  1. Hey guys I got this script from http://www.phpguru.org/static/TableEditor.html and http://www.phpguru.org/downloads/TableEditor/TableEditor.phps I have it setup how I want it for the most part, but i cannot figure out how to hide the empty fields. I have a noDisplay function I would like to call to but I'm not sure how to do this. my no Display function function noDisplay() { $args = func_get_args(); foreach ($args as $a) { if (isset($this->fields[$a])) { $this->fields[$a]['noDisplay'] = true; } } } how i view the table. /** * Handles viewing a row */ function handleView($id) { $quotedId = $this->dbQuote($id); foreach ($this->fields as $f => $v) { if (empty($v['noDisplay2'])) { $fields[] = $f; } } /** * Data filters */ if (!empty($this->dataFilters)) { $filters = implode(' AND ', $this->dataFilters); } else { $filters = 1; } $fields = implode(', ', $fields); list($tables, $joinClause) = $this->getQueryTables(); $row = $this->dbGetRow("SELECT $fields FROM $tables WHERE $joinClause AND $filters AND {$this->pk} = $quotedId"); if ($row === false) { $this->errors[] = 'Failed to find specified row'; return; } $this->parseResults($row); I talked to the guy who wrote the script and all he says is function RowCallback(&$row) { // Manipulate the row here } but i dont have any clue how to manipulate the row to call noDisplay on fields that are blank. I've been ripping my hair out over this so help is GREATLY Appreciated
  2. I was told by the guy who made this script: If it's the same field all the time, there's something like "hiddenColumns". If not, then define a callback function using AddCallback(). This function ia called just before each row is displayed so you can do anything you want to the row. The row data is passed as an arg. Use this for example: $editor->AddCallback('RowCallback'); //this goes on the index.php page function RowCallback(&$row) //this goes on the tableeditor.php page { // Manipulate the row here } the only problem is I don't know how to manipulate the row to only show fields with data in it.
  3. I'm not getting any errors such as PHP Parse error: syntax error, unexpected ';', expecting ':' in C:\Hickham Website\EDB\TableEditor.php on line 1203 But that code didn't hide the empty fields.
  4. Ok. Now im not getting any errors, I put <?else:?> but it still doesnt work.
  5. PHP Parse error: syntax error, unexpected ';', expecting ':' in C:\Hickham Website\EDB\TableEditor.php on line 1203 line 1203 was the: <?else?>
  6. These are the codes im using For the function function noDisplay2() { $args = func_get_args(); foreach ($args as $a) { if (!isset($this->fields[$a]) || $fields[$a] != "") { //For one you had this statement true if the field HAS a value $this->fields[$a]['noDisplay2'] = true; } } } To show the table /** * Handles viewing a row */ function handleView($id) { $quotedId = $this->dbQuote($id); foreach ($this->fields as $f => $v) { if (empty($v['noDisplay2'])) { $fields[] = $f; } } /** * Data filters */ if (!empty($this->dataFilters)) { $filters = implode(' AND ', $this->dataFilters); } else { $filters = 1; } $fields = implode(', ', $fields); list($tables, $joinClause) = $this->getQueryTables(); $row = $this->dbGetRow("SELECT $fields FROM $tables WHERE $joinClause AND $filters AND {$this->pk} = $quotedId"); if ($row === false) { $this->errors[] = 'Failed to find specified row'; return; } $this->parseResults($row);
  7. I'm getting this at the bottom of the page, and it's not hiding what i need it to. Here is a look at the code being used for this. http://www.phpguru.org/static/TableEditor.html and http://www.phpguru.org/downloads/TableEditor/TableEditor.phps
  8. I forgot to mention, I have a function that is called noDisplay, which will hide the table so could i do something like if(!$field == "") ['noDisplay'] = true;
  9. Hey guys I have a nifty script, but when i display stuff from the DB it even shows empty fields. I want to only see fields with info in them. Any ideas?
  10. Thanks for the reply I tried it but still the same error. Debug 3 ???
  11. It looks as if it's binding because it gets past the binding part. Wouldnt i get an error if it wouldnt let me bind from Debug 2?
  12. I couldn't get that script to work, but i got this one almost there. <?php //include_once("include/session.inc"); //include_once("include/functions.inc"); //PageTop(); //LocBar("Financial Department -> Login"); if( isset($_POST['login']) && isset($_POST['password']) ) { //LDAP stuff here. $username = trim($_POST['login']); $password = trim($_POST['password']); //TabTop("Authenticating..."); $ds = ldap_connect('XXX.XXX.XXX.XXX'); //Can't connect to LDAP. if( !ds ) { echo "Error in contacting the LDAP server -- contact "; echo "technical services! (Debug 1)"; //TabBot(); exit; } ldap_set_option($ad, LDAP_OPT_PROTOCOL_VERSION, 3); //Connection made -- bind anonymously and get dn for username. $bind = @ldap_bind($ds); //Check to make sure we're bound. if( !bind ) { echo "Anonymous bind to LDAP FAILED. Contact Tech Services! (Debug 2)"; //TabBot(); exit; } $search = ldap_search($ds, "ou=People,dc=somthing,dc=somthing,dc=somthing,dc=com", "uid=$username"); //Make sure only ONE result was returned -- if not, they might've thrown a * into the username. Bad user! if( ldap_count_entries($ds,$search) != 1 ) { echo "Error processing username -- please try to login again. (Debug 3)"; redirect("./login.php"); //TabBot(); exit; } $info = ldap_get_entries($ds, $search); //Now, try to rebind with their full dn and password. $bind = @ldap_bind($ds, $info[0][dn], $password); if( !$bind || !isset($bind)) { echo "Login failed -- please try again. (Debug 4)"; redirect("./login.php"); //TabBot(); exit; } //Now verify the previous search using their credentials. $search = ldap_search($ds, "dc=somthing,dc=somthing,dc=somthing,dc=com", "uid=$username"); $info = ldap_get_entries($ds, $search); if( $username == $info[0][uid][0] ) { echo "Authenticated."; //TabBot(); $_SESSION['username'] = $username; $_SESSION['fullname'] = $info[0][cn][0]; redirect("../index.php"); exit; } else { echo "Login failed -- please try again."; redirect("./login.php"); //TabBot(); exit; } ldap_close($ds); exit; } ?> <form action=login.php method=post name=Auth> <?php //TabTop("Please Login"); ?> Please log in using your user name and your portal password:<p> <table cellspacing=3 cellpadding=3 class=ContentBodyTable> <tr> <td>Username: </td> <td><input type=text name=login size=16 maxlength=15></td> </tr> <tr> <td>Password: </td> <td><input type=password name=password size=16 maxlength=15></td> </tr> <tr> <td colspan=2><input type=submit value=Authenticate style='width:100'></td> </tr> </table> </form> <?php //TabBot(); ?> <!-- Set the focus to the login text field onload. <script language="JavaScript" type="text/javascript"> document.Auth.login.focus(); </script> --> </body> </html> I'm getting an error Error processing username -- please try to login again. (Debug 3) Any Clues? Thanks in advance
  13. Thanks, but where is this suppose to go? <?php try{ // $key -> This is a unique key to distinguish the connection, so you can recall it with getInstance() later // $host -> Hostname of the AD server // $base -> Default Base DN, something like: cn=Users,dc=Domain,dc=co,dc=com // $user -> Username to bind with (leave off if you want to bind anonymously) // $pass -> Password for bind user $ad = new ldap ($key,$host,$base,$user,$pass); $results = $ad->search('user=foobar'); //Return only keys and first values for attributes print_r($results); $results = $ad->search('user=foobar',null,true); //Return all attribute data print_r($results); } catch (ldapException $e) { die("LDAP Connection Failed: ".$e->getMessage()); } ?> Also what is ad in test.php and init.inc? should that be changed to something?
  14. does anyone else have an expanatory script that i could use to authenticate active directory useres in php?
  15. I could not get it to work, could you give me some instructions on what to change? also what is connect.inc?
  16. Hey guys, I have LDAP enabled on my server, and can get a connection to my ad server using my admin account, but I'm trying to make an intranet webpage where users are authenticated by Actice Directory. Any know how to do this?
  17. I did change the php.ini, but just tried it putting the phpmailer in the test folder and called to it. It displayed the test form and i ran the test and everything failed. Test results: test_wordwrap FAIL test_low_priority FAIL test_multiple_plain_fileattachment FAIL test_plain_stringattachment FAIL test_quoted_printable FAIL test_html am i doing something wrong?
  18. I've just downloaded phpmailer, and don't think i installed it right. I created an includes folder under c:\PHP\ and then put class.phpmailer.php and languages/phpmailer.lang-en.php when i try to run the test script i'm getting just a blank page. I'm pretty sure the problems is my structure can you please help me. C:\PHP\includes (path where i put the phpmailer files) C:\Appserv\www\test (the path where i'm running the script http://local-computer/test) Any ideas?
  19. I have been searching for hours for a resolution for this, but nothing works. They have alot of ASP scripts for it, but I think ASP is worthless most times. Basically what this is, is a request form where people enter all the info on the request they want, then it will store it in a database and shoot the IT department an email. I built the html form, and am very happy with it, and i can even get it to post to a DB, or Email, but not both. Also i cannot get the email to look neat, and was thinking maybe html-email? I am using PHP4 and phpMyAdmin - 2.9.2 Has anyone seen some usefull code for this to point me in the right direction? Mainly HTML email that i can stick the results of the form into and arrange it nice and neat, and posting to a database at the same time. This is long and probably somthing no one is interested in besides me, but help would be much appreciated. Thanks in advance.
  20. Yep, it worked like a charm. Thanks man your a life saver.
  21. Hey guys, I'm trying to use this script: <? echo date("D, F d, Y g:ia" ,time()); ?> The problem is that my webserver php.ini is set to GMT, whereas I am GMT -5, and cannot change the php.ini folder. Is there something i can add on to it to make it subtract 5 hours?
  22. Thanks alot guys problem solved
×
×
  • 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.