Re: [PHP-DB] Intermittent odbc_connect() problem with iodbc/openlink
Assuming you always connect to the server using the exact parameter values for odbc_connect(), this does not look like an easy one to solve. I also connect to a Sybase database on a Win2K server from PHP/Apache/Solaris. However, I don't use the odbc extension. I use the odbtp extension, which works very well, and has better support. So, you probably will have better results with odbtp, which is available at http://odbtp.sourceforge.net. On Wed, 16 Feb 2005, Crone, James wrote: I'm having intermittent problems with odbc_connect(). Here's the situation I'm trying to connect to a Sybase Adaptive Server Anywhere database running on Win2K from my web server using Solaris, Apache, PHP, iODBC, and OpenLink's ODBC universal data access driver for MSSQL/Sybase. About 75% of the time, my php scripts talk to the Sybase system fine. However, the other 25% of the time nothing really happens. IE reports a Page cannot be displayed error, while Firefox acts like it may do something for a fraction of a second, but then just stays on the currently loaded page. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Re: checkbox into mysql using php input type=checkbox name=list
if its all going into one col, then implode the array into a string $data = implode(,,$_POST['games']); Then insert the data. Still doesn't relieve you of the need to validate the user data. Bastien From: moses Woldeselassie [EMAIL PROTECTED] To: php-db@lists.php.net, [EMAIL PROTECTED] Subject: RE: [PHP-DB] Re: checkbox into mysql using php input type=checkbox name=list Date: Thu, 17 Feb 2005 10:21:31 + thank Bastien I did try that, but the input is going into one column or it is take the last array value and put it each chart in the table. input type=checkbox name=games[] value=football / in that case, these are the value i got in mysql: f, o, o, t foreach($_POST['games'] AS $game = $value) $valuecount = count($_POST['games']); for($i =0; $i $valuecount; $i++) $sql = mysql_query(insert into interest values('$value[0]','$value[1]','$value[2]','$value[3]')); i'm looking forward to hearing from you. kind regards; m gt;From: quot;Bastien Koertquot; lt;[EMAIL PROTECTED]gt; gt;To: [EMAIL PROTECTED], php-db@lists.php.net gt;Subject: RE: [PHP-DB] Re: checkbox into mysql using php lt;input type=quot;checkboxquot; name=quot;list gt;Date: Wed, 16 Feb 2005 21:38:10 -0500 gt; gt;$value is not an array...wont run gt; gt;try gt; gt;$valuecount = count($_POST['games']); gt; gt;bastien gt; gt;gt;From: quot;moses Woldeselassiequot; lt;[EMAIL PROTECTED]gt; gt;gt;To: php-db@lists.php.net gt;gt;Subject: RE: [PHP-DB] Re: checkbox into mysql using php lt;input gt;gt;type=quot;checkboxquot; name=quot;list gt;gt;Date: Wed, 16 Feb 2005 22:09:09 + gt;gt; gt;gt;Thank you, gt;gt; gt;gt;i don't have any problem using that syntax: gt;gt;if (isset($_POST['submit'])) { gt;gt; echo quot;You chose the following games:lt;br /gt;quot;; gt;gt; foreach($_POST['games'] AS $game =gt; $value) gt;gt; $sql = mysql_query(quot;insert into interest(username) gt;gt;values('$value')quot;); gt;gt; gt;gt;but the problem is with the following: gt;gt; gt;gt; gt;gt;$valuecount = count($value) gt;gt;for($i =0; $i lt; $valuecount; $i++) { gt;gt;$sql = mysql_query(quot;insert into interest values('$value', gt;gt;'$value[$i]')quot;); gt;gt; gt;gt;I don't get any input into mysql. gt;gt; gt;gt;kind regards gt;gt;m gt;gt; gt;gt; gt;gt;amp;gt;From: pete M amp;lt;[EMAIL PROTECTED]amp;gt; gt;gt;amp;gt;To: php-db@lists.php.net gt;gt;amp;gt;Subject: [PHP-DB] Re: checkbox into mysql using php amp;lt;input gt;gt;type=amp;quot;checkboxamp;quot; gt;gt;name=amp;quot;list[]amp;quot;value=amp;quot;xamp;quot;amp;gt; gt;gt;amp;gt;Date: Wed, 16 Feb 2005 18:22:14 + gt;gt;amp;gt; gt;gt;amp;gt;foreach($_POST['name'] as $k =amp;gt; $v){ gt;gt;amp;gt; gt;gt;amp;gt;} gt;gt;amp;gt; gt;gt;amp;gt;moses Woldeselassie wrote: gt;gt;amp;gt;amp;gt;hi all gt;gt;amp;gt;amp;gt; gt;gt;amp;gt;amp;gt; gt;gt;amp;gt;amp;gt;I need a simple php script to use for html gt;gt;amp;gt;amp;gt; gt;gt;amp;gt;amp;gt; gt;gt;amp;gt;amp;gt; gt;gt;amp;gt;amp;gt;amp;lt;form action=amp;quot;checkbox.phpamp;quot; gt;gt;method=amp;quot;postamp;quot;amp;gt; gt;gt;amp;gt;amp;gt; Select from the list amp;lt;br /amp;gt; (check all that gt;gt;apply):amp;lt;br /amp;gt; gt;gt;amp;gt;amp;gt; amp;lt;input type=amp;quot;checkboxamp;quot; gt;gt;name=amp;quot;list[]amp;quot; value=amp;quot;xamp;quot;amp;gt; gt;gt;amp;gt;amp;gt; amp;lt;input type=amp;quot;checkboxamp;quot; gt;gt;name=amp;quot;list[]amp;quot; value=amp;quot;yamp;quot;amp;gt; gt;gt;amp;gt;amp;gt;amp;lt;input type=amp;quot;submitamp;quot; name=amp;quot;submitamp;quot; gt;gt;value=amp;quot;Go!amp;quot; /amp;gt; gt;gt;amp;gt;amp;gt;amp;lt;/formamp;gt; gt;gt;amp;gt;amp;gt; gt;gt;amp;gt;amp;gt;kind regards gt;gt;amp;gt;amp;gt;meberat gt;gt;amp;gt; gt;gt;amp;gt;-- gt;gt;amp;gt;PHP Database Mailing List (http://www.php.net/) gt;gt;amp;gt;To unsubscribe, visit: http://www.php.net/unsub.php gt;gt;amp;gt; gt;gt; gt;gt;-- gt;gt;PHP Database Mailing List (http://www.php.net/) gt;gt;To unsubscribe, visit: http://www.php.net/unsub.php gt;gt; gt; gt;-- gt;PHP Database Mailing List (http://www.php.net/) gt;To unsubscribe, visit: http://www.php.net/unsub.php gt; -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Re: checkbox into mysql using php input type=checkbox name=list
Bastien Koert wrote: if its all going into one col, then implode the array into a string $data = implode(,,$_POST['games']); Then insert the data. Still doesn't relieve you of the need to validate the user data. Bastien [snip] No no no - you're confusing the guy further. He's taking an array post variable, foreaching it (resulting in a string in $value) and then using string indexes. $value == 'football' $value[0] == 'f' etc. [unsnip - more to come] From: moses Woldeselassie [EMAIL PROTECTED] I did try that, but the input is going into one column or it is take the last array value and put it each chart in the table. input type=checkbox name=games[] value=football / in that case, these are the value i got in mysql: f, o, o, t foreach($_POST['games'] AS $game = $value) $valuecount = count($_POST['games']); for($i =0; $i $valuecount; $i++) $sql = mysql_query(insert into interest values('$value[0]','$value[1]','$value[2]','$value[3]')); [snip] what he wants is (I think): foreach($_POST['games'] AS $game_name) { $sql = mysql_query(insert into interest values('$game_name');); } or something similar. The idea is that they check 3 boxes for football, soccer, and hockey - and it inserts three rows into the database. It seems like we want to be inserting more than just the game though - surely the user it's associated with / etc. Moses - be sure to use curly brackets {} around blocks. Your above code only runs the $valuecount = bit inside the foreach, which is why you were spared it running 'squared' times (e.g. 2 games = 4 times, 3 = 9, 4 = 16). The foreach and the for($i= code above are both there to accomplish the same thing, but $value stores the last seen value, so it would have looked as if you were still inside the foreach's scope. Stick with the foreach imo, since you don't need the counter. (you can get it back by using your foreach, the counter is the $game = part - in my example I left it out since it's unnecessary. Cheers, -- - Martin Norland, Sys Admin / Database / Web Developer, International Outreach x3257 The opinion(s) contained within this email do not necessarily represent those of St. Jude Children's Research Hospital. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Intermittent odbc_connect() problem with iodbc/openlink
Crone, James wrote: I'm having intermittent problems with odbc_connect(). Here's the situation I'm trying to connect to a Sybase Adaptive Server Anywhere database running on Win2K from my web server using Solaris, Apache, PHP, iODBC, and OpenLink's ODBC universal data access driver for MSSQL/Sybase. About 75% of the time, my php scripts talk to the Sybase system fine. However, the other 25% of the time nothing really happens. IE reports a Page cannot be displayed error, while Firefox acts like it may do something for a fraction of a second, but then just stays on the currently loaded page. I have tracing turned on in iODBC. When things work fine, a lengthy trace file is generated and everything seems to be in order. When things don't work, all I get is the following: [snip] No connect errors are generated either in the trace file or in the browser's display. It's almost as if the process just dies without saying anything about why it happened. [snip] What do your servers error logs say? This sounds suspiciously like the behavior one gets when php runs out of memory. If so, it should have an Unable to allocate # bytes type message in the error log. Check that, and increase memory_limit in your php.ini if this is the case. Cheers, -- - Martin Norland, Sys Admin / Database / Web Developer, International Outreach x3257 The opinion(s) contained within this email do not necessarily represent those of St. Jude Children's Research Hospital. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] authenticating using system user list
I have a database program using postgres and having a PHP front end. It requires people to login to gain access. Everyone who needs to login to that database program has a system user account in that machine. (since it's also the email server) What is the best way to authenticate using the system users/passwd? (/etc/shadow ?) I hate to create a a new set of username/password in postgres for each person just to be able to login to this program. And it would really help a lot because they don't have to remember two passwords. Any help will be appreciated. Thanks -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] authenticating using system user list
why not create one account to use the db and use table based authentication? Same for email? bastien From: Henry Ortega [EMAIL PROTECTED] Reply-To: Henry Ortega [EMAIL PROTECTED] To: php-db@lists.php.net Subject: [PHP-DB] authenticating using system user list Date: Thu, 17 Feb 2005 11:54:17 -0500 I have a database program using postgres and having a PHP front end. It requires people to login to gain access. Everyone who needs to login to that database program has a system user account in that machine. (since it's also the email server) What is the best way to authenticate using the system users/passwd? (/etc/shadow ?) I hate to create a a new set of username/password in postgres for each person just to be able to login to this program. And it would really help a lot because they don't have to remember two passwords. Any help will be appreciated. Thanks -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] authenticating using system user list
I already have the one account in postgres to use the DB. I just need the authentication part. Sure, I can use table based authentication, but if I have 100 users and those 100 users already have an email account on this server, I might as well have them use those system account credentials to authenticate. Saves me time to create another 100 username/passwords for these people and makes it easier for them to remember only one password. I'm thinking, maybe as unprivileged user, you can always do a popen or write a different shell script to *query* the system if the user/password pair is legit. Maybe /bin/login would do, but I'm stuck since it doesn't take the password in the command line... Still playing around.. any help is welcome... On Thu, 17 Feb 2005 12:00:57 -0500, Bastien Koert [EMAIL PROTECTED] wrote: why not create one account to use the db and use table based authentication? Same for email? bastien From: Henry Ortega [EMAIL PROTECTED] Reply-To: Henry Ortega [EMAIL PROTECTED] To: php-db@lists.php.net Subject: [PHP-DB] authenticating using system user list Date: Thu, 17 Feb 2005 11:54:17 -0500 I have a database program using postgres and having a PHP front end. It requires people to login to gain access. Everyone who needs to login to that database program has a system user account in that machine. (since it's also the email server) What is the best way to authenticate using the system users/passwd? (/etc/shadow ?) I hate to create a a new set of username/password in postgres for each person just to be able to login to this program. And it would really help a lot because they don't have to remember two passwords. Any help will be appreciated. Thanks -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php