[PHP-DB] PHP, MySQL and Lookups
Hi everyone, I'm just getting into PHP at the moment and was wondering; what code would I need to look at a field value entered in a form, then if that value is found in my table, enter all the other information entered in the form, to the other fields on that record. Basically, what I'm trying to do is give a load of users an individual password that they enter, with various other pieces of information such as year of birth, single/married or whatever, into a form. In MySQL I have a table with three fields, but only the password one has any data in them. A script will then took in the table to find the password entered in the form, and then append all the other information (i.e. data for the other two fields) to the particular record that holds the password value entered. Hope that made sense, but I'd be so grateful if someone could help me with this Thanks, Max
[PHP-DB] Manipulate an image automatically
What is the quickest way to manipulate an image? I have a 300x100 image of something (template), and I want text to be inserted to that graphic at a certain coordinate (e.g. lower right), how would I do that?
[PHP-DB] PHP website authentication / shadow file?
I want my PHP script authentication to be based on my system username/password sets. My box is an email server also therefore I wanted my users to use the same username/password that they use checking their emails. Maybe I can have my PHP script check against my shadow file? Or maybe a totally separate C program that i can do popen and pass on parameters? Any suggestions? Is there an easy way to do this in PHP that I am not aware of?
[PHP-DB] RSS/XML
I want to put a website's RSS feed on my website. For example, http://beccary.com/feed/ I want to put all the titles of that blog page on my website. Is there an easy way to do this?
[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
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
[PHP-DB] Re: php-db Digest 28 Nov 2004 16:17:01 -0000 Issue 2703
-- Forwarded message -- From: balwantsingh [EMAIL PROTECTED] To: [EMAIL PROTECTED] Date: Sat, 27 Nov 2004 18:07:27 +0530 Subject: [PHP-DB] number format hello, may pls. suggest me how i can retreive number before decimal and after decimal. for example 123456.7. I want to store 123456 in a variable and 7 in another. also how can i force the user by validations so that he can only enter data in this format only i.e. 123456.7. thanks with best wishes balwant // Retrieve Number and Decimal Part $num = 123456.7; $num_part = substr($num, 0, strrpos($num, .)); $dec_part = substr($num, strrpos($num, .) + 1) ; // Validation if (preg_match(/^\d+\.\d+$/, $num)) { print(matched); } else { print(not matched); } Regards, Henry -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Inserting data into MySQL
Good Day All! I have been working a php/mysql and I have ran into a small problem. I have written an html form for inserting data, and it will not insert it. I am able to query the data from the data. I here is some of the code, maybe some one could point out the error. __ $query = INSERT into TBLutnsUser values ( .$fname., .$lname., .$email., .$phonenum., .$celnum., .$address., .$city., .$prov., .$postalcode.); __ There is one other field that is not in here, that is userIndex. and it is the indexing/primary key, and it is auto_increment. dose it need to be added in here too? Thank You -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] image in mysql?
is that possible in mysql that store image in mysql db , just like oracle's blob/bfile ... and how to extract these binary into real image if I use php?
Re: [PHP-DB] image in mysql?
thanks , that helps a lot to me!! one more question, can I use HTML's img to show the image with other thing instead of only image? - Original Message - From: Paul Burney [EMAIL PROTECTED] To: Henry [EMAIL PROTECTED]; PHP Database List [EMAIL PROTECTED] Sent: Tuesday, January 21, 2003 9:44 PM Subject: Re: [PHP-DB] image in mysql? on 1/21/03 7:00 AM, Henry at [EMAIL PROTECTED] appended the following bits to my mbox: is that possible in mysql that store image in mysql db , just like oracle's blob/bfile ... and how to extract these binary into real image if I use php? This has been answered numerous times on the list. Check the archives: http://marc.theaimsgroup.com/?l=php-db Also, a google search: http://www.google.com/search?q=mysql+php+image+blob Turns up a good tutorial as the first result: http://www.phpbuilder.com/columns/florian19991014.php3 Hope that helps. Sincerely, Paul Burney http://paulburney.com/ Q: Tired of creating admin interfaces to your MySQL web applications? A: Use MySTRI instead. http://www.burney.ws/software/mystri/ -- 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] image in mysql?
Oops...Sorry , I got the answer...thanks anyway ^_^ - Original Message - From: Henry [EMAIL PROTECTED] To: Paul Burney [EMAIL PROTECTED]; PHP Database List [EMAIL PROTECTED] Sent: Tuesday, January 21, 2003 10:24 PM Subject: Re: [PHP-DB] image in mysql? thanks , that helps a lot to me!! one more question, can I use HTML's img to show the image with other thing instead of only image? - Original Message - From: Paul Burney [EMAIL PROTECTED] To: Henry [EMAIL PROTECTED]; PHP Database List [EMAIL PROTECTED] Sent: Tuesday, January 21, 2003 9:44 PM Subject: Re: [PHP-DB] image in mysql? on 1/21/03 7:00 AM, Henry at [EMAIL PROTECTED] appended the following bits to my mbox: is that possible in mysql that store image in mysql db , just like oracle's blob/bfile ... and how to extract these binary into real image if I use php? This has been answered numerous times on the list. Check the archives: http://marc.theaimsgroup.com/?l=php-db Also, a google search: http://www.google.com/search?q=mysql+php+image+blob Turns up a good tutorial as the first result: http://www.phpbuilder.com/columns/florian19991014.php3 Hope that helps. Sincerely, Paul Burney http://paulburney.com/ Q: Tired of creating admin interfaces to your MySQL web applications? A: Use MySTRI instead. http://www.burney.ws/software/mystri/ -- 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 Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: major performance disparities with mysql/php - SOLVED
Nevermind.. I found the problem. My production server is running mysql 3.22.29, and I needed to use a SET SQL_BIG_TABLES=1 in many places to prevent a full table condition. The new server is running 3.23, and once I removed the SQL_BIG_TABLES=1 from the script (and allowed mysql to use memory instead), everything worked as expected. It was a PHP problem afterall - the developer! -Hank __ Do You Yahoo!? Yahoo! Movies - coverage of the 74th Academy Awards® http://movies.yahoo.com/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Determine last quarter
If anyone is interested, this is what I finally came up with. I'm not sure how graceful it is, but it works ;) Here's another method... which can be condensed, but I left it expanded to demonstrate what was going on. The trick is finding the first day of the *next* month, and getting the previous day ( mktime(0,0,0,$start_month+3,0,$year) ), which is always the last day of the previous month. -Hank ? $quarter = ceil(date('n')/3); $last_quarter = ($quarter==1?4:$quarter-1); $year =($last_quarter==4?date(Y)-1:date(Y)); $start_month = (($last_quarter-1)*3)+1; $end_day = date(d,mktime(0,0,0,$start_month+3,0,$year)); echo Start Date:.date(Y-m-d,mktime(0,0,0,$start_month,1,$year)).\n; echo End Date:.date(Y-m-d,mktime(0,0,0,$start_month+2,$end_day,$year)).\n; ? __ Do You Yahoo!? Yahoo! Sports - live college hoops coverage http://sports.yahoo.com/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] major performance disparities with mysql/php
Hello - I'm posted this to the mysql list but got no response. While it sounds like a mysql problem, I'm convinced that it is a PHP problem (see bottom of note.) I've recently installed mySQL on a RH7.2 box without any problems - it runs great. I've been testing some long running queries (full table scans, etc) under different scenarios, and get wildy differing results. Between each test case, I was flushing all tables and re-starting the mysql deamon. When I run one of my longest queries in the mysql command line client, it runs in about 77 seconds. When I run the identical query via a simple PHP script running on the box, the same query takes about 930 seconds to complete. For the life of me, I can not figure out why the identical query would run differently from the command line than from PHP. I've repeated this test about 10 times just to be sure - and it is entirely repeatable: command line - about a minute - PHP - about 16 times longer. Any ideas or suggestions? I'm running RH 7.2 (2.4.9-21) on a Dell Poweredge 2550, 1GB memory, RAID, with mysql version 3.23.41 (the standard install unchanged from the RH media). Here is the query...pretty simple: insert into summary_table select frb, denom, series, count(*) as cnt, sum(bills) as bills, sum(bills_hit) as bills_hit, sum(total_hits) as total_hits from detail_table If it a memory/cpu resource problem, how do I set RH to give PHP and Apache the same priority as the mysql deamon? I've also written a small Perl script to execute the same queries, and that runs in 70 seconds (same as mysql client), so there must be some memory/processor limitation placed on PHP that prevents it from running as quickly as these other methods. Any ideas/suggestions? Many thanks in advance.. -Hank __ Do You Yahoo!? Yahoo! Sports - live college hoops coverage http://sports.yahoo.com/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: mcrypt, postgres, only returning half the data
John A second question to answer, it's not clear from your description --- is the encryption 'breaking' during en-cryption (before it stuffs the value into the database) so that all the data is not even getting into the database? -or- is ir breaking during de-cryption ? Sounds to me like it might be a control character is getting interpreted by PgSQL and cutting off the query. You don't mention - what type field to save the encrypted data??? If there's a blob or binary field type (I dunno about PgSQL) try using that field type for encoded data. And - try skipping the add slashes step - what happens??? Good luck, Tom Henry John Starkey wrote: Hello all I'm working on encoding some data going in and decrypting coming out of postgres. I'm adding slashes going in and stripping them coming out. Using BLOWFISH and I've tried several different modes. But each time the data comes out I'm only getting half-decrypted data, it seems to hang at a random spot. The same for each piece of data but random in terms of different for each entry (confusing the issue enough?). I'm using mcrypt_encrypt and mcrypt_decrypt. When I test it on the same page (without going through the database) it decrypts fine, perfect as a matter of fact. But coming out of the DB, the same data is trashed. Is there any special way to send (or abstract) encrypted data into (from) the DB? I've been through the archives and it doesn't look like anyone has posted a problem like this. Am I the only one :} Thanks, John -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] Re: Show abbreviated article
Try using MySQL to do that right in the query itself (and save the overhead of retreiving the whole blob then PHP'ing the blob too). From the MySQL Doc's ;-) RTFM once at least -- SUBSTRING(str,pos,len) SUBSTRING(str FROM pos FOR len) MID(str,pos,len) Returns a substring len characters long from string str, starting at position pos. The variant form that uses FROM is ANSI SQL92 syntax. mysql select SUBSTRING('Quadratically',5,6); - 'ratica' -- For your problem it might look like $sql = SELECT field1, field2, SUBSTRING(blobfieldname,0,160) FROM articles where ( BTW I usually assume prox 8 chars per word for something like this so 20 wds x 8 char = 160 chars total BUT you might have lots of esoterica in there and might want to adjust that ;-) ) HTH Tom Henry Cilfa wrote: Hi, On my website I want to display some articles, in Slashdot style. The main page should only display the first 20 words of the article, and users should be able to click on a link to view the entire article. The articles are stored in a MySQL database, the body of the article in a blob-field. My question is this: how can I select only those first 20 words in the PHP code? I hope somebody can help me with this. Cilfa -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] Re: trash last message ,this ones right I think
Perhaps you could consider using the webserver config (in Apache it would be the httpd.conf file) to do the dirty work. Create and alias (in the /util/ domain) for img that points to the /hdocs/www/img/ location - voila! YMMV HTH Tom Henry Ken Sommers wrote: Hello again, DOCUMENT_ROOT is.. /htdocs/www I have a php file ( showdatabases.php) in my subdomain area /htdocs/util/ it loads up just fine: and if you click it, you will see my database structure if you like..:) http://util.consumergrapevine.org/showdatabases.php I have images stored in /hdocs/www/img/ right now (of course i could move them, and fix all references to them) but I like them there because I can refer to images in pages in /www/ with background=img/bgpic.jpg...of course this works just fine becuz /img/ is just down from /www/. but now I have pages in subdomains as menitoned above like: /htdocs/util/showdatabases.php and of course I want to refer to images from those subdomain pages too,,and of course I don't want to have another dir with the same pics in them..something like... /htdocs/util/img/ becuz I already have the pics in /htdocs/www/img/ and if I make another sub domain called /htdocs/stuff , I don't want to have to copy the pics AGAIN into /htdocs/stuff/img right? So,,, (yes I may be getting to the end now..) how or where should I put my pics so the /www/ and /util/ and /stuff/ guys can use them as background pics? what would the body tag look like? body background=../www/img/background.jpg doesn;t work what will? body background=What?? thanks again, Ken -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]