logs archiveIRC Archive / Freenode / #php / 2015 / September / 23 / 1
fellayaboy
im able to connect to ldap server and authenticate users, however, whats the best method to allow certain users from ldap/active directory access to the site.
should i create a database with the string: username and use a regex to match whats in database?
nobody44
hello, I am writing a LDAP manager (more to learn about PHP, than to rather publish it) and I need to parse the attribute types I get from OpenLDAP, e.g.
attributetype ( 1.2.840.113549.1.9.1
NAME ( 'email' 'emailAddress' 'pkcs9email' )
DESC 'RFC3280: legacy attribute for email addresses in DNs'
EQUALITY caseIgnoreIA5Match
SUBSTR caseIgnoreIA5SubstringsMatch
php-bot
Muting nobody44 for 20 seconds to prevent them from flooding
nobody44
welp... anyway, I need to "parse" this attribute type, but I don't write to parse this actual string... isn't there some kind of library for this?
I looked at PHPLDAPAdmin for this kind of function, and I found it, but it is really ugly...
Bad_Advice_Cat
nobody44, did you had a look at this: http://php.net/manual/en/book.ldap.php
nobody44
Bad_Advice_Cat: parts of it... it doesn't offer what I need though :-/
Bad_Advice_Cat
nobody44, what are you looking for?
Describe thoroughly.
Dr-007
how can i convert [query] => sauce_id=30 to array('sauce_id' => 30) ?
should i foreach this? or is there a function that could do this for me
sorabji
what format is that Dr-007 ?
         

Dr-007
where $query = 'sauce_id=30'
string
sorabji
what made it?
nobody44
I get a string from the LDAP, like "attributetype (1.2.3.4.5.6 NAME ('email' 'emailAddress' 'pkcs9email' ) DESC 'RFC3280: legacy whatever' ... )" and I would like to have a function, that parses this string and returns a usuable array or class
Dr-007
parse_url($url);
sorabji
ahh, you probably want parse_str
Dr-007
i've got another query array where i want to merge the sauce_id=30 in the mix
let me check it out
sorabji
i wonder why you have it in that format though
some more information would be welcome :)
relipse2
netbeans: how do I create a new project with existing directory?
sorabji
relipse2: check netbeans docs. we don't support their software, sorry
Dr-007
sorabji, thanks thats it. this is what happends: the URL /manager/sauces/create?sauce_id=30 is getting passed to the PHP function parse_url. this gives me an array with $parsed['query'] and ['path'] if the query is set i'm now using your suggested parse_str to convert the string to an array
sorabji
why are you parsing it yourself?
query params should already be in $_GET
Bad_Advice_Cat
nobody44, also, paste the code to wrote so far.
Dr-007
sorabji, because i want to pass the url query paramaters that are currently in the browsers navigation to an inpage button. so when you click the button all these parameters will get passed to the next page
+1 parameter
that the button adds
nobody44
Bad_Advice_Cat, I didn't write any yet... I was just looking at the PHP LDAP Admin code and thought it was ugly code...
I think i will try to write some kind of regular expression... should be doable...
sorabji
Dr-007: my point is, going through parse_url and parse_str gets to exactly the place you already had with $_GET
gets you*
Dr-007
ah true
my mistake :p
$url = $_SESSION['select_redirect']; $parsed = parse_url($url);
select_redirect is getting passed along via another function into the _SESSION
so its not the current URL its parsing
but the one it should redirect to
sorabji
interesting
Dr-007
and the destination url (select_redirect) should get that extra parameter
if you say so :)
sorabji
why are you storing the query params in string form as opposed to an array?
then you can just add your extra values to the array and http_build_query
Dr-007
to not mess up my _session to much
         

sorabji
how would an array mess up your session?
Dr-007
then i need to have a second _session for the query args.
__adrian
?
sorabji
and that's bad because?
__adrian
"second session" ?
sorabji
session value i'm assuming
Dr-007
an extra array in the _session
__adrian
ok
Dr-007
and thats bad because it gets messy
__adrian
sorabji | and that's bad because?
sorabji
how exactly?
Dr-007
+ this function was already up and running
as a session string
__adrian
then do it cleanly
sorabji
cramming everything into a single string
only to break it apart and cram it back together
__adrian
^-- that's messy
Dr-007
nah its not
sorabji
that strikes me as messier
Dr-007
it perfectly describes what it does
select_redirect is the URL the site should redirect to
sorabji
not worth arguing about. have fun :)
Dr-007
thaaaanks
ermajn
hello, when I print my xml with getXMLDOM()->saveXML() I got normal number format in cells, like 27.610,06
but when I do it with getXMLDOM(), so no XML, but DOM object..
I got it formated: 27610.06
can someone explain this to me pls?
TML
ermajn: What is "getXMLDOM()"?
cythrawll
ermajn, sounds like something is paying attention to locales
because 27610.06 is like no formatting.
the other looks liek something somewhere is applying locale
TML
27610.06 could also be the C/POSIX locale
I'm still curious what this getXMLDOM function is, myse,f
s/se,f/self/
I'm going to be typo-ridden for a bit. New keyboard layout is just slightly different enough that I'm having trouble retraining muscle memory
Bad_Advice_Cat
(Action) waves.
caffinated
doesn't sound like something DomDocument would do.
Gonna bet there is something else reformatting the locale.
intellix
getting this error when I try to make an API call to my php app:
'PDOException' with message 'could not find driver'. But I have pdo-pgsql installed. if I "php -i | grep pgsql" it claims that I have the PDO driver for pgsql
TML
lol
poor guy
intellix: The normal behaviour on most distros of Linux is for "php -i" and your web server to use different PHP configurations
intellix: You probably just need to enable the module in the httpd
and restart the httpd process
intellix: on Debian-based distros, there
's even a tool for it
« prev 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 next »