[PHP] advise on data encryption security.
Hi Can anyone point me in the direction of some good docs / howto's on building php apps that have fully encrypted databases etc .. Many thanks -- Gregory Machin [EMAIL PROTECTED] www.linuxpro.co.za -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] file open dialog box
Thanks for your answer Chris, but i already used this example yesterday as base for my request. Alain On 3/5/07, Chris [EMAIL PROTECTED] wrote: Alain Roger wrote: Hi, I would like to have an Open file dialog box in my PHP page like it exist on Microsoft Windows. This dialog box should allow user to select a file from his computer. Is there something like that in PHP ? Showing that box isn't php related, but this page has a tutorial about how to upload files through your browser manipulate them in php: http://www.tizag.com/phpT/fileupload.php -- Postgresql php tutorials http://www.designmagick.com/ -- Alain Windows XP SP2 PostgreSQL 8.1.4 Apache 2.0.58 PHP 5
[PHP] Problem with spam
Hi, I have problem with spam over function mail. My clients have badly written functions and I cannot find where. Is there in php simple way to detect which script generate mail? I mean like header (in case of returning mail) or log every using mail function etc. Thank you -- Regards Bc. Radek Krejca ICQ: 65895541 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: [PHP-DB] array field type
another option might be to store xml snippets that match the array. if you are using large numbers of arrays, perhaps a revamping of the db structure to map the arrays to sub-tables might be in order bastien From: Micah Stevens [EMAIL PROTECTED] To: Sancar Saran [EMAIL PROTECTED] CC: php-db@lists.php.net, php-general@lists.php.net Subject: Re: [PHP-DB] array field type Date: Sun, 04 Mar 2007 15:04:42 -0800 Not a single field, but there's several methods of storing trees of information, which is what an array is. Here's one: Nested Array storage table: ArrayID (int, autonumber) keyname (text) parent (int) data (bigtext or whatever would be appropriate for the data you're storing) For an array like this: array('one'=1, 'two'=array('three'=3, 'four'=4)) the table would store these rows: 1, 'one', 0, 1 2, 'two', 0, 2 3, 'three', 2, 3 4, 'four', 2, 4 You can use a recursive function to restore the array, unless you require the granular functionality this type of process would give you such as sorting and filtering and statistics gathering. -Micah However, I think in the long run, you'd be better off serializing the data. -Micah On 03/04/2007 02:15 PM, Sancar Saran wrote: On Sunday 04 March 2007 23:04, Sancar Saran wrote: Hi, I want to know is there any db server around there for store php arrays natively. Regards Sancar Thanks for responses, it seems I have to give more info about situation. In my current project, we had tons of arrays. They are very deep and unpredictable nested arrays. Currently we are using serialize/unserialize and it seems it comes with own cpu cost. Xdebug shows some serializing cost blips. Sure it was not SO BIG deal (for now of course). My db expertise covers a bit mysql and mysql does not have any array type field (enum just so simple). I just want to know is there any way to keep array data type natively in a sql field. Regards. Sancar _ Win a trip for four to a concert anywhere in the world! http://www.mobilelivetour.ca/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] module and access rights
But where do you store the $server_unique_key ? in DB ? if yes, it should be different for each user logged-in to system. Moreover, the $chec_string algorithm should not written in cookie as it is a weakness from my point of view. Alain On 3/4/07, Tijnema ! [EMAIL PROTECTED] wrote: Give your server a unique ID, and add that to your check string lets say so you store in your cookie the username and the check string. example $user = tijnema; $server_unique_key = w#$#%#54dfa4vf4w5$2!@@$w#$%23%25%2354dfa4vf4w5$2!@@$ ; $check_string = md5($server_unique_key.$user.$server_unqie_key); and check that each time the user does an action. Tijnema - Now to the PHP list On 3/4/07, Alain Roger [EMAIL PROTECTED] wrote: Ok, but i would be very glad to know how can i REALLY authenticate the user. for example, user is logged, so i have in the cookie his login name. how can i be sure that it's the same user and not some hacker who hacked the cookie and the session ? what should be checked and where those data should be stored ? because i can store in DB the sessionID, and check it to every DB request user does...but a sessionID can be easily fake. So what should I do ? Al. On 3/4/07, Tijnema ! [EMAIL PROTECTED] wrote: On 3/4/07, Stut [EMAIL PROTECTED] wrote: Alain Roger wrote: I would like to implement a module access rights in my web application. Basically after authentication and authorization. Logged user has a particular profile which allow him to have access to some part of the web application. after reading the security guide from *php*sec.org webpage, i'm confused regarding how to store user login and password. I mean the encrypted password stored in database is compared to encrypted password that user type. But where to store login and password once user is logged ? when i read the security guide it seems that it is not secured enough to store them in cookies or in sessions data... both can be hacked... So what is the best solution ? i will use those stored data to check if logged user can have access to a particular part of the web application. What is your point of view in such domain ? Ok, once the user has logged in there is no need to store the password. Simply store the username or other user details (but not the password) in the session - that's as secure as it's gonna get. *Never* store a password in a cookie. *Ever*. -Stut That's right, never store a password in a cookie or session, maybe a little extra security could be added by locking the cookie to a IP address, but even more secure isn't possible. Tijnema -- PHP General Mailing List (http://www.php.net/ ) To unsubscribe, visit: http://www.php.net/unsub.php -- Alain Windows XP SP2 PostgreSQL 8.1.4 Apache 2.0.58 PHP 5 -- Alain Windows XP SP2 PostgreSQL 8.1.4 Apache 2.0.58 PHP 5
Re: [PHP] module and access rights
I already started to use SSL, but i do not understand how to keep it running. I mean after user has been authenticated and authorized to go further, all next web pages are opened using PHP location(https://...); command. however, it does not certify that it can not be faked by just typing into browser address bar https://another_webpage.php for example : 1.my login page is called index.php and it is accessible only by https. if user type http://../index.php, the index.php redirect itself to https://.../index.php. 2. user type logon and password. 3. application control it with information stored into DB and authorize user to go further, so a session is created and user is redirected to https://.../welcome.php what avoid hacker to directly type https://.../welcome.php ? how to be sure that it works correctly as in my example ? thanks a lot, Al. On 3/4/07, Stut [EMAIL PROTECTED] wrote: Tijnema ! wrote: On 3/4/07, Stut [EMAIL PROTECTED] wrote: Tijnema ! wrote: Give your server a unique ID, and add that to your check string lets say so you store in your cookie the username and the check string. example $user = tijnema; $server_unique_key = w#$#%#54dfa4vf4w5$2!@@$w#$%23%25%2354dfa4vf4w5$2!@@$ ; $check_string = md5($server_unique_key.$user.$server_unqie_key); and check that each time the user does an action. How, exactly, is that any more secure than a standard session identifier? While it's good to worry about security, adding pointless activity such as this to every request is not going to help. Anything you do is going to involve some piece of data being transferred from client to server, and can therefore be faked/shared by the client. Get over it. -Stut It is ofcourse possible to share it to another client, but when combining this with the IP address. This means it can only be used in the same LAN. To get to the point, using this means you cannot simply fake the username in the cookie, which is possible else. session identifiers can be faked too. As I said in another email, you *cannot* use the IP address for any verification without causing usability issues. It is perfectly legitimate for sequential requests from any given user to come from different IP addresses. The biggest user of systems like this is AOL, and that's a fairly large user base you may want to avoid annoying by insisting that they login for every other request. In short, this issue has been discussed to death, not only by the PHP community but also by the web community at large. If you're really paranoid, use SSL to secure all data transferred, but just accept that it's possible that a session may be hijacked. However, unless you're a bank, is anyone really going to bother? -Stut On 3/4/07, Alain Roger [EMAIL PROTECTED] wrote: Ok, but i would be very glad to know how can i REALLY authenticate the user. for example, user is logged, so i have in the cookie his login name. how can i be sure that it's the same user and not some hacker who hacked the cookie and the session ? what should be checked and where those data should be stored ? because i can store in DB the sessionID, and check it to every DB request user does...but a sessionID can be easily fake. So what should I do ? Al. On 3/4/07, Tijnema ! [EMAIL PROTECTED] wrote: On 3/4/07, Stut [EMAIL PROTECTED] wrote: Alain Roger wrote: I would like to implement a module access rights in my web application. Basically after authentication and authorization. Logged user has a particular profile which allow him to have access to some part of the web application. after reading the security guide from *php*sec.org webpage, i'm confused regarding how to store user login and password. I mean the encrypted password stored in database is compared to encrypted password that user type. But where to store login and password once user is logged ? when i read the security guide it seems that it is not secured enough to store them in cookies or in sessions data... both can be hacked... So what is the best solution ? i will use those stored data to check if logged user can have access to a particular part of the web application. What is your point of view in such domain ? Ok, once the user has logged in there is no need to store the password. Simply store the username or other user details (but not the password) in the session - that's as secure as it's gonna get. *Never* store a password in a cookie. *Ever*. -Stut That's right, never store a password in a cookie or session, maybe a little extra security could be added by locking the cookie to a IP address, but even more secure isn't possible. Tijnema -- PHP General Mailing List (http://www.php.net/ ) To unsubscribe, visit:
Re: [PHP] module and access rights
2007. 03. 5, hétfő keltezéssel 15.05-kor Alain Roger ezt írta: I already started to use SSL, but i do not understand how to keep it running. I mean after user has been authenticated and authorized to go further, all next web pages are opened using PHP location(https://...); command. however, it does not certify that it can not be faked by just typing into browser address bar https://another_webpage.php for example : 1.my login page is called index.php and it is accessible only by https. if user type http://../index.php, the index.php redirect itself to https://.../index.php. 2. user type logon and password. 3. application control it with information stored into DB and authorize user to go further, so a session is created and user is redirected to https://.../welcome.php what avoid hacker to directly type https://.../welcome.php ? how to be sure that it works correctly as in my example ? you should check the session settings in the beginning of welcome.php if session is not set correctly redirect to index.php instead greets Zoltán Németh thanks a lot, Al. On 3/4/07, Stut [EMAIL PROTECTED] wrote: Tijnema ! wrote: On 3/4/07, Stut [EMAIL PROTECTED] wrote: Tijnema ! wrote: Give your server a unique ID, and add that to your check string lets say so you store in your cookie the username and the check string. example $user = tijnema; $server_unique_key = w#$#%#54dfa4vf4w5$2!@@$w#$%23%25%2354dfa4vf4w5$2!@@$ ; $check_string = md5($server_unique_key.$user.$server_unqie_key); and check that each time the user does an action. How, exactly, is that any more secure than a standard session identifier? While it's good to worry about security, adding pointless activity such as this to every request is not going to help. Anything you do is going to involve some piece of data being transferred from client to server, and can therefore be faked/shared by the client. Get over it. -Stut It is ofcourse possible to share it to another client, but when combining this with the IP address. This means it can only be used in the same LAN. To get to the point, using this means you cannot simply fake the username in the cookie, which is possible else. session identifiers can be faked too. As I said in another email, you *cannot* use the IP address for any verification without causing usability issues. It is perfectly legitimate for sequential requests from any given user to come from different IP addresses. The biggest user of systems like this is AOL, and that's a fairly large user base you may want to avoid annoying by insisting that they login for every other request. In short, this issue has been discussed to death, not only by the PHP community but also by the web community at large. If you're really paranoid, use SSL to secure all data transferred, but just accept that it's possible that a session may be hijacked. However, unless you're a bank, is anyone really going to bother? -Stut On 3/4/07, Alain Roger [EMAIL PROTECTED] wrote: Ok, but i would be very glad to know how can i REALLY authenticate the user. for example, user is logged, so i have in the cookie his login name. how can i be sure that it's the same user and not some hacker who hacked the cookie and the session ? what should be checked and where those data should be stored ? because i can store in DB the sessionID, and check it to every DB request user does...but a sessionID can be easily fake. So what should I do ? Al. On 3/4/07, Tijnema ! [EMAIL PROTECTED] wrote: On 3/4/07, Stut [EMAIL PROTECTED] wrote: Alain Roger wrote: I would like to implement a module access rights in my web application. Basically after authentication and authorization. Logged user has a particular profile which allow him to have access to some part of the web application. after reading the security guide from *php*sec.org webpage, i'm confused regarding how to store user login and password. I mean the encrypted password stored in database is compared to encrypted password that user type. But where to store login and password once user is logged ? when i read the security guide it seems that it is not secured enough to store them in cookies or in sessions data... both can be hacked... So what is the best solution ? i will use those stored data to check if logged user can have access to a particular part of the web application. What is your point of view in such domain ? Ok, once the user has logged in there is no need to store the password. Simply store the username or other user details (but not the
RE: [PHP] Problem with spam
Hi, I have problem with spam over function mail. My clients have badly written functions and I cannot find where. Is there in php simple way to detect which script generate mail? I mean like header (in case of returning mail) or log every using mail function etc. grep -l mail( *.php Thank you yw! JM -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] problem generating a file link
George Pitcher wrote: Hi, I have a web page that only I see, and I want to link to a PDF file on a mapped drive so that it will open in Acrobat. I have tried variations on the following: $storelink = a href=\file://G:\\.$filename..pdf\ target=\_blank\PDF/a; and the link keeps coming out as: file:///G:/575991.pdf is that what the browser (let me guess: IE) is interpreting the link as or is that what is literally in the html source? So I have 3 x '/' and a '/' where I want a '\'. Can anyone tell me how to code this to get it right? MTIA Cheers George -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] problem generating a file link
Jochem, I have tried variations on the following: $storelink = a href=\file://G:\\.$filename..pdf\ target=\_blank\PDF/a; and the link keeps coming out as: file:///G:/575991.pdf is that what the browser (let me guess: IE) is interpreting the link as or is that what is literally in the html source? I'm using Smarty so the link doesn't appear as HTML as such. This is what the browser (guessed wrong - I'm using Firefox) shows in the status bar. George -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] problem generating a file link
Hi, I have a web page that only I see, and I want to link to a PDF file on a mapped drive so that it will open in Acrobat. I have tried variations on the following: $storelink = a href=\file://G:\\.$filename..pdf\ target=\_blank\PDF/a; and the link keeps coming out as: file:///G:/575991.pdf So I have 3 x '/' and a '/' where I want a '\'. Can anyone tell me how to code this to get it right? MTIA Cheers George -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] module and access rights
Alain Roger wrote: I already started to use SSL, but i do not understand how to keep it running. I mean after user has been authenticated and authorized to go further, all next web pages are opened using PHP location(https://...); command. however, it does not certify that it can not be faked by just typing into browser address bar https://another_webpage.php for example : 1.my login page is called index.php and it is accessible only by https. if user type http://../index.php, the index.php redirect itself to https://.../index.php. 2. user type logon and password. 3. application control it with information stored into DB and authorize user to go further, so a session is created and user is redirected to https://.../welcome.php what avoid hacker to directly type https://.../welcome.php ? how to be sure that it works correctly as in my example ? There is absolutely nothing stopping a hacker or a regular user from doing that (not everyone that does that is trying to break your site). It's up to you, as the developer, to check in welcome.php, and any other page that requires a user to be logged in, that a user is logged in. So, to sum up, every page that needs the user to have logged in needs to check that a user has logged in, and redirect to the login page if not. Hope that makes it clear. -Stut -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Error in Script!!!
?php // Conexão com o banco de dados include mysql.php; // Inicia sessões session_start(); // Recupera o login $login = $_POST[username]; // Recupera a senha $senha = $_POST[password]; // Usuário não forneceu a senha ou o login if($login== $senha= ) { echo Você deve digitar sua senha e login!; exit; } /* * Executa a consulta no banco de dados. * Caso o número de linhas retornadas seja 1 o login é válido, * caso 0, inválido. */ echo $nome; $sql = SELECT username,realname,gid FROM utilizador WHERE username='$login'; $result_id = mysql_query($sql,$con) or die(brErro no banco de dados!);//line 23 $total = mysql_num_rows($result_id); // Caso o usuário tenha digitado um login válido o número de linhas será 1.. if($total) { // Obtém os dados do usuário, para poder verificar a senha e passar os demais dados para a sessão $dados = mysql_fetch_array($result_id); // Agora verifica a senha if(!strcmp($senha, $dados[password])) { // TUDO OK! Agora, passa os dados para a sessão e redireciona o usuário $_SESSION[username] = $dados[username]; $_SESSION[realname] = $dados[realname]; $_SESSION[gid]= $dados[gid]; require_once ('../utilizadores/listar.php'); exit; } // Senha inválida else { echo Senha inválida!; exit; } } // Login inválido else { echo Error; exit; } ? Why this script give me a error: *Warning*: mysql_query(): supplied argument is not a valid MySQL-Link resource in *ver.php* on line *23*
Re: [PHP] Error in Script!!!
Helder Lopes wrote: ?php // Conexão com o banco de dados include mysql.php; // Inicia sessões session_start(); // Recupera o login $login = $_POST[username]; // Recupera a senha $senha = $_POST[password]; // Usuário não forneceu a senha ou o login if($login== $senha= ) { echo Você deve digitar sua senha e login!; exit; } /* * Executa a consulta no banco de dados. * Caso o número de linhas retornadas seja 1 o login é válido, * caso 0, inválido. */ echo $nome; $sql = SELECT username,realname,gid FROM utilizador WHERE username='$login'; $result_id = mysql_query($sql,$con) or die(brErro no banco de dados!);//line 23 Where is $con defined??? -B $total = mysql_num_rows($result_id); // Caso o usuário tenha digitado um login válido o número de linhas será 1.. if($total) { // Obtém os dados do usuário, para poder verificar a senha e passar os demais dados para a sessão $dados = mysql_fetch_array($result_id); // Agora verifica a senha if(!strcmp($senha, $dados[password])) { // TUDO OK! Agora, passa os dados para a sessão e redireciona o usuário $_SESSION[username] = $dados[username]; $_SESSION[realname] = $dados[realname]; $_SESSION[gid]= $dados[gid]; require_once ('../utilizadores/listar.php'); exit; } // Senha inválida else { echo Senha inválida!; exit; } } // Login inválido else { echo Error; exit; } ? Why this script give me a error: *Warning*: mysql_query(): supplied argument is not a valid MySQL-Link resource in *ver.php* on line *23* -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] error in Script
In other file -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: [PHP-DB] array field type
Thanks for all those replies. It seems there was no easy solution (and or serializing was better solution) for us. Our arrays contains lots of things.. XML may not fit because content of array may broke xml structure. Thanks for help. Regards Sancar. Hi, I want to know is there any db server around there for store php arrays natively. Regards Sancar Thanks for responses, it seems I have to give more info about situation. In my current project, we had tons of arrays. They are very deep and unpredictable nested arrays. Currently we are using serialize/unserialize and it seems it comes with own cpu cost. Xdebug shows some serializing cost blips. Sure it was not SO BIG deal (for now of course). My db expertise covers a bit mysql and mysql does not have any array type field (enum just so simple). I just want to know is there any way to keep array data type natively in a sql field. Regards. Sancar _ Win a trip for four to a concert anywhere in the world! http://www.mobilelivetour.ca/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] problem generating a file link
George Pitcher wrote: Jochem, I have tried variations on the following: $storelink = a href=\file://G:\\.$filename..pdf\ target=\_blank\PDF/a; and the link keeps coming out as: file:///G:/575991.pdf is that what the browser (let me guess: IE) is interpreting the link as or is that what is literally in the html source? I'm using Smarty so the link doesn't appear as HTML as such. can't see what Smarty has to do with - can't remember Smarty 'cleaning' file url's (at least not without being specifically asked). besides Smarty is just outputting HTML so I don't understand your comment. This is what the browser (guessed wrong - I'm using Firefox) shows in the status bar. ok, right - so what does the html source actually contain? I'm assuming that the way firefox is interpreting the link makes it not work? does the link work in IE? George -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] RE:[[PHP] Error in Script!!!
Helder Lopes wrote: ?php // Conexão com o banco de dados include mysql.php; // Inicia sessões session_start(); // Recupera o login $login = $_POST[username]; // Recupera a senha $senha = $_POST[password]; // Usuário não forneceu a senha ou o login if($login== $senha= ) { echo Você deve digitar sua senha e login!; exit; } /* * Executa a consulta no banco de dados. * Caso o número de linhas retornadas seja 1 o login é válido, * caso 0, inválido. */ echo $nome; $sql = SELECT username,realname,gid FROM utilizador WHERE username='$login'; $result_id = mysql_query($sql,$con) or die(brErro no banco de dados!);//line 23 Where is $con defined??? -B $total = mysql_num_rows($result_id); // Caso o usuário tenha digitado um login válido o número de linhas será 1.. if($total) { // Obtém os dados do usuário, para poder verificar a senha e passar os demais dados para a sessão $dados = mysql_fetch_array($result_id); // Agora verifica a senha if(!strcmp($senha, $dados[password])) { // TUDO OK! Agora, passa os dados para a sessão e redireciona o usuário $_SESSION[username] = $dados[username]; $_SESSION[realname] = $dados[realname]; $_SESSION[gid]= $dados[gid]; require_once ('../utilizadores/listar.php'); exit; } // Senha inválida else { echo Senha inválida!; exit; } } // Login inválido else { echo Error; exit; } ? Why this script give me a error: **Warning**: mysql_query(): supplied argument is not a valid MySQL-Link resource in **ver.php** on line *23* in a file with a name mysql.php the $con is correct with the other that results
Re: [PHP] error in Script
Helder Lopes wrote: In other file I asked because it might prove helpful to see how that is set because this appears to be what is causing your error. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] error in Script
Helder Lopes wrote: In other file sarcasmwell then it *must* be correct./sarcasm have you tried actually looking at $con to see what it contains??? the connection to mysql failed or was never even attempted, the error you get makes that quite clear. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] problem generating a file link
Jochem, This is what the browser (guessed wrong - I'm using Firefox) shows in the status bar. ok, right - so what does the html source actually contain? a href=file://G:\588012.pdf target=_blankPDF/a I'm assuming that the way firefox is interpreting the link makes it not work? does the link work in IE? I get exactly the same in IE6. Source is good, link is bad. Cheers George -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Error in Script!!!
Helder Lopes wrote: snipped code Why this script give me a error: *Warning*: mysql_query(): supplied argument is not a valid MySQL-Link resource in *ver.php* on line *23* This means that the second parameter to the mysql_query call ($con) is not a valid connection to a MySQL database. How are you defining it? -Stut -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: pictures stored in PostgreSQL DB
Alain Roger wrote: Hi, It's amazing that my previous post has raised so much consideration about the fact to store or not pictures into DB. And yet you ask again!? Did you not learn? No good can come from this question. However, none of those posts answered to my question... How can i retrieve and display those pictures to my PHP pages ? Basically, on my PHP page I have some texts and I would like to extract from DB the pictures to display. Therefore, set the header to mine JPEG or GIF does not allow to have text also. This is another problem with images in databases, unlike text or data which can be incorporated into the HTML output stream, an image needs to be its own file. You will have to hit the database twice. Once to render the page, and again to render the image. To render the image you need to query the database and send the data back on its own, but before you do, you have to set the content type header to jpeg, gif, or whatever. This is why I say image data does not belong in the database. So please, how can i do to display pictures from DB, when my PHP page also include texts and other images (from filesystem) ? In fact i would like to do something like a thumbnail... You will need to repeat the same steps outlined above, but use image manipulation utilities to reduce the image. Again, that's why you store images in files and not in the database. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] RE:[[PHP] Error in Script!!! - SOLVED
Thanxs for helping! The error has that i was not calling the database, neither the connection!! Im so stupid! Sorry for your time lost!
Re: [PHP] problem generating a file link
George Pitcher wrote: Jochem, This is what the browser (guessed wrong - I'm using Firefox) shows in the status bar. ok, right - so what does the html source actually contain? a href=file://G:\588012.pdf target=_blankPDF/a so what happens when you make it like so: a href=file:///G:/588012.pdf target=_blankPDF/a ? I'm assuming that the way firefox is interpreting the link makes it not work? does the link work in IE? I get exactly the same in IE6. Source is good, link is bad. Cheers George -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP Clustering solution -- Beta Testers Needed
I have a web clustering solution. It is better than putting session files on NFS and better than using a database. Take a look and give it a try. I need feedback on platforms, installation problems, bugs, suggestions, and if you are up to it, patches. Here is a brief outline http://www.mohawksoft.org/?q=node/36 You can download it from http://www.mohawksoft.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] template engine/template class
I am looking for a template class that will take a basic 2 column template I have made and let the user -change the page title -add an header image - enter the main body text -save the file to a folder of their choice Is there already a class out there that does this or similar. Smarty is far too complex for this. It is not really an engine I am looking for but a good class where all the user does is fill in a form and the page is generated. Could do one myself but if there is already one out there why reinvent the wheel? R. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] problem generating a file link
Jochem, This is what the browser (guessed wrong - I'm using Firefox) shows in the status bar. ok, right - so what does the html source actually contain? a href=file://G:\588012.pdf target=_blankPDF/a so what happens when you make it like so: a href=file:///G:/588012.pdf target=_blankPDF/a ? No change. George -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] template engine/template class
http://www.eframework.org/index.php has one, better than Smarty :P Check docs http://www.eframework.org/doc/ http://www.eframework.org/template-syntax/ 2007/3/5, Ross [EMAIL PROTECTED]: I am looking for a template class that will take a basic 2 column template I have made and let the user -change the page title -add an header image - enter the main body text -save the file to a folder of their choice Is there already a class out there that does this or similar. Smarty is far too complex for this. It is not really an engine I am looking for but a good class where all the user does is fill in a form and the page is generated. Could do one myself but if there is already one out there why reinvent the wheel? R. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- bet0x - Barrahome http://www.barrahome.com.ar -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Help with a within week function
I have been trying to find a way to search a DB and match a range within a week ( php mysql ). This doesn't make sense, so I will describe it in more detail. Hi everyone, I need help with a search, lets say a record has a date of 2/5/2007 and if someone visits the website between 2/5/07 and 2/11/07 I want to display the record with 2/5/2007. If it's within the week so to speak. Does anyone know how I can accomplish this? Thanks! Joey -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Help with a within week function
I have been trying to find a way to search a DB and match a range within a week ( php mysql ). This doesn't make sense, so I will describe it in more detail. Hi everyone, I need help with a search, lets say a record has a date of 2/5/2007 and if someone visits the website between 2/5/07 and 2/11/07 I want to display the record with 2/5/2007. If it's within the week so to speak. Does anyone know how I can accomplish this? (You might get better answers from the MySQL list when asking MySQL questions.) SELECT * from table where record_date between '$begin_date' and '$end_date'; JM -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] problem generating a file link
There's nothing wrong with this. It's standard. I believe the logic of this is that the first two forward slashes represent the standard protocol indicator: http://, ftp://, file://, while the final forward slash represents a directory off the root directory, as a carry over from unix /tmp, /bin, /usr, etc. George Pitcher wrote: Jochem, I have tried variations on the following: $storelink = a href=\file://G:\\.$filename..pdf\ target=\_blank\PDF/a; and the link keeps coming out as: file:///G:/575991.pdf is that what the browser (let me guess: IE) is interpreting the link as or is that what is literally in the html source? I'm using Smarty so the link doesn't appear as HTML as such. This is what the browser (guessed wrong - I'm using Firefox) shows in the status bar. George -- _ Myron Turner http://www.room535.org http://www.bstatzero.org http://www.mturner.org/XML_PullParser/
Re: [PHP] Help with a within week function
On 3/5/07, Jim Moseby [EMAIL PROTECTED] wrote: I have been trying to find a way to search a DB and match a range within a week ( php mysql ). This doesn't make sense, so I will describe it in more detail. Hi everyone, I need help with a search, lets say a record has a date of 2/5/2007 and if someone visits the website between 2/5/07 and 2/11/07 I want to display the record with 2/5/2007. If it's within the week so to speak. Does anyone know how I can accomplish this? (You might get better answers from the MySQL list when asking MySQL questions.) SELECT * from table where record_date between '$begin_date' and '$end_date'; JM There's probably a solution in here as well: $queryLocation1 = SELECT `mrem_per_hour` as `Loc1`, if((date_time = DATE_SUB(now(), interval 2 minute)), 'display', 'noDisplay') as `test` FROM `location1` ORDER BY `date_time` DESC LIMIT 1; David
[PHP] Accessing to an Object from a function
Hi, i made a script that uses an object to access to the site data, i divided the whole site into various high specialized functions. All functions accesses to a single object (the object is a txtSQL instance). ... but ... i can't access to the variable declared in the main script. Best regards. Lorenzo Giuliani -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Accessing to an Object from a function
Lorenzo Giuliani wrote: i made a script that uses an object to access to the site data, i divided the whole site into various high specialized functions. All functions accesses to a single object (the object is a txtSQL instance). ... but ... i can't access to the variable declared in the main script. This is something known as scope, and you really should know all about it: http://php.net/variables.scope In this particular case you can either user the $GLOBALS superglobal, or the global keyword. Both are covered on that manual page. -Stut -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP Clustering solution -- Beta Testers Needed
Hello, on 03/05/2007 12:22 PM Mark said the following: I have a web clustering solution. It is better than putting session files on NFS and better than using a database. Take a look and give it a try. I need feedback on platforms, installation problems, bugs, suggestions, and if you are up to it, patches. Here is a brief outline http://www.mohawksoft.org/?q=node/36 You can download it from http://www.mohawksoft.org This seems very much like memcached based solutions. -- Regards, Manuel Lemos Metastorage - Data object relational mapping layer generator http://www.metastorage.net/ PHP Classes - Free ready to use OOP components written in PHP http://www.phpclasses.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Session_Start() error
*hi people, Hi have this error in the session cookie, how to solve this??? Warning*: session_start() [function.session-starthttp://localhost/function.session-start]: Cannot send session cache limiter - headers already sent (output started at D:\PHP\xampp\htdocs\index.php:10) in *D:\PHP\xampp\htdocs\verifica.php* on line *3*
Re: [PHP] Session_Start() error
Hi, just put session_start() (first line) the first thing in your php file and this should solve the problem. Regards, Rabih On 3/5/07, Helder Lopes [EMAIL PROTECTED] wrote: *hi people, Hi have this error in the session cookie, how to solve this??? Warning*: session_start() [function.session-starthttp://localhost/function.session-start]: Cannot send session cache limiter - headers already sent (output started at D:\PHP\xampp\htdocs\index.php:10) in *D:\PHP\xampp\htdocs\verifica.php* on line *3*
Re: [PHP] Re: pictures stored in PostgreSQL DB
On Mon, 2007-03-05 at 10:16 -0500, Mark wrote: Alain Roger wrote: Hi, It's amazing that my previous post has raised so much consideration about the fact to store or not pictures into DB. And yet you ask again!? Did you not learn? No good can come from this question. He didn't care about the debate. He is already using a database and wants to display the images. I'm sure he learned plenty, but not what he wanted to learn. I'd say the most important outcome of the side-track debate was to clarify that it depends on what you are working with, what you are doing, what your tolerance is for various types of solutions, and where those tolerances lie. An important thing we also learned, is that while filesystem storage is often the better solution, it is not always the best solution, especially when factoring in such things as convenience and simplicity. However, none of those posts answered to my question... How can i retrieve and display those pictures to my PHP pages ? Basically, on my PHP page I have some texts and I would like to extract from DB the pictures to display. Therefore, set the header to mine JPEG or GIF does not allow to have text also. This is another problem with images in databases, unlike text or data which can be incorporated into the HTML output stream, an image needs to be its own file. Image doesn't need to be it's own file, if it did then it would be forced to be on the filesystem, since we know it can be in a database instead, it thus follow it does not need to be it's own file... Ah but you are going to say but it needs it's own script to access the image! but that is not so, since a front end controller style script could easily contain the code to display an image with a little switch statement. Either way, you need a script wrapped around serving images from the filesystem if those images need to be protected by your site's authentication. Thus the point is completely moot. You will have to hit the database twice. Once to render the page, and again to render the image. To render the image you need to query the database and send the data back on its own, but before you do, you have to set the content type header to jpeg, gif, or whatever. This is why I say image data does not belong in the database. Boring. Belongs wherever the developer or the business requirements want to store it. Once again, you will need to set the content type header anyways if you have wrapped the image serving in your site's authentication checks -- whether it resides on the filesystem, in the database, or in a dark place where the sun don't shine. So please, how can i do to display pictures from DB, when my PHP page also include texts and other images (from filesystem) ? In fact i would like to do something like a thumbnail... You will need to repeat the same steps outlined above, but use image manipulation utilities to reduce the image. Again, that's why you store images in files and not in the database. Wrong again. Can pull the image directly into memory from the retrieved database field. Can then convert it to an image resource using imagecreatefromstring(). Can manipulate the image directly in memory using the image manipulation functions. And finally, can directly flush the image to the browser without ever having touched the filesystem manually. Filesystem is not a necessity. Cheers, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Session_Start() error
Also make sure you don't have empty lines before the ?php or ? tags Helder Lopes [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] *hi people, Hi have this error in the session cookie, how to solve this??? Warning*: session_start() [function.session-starthttp://localhost/function.session-start]: Cannot send session cache limiter - headers already sent (output started at D:\PHP\xampp\htdocs\index.php:10) in *D:\PHP\xampp\htdocs\verifica.php* on line *3* -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Matching Proper Versions Of PHP and MySQL
Hello All, I'm a newbie. My server just upgraded to PHP version 5.1.2 from php 4.3.11 MySQL currently is v 4.0.27 Q: What is the oldest - best/safest version of mySQL to use with PHP version 5.1.2.? The reason I mentioned the oldest - is because, for legacy clients, I would like to do the minimum upgrade to ensure best compatibility with legacy code ( mySQL and NON php etc.). If it is OK to stay on mySQL version 4.0.27 ... That would be good to know. Q: Is PHP version 5.1.2 - relatively stable version of PHP 5? -- Thanks - RevDave [EMAIL PROTECTED] [db-lists] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Holes in mysql primary key and other db issues...
At 2:49 PM -0600 3/4/07, Larry Garfield [EMAIL PROTECTED] wrote: On Sunday 04 March 2007 1:15 pm, Mike Shanley wrote: Stut wrote: I have a sidebar on my site that gets a few random articles from that table, prints the titles, small blurbs, and a link. The link goes to the main article. I get the random IDs outside of mysql because I've made it more likely for newer articles to be chosen than older ones... This, accomplished via ID, because it's much easier to SELECT count(*) and slant my randomization to the last 25% of ID numbers than any other way I can think of... Of course, this means that having holes results in empty sidebar boxes... And that's not too good lookin... How are you selecting random entries? A common way to do this is to use the MySQL rand() function, but that is exceedingly slow. I would suggest that you get a list of (or a subset of) the IDs in the table, use PHP to randomly select however many you need and then get the full data for those. You can't rely on the IDs, and the work involved in resetting all the IDs such that they're sequential without gaps is not worth it. I use mt_rand(0,$max_rows) to get each of my values and send the call. Getting an array of IDs sounds alright for now, but also sounds like it gets increasingly slower and the table is expanded. I'll give it a try though. As Stut said, holes in the sequence are not a problem, they're a feature. :-) They are guaranteed only to be a unique id. You have no other guarantee about them, including the order in which they exist in the database. It is perfectly legal in SQL to add 5 records in order to a table, get an auto_increment added for each, then select the whole table and get them in a non-numeric order unless you explicitly order them. The ID is for reference purposes only, not for ordering or anything else. What I've done in the past for selecting three random items from the last 10 (which sounds close to what you're doing) is something like this: $result = mysql_query(SELECT * FROM foo ORDER BY timefield DESC LIMIT 10); $records = array(); while ($record = mysql_fetch_object($result)) { $records[] = $record; } array_shuffle($records); for ($i=0; $i 3; ++$i) { $use[] = $records[$i]; } Now you have an array, $use, that is 3 random entries from the last 10, ordered by a time field. The unique ID is irrelevant to that, as it should be. This is getting to be more of a MySQL question, but to emphasize again...the autonumbered sequence # is *only* to provide a unique ID. It is normally used as a 'surrogate key' in the database, and is used to link other tables to this one. If you renumber this table, that means you would have to update all tables this refers to. This set of queries should do the trick, though (untested; need to doublecheck edge cases of max/min id, 0 0.99 random #'s): select max(id) from your_table into @max_id select * from your_table where id ceil(rand() * @max_id) limit 1 For more info, see: http://dev.mysql.com/doc/refman/4.1/en/user-variables.html http://dev.mysql.com/doc/refman/4.1/en/mathematical-functions.html -steve PS. If you *really* wanted to renumber the database, you should be able to drop and then re-add the auto_increment column, but that's a bad idea (tm) and don't tell anyone I told you how to do it :) -- +--- my people are the people of the dessert, ---+ | Steve Edberghttp://pgfsun.ucdavis.edu/ | | UC Davis Genome Center[EMAIL PROTECTED] | | Bioinformatics programming/database/sysadmin (530)754-9127 | + said t e lawrence, picking up his fork + -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] session question
Hi, I have an index.php page which does not user session_start(); command. However in this index.php page, there are some $_SESSION['...']; variables stored. How is it possible that $_SESSION['...']; works even if no session has been created before ? moreover, if i use a print Session ID : .session_id(); after those lines, session_id() is empty (which is logical) as no session_start(); command has been used before. So, how is it possible that $_SESSION['..'] works ? Do i have a session created or not ? -- Alain Windows XP SP2 PostgreSQL 8.1.4 Apache 2.0.58 PHP 5
[PHP] Image storing
Hi, Can you recommend the best way to store an image into the MySQL database and optimze it. And display and manipulate that image in PHP. Thank you very much! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Image storing
[snip] Can you recommend the best way to store an image into the MySQL database and optimze it. And display and manipulate that image in PHP. [/snip] There are many tutorials; http://www.google.com/search?hl=enq=store+image+in+database+PHP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] session question
the index.php page is the first page where user should logon. it consists of 3 flags (english, french and slovak). when use click on 1 flags, it reload the index.php page and changes the login and password words by their relative translation into the flag country selected. if user click on LOGON button, therefore it calls the checklogin.php page and ONLY if login and password are correct, the session is created by session_start(); command. I've read the $_SESSION array is available even if the session_start() command has not been used. but they told that variable stored in $_SESSION are not available to user till session_start() has not been used... in my case, they are available... :-( Al On 3/5/07, Ólafur Waage [EMAIL PROTECTED] wrote: I have an index.php page which does not user session_start(); command. However in this index.php page, there are some $_SESSION['...']; variables stored. How is it possible that $_SESSION['...']; works even if no session has been created before ? If the page is redirected to from some other place? - Ólafur W -- Alain Windows XP SP2 PostgreSQL 8.1.4 Apache 2.0.58 PHP 5
Re: [PHP] Re: pictures stored in PostgreSQL DB
On Mon, 2007-03-05 at 10:16 -0500, Mark wrote: Alain Roger wrote: Hi, It's amazing that my previous post has raised so much consideration about the fact to store or not pictures into DB. And yet you ask again!? Did you not learn? No good can come from this question. He didn't care about the debate. He is already using a database and wants to display the images. I'm sure he learned plenty, but not what he wanted to learn. I gained nothing at all from supreme enlightenment - and for that very reason, it is called supreme enlightenment Buddha. I'd say the most important outcome of the side-track debate was to clarify that it depends on what you are working with, what you are doing, what your tolerance is for various types of solutions, and where those tolerances lie. An important thing we also learned, is that while filesystem storage is often the better solution, it is not always the best solution, especially when factoring in such things as convenience and simplicity. I don't think we came to any such conclusion. I still assert that while there may be multiple right ways to accomplish a task, there are often clearly wrong ways. Putting bitmap data inside the database is a mistake. Before y'all got hyper-literal trying to argue the finer details of the definition of mistake, my assertion is this: I have yet to see one implementation or strategy where putting bitmap data in a database can not be accomplished more efficiently using a different approach. Bitmap data does not belong in a SQL database because it is not something that is of any use to the algebraic relational syntax of SQL, thus it is more efficient to store a reference to the data rather than the data itself. Putting database data in the database needlessly increases load on the database. If you are using MySQL, the tables in which the bitmap is stored are read-locked during the read of the data. If the data is large, it can use up buffering resources otherwise used to increase query performance. Bitmap image data can not be incorporated into the HTML stream with the rest of the data retrieved. A reference must be created in the HTML document so that the client web browser can issue a new HTTP request for the image. It is more efficient to put a reference in the database and have the browser query directly for the image against a file based system. SQL databases don't use normal data access methods to access large binary data, in PostgreSQL TOAST is used, in MySQL they are read as their own data blocks, and in Oracle they are sometimes put in different table spaces. Anyway you slice it, they are less efficient than normal data. If you can't come up with a scenario that disproves the previous assertions, then you aren't arguing the point and creating strawmen in an effort to avoid the real issues. However, none of those posts answered to my question... How can i retrieve and display those pictures to my PHP pages ? Basically, on my PHP page I have some texts and I would like to extract from DB the pictures to display. Therefore, set the header to mine JPEG or GIF does not allow to have text also. This is another problem with images in databases, unlike text or data which can be incorporated into the HTML output stream, an image needs to be its own file. Image doesn't need to be it's own file, Again, don't get hyper-literal, by file, as used in this post, I meant file as seen by the browser which is represented by a URL and causes a HTTP request. [snip] You will have to hit the database twice. Once to render the page, and again to render the image. To render the image you need to query the database and send the data back on its own, but before you do, you have to set the content type header to jpeg, gif, or whatever. This is why I say image data does not belong in the database. Boring. Actual answers to actual problems are usually boring. Belongs wherever the developer or the business requirements want to store it. Yea, and 1+1 = what ever the engineer or the business requirements want it to be, right? This is engineering, not art class. There are ways to evaluate solutions as being better than others. [snip] So please, how can i do to display pictures from DB, when my PHP page also include texts and other images (from filesystem) ? In fact i would like to do something like a thumbnail... You will need to repeat the same steps outlined above, but use image manipulation utilities to reduce the image. Again, that's why you store images in files and not in the database. [snip] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: session question
ORIGINAL # I have an index.php page which does not user session_start(); command. However in this index.php page, there are some $_SESSION['...']; variables stored. How is it possible that $_SESSION['...']; works even if no session has been created before ? moreover, if i use a print Session ID : .session_id(); after those lines, session_id() is empty (which is logical) as no session_start(); command has been used before. So, how is it possible that $_SESSION['..'] works ? Do i have a session created or not ? END ORIGINAL If you treat $_SESSION['username'] as a variable and set its value and then print it or check it. It will display the value but value will not be maintained for the next pages e.g. for index.php you dont use session_start() but you do the follow $_SESSION['username']=some value; echo $_SESSION['username']; //this will print some value So, in your case it is possible that some page is being included that is starting a session or setting up variable. -- Regards Fahad Pervaiz www.ecommerce-xperts.com (Shopping Cart Applications, Framework for Multilingual Web Sites, Web Designs) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: pictures stored in PostgreSQL DB
On Monday 05 March 2007 19:14, Robert Cummings wrote: On Mon, 2007-03-05 at 10:16 -0500, Mark wrote: Alain Roger wrote: Hi, It's amazing that my previous post has raised so much consideration about the fact to store or not pictures into DB. And yet you ask again!? Did you not learn? No good can come from this question. He didn't care about the debate. He is already using a database and wants to display the images. I'm sure he learned plenty, but not what he wanted to learn. I'd say the most important outcome of the side-track debate was to clarify that it depends on what you are working with, what you are doing, what your tolerance is for various types of solutions, and where those tolerances lie. An important thing we also learned, is that while filesystem storage is often the better solution, it is not always the best solution, especially when factoring in such things as convenience and simplicity. However, none of those posts answered to my question... How can i retrieve and display those pictures to my PHP pages ? Basically, on my PHP page I have some texts and I would like to extract from DB the pictures to display. Therefore, set the header to mine JPEG or GIF does not allow to have text also. This is another problem with images in databases, unlike text or data which can be incorporated into the HTML output stream, an image needs to be its own file. Image doesn't need to be it's own file, if it did then it would be forced to be on the filesystem, since we know it can be in a database instead, it thus follow it does not need to be it's own file... Ah but you are going to say but it needs it's own script to access the image! but that is not so, since a front end controller style script could easily contain the code to display an image with a little switch statement. Either way, you need a script wrapped around serving images from the filesystem if those images need to be protected by your site's authentication. Thus the point is completely moot. You will have to hit the database twice. Once to render the page, and again to render the image. To render the image you need to query the database and send the data back on its own, but before you do, you have to set the content type header to jpeg, gif, or whatever. This is why I say image data does not belong in the database. Boring. Belongs wherever the developer or the business requirements want to store it. Once again, you will need to set the content type header anyways if you have wrapped the image serving in your site's authentication checks -- whether it resides on the filesystem, in the database, or in a dark place where the sun don't shine. So please, how can i do to display pictures from DB, when my PHP page also include texts and other images (from filesystem) ? In fact i would like to do something like a thumbnail... You will need to repeat the same steps outlined above, but use image manipulation utilities to reduce the image. Again, that's why you store images in files and not in the database. Wrong again. Can pull the image directly into memory from the retrieved database field. Can then convert it to an image resource using imagecreatefromstring(). Can manipulate the image directly in memory using the image manipulation functions. And finally, can directly flush the image to the browser without ever having touched the filesystem manually. Filesystem is not a necessity. I picked up on that link, very interesting reading. Just a lot of fuss making the scaling function work, wheras I got pnmscale doing it for nothing. But I really liked the _clean_ solution fetching images from database and rescale on FREAKY!!! ;D *but slow* And even when I now seldom use the database to store images, I found even more areas to implement the idead you put me on... thanks Cheers, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | | :: : | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- --- Børge Kennel Arivene http://www.arivene.net --- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP Clustering solution -- Beta Testers Needed
Manuel Lemos wrote: Hello, on 03/05/2007 12:22 PM Mark said the following: I have a web clustering solution. It is better than putting session files on NFS and better than using a database. Take a look and give it a try. I need feedback on platforms, installation problems, bugs, suggestions, and if you are up to it, patches. Here is a brief outline http://www.mohawksoft.org/?q=node/36 You can download it from http://www.mohawksoft.org This seems very much like memcached based solutions. Actually the system codebase predates memcached and it is far more complete as a solution. It properly handles session locking during web page processing to avoid the phantom write problem. It provides a host of Concurrent access APIs for web sites. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: pictures stored in PostgreSQL DB
On Mon, 2007-03-05 at 14:48 -0500, markw@mohawksoft.com wrote: On Mon, 2007-03-05 at 10:16 -0500, Mark wrote: Alain Roger wrote: Hi, It's amazing that my previous post has raised so much consideration about the fact to store or not pictures into DB. And yet you ask again!? Did you not learn? No good can come from this question. He didn't care about the debate. He is already using a database and wants to display the images. I'm sure he learned plenty, but not what he wanted to learn. I gained nothing at all from supreme enlightenment - and for that very reason, it is called supreme enlightenment Buddha. Supreme enlightenment is only possible after death, and that presumes there's an afterlife that does not have the restrictions of our currently reality. Once you're dead, I highly doubt anyone's is going to care about your filesystem argument (or my counter argument for that matter). Besides, everyone knows God stores reality in a database. All your images belong to him. Me I'd say the most important outcome of the side-track debate was to clarify that it depends on what you are working with, what you are doing, what your tolerance is for various types of solutions, and where those tolerances lie. An important thing we also learned, is that while filesystem storage is often the better solution, it is not always the best solution, especially when factoring in such things as convenience and simplicity. I don't think we came to any such conclusion. I still assert that while there may be multiple right ways to accomplish a task, there are often clearly wrong ways. Putting bitmap data inside the database is a mistake. By we you mean you and perhaps some other edge believers. Before y'all got hyper-literal trying to argue the finer details of the definition of mistake, my assertion is this: I have yet to see one implementation or strategy where putting bitmap data in a database can not be accomplished more efficiently using a different approach. Bitmap data does not belong in a SQL database because it is not something that is of any use to the algebraic relational syntax of SQL, thus it is more efficient to store a reference to the data rather than the data itself. Image data can benefit from proximity to meta data that describes it that is in a relational database. You incorrect presumption is that one would want to make some kind of algebraic query against the binary data itself, when in fact quite often we merely want to retrieve the data due it's relevance to some other field upon which a query has been made. Putting database data in the database needlessly increases load on the database. If you are using MySQL, the tables in which the bitmap is stored are read-locked during the read of the data. If the data is large, it can use up buffering resources otherwise used to increase query performance. Putting image data on the filesystem when it has related fields in the database needlessly increases the load on the complexity of the application. Bitmap image data can not be incorporated into the HTML stream with the rest of the data retrieved. A reference must be created in the HTML document so that the client web browser can issue a new HTTP request for the image. It is more efficient to put a reference in the database and have the browser query directly for the image against a file based system. Filesystem data cannot be directly incorporated into the browser request when a custom authentication system is in place that requires wrapping the file request in a PHP script. Your argument keep going back to the same refuted point. YOU CANNOT ALLOW DIRECT REQUESTING OF SENSITIVE DATA. SQL databases don't use normal data access methods to access large binary data, in PostgreSQL TOAST is used, in MySQL they are read as their own data blocks, and in Oracle they are sometimes put in different table spaces. Anyway you slice it, they are less efficient than normal data. Once again you speak of one kind of efficiency. There are many kinds of efficiency when practicing computer science. Probably you think we should go back to directly programming in 1's and 0s because the efficiency of the code is superior to that generated by a higher level compiler. Puhlease. Did you actually study computer science? If you can't come up with a scenario that disproves the previous assertions, then you aren't arguing the point and creating strawmen in an effort to avoid the real issues. I've come up with plenty of examples. You have chosen to ignore them. I also left an open challenge to you on an implementation basis that you have yet to accept. Feel free to study up on self-deception. Your critical thinking appears to fall into this category: http://en.wikipedia.org/wiki/Self-deception However, none of those posts answered to my question... How can i retrieve and display those pictures to my PHP pages ? Basically, on my
Re: [PHP] Image storing
This dude is just trying to start another skirmishand probably a riot. On Monday 05 March 2007 19:50, Jay Blanchard wrote: [snip] Can you recommend the best way to store an image into the MySQL database and optimze it. And display and manipulate that image in PHP. [/snip] There are many tutorials; http://www.google.com/search?hl=enq=store+image+in+database+PHP -- --- Børge Kennel Arivene http://www.arivene.net --- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Image storing
On Mon, 2007-03-05 at 20:55 +0100, Børge Holen wrote: This dude is just trying to start another skirmishand probably a riot. Well he didn't ask about filesystems, so if everyone keeps it on topic there shouldn't be an issue ;) On Monday 05 March 2007 19:50, Jay Blanchard wrote: [snip] Can you recommend the best way to store an image into the MySQL database and optimze it. And display and manipulate that image in PHP. [/snip] There are many tutorials; http://www.google.com/search?hl=enq=store+image+in+database+PHP Personally, I've always found INSERT works well for storing pretty much any kind of data into a MySQL database. It also helps to properly quote the data. I've heard tell of a non standard keyword called REPLACE that can store the information also regardless of whether an existing entry exists for any defined primary key. f an entry already exists within a table having a defined primary key, then I'd strongly favour the UPDATE syntax. :) Cheers, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] session question
Alain Roger wrote: the index.php page is the first page where user should logon. it consists of 3 flags (english, french and slovak). when use click on 1 flags, it reload the index.php page and changes the login and password words by their relative translation into the flag country selected. if user click on LOGON button, therefore it calls the checklogin.php page and ONLY if login and password are correct, the session is created by session_start(); command. I've read the $_SESSION array is available even if the session_start() command has not been used. but they told that variable stored in $_SESSION are not available to user till session_start() has not been used... in my case, they are available... :-( 2 possibilities... 1) The session.auto_start php.ini setting is On - this causes session_start to be called before each request is processed. 2) There is no session. Remember that $_SESSION is a variable just like any other. It just happens that it gets stored between page requests if session_start is called. There is nothing stopping you using that variable, but I highly doubt its contents are getting stored between requests if you're not calling session_start. -Stut -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Accessing to an Object from a function
Stut wrote: Lorenzo Giuliani wrote: i made a script that uses an object to access to the site data, i divided the whole site into various high specialized functions. All functions accesses to a single object (the object is a txtSQL instance). ... but ... i can't access to the variable declared in the main script. This is something known as scope, and you really should know all about it: http://php.net/variables.scope In this particular case you can either user the $GLOBALS superglobal, or the global keyword. Both are covered on that manual page. or you pass in a reference/copy of the object as an argument to your function :-) -Stut -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Session_Start() error
Helder Lopes wrote: *hi people, Hi have this error in the session cookie, how to solve this??? did you read the error message? did you look up the lines specified in the error message? did you read the manual pages related to sessions and session functions? headers have already been sent because output has already been sent, you can't send headers after output has been sent out - so don't do that. Warning*: session_start() [function.session-starthttp://localhost/function.session-start]: Cannot send session cache limiter - headers already sent (output started at D:\PHP\xampp\htdocs\index.php:10) in *D:\PHP\xampp\htdocs\verifica.php* on line *3* -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: pictures stored in PostgreSQL DB
Robert Cummings escribió: This is engineering, not art class. There are ways to evaluate solutions as being better than others. This is computer science, not engineering. There are considerations for one approach over another not necessarily confined to your idea of efficiency. The problem encompasses time, space, economics, and any number of other dimensions. Most people put programming nearer to literature, art and mathematics then to physics and mechanic. So I would say that we are closer to an art class then to a class of engineering. :-D I'm pretty old-school when it comes to computer engineering. Like any engineering there is both science and art involved. The science is computer science and that is mostly mathematics based. The art is the creativity of coming up with novel solutions. The thing that separates engineering from art is the fact that after the abstract creativity takes place, it is verified against the science. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Matching Proper Versions Of PHP and MySQL
revDAVE escreveu: Hello All, I'm a newbie. My server just upgraded to PHP version 5.1.2 from php 4.3.11 MySQL currently is v 4.0.27 Q: What is the oldest - best/safest version of mySQL to use with PHP version 5.1.2.? The reason I mentioned the oldest - is because, for legacy clients, I would like to do the minimum upgrade to ensure best compatibility with legacy code ( mySQL and NON php etc.). If it is OK to stay on mySQL version 4.0.27 ... That would be good to know. Q: Is PHP version 5.1.2 - relatively stable version of PHP 5? -- Thanks - RevDave [EMAIL PROTECTED] [db-lists] The last release version of PHP is 5.2.1. The last relase version of MySQL is 5.0.27. You can use php 5.2.1 with MySQL 5.0.27 without problems. The system is very stable. -- zerof http://www.educar.pro.br/ Apache - PHP - MySQL - Boolean Logics - Project Management -- Você deve, sempre, consultar uma segunda opinião! -- Deixe todos saberem se esta informação foi-lhe útil. -- You must hear, always, one second opinion! In all cases. -- Let the people know if this info was useful for you! -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: pictures stored in PostgreSQL DB
Robert Cummings escribió: On Mon, 2007-03-05 at 14:48 -0500, markw@mohawksoft.com wrote: Yea, and 1+1 = what ever the engineer or the business requirements want it to be, right? Once again it depends. What base are we working in? Are we working in some kind of odd algebraic space? 1+1 only equals 2 in specific situations. Well, it's really the metric of the space you're in. That is, how you are going to measure things. :-) This is engineering, not art class. There are ways to evaluate solutions as being better than others. This is computer science, not engineering. There are considerations for one approach over another not necessarily confined to your idea of efficiency. The problem encompasses time, space, economics, and any number of other dimensions. Most people put programming nearer to literature, art and mathematics then to physics and mechanic. So I would say that we are closer to an art class then to a class of engineering. :-D -- select 'mmarques' || '@' || 'unl.edu.ar' AS email; - Martín Marqués | Programador, DBA Centro de Telemática| Administrador Universidad Nacional del Litoral - -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: pictures stored in PostgreSQL DB
On Mon, 2007-03-05 at 14:48 -0500, markw@mohawksoft.com wrote: On Mon, 2007-03-05 at 10:16 -0500, Mark wrote: Alain Roger wrote: Hi, It's amazing that my previous post has raised so much consideration about the fact to store or not pictures into DB. And yet you ask again!? Did you not learn? No good can come from this question. He didn't care about the debate. He is already using a database and wants to display the images. I'm sure he learned plenty, but not what he wanted to learn. I gained nothing at all from supreme enlightenment - and for that very reason, it is called supreme enlightenment Buddha. Supreme enlightenment is only possible after death, That depends on your philosophical underpinnings I suppose. Enlightenment, is an interesting topic, one I'm pretty sure goes WAY off topic on this list. and that presumes there's an afterlife Assumptions without proof do not a logical argument make. that does not have the restrictions of our currently reality. Most people don't even know what reality is. Once you're dead, I highly doubt anyone's is going to care about your filesystem argument (or my counter argument for that matter). Besides, everyone knows God stores reality in a database. All your images belong to him. As an atheist, I store god in the bit bucket, where [s]he/it belongs. I'd say the most important outcome of the side-track debate was to clarify that it depends on what you are working with, what you are doing, what your tolerance is for various types of solutions, and where those tolerances lie. An important thing we also learned, is that while filesystem storage is often the better solution, it is not always the best solution, especially when factoring in such things as convenience and simplicity. I don't think we came to any such conclusion. I still assert that while there may be multiple right ways to accomplish a task, there are often clearly wrong ways. Putting bitmap data inside the database is a mistake. By we you mean you and perhaps some other edge believers. Before y'all got hyper-literal trying to argue the finer details of the definition of mistake, my assertion is this: I have yet to see one implementation or strategy where putting bitmap data in a database can not be accomplished more efficiently using a different approach. Bitmap data does not belong in a SQL database because it is not something that is of any use to the algebraic relational syntax of SQL, thus it is more efficient to store a reference to the data rather than the data itself. Image data can benefit from proximity to meta data that describes it that is in a relational database. This is a false assumption. What possible benefit is gained? You incorrect presumption is that one would want to make some kind of algebraic query against the binary data itself, when in fact quite often we merely want to retrieve the data due it's relevance to some other field upon which a query has been made. Apart from a misunderstanding of what I wrote in your first sentence, the rest reads correctly. The functionality can be as easily implemented and more efficiently using references instead of the data. Putting database data in the database needlessly increases load on the database. If you are using MySQL, the tables in which the bitmap is stored are read-locked during the read of the data. If the data is large, it can use up buffering resources otherwise used to increase query performance. Putting image data on the filesystem when it has related fields in the database needlessly increases the load on the complexity of the application. Please explain how. You have to put a reference in the HTML stream for a later HTTP request from the browser anyway. Where is the complexity coming from? If you upload an image to the web server, it is stored in a temp directory and must be moved. I find it difficult to quantify any real added complexity between a file system move and a database insert. Bitmap image data can not be incorporated into the HTML stream with the rest of the data retrieved. A reference must be created in the HTML document so that the client web browser can issue a new HTTP request for the image. It is more efficient to put a reference in the database and have the browser query directly for the image against a file based system. Filesystem data cannot be directly incorporated into the browser request when a custom authentication system is in place that requires wrapping the file request in a PHP script. Your argument keep going back to the same refuted point. YOU CANNOT ALLOW DIRECT REQUESTING OF SENSITIVE DATA. No need for caps. There are many better ways of implementing authorization to access images. One could store in the local session data a variable allowed = /images/filename and rerieve the image. That way it authenticates locally and saves a database hit. The PHP file can simply
[PHP] Turning serialize data into an array
How can I get the data out of this string that has been serialize I need to get it into an array so I can access the data with something like $testdata[1] I have tried $testdata= unserialize($testdata); also $sst= base64_encode(serialize($testdata)); $testdata1= unserialize(base64_decode($sst)); I ether get an error bool(false) or the same data back. I do not have control of the script that serializes it $testdata='a:17:{s:11:event_start;s:4:2230;s:9:event_end;s:4:2300;s: 14:start_unixtime;i:1173076200;s:12:end_unixtime;i:1173078000;s:10:even t_text;s:37:Call+NANCYADKINS+-+%28276%29+681-6548;s:12:event_length;i:1 800;s:13:event_overlap;i:0;s:11:description;s:17:This+is+test+Data;s:6 :status;s:0:;s:5:class;s:7:CONTACT;s:9:spans_day;b:0;s:8:location ;s:0:;s:9:organizer;s:6:a:0:{};s:8:attendee;s:6:a:0:{};s:9:calnu mber;i:1;s:7:calname;s:5:admin;s:3:url;s:0:';
Re: [PHP] Re: pictures stored in PostgreSQL DB
On Mon, 2007-03-05 at 17:08 -0500, markw@mohawksoft.com wrote: On Mon, 2007-03-05 at 14:48 -0500, markw@mohawksoft.com wrote: On Mon, 2007-03-05 at 10:16 -0500, Mark wrote: I gained nothing at all from supreme enlightenment - and for that very reason, it is called supreme enlightenment Buddha. Supreme enlightenment is only possible after death, That depends on your philosophical underpinnings I suppose. Enlightenment, is an interesting topic, one I'm pretty sure goes WAY off topic on this list. Nah, on this list almost anything goes. Even futile opinion pieces purporting that filesystems are necessarily better than databases for storing images. But at any rate, my thoughts on Supreme Enlightenment would be All knowing since anything otherwise wouldn't be quite enlightended. As such, that would require more bits to encode as knowledge than materials exist in the universe to encode the knowledge... and even then those bits themselves would need to be accounted for. and that presumes there's an afterlife Assumptions without proof do not a logical argument make. I keep telling you that. that does not have the restrictions of our currently reality. Most people don't even know what reality is. I never claimed to know what it was, I'm only making some guesses with what little I presume. Once you're dead, I highly doubt anyone's is going to care about your filesystem argument (or my counter argument for that matter). Besides, everyone knows God stores reality in a database. All your images belong to him. As an atheist, I store god in the bit bucket, where [s]he/it belongs. As an atheist why do you bother stumbling upon the gender issue? Why even assign a gender? I have yet to see one implementation or strategy where putting bitmap data in a database can not be accomplished more efficiently using a different approach. Bitmap data does not belong in a SQL database because it is not something that is of any use to the algebraic relational syntax of SQL, thus it is more efficient to store a reference to the data rather than the data itself. Image data can benefit from proximity to meta data that describes it that is in a relational database. This is a false assumption. What possible benefit is gained? That's not an assumption, it's a fact. If I've already accessed a location on the hard drive where the meta data exists, and the binary data is beside it, then I can retrieve the binary data quite likely without another seek. As such, the time to retrieve is decreased and I was going to retrieve the meta data anyways. Using the filesystem, where the data is not in any kind of proximity would suggest a seek (not withstanding caching). You incorrect presumption is that one would want to make some kind of algebraic query against the binary data itself, when in fact quite often we merely want to retrieve the data due it's relevance to some other field upon which a query has been made. Apart from a misunderstanding of what I wrote in your first sentence, the rest reads correctly. The functionality can be as easily implemented and more efficiently using references instead of the data. Sounds like you want to make a database out of a filesystem. Once again, as I've mentioned numerous times, there is little your file system implementation can do to make the following a more succinct piece of code: ?php $conn = DbConnect(); $query = SELECT .name, .mime, .image_content .FROM .user_images .WHERE .id = .DbQuote( $imageId ). .AND .owner = .DbQuote( $ownerId ). ; if( DbQuery( $conn, $query ) DbNextRow( $conn ) ) { header( 'Content-Type: '.DbField( 'mime' ) ); header( 'Content-Disposition: attachment; filename='.DbField( 'name' ).'' ); echo DbField( 'image_content' ); exit(); } header( 'HTTP/1.0 404 Not Found' ); ? Putting database data in the database needlessly increases load on the database. If you are using MySQL, the tables in which the bitmap is stored are read-locked during the read of the data. If the data is large, it can use up buffering resources otherwise used to increase query performance. Putting image data on the filesystem when it has related fields in the database needlessly increases the load on the complexity of the application. Please explain how. You have to put a reference in the HTML stream for a later HTTP request from the browser anyway. Where is the complexity coming from? Development. If you upload an image to the web server, it is stored in a temp directory and must be moved. I find it difficult to quantify any real added complexity between a file system move and a database insert. That's insertion. What about retrieval, deletion, and backup? Bitmap image data can not be incorporated into
[PHP] Re: advise on data encryption security.
Gregory Machin wrote: Hi Can anyone point me in the direction of some good docs / howto's on building php apps that have fully encrypted databases etc .. Many thanks I'm not sure you'll find any links to fully encrypted databases. That's almost useless. You may want to consider encrypted data within the database. The encryption methodology is important for both security and performance. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Matching Proper Versions Of PHP and MySQL
zerof wrote: revDAVE escreveu: Hello All, I'm a newbie. My server just upgraded to PHP version 5.1.2 from php 4.3.11 MySQL currently is v 4.0.27 Q: What is the oldest - best/safest version of mySQL to use with PHP version 5.1.2.? The reason I mentioned the oldest - is because, for legacy clients, I would like to do the minimum upgrade to ensure best compatibility with legacy code ( mySQL and NON php etc.). If it is OK to stay on mySQL version 4.0.27 ... That would be good to know. Q: Is PHP version 5.1.2 - relatively stable version of PHP 5? -- Thanks - RevDave [EMAIL PROTECTED] [db-lists] The last release version of PHP is 5.2.1. The last relase version of MySQL is 5.0.27. You can use php 5.2.1 with MySQL 5.0.27 without problems. The system is very stable. That wasn't his question. Stability wise they should be fine. Functionality wise, it depends. The best way to work out the minimum version for your software to work is to check the functions that you're using. eg http://www.php.net/manual/en/function.date-default-timezone-get.php came in at 5.1.0. So depending on what functions you are using, you may need to run a newer version. Mysql 4.0.27 should be ok - but that means you're losing sub-queries (v4.1+) and database functions (v5.0+ I think, maybe 5.1+). Also both are old versions - if you find bugs/have issues, you'll either have to work around them or upgrade - the respective developers will not try to fix bugs in them because they are old (comparatively speaking). -- Postgresql php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Image storing
At 8:55 PM +0100 3/5/07, Børge Holen wrote: This dude is just trying to start another skirmishand probably a riot. Was there something I missed. :-) tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re[2]: [PHP] Problem with spam
Hello, JM grep -l mail( *.php I of course tried this before but I have hundereds domains and a lot of files where clients using function mail. -- Regards, Bc. Radek Krejca ICQ: 65895541 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] problem in using ldap_add() function
Hi , i m trying to insert a new user account into the ldap using php . bt i m getting the following warning and the data is not geting inserted *Warning*: ldap_add() [function.ldap-addhttp://gsrv/%7Earun/globees_webservice/Authentication_Layer/function.ldap-add]: Value array must have consecutive indices 0, 1, ... in * /home/arun/public_html/globees_webservice/Authentication_Layer/cls.authentication.php * on line *148* Could not add new entry! following is my ldap details openldap2.2 LDPv3 PHP Version 5.1.2 Server: Ubuntu 6.06.1 LTS Apache2 the ldap is working queit fine with other systems. here i am also inclding the code i was trying function addUser($username,$password){ $dn = uid=arun,ou=People,dc=globees,dc=com; $pass = 'arun'; $ds=ldap_connect('localhost'); // must be a valid LDAP server! $session_id = ''; $error_status = '-'; if ($ds) { if (!ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3)) $error_status = Failed to set protocol version 3; [EMAIL PROTECTED]($ds,$dn,$pass); if ($r == TRUE) { //do insertion $dn = uid=testarun,ou=People,dc=globees,dc=com; $entry[uid] = testarun; $entry[cn] = testarun; $entry[sn] = test; $entry['mail'] = [EMAIL PROTECTED]; $entry['objectClass'][0] = inetLocalMailRecipient; $entry['objectclass'][1] = person; $entry['objectclass'][2] = organizationalPerson; $entry['objectclass'][3] = inetOrgPerson; $entry['objectClass'][4] = posixAccount; $entry['objectClass'][5] = top; $entry['objectClass'][6] = shadowAccount; $entry[gidnumber] = 100; $entry['homeDirectory'] = /home/arun; $entry['gecos'] = testarun; $entry['loginShell']= '/bin/bash'; $entry['userPassword']='{MD5}' . base64_encode(pack('H*',md5(testarun))); $f = ldap_add($ds, $dn, $entry) or die(Could not add new entry!); if($f==TRUE) //return a success mesage if insertion successful echo successfully added; } elseif ($r == FALSE) $error_status = Access Denied!!!; else $error_status = LDAP ERROR!; } else $error_status = Connection Error; return $error_status; }//end of method _ if anybody has some possible solutions to solve this problem plzz give me a reply -- Regards, ...Arun
[PHP] problem in using ldap_add() function
Hi , i m trying to insert a new user account into the ldap using php . bt i m getting the following warning and the data is not geting inserted _ Warning: ldap_add() [function.ldap-add]: Value array must have consecutive indices 0, 1, ... in /home/arun/public_html/globees_webservice/Authentication_Layer/cls.authentication.php on line 148 Could not add new entry! __ following is my ldap details ___ openldap2.2 LDPv3 PHP Version 5.1.2 Server: Ubuntu 6.06.1 LTS Apache2 the ldap is working queit fine with other systems. here i am also inclding the code i was trying function addUser($username,$password){ $dn = uid=arun,ou=People,dc=globees,dc=com; $pass = 'arun'; $ds=ldap_connect('localhost'); // must be a valid LDAP server! $session_id = ''; $error_status = '-'; if ($ds) { if (!ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3)) $error_status = Failed to set protocol version 3; [EMAIL PROTECTED]($ds,$dn,$pass); if ($r == TRUE) { //do insertion $dn = uid=testarun,ou=People,dc=globees,dc=com; $entry[uid] = testarun; $entry[cn] = testarun; $entry[sn] = test; $entry['mail'] = [EMAIL PROTECTED]; $entry['objectClass'][0] = inetLocalMailRecipient; $entry['objectclass'][1] = person; $entry['objectclass'][2] = organizationalPerson; $entry['objectclass'][3] = inetOrgPerson; $entry['objectClass'][4] = posixAccount; $entry['objectClass'][5] = top; $entry['objectClass'][6] = shadowAccount; $entry[gidnumber] = 100; $entry['homeDirectory'] = /home/arun; $entry['gecos'] = testarun; $entry['loginShell']= '/bin/bash'; $entry['userPassword']='{MD5}' . base64_encode(pack('H*',md5(testarun))); $f = ldap_add($ds, $dn, $entry) or die(Could not add new entry!); if($f==TRUE) //return a success mesage if insertion successful echo successfully added; } elseif ($r == FALSE) $error_status = Access Denied!!!; else $error_status = LDAP ERROR!; } else $error_status = Connection Error; return $error_status; }//end of method _ if anybody has some possible solutions to solve this problem plzz give me a reply -- Regards, ...Arun -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php