Re: [PHP-DB] Trouble with uploading a file via ftp_put
Hi, Let me get this straight: You're trying to transfer a file from a local PC (A) to a server (B). And your code is running on (B)? If so, then, (assuming you have things setup correctly, ie have an ftpserver running on (A)), you should be using ftp_get() or similar. If not, could you describe *exactly* what you're trying to do and explain why you're not using a standard FTP client on the local pc to transfer the file to the remote pc. I want that (B) can locate the file on (A) and upload it to the subdirectory on (B). This should also be possible in the case the user have no ftp-server on his local pc. Why I want try it without the standart FTP client. The script is part of a portal and because of comfortreasons and securityreasons I want the upload and the entry in a database act with php on (B). (B) has a ftpserver included. If the way over ftp is the wrong way, you can also tell me how to do this with the normay copy-command. Regards, Ruprecht -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Selecting two names from a table
Hi, I have a table called Bookings and a table called User. Bookings are created and hold the User_ID of the User who created it (Booking.Booked_User) and the User who will be going on the booking (Booking.Booking_Creator). How can I create a report that lists both users on each row. If I do 'SELECT U.User_Name, B.Booking_Date FROM WMS_User WHERE B.Booking_Creator = U.User_ID AND B.Booked_User = U.User_ID', then the query returns no data. So for each row in the table I need to somehow select 2 names from the user table based on 2 different User_ID's held in the Bookings table. Any help would be greatly appreciated. Thanks for your help -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] pathinformation from file-field
Hi, how can I get the pathinformation you can see in the file-field if you chose one file within a formular for transfer. Regards, Ruprecht -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] pathinformation from file-field
how can I get the pathinformation you can see in the file-field if you chose one file within a formular for transfer. http://nl.php.net/manual/en/function.pathinfo.php ? laters, Fedde ~= Everybody lies, but it doesn't matter because nobody listens =~ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Selecting two names from a table
Hi, Try something like this: SELECT U1.User_Name , U2.User_Name , B.Booking_Date FROMUSER U1 , USER U2 , BOOKING B WHERE B.Booking_Creator = U1.User_ID AND B.Booked_User = U2.User_ID' Jack -Original Message- From: Shaun [mailto:[EMAIL PROTECTED] Sent: Monday, October 06, 2003 11:24 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] Selecting two names from a table Hi, I have a table called Bookings and a table called User. Bookings are created and hold the User_ID of the User who created it (Booking.Booked_User) and the User who will be going on the booking (Booking.Booking_Creator). How can I create a report that lists both users on each row. If I do 'SELECT U.User_Name, B.Booking_Date FROM WMS_User WHERE B.Booking_Creator = U.User_ID AND B.Booked_User = U.User_ID', then the query returns no data. So for each row in the table I need to somehow select 2 names from the user table based on 2 different User_ID's held in the Bookings table. Any help would be greatly appreciated. Thanks for your help -- 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] pathinformation from file-field
On Monday 06 October 2003 18:31, Ruprecht Helms wrote: how can I get the pathinformation you can see in the file-field if you chose one file within a formular for transfer. If you mean when you do an HTTP upload, then no, you cannot get the path info. All you get is the file name. This is for security reasons. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-db -- /* I believe a little incompatibility is the spice of life, particularly if he has income and she is pattable. -- Ogden Nash */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Selecting two names from a table
Thank you! Jacob A. Van Zanen [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi, Try something like this: SELECT U1.User_Name , U2.User_Name , B.Booking_Date FROM USER U1 , USER U2 , BOOKING B WHERE B.Booking_Creator = U1.User_ID AND B.Booked_User = U2.User_ID' Jack -Original Message- From: Shaun [mailto:[EMAIL PROTECTED] Sent: Monday, October 06, 2003 11:24 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] Selecting two names from a table Hi, I have a table called Bookings and a table called User. Bookings are created and hold the User_ID of the User who created it (Booking.Booked_User) and the User who will be going on the booking (Booking.Booking_Creator). How can I create a report that lists both users on each row. If I do 'SELECT U.User_Name, B.Booking_Date FROM WMS_User WHERE B.Booking_Creator = U.User_ID AND B.Booked_User = U.User_ID', then the query returns no data. So for each row in the table I need to somehow select 2 names from the user table based on 2 different User_ID's held in the Bookings table. Any help would be greatly appreciated. Thanks for your help -- 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] Trouble with uploading a file via ftp_put
On Monday 06 October 2003 16:48, Ruprecht Helms wrote: I want that (B) can locate the file on (A) and upload it to the subdirectory on (B). This should also be possible in the case the user have no ftp-server on his local pc. If (A) does not have an ftp server installed then you're asking for the impossible. Why I want try it without the standart FTP client. The script is part of a portal and because of comfortreasons and securityreasons I want the upload and the entry in a database act with php on (B). The only standard way in which a website, ie (B), can get a file from a web browser, ie (A), is through HTTP upload. (B) has a ftpserver included. If the way over ftp is the wrong way, you can also tell me how to do this with the normay copy-command. (B) which is running the script is in effect the ftp client, it needs to be able to connect to an ftp server. COnnecting to itself isn't very useful. In other words you need an ftp server on (A). -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-db -- /* A fool-proof method for sculpting an elephant: first, get a huge block of marble; then you chip away everything that doesn't look like an elephant. */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] pathinformation from file-field
On Mon, 2003-10-06 at 13:07, Jason Wong wrote: On Monday 06 October 2003 18:31, Ruprecht Helms wrote: how can I get the pathinformation you can see in the file-field if you chose one file within a formular for transfer. If you mean when you do an HTTP upload, then no, you cannot get the path info. All you get is the file name. This is for security reasons. yes for upload. I try to use it with the copy-command. I want combine it with the ipadress of the local host. If I'm right the file should be copied to a webserver. With ftp or http-upload I have trouble, because the uploadfunctions are malefunction. Regards, Ruprecht -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Trouble with uploading a file via ftp_put
On Mon, 2003-10-06 at 13:05, Jason Wong wrote: Now I tried the method with move_uploaded (http-upload). This is the testscript ?php // upload.php: PHP File Upload im Safe Mode21.5.02/vo // (http-Protokoll und POST-Mechanismus) // Skript funktioniert auch im Safe Mode, da //die Funktion move_uploaded_file verwendet wird. if ($img1_name == ) { ? html head titleUpload a File/title /head !-- Formular: in einem Filepanel kann der Name des lokalen Files angegeben werden, das auf den Server hochgeladen werden soll. -- body h1Upload a File/h1 form enctype=multipart/form-data method=post action=?php echo $PHP_SELF? pstrongFile to Upload:/strongbr input type=file name=img1 size=30/p Pinput type=submit name=submit value=Upload File/p /form ?php } // Das Formular ist ausgefuellt worden... else { $curdir=getcwd(); // der Filename kommt vom Formularfeld img1, s. oben. // Dieser Touch muss mit dem cgi-Skript gemacht werden: // exec(/usr/local/info-sys/cgi-bin/phptouch $SCRIPT_FILENAME $curdir/tmp/$img1_name,$t,$status); move_uploaded_file($img1, ./html/$img1_name); // Dieser Chown muss mit dem cgi-Skript gemacht werden: // exec(/usr/local/info-sys/cgi-bin/phpchown $SCRIPT_FILENAME $curdir/tmp/$img1_name,$r,$status); // Wichtig: // rwx-Permissions erforderlich fuer Zielverzeichnis tmp ? html head titleFile Upload/title /head body PYou sent: ?php echo $img1_name; ?, a ?php echo $img1_size; ? byte file with a mime type of ?php echo $img1_type; ?./p ?php } ? /body /html And this are the errormessages. Warning: move_uploaded_file(./html/udsklein.png) [function.move-uploaded-file]: failed to create stream: No such file or directory in /home/www/web172/html/upload.php on line 51 Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move '/home/www/web172/phptmp/php7AuByW' to './html/udsklein.png' in /home/www/web172/html/upload.php on line 51 You sent: udsklein.png, a 5741 byte file with a mime type of image/png. What can be wrong here -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Need help with a OpenLink ODBC driver error again
Ok this time I checked the SQL select syntax! So I hope it's not something that easy again (Well actually easy would be nice) The other day I Posted a email question about getting a 37000 sql error but my sql syntax was wrong. Yes I felt stupid but this time I corrected the syntax and I am still getting an error but, the error is that the web browser times-out trying to get the page. (Nothing displayed and a browser error Could not open the page ³http://127.0.0.1/tests/odbc.php² because Safari could not load any data for this location. I get the same type of thing with Internet Explorer. Here is a recap. I am using iodbc from openlink on OS X and everything seems fine. I can get and display tables with: $results = odbc_tables($conn) or die(P.odbc_errormsg()); odbc_result_all($results) or die(ppulling result error); (full syntax below) But when I switch to $results = odbc_exec($conn,$sql) or die(p captured .odbc_errormsg()); odbc_result_all($results) or die(ppulling result error); I get an: Could not open the page ³http://127.0.0.1/tests/odbc.php² because Safari could not load any data for this location. Any ideas? Why tables work but SQL Select doesn't? Also I have a 5 user openlink license. how do I reset the connections after I get 5 errors because I think the connections are not dropped when PHP gets an error? The only way I can get to 5 lic. Limit to reset is to restart os x? Sudo apachectl restart doesn't seem to work either? Full Syntax: ? odbc_close_all(); putenv(DYLD_LIBRARY_PATH=/usr/lib/libiodbc.dylib); putenv(ODBCINSTINI=/Library/ODBC/odbcinst.ini); putenv(ODBCINI=/Library/ODBC/odbc.ini); //odbc.ini contains your DSNs. $dsn=DSNname; // this is a valid DSN can be tested in odbctest $user=name; $password=password; $sql=SELECT * FROM tblDepartments; $conn=odbc_connect($dsn,$user,$password) or die (pcouldn't connect); echo connected to DSN: $dsn; echo BRbSQL:/b $sqlBR; //$results = odbc_exec($conn,$sql) or die(p captured .odbc_errormsg()); $results = odbc_tables($conn) or die(P.odbc_errormsg()); odbc_result_all($results) or die(ppulling result error); echo closing connection $conn; odbc_close($conn); odbc_close_all(); ? Don Myers -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Need help with a OpenLink ODBC driver error again
Hi Does the query return data when executed not through a browser but directly on the database? If yes, how much time does it take to return the data. I believe default time out for apache is 30 seconds. So maybe it's a webserver setting that needs to be increased. Jack -Original Message- From: Don Myers [mailto:[EMAIL PROTECTED] Sent: Monday, October 06, 2003 3:23 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] Need help with a OpenLink ODBC driver error again Ok this time I checked the SQL select syntax! So I hope it's not something that easy again (Well actually easy would be nice) The other day I Posted a email question about getting a 37000 sql error but my sql syntax was wrong. Yes I felt stupid but this time I corrected the syntax and I am still getting an error but, the error is that the web browser times-out trying to get the page. (Nothing displayed and a browser error Could not open the page ³http://127.0.0.1/tests/odbc.php² because Safari could not load any data for this location. I get the same type of thing with Internet Explorer. Here is a recap. I am using iodbc from openlink on OS X and everything seems fine. I can get and display tables with: $results = odbc_tables($conn) or die(P.odbc_errormsg()); odbc_result_all($results) or die(ppulling result error); (full syntax below) But when I switch to $results = odbc_exec($conn,$sql) or die(p captured .odbc_errormsg()); odbc_result_all($results) or die(ppulling result error); I get an: Could not open the page ³http://127.0.0.1/tests/odbc.php² because Safari could not load any data for this location. Any ideas? Why tables work but SQL Select doesn't? Also I have a 5 user openlink license. how do I reset the connections after I get 5 errors because I think the connections are not dropped when PHP gets an error? The only way I can get to 5 lic. Limit to reset is to restart os x? Sudo apachectl restart doesn't seem to work either? Full Syntax: ? odbc_close_all(); putenv(DYLD_LIBRARY_PATH=/usr/lib/libiodbc.dylib); putenv(ODBCINSTINI=/Library/ODBC/odbcinst.ini); putenv(ODBCINI=/Library/ODBC/odbc.ini); //odbc.ini contains your DSNs. $dsn=DSNname; // this is a valid DSN can be tested in odbctest $user=name; $password=password; $sql=SELECT * FROM tblDepartments; $conn=odbc_connect($dsn,$user,$password) or die (pcouldn't connect); echo connected to DSN: $dsn; echo BRbSQL:/b $sqlBR; //$results = odbc_exec($conn,$sql) or die(p captured .odbc_errormsg()); $results = odbc_tables($conn) or die(P.odbc_errormsg()); odbc_result_all($results) or die(ppulling result error); echo closing connection $conn; odbc_close($conn); odbc_close_all(); ? Don Myers -- 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] HELP With UPDATE Query in mySQL
and put it inside a transaction cos in case something goes wrong part of the way through pete Jeff Shapiro wrote: This should do it: UPDATE Bookings SET Booking_Start_Date = CONCAT(DATE_FORMAT(Booking_Start_Date, '%Y-%m-%d'), '09:00:00'), Booking_End_Date = CONCAT(DATE_FORMAT(Booking_End_Date, '%Y-%m-%d'), '17:30:00'); If you are using version 4.1.1 or newer the DATE_FORMAT function could be replaced by: DATE(Booking_Start_Date) On Fri, 3 Oct 2003 22:54:49 +0100, Shaun spoke thusly about [PHP-DB] HELP With UPDATE Query in mySQL: Hi, I have two columns in my Bookings table of type DATETIME - Booking_Start_Date and Boking_End_Date. How can i update every row so that all of the times for Booking_Start_Date are 09.00 and all of the times for Booking_End_Date are 17.30, without affecting any of the dates? Thanks for your help --- Listserv only address. Jeff Shapiro -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Red Hat 9 + MS SQL
Hi, I could use some help here. I've been running a Red Hat 9 server for the last couple of months that uses FreeTDS/unixODBC to connect to a Microsoft SQL Server 2k Server. Lately I've added the Windows server to the Active Directory Domain, and now php cannot keep a persistant connection to the database. Regular connections work fine. This used to work fine for a long time, and now it's not working. Any idea why this isn't working or how I could fix it? Thanks in advance for any help, Chris Frederick -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Trouble with uploading a file via ftp_put
Ruprecht, I've experienced this problem, its that you need to turn ftp_pasv on. ftp_pasv($connection_id,true); That should take care of it, don't' worry about anything else. Michael Scappa Lead Developer Verve Internet Solutions for higher education -Original Message- From: Ruprecht Helms [mailto:[EMAIL PROTECTED] Sent: Sunday, October 05, 2003 5:16 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] Trouble with uploading a file via ftp_put Hi, by uploading a file via the ftp_put-command the upload is not done properly. Result is I have a file in the destinationdirectory but 0 bit in size, only the filename is transfered. How have I to write the script that the file I want upload should be uploaded within the correct size. The actual script you can see here. [code] $conn_id=ftp_connect('62.241.50.14'); ftp_login($conn_id,'user','password'); echo Current directory : , ftp_pwd($conn_id), \n; ftp_chdir($conn_id,html); echo Current directory is now : , ftp_pwd($conn_id), \n; $dstdir=html; $upload=ftp_put($conn_id,$bild,$dstdir./.$bild,FTP_BINARY); [/code] Regards, Ruprecht -- 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] Is this redundant? {OT}
Robin Kopetzky wrote: Good afternoon. I found this code in a program I'm renovating and think this is very redundant. Also, it does slow queries down while doing all of the conversions. prod_id in the mysql database is declared an integer. SQL above where prod_id = ' . (int)$prod_id . ' and SQL below Question: since $prod_is is already an integer, why would someone convert it into an integer, then convert it into a string to later have mysql convert it back into an integer?? Could someone shed some light on the intent behind this weird code?? This is most likely a security measure and not redundant at all. Even if someone tries to inject malicious SQL into $prod_id, this code will cast it as an integer, discarding any non-numeric characters. For example, if $prod_id is 42; drop database foo;, that would be very dangerous. With the (int) cast, $prod_id will simply be cast to the integer 42. A good idea in my view. --Dave -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Is this redundant? {OT}
Robin Kopetzky wrote: Good afternoon. I found this code in a program I'm renovating and think this is very redundant. Also, it does slow queries down while doing all of the conversions. prod_id in the mysql database is declared an integer. SQL above where prod_id = ' . (int)$prod_id . ' and SQL below Question: since $prod_is is already an integer, why would someone convert it into an integer, then convert it into a string to later have mysql convert it back into an integer?? Could someone shed some light on the intent behind this weird code?? How do you KNOW that $prod_id is an integer? If register_globals is ON and it's coming from user input, then you don't. The only part that's redundant is including the single quotes in the SQL statement for an integer. where prod_id = . (int)$prod_id . and would be more efficient. -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals www.phparch.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Wont connect to remote mysql
Hello, For some reason php will not connect to a remote mysql server.. Using the following code: ?php $link = mysql_connect('hostname:3306', username, password) or die(Could not connect: . mysql_error() . \n); print (Connected successfully); mysql_close($link); ? Returns the following error: Warning: mysql_connect(): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) in /vws/blakecrosby.com/docs/test.php on line 2 Could not connect: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) I can connect to the database using the mysql client from the same machine. Any suggestions? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Wont connect to remote mysql
That's not it. The user can connect to the database using the mysql client on the same machine as the webserver to the database machine. Blake On 07/10/2003 12:03 AM, Andy Green [EMAIL PROTECTED] wrote: check the permissions granted to the user to make sure that it's not restricted to localhost only. i had the same problem you're describing not too long ago, and i discovered that the user name i was passing was restricted to localhost only. the permissions can be viewed in the 'host' attributes, found in the 'user' table in the 'mysql' database. hope this helps green -Original Message- From: Blake Crosby [mailto:[EMAIL PROTECTED] Sent: Monday, October 06, 2003 11:55 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] Wont connect to remote mysql Hello, For some reason php will not connect to a remote mysql server.. Using the following code: ?php $link = mysql_connect('hostname:3306', username, password) or die(Could not connect: . mysql_error() . \n); print (Connected successfully); mysql_close($link); ? Returns the following error: Warning: mysql_connect(): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) in /vws/blakecrosby.com/docs/test.php on line 2 Could not connect: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) I can connect to the database using the mysql client from the same machine. Any suggestions? -- 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
[PHP-DB] Another Question
Hi, All: I have some information stored in the database. When I try to show them, sometimes it give me the following warning: Warning: printf(): Too few arguments ... Here is the problematic code: printf(textarea COLS=56 ROWS=7 name=\description\$des/textarea br); I figured out that if there are % in the string $des, it will give me this warning. But I want to show % in the textarea. How can I do that? Further, how to do the input filtering? Are there any modules that I can use? Thanks in advance for any help. Zhan Xu EECS Department Case Western Reserver University Email: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php