Re: [PHP] ldap add Invalid DN syntax

2010-05-04 Thread Manolis Vlachakis
solved as simple as i couldn't imagine...
for a reason was not accepting
the iconv anywhere else but...
[CODE]$info[cn] =iconv(Windows-1253,UTF-8,$data[$c]);
//echo |onoma--;
//echo $info[cn] ;
 $c++;
$info[sn] = iconv(Windows-1253,UTF-8,$data[$c]);[/CODE]

so for all the greeks out there this is the way is being done

-- 

On 3 May 2010 18:56, Manolis Vlachakis vlachakis.mano...@gmail.com wrote:


 the thing i just tried is with

   // Open a memory file for read/write...
   $fp = fopen('php://temp', 'r+');
   // ... write the $input array to the file using fputcsv()...
   fputcsv($fp, $input, $delimiter, $enclosure);
   // ... rewind the file so we can read what we just wrote...
   rewind($fp);
   // ... read the entire line into a variable...
   $data = fread($fp, 1048576); // [changed]
   // ... close the file...
   fclose($fp);
   // ... and return the $data to the caller, with the trailing newline from
 fgets() removed.

 and it comes back to me that is not an array
 does anyone think that this may cause the problem on the problem i face?


 On 3 May 2010 12:37, Manolis Vlachakis vlachakis.mano...@gmail.comwrote:

 and my code begins like this...

 $uploaddir =
 $_SERVER['DOCUMENT_ROOT'].'/webteam/voiko/public_html/uploads/';
 $file = $uploaddir . basename($_FILES['uploadfile']['name']);

 $data = file_get_contents($uploaddir . $_FILES[uploadfile][name]);


 $data=split([;\r],$data);

 ;

 $num = count($data);


 var_dump($data);

 
 and goes on as i show you on the last mails..





 On 30 April 2010 17:22, Manolis Vlachakis vlachakis.mano...@gmail.comwrote:

 on the array and on the server side i can see the names are added
 normally and with the correct encode(despite what i show you )
 and the only thing is tha i get that DN not valid...
 i used the \r cause i use it on my csv file at least one...
 but i am sure (i used a counter for the letters + i compered the name
 they are the same)

 so it is pretty strange why is not working...


 1.trust me after many times faced problems with delimiters i can tell you
 the correct is with [ ] and your delimiter in between
 2.print_r seems good exactly what i have in csv file..
 3.var_dump works fine counts everything and stuff but even though i get
 the right attributes ...
 i still have the same error(see below)
 it's made me crazy



 onoma--���|epwnimo--��
 *Warning*: ldap_add() 
 [function.ldap-addhttps://195.251.90.188:65007/~voiko/admin/function.ldap-add]:
 Add: Invalid DN syntax

 Thank you for your answer


 On 30 April 2010 16:53, Ashley Sheridan a...@ashleysheridan.co.ukwrote:

  On Fri, 2010-04-30 at 14:34 +0300, Manolis Vlachakis wrote:

 Hallo there everyone
 although i have built my code correctly according to the examples i found 
 on
 the net..
 i get Invalid DN syntax error when i try to insert some attributes with 
 ldap
 add..

 i get and read a csv file where i get the data correctly as i can see on 
 the
 echos that follow:

*$data=split([;\r],$data);*
 *
 *
 * **$info[cn]= $data[$c];*
 * **echo |onoma--;*
 * **echo $info[cn] ;//*
 *** **   $c++;*
 * **$info[sn]= $data[$c];*
 * **echo |epwnimo--;*
 * **echo $info[sn] ;*
 * *
 * **$info[objectclass][0] = top;*
 *  ** **$info[objectclass][1] = organizationalPerson;*
 * *
 * ** *
 * ** $r = ldap_add($ldapconn,
 cn=.$info['cn'].,cn=*,ou=@@@,ou=.,ou=,dc=.dc=,
 $info);*

 funny thing is that when i put them absolute like *$info[sn]= bla
 bla;* it works fine...
 any ideas?


 Are you using the correct split() delimiter? What happens if you just
 output that array with print_r() or var_dump()? I see the delimiter as:

 [;
 ]

 Because the \r is recognised as a carriage return because your string is
 in double quotes.

   Thanks,
 Ash
 http://www.ashleysheridan.co.uk





 --
 Manolis Vlachakis

 Nelly's Family Hotel
 Visit:   www.nellys-hotel.gr
   www.nellys.gr
 Skype : manolis.vlachakis




 --
 Manolis Vlachakis

 Nelly's Family Hotel
 Visit:   www.nellys-hotel.gr
   www.nellys.gr
 Skype : manolis.vlachakis




 --
 Manolis Vlachakis

 Nelly's Family Hotel
 Visit:   www.nellys-hotel.gr
   www.nellys.gr
 Skype : manolis.vlachakis




-- 
Manolis Vlachakis

Nelly's Family Hotel
Visit:   www.nellys-hotel.gr
  www.nellys.gr
Skype : manolis.vlachakis


Re: [PHP] Inserting rows with missing IDs

2010-05-04 Thread Richard Quadling
On 3 May 2010 14:34, Andre Polykanine an...@oire.org wrote:
 Hello everyone,
 It's not a strictly PHP question, however since I use that with PHP,
 I'm asking it there.
 How can I accomplish the task of inserting rows into MySql database
 with missing IDs? Say, I have rows with IDs 1, 2, 3, 5, 9, 12, 17, and
 195. How do I make the check that allows to insert firstly the missing
 IDs and only then apply the auto-increment?
 Thanks!

Using PHP, you could find the missing IDs by using the following steps.

1 - Get the current maximum ID.

SELECT max(ID) as Max FROM table

If you aren't interested in the ones before the first valid ID then
also retrieve the min(ID).

So you end up with $MinID = 1, $MaxID = 195.

2 - Get all the current IDs.

SELECT ID FROM table

So you end up with $KnownIDs = array(1,2,3,5,9,12,17,195);

3 - Use the range() function in PHP to build an array from the lowest
id (or 1) to the highest id.

$RangeIDs = range($MinID, $MaxID);

4 - Use array_diff($RangeIDs, $KnownIDs); to find the missing IDs.


So ...

?php
$MinID = 1;
$MaxID = 30;  // Edited to suit output
$KnownIDs = array(1,2,3,5,9,12,17,30);  // Edited to suit output
$RangeIDs = range($MinID, $MaxID);
print_r(array_diff($RangeIDs, $KnownIDs));
?

outputs ...

Array
(
[3] = 4
[5] = 6
[6] = 7
[7] = 8
[9] = 10
[10] = 11
[12] = 13
[13] = 14
[14] = 15
[15] = 16
[17] = 18
[18] = 19
[19] = 20
[20] = 21
[21] = 22
[22] = 23
[23] = 24
[24] = 25
[25] = 26
[26] = 27
[27] = 28
[28] = 29
)


-- 
-
Richard Quadling
Standing on the shoulders of some very clever giants!
EE : http://www.experts-exchange.com/M_248814.html
EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
ZOPA : http://uk.zopa.com/member/RQuadling

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Inserting rows with missing IDs

2010-05-04 Thread Richard Quadling
On 3 May 2010 14:34, Andre Polykanine an...@oire.org wrote:
 Hello everyone,
 It's not a strictly PHP question, however since I use that with PHP,
 I'm asking it there.
 How can I accomplish the task of inserting rows into MySql database
 with missing IDs? Say, I have rows with IDs 1, 2, 3, 5, 9, 12, 17, and
 195. How do I make the check that allows to insert firstly the missing
 IDs and only then apply the auto-increment?
 Thanks!

You can also reseed the autoinc column back to 0 and that will start
filling in the gaps.

ALTER TABLE tablename AUTO_INCREMENT = 0

may work for you
(http://arstechnica.com/civis/viewtopic.php?f=20t=123689 via
http://tinyurl.com/3amlo2u)



--
-
Richard Quadling
Standing on the shoulders of some very clever giants!
EE : http://www.experts-exchange.com/M_248814.html
EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
ZOPA : http://uk.zopa.com/member/RQuadling

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Inserting rows with missing IDs

2010-05-04 Thread Richard Quadling
On 3 May 2010 14:34, Andre Polykanine an...@oire.org wrote:
 Hello everyone,
 It's not a strictly PHP question, however since I use that with PHP,
 I'm asking it there.
 How can I accomplish the task of inserting rows into MySql database
 with missing IDs? Say, I have rows with IDs 1, 2, 3, 5, 9, 12, 17, and
 195. How do I make the check that allows to insert firstly the missing
 IDs and only then apply the auto-increment?
 Thanks!

BTW, I agree with the other posters here. Buggering around with the ID
is normally pointless unless you have SO many missing IDs that you are
approaching the limit of the value of the column containing the ID.
-- 
-
Richard Quadling
Standing on the shoulders of some very clever giants!
EE : http://www.experts-exchange.com/M_248814.html
EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
ZOPA : http://uk.zopa.com/member/RQuadling

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re[2]: [PHP] Inserting rows with missing IDs

2010-05-04 Thread Andre Polykanine
Hello Richard,

Thanks, will try this!)
-- 
With best regards from Ukraine,
Andre
Skype: Francophile; WlmMSN: arthaelon @ yandex.ru; Jabber: arthaelon @ 
jabber.org
Yahoo! messenger: andre.polykanine; ICQ: 191749952
Twitter: m_elensule

- Original message -
From: Richard Quadling rquadl...@googlemail.com
To: Andre Polykanine an...@oire.org
Date: Tuesday, May 4, 2010, 6:08:28 PM
Subject: [PHP] Inserting rows with missing IDs

On 3 May 2010 14:34, Andre Polykanine an...@oire.org wrote:
 Hello everyone,
 It's not a strictly PHP question, however since I use that with PHP,
 I'm asking it there.
 How can I accomplish the task of inserting rows into MySql database
 with missing IDs? Say, I have rows with IDs 1, 2, 3, 5, 9, 12, 17, and
 195. How do I make the check that allows to insert firstly the missing
 IDs and only then apply the auto-increment?
 Thanks!

Using PHP, you could find the missing IDs by using the following steps.

1 - Get the current maximum ID.

SELECT max(ID) as Max FROM table

If you aren't interested in the ones before the first valid ID then
also retrieve the min(ID).

So you end up with $MinID = 1, $MaxID = 195.

2 - Get all the current IDs.

SELECT ID FROM table

So you end up with $KnownIDs = array(1,2,3,5,9,12,17,195);

3 - Use the range() function in PHP to build an array from the lowest
id (or 1) to the highest id.

$RangeIDs = range($MinID, $MaxID);

4 - Use array_diff($RangeIDs, $KnownIDs); to find the missing IDs.


So ...

?php
$MinID = 1;
$MaxID = 30;  // Edited to suit output
$KnownIDs = array(1,2,3,5,9,12,17,30);  // Edited to suit output
$RangeIDs = range($MinID, $MaxID);
print_r(array_diff($RangeIDs, $KnownIDs));
?

outputs ...

Array
(
[3] = 4
[5] = 6
[6] = 7
[7] = 8
[9] = 10
[10] = 11
[12] = 13
[13] = 14
[14] = 15
[15] = 16
[17] = 18
[18] = 19
[19] = 20
[20] = 21
[21] = 22
[22] = 23
[23] = 24
[24] = 25
[25] = 26
[26] = 27
[27] = 28
[28] = 29
)


-- 
-
Richard Quadling
Standing on the shoulders of some very clever giants!
EE : http://www.experts-exchange.com/M_248814.html
EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
ZOPA : http://uk.zopa.com/member/RQuadling


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] In need of CVS/SVN checkout script for Production servers [solved]

2010-05-04 Thread Daevid Vincent
 -Original Message-
 From: Daevid Vincent [mailto:dae...@daevid.com] 
 Sent: Thursday, April 29, 2010 12:33 PM
 To: php-general@lists.php.net
 Subject: [PHP] In need of CVS/SVN checkout script for 
 Production servers
 
 Semi-off-topic, but I'm pretty sure you all are faced with this same
 challenge, I figured it's worth a shot and maybe some flaming.
 
 I'm looking for a script (bash or php) that I would run on my 
 production
 web server that would do this or close to it:
 
   1. do a CVS/SVN checkout to a new timestamped directory
   2. change the symlink from the old directory
   3. change permissions to www-data:www-data on new directory
   4. and possibly tarball up the old directory.
 
 I'm assuming this is a fairly common task, and I actually wrote one of
 these at my previous job, but I can't find the script 
 anymore. I remember
 it's not quite as trivial as it sounds and took a few hours 
 to perfect, so
 I thought I'd try to save myself some time. :)
  
 I have some other useful SVN scripts here if anyone is interested:
 http://daevid.com/content/examples/snippets.php

Well, here is the one I'm using. I ended up just writing one (again!)

http://www.daevid.com/content/examples/snippets.php :: Production
Deployment Script


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] In need of CVS/SVN checkout script for Production servers [solved]

2010-05-04 Thread Nathan Rixham

Daevid Vincent wrote:

-Original Message-
From: Daevid Vincent [mailto:dae...@daevid.com] 
Sent: Thursday, April 29, 2010 12:33 PM

To: php-general@lists.php.net
Subject: [PHP] In need of CVS/SVN checkout script for 
Production servers


Semi-off-topic, but I'm pretty sure you all are faced with this same
challenge, I figured it's worth a shot and maybe some flaming.

I'm looking for a script (bash or php) that I would run on my 
production

web server that would do this or close to it:

1. do a CVS/SVN checkout to a new timestamped directory
2. change the symlink from the old directory
3. change permissions to www-data:www-data on new directory
4. and possibly tarball up the old directory.

I'm assuming this is a fairly common task, and I actually wrote one of
these at my previous job, but I can't find the script 
anymore. I remember
it's not quite as trivial as it sounds and took a few hours 
to perfect, so

I thought I'd try to save myself some time. :)
 
I have some other useful SVN scripts here if anyone is interested:

http://daevid.com/content/examples/snippets.php


Well, here is the one I'm using. I ended up just writing one (again!)

http://www.daevid.com/content/examples/snippets.php :: Production
Deployment Script



It appears your browser does not support some of the advanced features 
this site requires.


Please use Internet Explorer or Firefox.

getting that in chrome 5.0.375.29 beta - what advanced features am I 
(and chrome) missing?


sounds like I'm being negative, but I'm not :)

tip though; degrade gracefully mate, don't break the net for 
non-required features.


best,

nathan

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Inserting rows with missing IDs

2010-05-04 Thread Nathan Rixham

Richard Quadling wrote:

On 3 May 2010 14:34, Andre Polykanine an...@oire.org wrote:

Hello everyone,
It's not a strictly PHP question, however since I use that with PHP,
I'm asking it there.
How can I accomplish the task of inserting rows into MySql database
with missing IDs? Say, I have rows with IDs 1, 2, 3, 5, 9, 12, 17, and
195. How do I make the check that allows to insert firstly the missing
IDs and only then apply the auto-increment?
Thanks!


You can also reseed the autoinc column back to 0 and that will start
filling in the gaps.

ALTER TABLE tablename AUTO_INCREMENT = 0

may work for you
(http://arstechnica.com/civis/viewtopic.php?f=20t=123689 via
http://tinyurl.com/3amlo2u)



quite sure that once mysql hit's the max int limit it starts filling in 
the gaps too - like ~96.4% sure


have to agree though, one shouldn't have any dependency on sequential 
numbers (unless it's a number table!)


best,

nathan

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php