Re: [PHP] problem with INSERT query
insert following... echo $sql; immediatly after the folowing code block.. $sql = INSERT INTO tutor (tutor_name, tutor_contact,tutor_email,tutor_profile) VALUES ('$tutor_name', '$tutor_contact', '$tutor_email', '$tutor_profile'); then execute the script, and check whether it show s the correct values for the '$tutor_name', '$tutor_contact', '$tutor_email', '$tutor_profile'. you will note the problem. Viraj [EMAIL PROTECTED] wrote: Hi all, I am trying to do a simple INSERT data into the database using the following php script but the problem here is that whenever I click submit, the script only insert a NULL value into the columns into the datadase instead the value I enter in the forms fieldSELECT query was successful but not INSERT.. A snip of the code are as follow: ?php //declare error variable $err = ; //set error variable $err .= check_tutor_name(); $err .= check_tutor_contact(); $err .= check_tutor_email(); $err .= check_tutor_profile(); //define connection string $dsn = mysql://root:[EMAIL PROTECTED]/table1; //connect to DB $db = DB::connect ($dsn); //check for any DB connection errors if (DB::isError ($db)) die ($db-getMessage()); $tutor_name = $db-quote($POST[tutor_name]); $tutor_contact = $db-quote($POST[tutor_contact]); $tutor_email = $db-quote($POST[tutor_email]); $tutor_profile = $db-quote($POST[tutor_profile]); $sql = INSERT INTO tutor (tutor_name, tutor_contact,tutor_email,tutor_profile) VALUES ('$tutor_name', '$tutor_contact', '$tutor_email', '$tutor_profile'); //execute query statement $result = $db-query($sql);//check for DB query error if( DB::isError($result) ) { die ($result-getMessage());?php if( $_POST[submit] != Save ) { ? **HTML** div align=center form name=classinfo action=?php echo $_SERVER[PHP_SELF]; ? method=post input type=hidden name=form_submitted value=1 table name=add_tutor border=0px cellpadding=0 cellspacing=2 width=900 tr th class=darkgreen width=100% colspan=2bTeacher/b/th /tr tr td class=lighter width=200Name:/td td class=lighter width=500Input type=text size=50 name=tutor_name/td /tr tr td class=darker width=150Contact No:/td td class=darker width=150Input type=text size=30 name=tutor_contact/td /tr tr td class=lighter width=150Email:/td td class=lighter width=150Input type=text size=50 name=tutor_email/td /tr tr td class=darker width=150Profile:/td td class=darker width=150TEXTAREA class=textarea name=tutor_profile ROWS=6 COLS=70 /TEXTAREA /td /tr } So, what could be the problem with the code I have wriiten??? Any help are appreciated. Irin. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] problem with INSERT query
This is what I get after I echo my query statement: INSERT INTO tutor (tutor_name, tutor_contact, tutor_email, tutor_profile) VALUES ('NULL', 'NULL', 'NULL', 'NULL') How come the value is null??? In my INSERT query, I already state my value variable to be the name of the fields in my html. Why is it still inserting NULL into the database when I have entered values in the HTML fields? $sql = INSERT INTO tutor (tutor_name, tutor_contact,tutor_email,tutor_profile) VALUES ('$tutor_name', '$tutor_contact', '$tutor_email', '$tutor_profile'); What could be the problem?? Irin. --- Viraj Kalinga Abayarathna [EMAIL PROTECTED] wrote: insert following... echo $sql; immediatly after the folowing code block.. $sql = INSERT INTO tutor (tutor_name, tutor_contact,tutor_email,tutor_profile) VALUES ('$tutor_name', '$tutor_contact', '$tutor_email', '$tutor_profile'); then execute the script, and check whether it show s the correct values for the '$tutor_name', '$tutor_contact', '$tutor_email', '$tutor_profile'. you will note the problem. Viraj --- [EMAIL PROTECTED] wrote: Hi all, I am trying to do a simple INSERT data into the database using the following php script but the problem here is that whenever I click submit, the script only insert a NULL value into the columns into the datadase instead the value I enter in the forms fieldSELECT query was successful but not INSERT.. A snip of the code are as follow: ?php //declare error variable $err = ; //set error variable $err .= check_tutor_name(); $err .= check_tutor_contact(); $err .= check_tutor_email(); $err .= check_tutor_profile(); //define connection string $dsn = mysql://root:[EMAIL PROTECTED]/table1; //connect to DB $db = DB::connect ($dsn); //check for any DB connection errors if (DB::isError ($db)) die ($db-getMessage()); $tutor_name = $db-quote($POST[tutor_name]); $tutor_contact = $db-quote($POST[tutor_contact]); $tutor_email = $db-quote($POST[tutor_email]); $tutor_profile = $db-quote($POST[tutor_profile]); $sql = INSERT INTO tutor (tutor_name, tutor_contact,tutor_email,tutor_profile) VALUES ('$tutor_name', '$tutor_contact', '$tutor_email', '$tutor_profile'); //execute query statement $result = $db-query($sql);//check for DB query error if( DB::isError($result) ) { die ($result-getMessage());?php if( $_POST[submit] != Save ) { ? **HTML** div align=center form name=classinfo action=?php echo $_SERVER[PHP_SELF]; ? method=post input type=hidden name=form_submitted value=1 table name=add_tutor border=0px cellpadding=0 cellspacing=2 width=900 tr th class=darkgreen width=100% colspan=2bTeacher/b/th /tr tr td class=lighter width=200Name:/td td class=lighter width=500Input type=text size=50 name=tutor_name/td /tr tr td class=darker width=150Contact No:/td td class=darker width=150Input type=text size=30 name=tutor_contact/td /tr tr td class=lighter width=150Email:/td td class=lighter width=150Input type=text size=50 name=tutor_email/td /tr tr td class=darker width=150Profile:/td td class=darker width=150TEXTAREA class=textarea name=tutor_profile ROWS=6 COLS=70 /TEXTAREA /td /tr -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] problem with INSERT query
On Tuesday 09 December 2003 15:20, [EMAIL PROTECTED] wrote: This is what I get after I echo my query statement: INSERT INTO tutor (tutor_name, tutor_contact, tutor_email, tutor_profile) VALUES ('NULL', 'NULL', 'NULL', 'NULL') How come the value is null??? In my INSERT query, I already state my value variable to be the name of the fields in my html. Why is it still inserting NULL into the database when I have entered values in the HTML fields? $sql = INSERT INTO tutor (tutor_name, tutor_contact,tutor_email,tutor_profile) VALUES ('$tutor_name', '$tutor_contact', '$tutor_email', '$tutor_profile'); What could be the problem?? $tutor_name = $db-quote($POST[tutor_name]); $tutor_contact = $db-quote($POST[tutor_contact]); $tutor_email = $db-quote($POST[tutor_email]); $tutor_profile = $db-quote($POST[tutor_profile]); You most probably be wanting to use $_POST instead of $POST. -- 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-general -- /* Pohl's law: Nothing is so good that somebody, somewhere, will not hate it. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] problem with INSERT query
Well, I tried that and this is what i got: INSERT INTO tutor (tutor_name, tutor_contact, tutor_email, tutor_profile) VALUES (''irin'', ''788798878'', ''[EMAIL PROTECTED]'', ''no profile'') DB Error: syntax error well, when I echo again, i can successfully see the values I entered. But this time there's a DB syntax error and when I went into the database to view, it stil reflect a NULL value... --- On Tuesday 09 December 2003 15:20, [EMAIL PROTECTED] wrote: This is what I get after I echo my query statement: INSERT INTO tutor (tutor_name, tutor_contact, tutor_email, tutor_profile) VALUES ('NULL', 'NULL', 'NULL', 'NULL') How come the value is null??? In my INSERT query, I already state my value variable to be the name of the fields in my html. Why is it still inserting NULL into the database when I have entered values in the HTML fields? $sql = INSERT INTO tutor (tutor_name, tutor_contact,tutor_email,tutor_profile) VALUES ('$tutor_name', '$tutor_contact', '$tutor_email', '$tutor_profile'); What could be the problem?? $tutor_name = $db-quote($POST[tutor_name]); $tutor_contact = $db-quote($POST[tutor_contact]); $tutor_email = $db-quote($POST[tutor_email]); $tutor_profile = $db-quote($POST[tutor_profile]); You most probably be wanting to use $_POST instead of $POST. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] problem with INSERT query
Well, I tried that and this is what i got: INSERT INTO tutor (tutor_name, tutor_contact, tutor_email, tutor_profile) VALUES (''irin'', ''788798878'', ''[EMAIL PROTECTED]'', ''no profile'') DB Error: syntax error well, when I echo again, i can successfully see the values I entered. But this time there's a DB syntax error and when I went into the database to view, it stil reflect a NULL value... --- On Tuesday 09 December 2003 15:20, [EMAIL PROTECTED] wrote: This is what I get after I echo my query statement: INSERT INTO tutor (tutor_name, tutor_contact, tutor_email, tutor_profile) VALUES ('NULL', 'NULL', 'NULL', 'NULL') How come the value is null??? In my INSERT query, I already state my value variable to be the name of the fields in my html. Why is it still inserting NULL into the database when I have entered values in the HTML fields? $sql = INSERT INTO tutor (tutor_name, tutor_contact,tutor_email,tutor_profile) VALUES ('$tutor_name', '$tutor_contact', '$tutor_email', '$tutor_profile'); What could be the problem?? $tutor_name = $db-quote($POST[tutor_name]); $tutor_contact = $db-quote($POST[tutor_contact]); $tutor_email = $db-quote($POST[tutor_email]); $tutor_profile = $db-quote($POST[tutor_profile]); You most probably be wanting to use $_POST instead of $POST. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] problem with INSERT query
On Tuesday 09 December 2003 15:34, [EMAIL PROTECTED] wrote: Well, I tried that and this is what i got: INSERT INTO tutor (tutor_name, tutor_contact, tutor_email, tutor_profile) VALUES (''irin'', ''788798878'', ''[EMAIL PROTECTED]'', ''no profile'') DB Error: syntax error well, when I echo again, i can successfully see the values I entered. But this time there's a DB syntax error That's most likely because: $db-quote($_POST[tutor_contact] actually adds the single quotes around the original value of $_POST[tutor_contact]. Thus your sql construction statement should omit the the single quotes: $sql = INSERT INTO tutor (tutor_name, tutor_contact,tutor_email,tutor_profile) VALUES ($tutor_name, $tutor_contact, $tutor_email, $tutor_profile); and when I went into the database to view, it stil reflect a NULL value... Because the above query failed the record still contains its old value. -- 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-general -- /* Interchangeable parts don't, leak proof seals will and self starters wont -- Murphy's Bush Fire Brigade Laws n20 */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] problem with INSERT query
VALUES (''irin'', ''788798878'', ''[EMAIL PROTECTED]'', ''no profile'') in above line, note the two quotes, in both side of each value.. this is the cause to your DB syntax error.. correct the above line as follows... ($tutor_name,$tutor_contact,$tutor_email,$tutor_profile); and try, but investigate for why you are getting two quotes instead of one quote. Viraj [EMAIL PROTECTED] wrote: Well, I tried that and this is what i got: INSERT INTO tutor (tutor_name, tutor_contact, tutor_email, tutor_profile) VALUES (''irin'', ''788798878'', ''[EMAIL PROTECTED]'', ''no profile'') DB Error: syntax error well, when I echo again, i can successfully see the values I entered. But this time there's a DB syntax error and when I went into the database to view, it stil reflect a NULL value... --- On Tuesday 09 December 2003 15:20, [EMAIL PROTECTED] wrote: This is what I get after I echo my query statement: INSERT INTO tutor (tutor_name, tutor_contact, tutor_email, tutor_profile) VALUES ('NULL', 'NULL', 'NULL', 'NULL') How come the value is null??? In my INSERT query, I already state my value variable to be the name of the fields in my html. Why is it still inserting NULL into the database when I have entered values in the HTML fields? $sql = INSERT INTO tutor (tutor_name, tutor_contact,tutor_email,tutor_profile) VALUES ('$tutor_name', '$tutor_contact', '$tutor_email', '$tutor_profile'); What could be the problem?? $tutor_name = $db-quote($POST[tutor_name]); $tutor_contact = $db-quote($POST[tutor_contact]); $tutor_email = $db-quote($POST[tutor_email]); $tutor_profile = $db-quote($POST[tutor_profile]); You most probably be wanting to use $_POST instead of $POST.
Re: [PHP] problem with INSERT query
Thanks alot for your help!!! It was only a spacing mistake... There should have no spacing in between each variables: VALUES ($tutor_name,$tutor_contact,$tutor_email,$tutor_profile); Thanks a million. Irin. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Best practices for sharing members database between different portals
Dear All, Please comment on Best Practices for sharing members database between different portals. Suppose we have 3 portals running on different networks. Assignment is to make a single Login/Pass for all portals, means once LogedIn in one of the portal, could able to access the other portals without loging In. Constraints are, every portal have different Database structure and also have different Global / Session variables. Please share your experience and which approach is the best practice. Regards, TM
[PHP] Structuring keyword searches
I'd better apologize at the outset as I'm not sure this is strictly a PHP problem - though I'm using PHP as the means of building the application. Anyway, here goes: I'm creating a website that will function as a directory of services within a specific area of the UK charity sector. A variety of groups will input the content via a custom built CMS and this content will then be available to the general public. One of the requirements is that a keyword search facility is built into the application allowing end users to search for services based on a variety of words they might associate with them. What I propose to do is have a separate table of keywords/phrases that have been previously entered by contributors. There will then be a separate table linking the id field of the associated keywords with the id field of the service in question. Herein lies the problem. The contributors will be presented with a multi-part form. When it comes to the stage at which they will need to enter the relevant keywords for a service there seem to me to two ways of dealing with this: 1. Allow the contributors to enter whatever keywords and phrases they wish. 2. Only allow contributors to have access to a restricted set of keywords/phrases. The first of these options would run the risk of creating an unmanageably large and devalued set of keywords/phrases. The second option would seem to result in a set of keywords that are too generalized to be of much benefit to the ultimate end users. Are there any accepted approaches to tackling such a problem which anyone could point me towards? I'm sure it must have been encountered before though I've been unable to find much on this after extensive googling and searching through mailing list archives. Thanks in advance (and in hope), Michael Egan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] restrict access to multiple pages
I like your second solution better. (seems simpler to me to leave out the nested else...). I'd just write it this way: ?php if(!loggedin()) { // redirect to login page header (Location: http://domain.com/login.php;); exit; } ? Also check out some of these articles for some different options/ideas: http://www.google.com/search?q=php+user+authentication olinux --- Chris W. Parker [EMAIL PROTECTED] wrote: Hey y'all. Ok so I am working on the admin sectin of the e-commerce app I'm writing and I'm hoping there's a better way to do what I am currently doing. In an effort to prevent circumvention of the login page I've placed a check at the beginning of each page that basically does the following: ?php if(loggedin()) { // entire page of code goes here } else { // redirect back to login page } ? By doing this people will not be able to just enter manually any URL they want and have the page load. As far as better ways go I was thinking that maybe I could employ .htaccess somehow? But then I think that might require having user accounts registered with the server instead of just using a db and I don't want to do that. I was thinking that maybe I could change it to this: ?php // define function stored in class file // (basic auth function, not at all what i'm using. // just an example.) function IsLoggedIn($input) { if(isset($input) !empty($input)) { return 1; } else { // redirect to login page } } IsLoggedIn($input); // entire page of code goes here ? Any want to share their experiences and ideas? __ Do you Yahoo!? New Yahoo! Photos - easier uploading and sharing. http://photos.yahoo.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: spambothoney: script to pollute spammer's databases
Manuel Lemos schrieb: Hello, On 12/09/2003 12:26 AM, Daniel Hahler wrote: I proudly announce the first release of my first PHP script: spambothoney. It provides a class to generate different types of email addresses (random invalid, combination of users/hosts, with spambots IP/host, binary output) and is meant to pollute the crawling spambots that harvest email addresses from webpages. It uses a MySQL database for configuration (through web-interface) and for logging purposes. I would be glad, if this is of some interest for you and you would take a look: http://thequod.de/comp/mysoft/spambothoney (direct download: http://thequod.de/action.php?download=1) That is curious. This seems to be the second class that I see that seems to be for the same purpose. The other class also seems to be meant to generate honey pot e-mail addresses. Class: Honey Pot http://www.phpclasses.org/honeypot I'm especially interested into security issues, but feedback in general is very appreciated.. I read something about e-mail honey pots and I am afraid that may not be as useful as you think. When you say polluting crawling spambots you will probably be causing harm to innocent mail servers. Let me explain. The latest spamming strategies consist on using valid sender addresses of inocent companies. Therefore, when you make up invalid addresses, all the bounces will go to the innocent companies mail servers. The more invalid addresses you make up the more harm you cause to innocent companies. Anyway, you may want to contribute your class also to the PHP Classes site so you can get the feedback of tens of thousands of potential users that are notified when a new class is published. Despite your class seems to do the same as the other above, it will also be approved for publishing and let the users decide which is more useful. hi, not only the bounces are the problem, think of the traffic and the 'innocent' isp's. ;-) i think that's not the best method for fighting against spam. ciao SVEN -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: spambothoney: script to pollute spammer's databases
Manuel Lemos wrote: The latest spamming strategies consist on using valid sender addresses of inocent companies. Therefore, when you make up invalid addresses, all the bounces will go to the innocent companies mail servers. The more invalid addresses you make up the more harm you cause to innocent companies. My strategy against spam is giving invalid addresses at my domain name, all of which redirect to [EMAIL PROTECTED] No innocent servers besides my own are harmed, and the spam is given to an authority who will (in theory) do something about it. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Problems with imagick's imagick_readimage
Hi I was wondering if you any advice as to why the imagick function imagick_readimage can not read a url on my php installation. Problem: I am trying to get imagick to load an image from a URL. I can read from a file on the a file system no problem. eg, $url = http://static.php.net/www.php.net/images/php_snow.gif;; $handle = imagick_readimage($url) ; // THIS DOES NOT WORK $url = /tmp/foo.gif; $handle = imagick_readimage($file) ; // THIS DOES WORK also I can get GD to read from a URL .eg. $url = http://static.php.net/www.php.net/images/php_snow.gif;; $src_img=ImageCreateFromGIF($url); The problem started after I was forced to change servers due to a disk crash. I am using the same versions of the software to build the php/mysql/apache. Is there any configuration /installation setting that I have missed that would stop me from loading the image via the URL ??? I have tried using GD, but found the image scaling quality to be substandard to imagick. I would like to use image magic if possible. Has anyone had similar problems? Here is a summary of my config: Apache 2.0.48 / mysql 3.23.58 PHP 4.3.4: Configure Command './configure' '--with-apxs2=/smartbid/webserver/bin/apxs' '--with-mysql=/smartbid/database/' '--prefix=/smartbid/webserver/php' '--with-imagick' '--with-config-file-path=/smartbid/webserver/php/etc' '--with-openssl=/usr/local/ssl' '--with-zlib' '--with-gd' '--with-jpeg-dir=/usr/local/lib' '--with-freetype-dir=/usr/local/lib' '--with-exif' '--with-png-dir=/usr/local/lib' '--with-db3=/usr/local/BerkeleyDB.3.3/lib' Imagemagick: 5.57 Shared libraries --enable-shared=yes yes Static libraries --enable-static=yes yes GNU ld--with-gnu-ld=yes yes LZW support --enable-lzw=no no Quantum depth --with-quantum-depth=16 16 Delegate Configuration: BZLIB --with-bzlib=yes yes DPS --with-dps=yesno EXIF --with-exif=yes yes FlashPIX --with-fpx=yesno FreeType 2.0 --with-ttf=yesyes Ghostscript None /usr/bin/gs (7.05) Ghostscript fonts --with-gs-font-dir=default /usr/share/fonts/default/Type1/ Ghostscript lib --with-gslib=no no JBIG --with-jbig=yes no JPEG v1 --with-jpeg=yes yes JPEG-2000 --with-jp2=yesno LCMS --with-lcms=yes yes Magick++ --with-magick-plus-plus=yes yes PERL --with-perl=yes /usr/bin/perl PNG --with-png=yesyes TIFF --with-tiff=yes yes Windows fonts --with-windows-font-dir= none WMF --with-wmf=yesno X11 --with-x= no XML --with-xml=yesno ZLIB --with-zlib=yes yes imagick php API 0.9.8 Any help or suggestions would be appreciated. Regards John Clegg -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: post an array into another site
[snip] ...wow... [/snip] All of this an no one mentioned cURL? ;) http://www.php.net/curl -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: post an array into another site
On dinsdag 9 december 2003 13:11 Jay Blanchard told the butterflies: [snip] ...wow... [/snip] All of this an no one mentioned cURL? ;) http://www.php.net/curl Yes .. ehmm, especially considering this wasn't the guy's actual question. If I read it correctly, it was this: On 12/08/2003 10:30 AM, Fred wrote: I have an array in php like this: $arr[0][0] = Something; $arr[0][1] = Hello; $arr[0][2] = Hi; It is possible to post this array to another site in a form? Or how can i do this? which makes me think he just wants to post same data from one page of a site to another page of (possibly) another site. For that I would probably rethink some major parts of my code, if I find myself wanting to do that. If it turns out I really want it, serialize(), htmlentities() and a hidden field would be my solution. Or, if I remain on my own site add it to $_SESSION. It was an interesting discussion, though ;) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Leechers...
I've just installed and am happily using Galery HP (http://www.galleryhp.org/) A great photo gallery package... Anyhoo, I want to now be able to stop people from linking to the images directly, and only be able to access the images via my site... Is this possible...? Perhaps my questio is to vauge, but I'm just having a think at teh mo... For the record, Gallery HP does a good job of hiding the full URL anyway. * The information contained in this e-mail message is intended only for the personal and confidential use of the recipient(s) named above. If the reader of this message is not the intended recipient or an agent responsible for delivering it to the intended recipient, you are hereby notified that you have received this document in error and that any review, dissemination, distribution, or copying of this message is strictly prohibited. If you have received this communication in error, please notify us immediately by e-mail, and delete the original message. ***
Re: [PHP] Re: goto label
Justin Patrin wrote: Robert Cummings wrote: Goto line number is a very broken way of coding. Goto label is a very useful and structured way of coding especially when creating fast FSMs for parsing. I was a little disappointed a few months ago when I found that PHP didn't support the goto label syntax since it would have provided the most elegant solution. goto anywhere is broken. For instance, goto-ing out of loops and functions, or into one function from another causes untold grief to the language developer and makes it very hard to read the code. Then there's using goto into and out of class functions, which is even worse. In truth, goto has no place in a higher level programming language. Anything that can be done with goto can be done without it and (IMHO) more elegantly. Robert, I know your grief, been there, I know how it feels. I started my childhood with BASIC, which was /the/ GOTO programming language, learned Turbo Pascal when I was a teenager, and continued to use GOTO's (Pascal discourages but doesn't disallow GOTO's, so I was still able to cheat when there was a need for it). Well, later on when I started finding out how major projects are being developed, what structured programming really means and so on, I felt the way you feel now: cheated. Why in God's name is GOTO bad? It's SO useful! They're mad! Well, it simply isn't true -- the problem is that you have to change your mindset about programming, try to really structure the way you see a program, break it into efficient stand-alone functions, group those in classes, etc, and you'll see that there *is* no need for GOTO, ever. You do need to break out of loops, you do need to short a loop when a condition is met, you do need to break out of switches, if branches and the lot - but those tools you have in PHP. GOTO is not needed and harmful. Even simply learning to program without GOTO will coerce you into saner code. Sorry if my message sounded melodramatic or something, I remembered the frustration feeling so strongly from your message that I wanted to reinforce the other people's messages with a personal testimonial if you wish. Bogdan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Leechers...
On dinsdag 9 december 2003 13:50 [EMAIL PROTECTED] told the butterflies: I've just installed and am happily using Galery HP (http://www.galleryhp.org/) A great photo gallery package... Anyhoo, I want to now be able to stop people from linking to the images directly, and only be able to access the images via my site... Is this possible...? Perhaps my questio is to vauge, but I'm just having a think at teh mo... For the record, Gallery HP does a good job of hiding the full URL anyway. * The information contained in this e-mail message is intended only for the personal and confidential use of the recipient(s) named above. If the reader of this message is not the intended recipient or an agent responsible for delivering it to the intended recipient, you are hereby notified that you have received this document in error and that any review, dissemination, distribution, or copying of this message is strictly prohibited. If you have received this communication in error, please notify us immediately by e-mail, and delete the original message. ** * You haven't been googling around, have you? Me neither, but you'll probably find that you want to block requests with a referrer other than your own website. This can be done with mod_rewrite. Have fun! Wouter In the future, can you please create a NEW email message, rather than replying to another and clearing it's entire contents when you're making a new thread... !?!?! (Welcome to the world, Catharina-Amalia Beatrix Carmen Victoria) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] for statement weirdness, no echo
for($i = 2; $i 0144; $i++){ echo $i . \n; } does not echo anything. Even put the numbers in quotes (single and double). What has being brain-dead caused me to miss this morning? Thanks! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] for statement weirdness, no echo SOLVED
[snip] for($i = 2; $i 0144; $i++){ echo $i . \n; } does not echo anything. Even put the numbers in quotes (single and double). What has being brain-dead caused me to miss this morning? [/snip] I found it...one too many zeros in initial $i (I wanted to say one two many..) :) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] for statement weirdness, no echo
Hello Jay, Tuesday, December 9, 2003, 1:31:35 PM, you wrote: JB for($i = 2; $i 0144; $i++){ JB echo $i . \n; JB } JB does not echo anything. Even put the numbers in quotes (single and JB double). What has being brain-dead caused me to miss this morning? Look at your values being compared :) -- Best regards, Richardmailto:[EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Structuring keyword searches
I'd better apologize at the outset as I'm not sure this is strictly a PHP problem - though I'm using PHP as the means of building the application. Anyway, here goes: I'm creating a website that will function as a directory of services within a specific area of the UK charity sector. A variety of groups will input the content via a custom built CMS and this content will then be available to the general public. One of the requirements is that a keyword search facility is built into the application allowing end users to search for services based on a variety of words they might associate with them. What I propose to do is have a separate table of keywords/phrases that have been previously entered by contributors. There will then be a separate table linking the id field of the associated keywords with the id field of the service in question. Herein lies the problem. The contributors will be presented with a multi-part form. When it comes to the stage at which they will need to enter the relevant keywords for a service there seem to me to two ways of dealing with this: 1.Allow the contributors to enter whatever keywords and phrases they wish. 2.Only allow contributors to have access to a restricted set of keywords/phrases. The first of these options would run the risk of creating an unmanageably large and devalued set of keywords/phrases. The second option would seem to result in a set of keywords that are too generalized to be of much benefit to the ultimate end users. Are there any accepted approaches to tackling such a problem which anyone could point me towards? I'm sure it must have been encountered before though I've been unable to find much on this after extensive googling and searching through mailing list archives. I like the Luke Welling, Laura Thomson approach for keyword searching described in PHP and MySQL Web Development -- http://www.lukelaura.com. The system described is your option (1) above, and allows the keywords to be weighted by the contributors. HTH -- Lowell Allen -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Leechers...
on Tue, 9 Dec 2003 12:49:56 + [EMAIL PROTECTED] wrote: TPrsc I want to now be able to stop people from linking to the images directly, TPrsc and only be able to access the images via my site... With Apache you can either use mod_rewrite: RewriteCond %{HTTP_REFERER} !^$ RewriteCond %{HTTP_REFERER} !^http://domain.com.*$ [NC] RewriteCond %{HTTP_REFERER} !^http://www.domain.com.*$ [NC] RewriteRule .*(gif|png|jpe?g)$- [F] or more general method (don't know which mod this is): #prevent refering to my images SetEnvIfNoCase Referer ^http://www.domain.com/; locally_linked=1 SetEnvIfNoCase Referer ^http://domain.com/; locally_linked=1 SetEnvIf Referer ^$ locally_linked=1 FilesMatch \.(gif|png|jpe?g)$ Order Allow,Deny Allow from env=locally_linked /FilesMatch both can be added to your .htaccess file. -- shinE! http://www.thequod.de ICQ#152282665 PGP 8.0 key: http://thequod.de/danielhahler.asc -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Leechers...
On dinsdag 9 december 2003 14:30 Wouter van Vliet told the butterflies: On dinsdag 9 december 2003 13:50 [EMAIL PROTECTED] told the butterflies: I've just installed and am happily using Galery HP (http://www.galleryhp.org/) A great photo gallery package... Anyhoo, I want to now be able to stop people from linking to the images directly, and only be able to access the images via my site... Is this possible...? Perhaps my questio is to vauge, but I'm just having a think at teh mo... For the record, Gallery HP does a good job of hiding the full URL anyway. * The information contained in this e-mail message is intended only for the personal and confidential use of the recipient(s) named above. If the reader of this message is not the intended recipient or an agent responsible for delivering it to the intended recipient, you are hereby notified that you have received this document in error and that any review, dissemination, distribution, or copying of this message is strictly prohibited. If you have received this communication in error, please notify us immediately by e-mail, and delete the original message. ** * You haven't been googling around, have you? Me neither, but you'll probably find that you want to block requests with a referrer other than your own website. This can be done with mod_rewrite. Have fun! Wouter In the future, can you please create a NEW email message, rather than replying to another and clearing it's entire contents when you're making a new thread... !?!?! (Welcome to the world, Catharina-Amalia Beatrix Carmen Victoria) Curse me, I mislooked. You did make a fresh post.. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP My SQL vs ASP.NET SQL 2000 Server
Ryotaro Ishikawa MD wrote: Hi, I am a MD, involved in a very large medical project that requieres a strong database plataform, the project must be .NET , the estimated transactional movement is about 40 on line users accesing a DB with a 200 relational tables. The policy is to program this SW in three layer design, our first oprion is ASP.NET and SQL Server 2000, because is worldwide spread. I had investigated PHP and MySQL, and I wonder if you can give me a imparcial advise if I must continue with ASP.NET or if PHP is a reasonable alternative. Thanks. It's hard for me to be unbiased when it comes to MS vs. Open Source, but I'll give it a shot. :) The major problem I have with anything MS is security (yes, yes, I know there are security issues in the Open Source community too). Applications running on a MS system have pretty much admin access to the system, so even if the app you're using is secure, the very nature of the OS makes it a risk. However, if you know your system, you can secure the known problems, so in the end I think it all boils down to what feature set you're looking for. MSSQL vs. MySQL MySQL is faster and has a smaller footprint than MSSQL, and until recently wasn't as near feature rich as MSSQL. However MySQL now supports many of the features of the large 'Enterprise level' RDMS. Not all of them, but many of them, so if one of the features you're looking for isn't supported by MySQL, that should make the decision easier (or at least bump you up to PostgreSQL vs. MSSQL). PHP vs. .NET I'm not familiar with everything .NET can do, but I have yet to see .NET accomplish anything that I can't do in PHP. Again, this boils down to features. Another deciding factor could be the learning curve. If you've never used a language like PHP before, and are familiar with writing code for MS apps, it may be best to stick with what you know if you're on a deadline. Even if you've never written code before, .NET may be easier to pick up in the short run due to the 'click-n-point' tools. But learning something like PHP will benifit you in the long run; learning how to write code from scratch gives you the ability to understand what the code is doing, thus giving you a leg-up when it's time to troubleshoot. MS vs. Open Source Again, this comes down to what you're looking for, and what you feel comfortable with. With Open Source you don't have the 'security blanket' of a large corporation for support (but from what I hear, you still don't have support with MS), but the online and community support for Open Source are second to none. Small budget? Steer clear of MS. In the end, only you can answer what's best for you. What do I want? What do I need? By answering these two questions, you will be able to choose the solution that fits you best. -- By-Tor.com It's all about the Rush http://www.by-tor.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: goto label
Justin Patrin wrote: Nitin wrote: Hi all, I was wondering, if there's any way to achieve 'goto label:' using PHP Thanx for ur time Nitin goto is a very old and broken way of coding. If you ever find yourself in need of a goto, you should re-evaluate how you're doing things. If you're having trouble finding out how to do it better, just ask here. :-) Right, use GOSUB instead. ;) -- By-Tor.com It's all about the Rush http://www.by-tor.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Leechers...
[EMAIL PROTECTED] wrote: I've just installed and am happily using Galery HP (http://www.galleryhp.org/) A great photo gallery package... Anyhoo, I want to now be able to stop people from linking to the images directly, and only be able to access the images via my site... Is this possible...? Perhaps my questio is to vauge, but I'm just having a think at teh mo... For the record, Gallery HP does a good job of hiding the full URL anyway. Got Apache? mod_rewrite. Good stuff. Does a body good. -- By-Tor.com It's all about the Rush http://www.by-tor.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] date convertion
I have a script where a user inputs a date in MMDD format, and I need to convert it to month day, year. For example they will enter 20031209 and I need the script to return the date as December 09, 2003. They won't be entering today's date, so I can't use the timestamp with the date function. So any ideas? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] date convertion
Hi, I have a script where a user inputs a date in MMDD format, and I need to convert it to month day, year. For example they will enter 20031209 and I need the script to return the date as December 09, 2003. They won't be entering today's date, so I can't use the timestamp with the date function. So any ideas? Check out date() and mktime(). Example: date( m, d, Y, mktime( 0, 0, 0, MM, DD, YYY ) ); You'll have to check the date() page for more info on which letters to use to get the format you want. -Dan Joseph -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] I need a script for deleting mail from mail boxes...
Hi All, I need to know how to write a script for deleting mail from a Linux server. Essentially I need to be able to delete all mail with a date-stamp less than some threshold date. Then I want this script to run from a regular cron job. I am not sure if this is doable in PHP or whether I must write a shell script, but either way I need some pointers on how to go about it. Any help would be much appreciated. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] I need a script for deleting mail from mail boxes...
At 16:08 9-12-03, you wrote: Hi All, I need to know how to write a script for deleting mail from a Linux server. It's more important to know what sort of mail it is. I suppose POP3 mail, so then look for the POP class of Manuel Lemos, i think on phpclasses.org. Essentially I need to be able to delete all mail with a date-stamp less than some threshold date. That should be do-able with that class. Then I want this script to run from a regular cron job. I am not sure if this is doable in PHP or whether I must write a shell script, but either way I need some pointers on how to go about it. There are quite some tutorials on cron jobs with PHP. To run PHP as a cron job you need the cgi version, as far as I know. Ask your favourite search engine. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] date convertion
I have a script where a user inputs a date in MMDD format, and I need to convert it to month day, year. For example they will enter 20031209 and I need the script to return the date as December 09, 2003. They won't be entering today's date, so I can't use the timestamp with the date function. So any ideas? Use strtotime() to convert it to a Unix timestamp and then use date() to format it. ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Leechers...
Cheers for this... On the 'new mail' thread... I did start a new mail this time, I remember cause I'm been flamed for this before..? Curious... Sadly, I use Lotus Notes, if I opened an E-mail, copied the address and then hit new mail, would Notes remember and extra info? Quite quite confusing :-( Wouter van Vliet [EMAIL PROTECTED] 09/12/2003 13:29 To [EMAIL PROTECTED], [EMAIL PROTECTED] cc Subject RE: [PHP] Leechers... On dinsdag 9 december 2003 13:50 [EMAIL PROTECTED] told the butterflies: I've just installed and am happily using Galery HP (http://www.galleryhp.org/) A great photo gallery package... Anyhoo, I want to now be able to stop people from linking to the images directly, and only be able to access the images via my site... Is this possible...? Perhaps my questio is to vauge, but I'm just having a think at teh mo... For the record, Gallery HP does a good job of hiding the full URL anyway. * The information contained in this e-mail message is intended only for the personal and confidential use of the recipient(s) named above. If the reader of this message is not the intended recipient or an agent responsible for delivering it to the intended recipient, you are hereby notified that you have received this document in error and that any review, dissemination, distribution, or copying of this message is strictly prohibited. If you have received this communication in error, please notify us immediately by e-mail, and delete the original message. ** * You haven't been googling around, have you? Me neither, but you'll probably find that you want to block requests with a referrer other than your own website. This can be done with mod_rewrite. Have fun! Wouter In the future, can you please create a NEW email message, rather than replying to another and clearing it's entire contents when you're making a new thread... !?!?! (Welcome to the world, Catharina-Amalia Beatrix Carmen Victoria) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php * The information contained in this e-mail message is intended only for the personal and confidential use of the recipient(s) named above. If the reader of this message is not the intended recipient or an agent responsible for delivering it to the intended recipient, you are hereby notified that you have received this document in error and that any review, dissemination, distribution, or copying of this message is strictly prohibited. If you have received this communication in error, please notify us immediately by e-mail, and delete the original message. ***
RE: [PHP] Leechers...
Forget my whole new post retort ;-) Wouter van Vliet [EMAIL PROTECTED] 09/12/2003 14:11 To 'Wouter van Vliet' [EMAIL PROTECTED], [EMAIL PROTECTED], [EMAIL PROTECTED] cc Subject RE: [PHP] Leechers... On dinsdag 9 december 2003 14:30 Wouter van Vliet told the butterflies: On dinsdag 9 december 2003 13:50 [EMAIL PROTECTED] told the butterflies: I've just installed and am happily using Galery HP (http://www.galleryhp.org/) A great photo gallery package... Anyhoo, I want to now be able to stop people from linking to the images directly, and only be able to access the images via my site... Is this possible...? Perhaps my questio is to vauge, but I'm just having a think at teh mo... For the record, Gallery HP does a good job of hiding the full URL anyway. * The information contained in this e-mail message is intended only for the personal and confidential use of the recipient(s) named above. If the reader of this message is not the intended recipient or an agent responsible for delivering it to the intended recipient, you are hereby notified that you have received this document in error and that any review, dissemination, distribution, or copying of this message is strictly prohibited. If you have received this communication in error, please notify us immediately by e-mail, and delete the original message. ** * You haven't been googling around, have you? Me neither, but you'll probably find that you want to block requests with a referrer other than your own website. This can be done with mod_rewrite. Have fun! Wouter In the future, can you please create a NEW email message, rather than replying to another and clearing it's entire contents when you're making a new thread... !?!?! (Welcome to the world, Catharina-Amalia Beatrix Carmen Victoria) Curse me, I mislooked. You did make a fresh post.. * The information contained in this e-mail message is intended only for the personal and confidential use of the recipient(s) named above. If the reader of this message is not the intended recipient or an agent responsible for delivering it to the intended recipient, you are hereby notified that you have received this document in error and that any review, dissemination, distribution, or copying of this message is strictly prohibited. If you have received this communication in error, please notify us immediately by e-mail, and delete the original message. ***
Re: [PHP] problem with INSERT query
Hi, Tuesday, December 9, 2003, 4:58:30 PM, you wrote: ijc Hi all, ijc I am trying to do a simple INSERT data into the database using the following ijc php script but the problem here is that whenever I click submit, the script ijc only insert a NULL value into the columns into the datadase instead the ijc value I enter in the forms fieldSELECT query was successful but not ijc INSERT.. ijc A snip of the code are as follow: ijc ?php ijc //declare error variable ijc $err = ; ijc //set error variable ijc $err .= check_tutor_name(); ijc $err .= check_tutor_contact(); ijc $err .= check_tutor_email(); ijc $err .= check_tutor_profile(); ijc //define connection string ijc $dsn = mysql://root:[EMAIL PROTECTED]/table1; ijc //connect to DB ijc $db = DB::connect ($dsn); ijc //check for any DB connection errors ijcif (DB::isError ($db)) ijcdie ($db-getMessage()); $tutor_name = $db-quote($POST[tutor_name]); ijc $tutor_contact = $db-quote($POST[tutor_contact]); $tutor_email = $db-quote($POST[tutor_email]); ijc $tutor_profile = $db-quote($POST[tutor_profile]); ijc $sql = INSERT INTO tutor (tutor_name, ijc tutor_contact,tutor_email,tutor_profile) ijc VALUES ijc('$tutor_name', '$tutor_contact', '$tutor_email', '$tutor_profile'); ijc //execute query statement $result = $db-query($sql);//check for DB query error ijc if( DB::isError($result) ) { ijc die ($result-getMessage());?php if( $_POST[submit] != Save ) ijc { ? ijc **HTML** ijc div align=center ijc form name=classinfo action=?php echo $_SERVER[PHP_SELF]; ? method=post ijc input type=hidden name=form_submitted value=1 ijc table name=add_tutor border=0px cellpadding=0 cellspacing=2 width=900 ijc tr ijc th class=darkgreen width=100% colspan=2bTeacher/b/th ijc /tr ijc tr ijc td class=lighter width=200Name:/td ijc td class=lighter width=500Input type=text size=50 name=tutor_name/td ijc/tr ijc tr ijc td class=darker width=150Contact No:/td ijc td class=darker width=150Input type=text size=30 ijc name=tutor_contact/td ijc/tr ijc tr ijc td class=lighter width=150Email:/td ijc td class=lighter width=150Input type=text size=50 name=tutor_email/td ijc/tr ijc tr ijc td class=darker width=150Profile:/td ijc td class=darker width=150TEXTAREA class=textarea ijc name=tutor_profile ROWS=6 COLS=70 ijc /TEXTAREA ijc /td ijc /tr ijc } ijc So, what could be the problem with the code I have wriiten??? ijc Any help are appreciated. ijc Irin. you need $_POST[] for the variables -- regards, Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Operator question
In PHP, what does the operator -= do? I can't find a ref to it's function in the online manual or any books I have. Thanks, Jeff -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Operator question
Hello Jeff, Tuesday, December 9, 2003, 4:11:10 PM, you wrote: JM In PHP, what does the operator -= do? I can't find a ref to it's JM function in the online manual or any books I have. Set's a negative value: $a = 10; $b -= $a; or $b -= 10; In both cases $b will equal -10. -- Best regards, Richardmailto:[EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Operator question
snip In PHP, what does the operator -= do? /snip $var -= 1 is the same as $var = $var - 1 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] FW: errors using iis,soap,php
-Original Message- From: Roger Schweppe [mailto:[EMAIL PROTECTED] Sent: Tuesday, December 09, 2003 9:55 AM To: [EMAIL PROTECTED] Subject: FW: errors using iis,soap,php Hi, Arnaud Limbourg suggested that I might find an answer to the question below from someone at this e-mail address: Thanks for any help you can give me!! Roger Schweppe I downloaded soap-0.8rc2.tgz and installed soap with it's dependencies. I am using 4.3.3 php on a iis 5 windows 2000 computer. Now I am getting the errors below. I was wondering if I needed to do anything different with the soap install? With the Windows version of PHP, I am under the impression that OpenSSL comes with the precompiled binaries. These done with extensions for support of Openssl, by enabling said extension, php_openssl.dll, in the php.ini. Of course, before enabling said extenstion, the two dlls /libeay32.dll /and ssleay32.dll were copied to the C:\WINNT\SYSTEM32 directory. After this failed, I was refered to http://ftp.proventum.net/pub/php/win32/misc/openssl/ to install a patch that patches SSL support directly into php4ts.dll. Before the patch, we were getting: Warning: fsockopen(): No SSL support for this build in C:\PHP\pear\Net\Socket.php on line 108 After the patch we got: Warning: fread(): SSL: fatal protocol error in C:\PHP\pear\Net\Socket.php on line 243 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Operator question
Uhhh, nope. That only works in your code if $b is initially 0. They're shorthand for do something and reassign. $a = 100; $a += 10; // $a = $a + 10 $a -= 10; // $a = $a - 10 $a /= 10; // etc... $a += 10; $a = 2; $a .= ' is a weird number'; $mode = 0755; $mode = 01; --Jeff -- Jeffrey Labonski| http://www.eportation.com Senior Software Developer | (215) 627-2651 voice ePortation, LLC.| (267) 237-7866 cell [EMAIL PROTECTED] | (215) 893-5287 fax On Tue, 9 Dec 2003, Richard Davey wrote: Hello Jeff, Tuesday, December 9, 2003, 4:11:10 PM, you wrote: JM In PHP, what does the operator -= do? I can't find a ref to it's JM function in the online manual or any books I have. Set's a negative value: $a = 10; $b -= $a; or $b -= 10; In both cases $b will equal -10. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] CORBA/satellite extension..
Has anyone seen it lately ? , php.net seems to think it has moved to PEAR or PECL but unless its been renamed ... ? any ideas Regards, Simon Wheeler. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] restrict access to multiple pages
Chris Shiflett mailto:[EMAIL PROTECTED] on Monday, December 08, 2003 5:17 PM said: The only risk is forgetting to add this check, since I assume you mean that you have to copy/paste this into every script. You might want to consider whether you can design your application in such a way that you can have a more centralized way to enforce authorization. This is what I tried to do with my second example. I thought it to be an improvement because it was merely one function call and not a if..else construct. Any comments on that? The one thing I would definitely consider doing differently is the redirect. You could, instead, just include the logic necessary for the login page, so that you avoid the superfluous transaction. Is this comment from a security standpoint or an effciency issue? As far as better ways go I was thinking that maybe I could employ .htaccess somehow? Yes, and you can use a database like you're wanting. There is existing code to help you do this. However, this implements HTTP authentication, which has the little popup window. This is fine, but some people might perceive this as being unprofessional, so you might want to keep your audience in mind. Ewww.. no I don't want to do that. And to olinux, yes I will check google! :) Chris. -- Don't like reformatting your Outlook replies? Now there's relief! http://home.in.tum.de/~jain/software/outlook-quotefix/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problems with imagick's imagick_readimage
John Clegg wrote: Problem: I am trying to get imagick to load an image from a URL. I can read from a file on the a file system no problem. Maybe you should simply circumvent the problem - download the file to your location into a temporary file, then act on this file locally...Use CURL. -- Seks, seksi, seksolatki... news:pl.soc.seks.moderowana http://hyperreal.info { iWanToDie } WiNoNa) ( http://szatanowskie-ladacznice.0-700.pl foReVeR( * ) Poznaj jej zwiewne ksztaty... http://www.opera.com 007 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] restrict access to multiple pages
On Mon, 8 Dec 2003, Chris W. Parker wrote: Ok so I am working on the admin sectin of the e-commerce app I'm writing and I'm hoping there's a better way to do what I am currently doing. In an effort to prevent circumvention of the login page I've placed a check at the beginning of each page that basically does the following: ... In the case that this is part of a larger application, as it seems to be, you probably should have an include that you are doing on each hit that handles the user identity/authentication.. Not just for your admin users, but a general container for all the user-related functions. On that page Within that include, let's call it loguser.php, you could write functions such as require_admin() or require_login() .. then, call those functions on the pages that require the user to be an admin or be logged in. The functions would determine if the logged-in user had adequate permission, and redirect them if not. That way, you can control this behavior from a central location--you don't want to have to go through each page of your app and change a URL. -- Kelly Hallman // Ultrafancy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] display settings
I am sort of new at this, I am wondering if it is possible to find the display settings of the user I know that ?php echo $_SERVER[HTTP_USER_AGENT]; ? will give you Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0) is there one that will recover the display settings of the user? Matt
RE: [PHP] restrict access to multiple pages
Kelly Hallman wrote: On Mon, 8 Dec 2003, Chris W. Parker wrote: Ok so I am working on the admin sectin of the e-commerce app I'm writing and I'm hoping there's a better way to do what I am currently doing. In an effort to prevent circumvention of the login page I've placed a check at the beginning of each page that basically does the following: ... In the case that this is part of a larger application, as it seems to be, you probably should have an include that you are doing on each hit that handles the user identity/authentication.. Not just for your admin users, but a general container for all the user-related functions. On that page Within that include, let's call it loguser.php, you could write functions such as require_admin() or require_login() .. then, call those functions on the pages that require the user to be an admin or be logged in. The functions would determine if the logged-in user had adequate permission, and redirect them if not. That way, you can control this behavior from a central location--you don't want to have to go through each page of your app and change a URL. -- Kelly Hallman // Ultrafancy What I've done for the CMS I've been working on for a while is I have a base class which is the core of the application, and all modules in the CMS extend from this base class. Part of this base class is a check_login() method, and I simply call this in the constructor of each module to verify login and access privelidges. This method first verifies a basic login, and assuming the login passes it then checks the user's credentials against a list of credentials which are necessary to access the different functionalities in each module, and away we go. If the login test fails, the session is destroyed and the user is sent back to the login page. Otherwise if they are attempting to access functionality to which they don't have access they get notified of this, else they proceed as normal. Cheers, Pablo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] display settings
Hartley, Matt wrote: I am sort of new at this, I am wondering if it is possible to find the display settings of the user I know that ?php echo $_SERVER[HTTP_USER_AGENT]; ? will give you Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0) is there one that will recover the display settings of the user? Matt Hi Matt. I'm not sure if this will do what you want or not, but it's worth a look. It's provides a plethora of browser info. http://phpsniff.sourceforge.net/ Cheers, Pablo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problems with imagick's imagick_readimage
I was wondering if you any advice as to why the imagick function imagick_readimage can not read a url on my php installation. Problem: I am trying to get imagick to load an image from a URL. I can read from a file on the a file system no problem. $url = http://static.php.net/www.php.net/images/php_snow.gif;; $handle = imagick_readimage($url) ; // THIS DOES NOT WORK $url = /tmp/foo.gif; $handle = imagick_readimage($file) ; // THIS DOES WORK also I can get GD to read from a URL .eg. $url = http://static.php.net/www.php.net/images/php_snow.gif;; $src_img=ImageCreateFromGIF($url); The problem started after I was forced to change servers due to a disk crash. I am using the same versions of the software to build the php/mysql/apache. Is there any configuration /installation setting that I have missed that would stop me from loading the image via the URL ??? I have tried using GD, but found the image scaling quality to be substandard to imagick. I would like to use image magic if possible. I have made this quick test, to experiment IM loading from url: display http://static.php.net/www.php.net/images/php_snow.gif and found a strange behavior, the image is displayed, but just 3 seconds, then display stops itself. But loading in local don't bring this behavior.. Probably no relation, but pecl-imagick is still experimental, perhaps that's just it ? Well, if you don't find another solution, what you do can (rather than writing a tmp img file) is to load all the data image in a php var, and then throw it to pecl-imagick with the imagick_blob2image() function... This solution works, I'm using it to link php-gtk with php-imagick without tmp img files. Moreover as you can see below, this is shown in the exemples given in the imagick package: http://grincheux.codelutin.org/~monnier/doc/imagick/blob2image.php Has anyone had similar problems? Me, my problem with pecl-imagick is that not all the ImageMagick fonctions I am used to are available. And some of the non-available fonctions are very important like mask, disolve, some others not very important but rather very useful like round edge rectangles, bezier curves, etc... Well, there is still a lot of work to do to bring pcel-imagick to the same high level than Perl-imageMagick ... :,( -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] restrict access to multiple pages
Kelly Hallman wrote: On Mon, 8 Dec 2003, Chris W. Parker wrote: Ok so I am working on the admin sectin of the e-commerce app I'm writing and I'm hoping there's a better way to do what I am currently doing. In an effort to prevent circumvention of the login page I've placed a check at the beginning of each page that basically does the following: ... In the case that this is part of a larger application, as it seems to be, you probably should have an include that you are doing on each hit that handles the user identity/authentication.. Not just for your admin users, but a general container for all the user-related functions. On that page Within that include, let's call it loguser.php, you could write functions such as require_admin() or require_login() .. then, call those functions on the pages that require the user to be an admin or be logged in. The functions would determine if the logged-in user had adequate permission, and redirect them if not. That way, you can control this behavior from a central location--you don't want to have to go through each page of your app and change a URL. -- Kelly Hallman // Ultrafancy What I've done for the CMS I've been working on for a while is I have a base class which is the core of the application, and all modules in the CMS extend from this base class. Part of this base class is a check_login() method, and I simply call this in the constructor of each module to verify login and access privelidges. This method first verifies a basic login, and assuming the login passes it then checks the user's credentials against a list of credentials which are necessary to access the different functionalities in each module, and away we go. If the login test fails, the session is destroyed and the user is sent back to the login page. Otherwise if they are attempting to access functionality to which they don't have access they get notified of this, else they proceed as normal. Cheers, Pablo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] display settings
Not via PHP. You will need javascript to accomplish this. On Tue, 2003-12-09 at 10:57, Hartley, Matt wrote: I am sort of new at this, I am wondering if it is possible to find the display settings of the user I know that ?php echo $_SERVER[HTTP_USER_AGENT]; ? will give you Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0) is there one that will recover the display settings of the user? Matt -- Tyler Lane [EMAIL PROTECTED] Lyrical Communications -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Operator question
Assignment Operators http://www.php.net/manual/en/language.operators.assignment.php Incrementing/Decrementing Operators Arithmetic Operators http://www.php.net/manual/en/language.operators.increment.php Arithmetic Operators http://www.php.net/manual/en/language.operators.arithmetic.php Operator Precedence http://www.php.net/manual/en/language.operators.php Jeff McKeon [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] In PHP, what does the operator -= do? I can't find a ref to it's function in the online manual or any books I have. Thanks, Jeff -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Best practices for sharing members database between different portals
There is no good way to really handle this between domains and keep the user logged in. I doubt there are any real best practices on this. If you're disparate, you might be able to use some tricks to make it work, but all in all, I don't think it's a very easy thing. Cookies sessions just don't span multiple domains! -Galen On Dec 9, 2003, at 1:26 PM, Tariq Murtaza wrote: Dear All, Please comment on Best Practices for sharing members database between different portals. Suppose we have 3 portals running on different networks. Assignment is to make a single Login/Pass for all portals, means once LogedIn in one of the portal, could able to access the other portals without loging In. Constraints are, every portal have different Database structure and also have different Global / Session variables. Please share your experience and which approach is the best practice. Regards, TM -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] display settings
Since PHP is a server side language, you cannot get information like the users display settings. If you want this information, you will need to use a client side language like Javascript or VBScript. --Sam Hartley, Matt wrote: I am sort of new at this, I am wondering if it is possible to find the display settings of the user I know that ?php echo $_SERVER[HTTP_USER_AGENT]; ? will give you Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0) is there one that will recover the display settings of the user? Matt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Leechers...
Hello, On 12/09/2003 10:49 AM, Tristan Pretty wrote: I've just installed and am happily using Galery HP (http://www.galleryhp.org/) A great photo gallery package... Anyhoo, I want to now be able to stop people from linking to the images directly, and only be able to access the images via my site... Is this possible...? Perhaps my questio is to vauge, but I'm just having a think at teh mo... For the record, Gallery HP does a good job of hiding the full URL anyway. There are the traditional solutions to block accesses from the wrong referer but those are easy to work around. Some time ago I noticed this solution that seems to be much more robust as it protects the actual images via a special URL wrapper that only gives access to the images if you really have set some session variables. Not that it may be full proof, but I think it will protect your picture better. From what I could gather it does not require that you change the code that generates your image tags as it does some magic with your page HTML. http://www.phpclasses.org/class_protect_pictur -- Regards, Manuel Lemos 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
Re: [PHP] Re: spambothoney: script to pollute spammer's databases
Hello, On 12/09/2003 09:42 AM, Leif K-Brooks wrote: The latest spamming strategies consist on using valid sender addresses of inocent companies. Therefore, when you make up invalid addresses, all the bounces will go to the innocent companies mail servers. The more invalid addresses you make up the more harm you cause to innocent companies. My strategy against spam is giving invalid addresses at my domain name, all of which redirect to [EMAIL PROTECTED] No innocent servers besides my own are harmed, and the spam is given to an authority who will (in theory) do something about it. Are you sure that will not get yourself into problems with FTC for forwarding SPAM? Even if that nothing happens, I am afraid that soon nobody will be listening to messages sent to that [EMAIL PROTECTED] address. -- Regards, Manuel Lemos 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] Write on image in faint color
Hi, This was asked some time ago but cant find it in the archive, anybody remember how it was solved please write and tell me. Requirment: Write domain name in faint color on picture (a kind of watermark) Reason: I have 3 directories full of images that are original to our site and I spent a crapload of time scanning them and putting them up, I dont want others to just borrow the images and use them without giving us some type of credit... I found a package on google after searching that you just throw all the images in a folder and it generates the thumbs for you in a folder called thumbs, can i do the same for this too? ie. throw all the images in a folder, run the program and get www.sitename.com written on all the images? Any help and reminders appreciated. Cheers, -Ryan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Any security issues with preg_match and web form input ?
I accept a regex search term posted from a form, but I use $_REQUEST, so a person could throw the search term on the url if they wanted to. Am I open to any security breaches ? $search_term = isset ($_REQUEST ['search']) ? $_REQUEST ['search'] : ''; if ($search_term != ) { ... $contents = join (, file($file)); if (preg_match (/$search_term/i, $contents)) { } ... } Thanks, -- Richard A. DeVenezia -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Any security issues with preg_match and web form input ?
--- Richard A. DeVenezia [EMAIL PROTECTED] wrote: I accept a regex search term posted from a form, but I use $_REQUEST, so a person could throw the search term on the url if they wanted to. Am I open to any security breaches? $search_term = isset ($_REQUEST ['search']) ? $_REQUEST ['search'] : ''; if ($search_term != ) { ... $contents = join (, file($file)); if (preg_match (/$search_term/i, $contents)) { } ... } Although I can't think of a specific vulnerability for this, it is a bad practice to directly use data from the client without validating it in any way prior. Imagine that a random user can sit down at your desk and edit this script, except that he can only enter code where you have $search_term in your example above. Each time he makes a change, he executes this script to see the result. Now, imagine that he spends day after day trying to figure out something that he can use to compromise your script or cause it to misbehave in some way. Now imagine that there are thousands of people all doing this, day after day. Would you feel comfortable allowing them to edit your code (even just this one part) and be able to test each change, or would you rather have a look at what they entered before running the script each time? Hopefully you would rather make sure they entered something that looks like a valid regular expression. Your code can take this same approach. Hope that helps. Chris = Chris Shiflett - http://shiflett.org/ PHP Security Handbook Coming mid-2004 HTTP Developer's Handbook http://httphandbook.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: goto label
On Tue, 2003-12-09 at 08:14, Bogdan Stancescu wrote: Robert, I know your grief, been there, I know how it feels. I started my childhood with BASIC, which was /the/ GOTO programming language, learned Turbo Pascal when I was a teenager, and continued to use GOTO's (Pascal discourages but doesn't disallow GOTO's, so I was still able to cheat when there was a need for it). Well, later on when I started finding out how major projects are being developed, what structured programming really means and so on, I felt the way you feel now: cheated. Why in God's name is GOTO bad? It's SO useful! They're mad! Well, it simply isn't true -- the problem is that you have to change your mindset about programming, try to really structure the way you see a program, break it into efficient stand-alone functions, group those in classes, etc, and you'll see that there *is* no need for GOTO, ever. You do need to break out of loops, you do need to short a loop when a condition is met, you do need to break out of switches, if branches and the lot - but those tools you have in PHP. GOTO is not needed and harmful. Even simply learning to program without GOTO will coerce you into saner code. Sorry if my message sounded melodramatic or something, I remembered the frustration feeling so strongly from your message that I wanted to reinforce the other people's messages with a personal testimonial if you wish. U, I rarely use the goto statement, and I do not advocate it for regular everyday coding. I do know the difference between well structured code and otherwise. What I did say, is that goto label has it's uses, and sometimes it IS the best solution. Just because someone tells you something is bad, doesn't mean to say it is always bad. It's like someone saying salt is bad for you, and so you never take salt again and die from salt deficiency. People really need to change their mindset about being sheeple (yes sheep people) and blindly following preached dogma. I don't mind your message sounding melodramatic, but it doesn't explain in any way why goto shouldn't be used. It just asserts that you found out how major projects are done, which IMHO doesn't lend support to why one shouldn't use the goto statement. In actual fact it makes me think you are missing a few points. For instance properly structured programming is often about the functions, objects, and methods, not about the code within a function that performs the logic. For this reason the use of goto statements within a given function that facilitates faster cleaner code is sometimes the best solution not to mention its contents can be considered a black box by the user of the function. Also your response seems to indicate that you think I am a newbie coder, well that would be a bit of an oversight. I've been coding for over 10 years (some hobby, some academic, and some professional) using many different styles (functional, procedural, and OOP) and so I am plenty aware of design paradigms, re-usability, and clarity. I also have extensive experience refactoring old spaghetti code. 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
[PHP] Cannot store ldap_connect() resource handle in session $SESSION[] ?
Is it possible to connect to an LDAP server with ldap_connect() then store the resulting resource handle in the session variable $SESSION[]? I'm hoping to avoid re-connecting and re-binding every time the user clicks on something. It does not appear to be saving my LDAP connection handle along with the other $SESSION variables I'm successfully storing. The relevant code fragments in execution order are from an Authentication function: session_start(); $ldapConn = ldap_connect($confLdapServer) or die(Cannot connect to LDAP server=$confLdapServer); ldap_bind($ldapConn, $ldapDN, $password) or die(Could not do authenticated bind to LDAP server='$confLdapServer' . with password='$password' and dn='$ldapDN'); $_SESSION['username'] = $username; $_SESSION['ldapConn'] = $ldapConn; $_SESSION['ldapDN'] = $ldapDN; When I return to the page after authenticating $_SESSION['ldapConn'] is zero. The other session variables are fine. I can see them in the session serialized under tmp: ... ldapConn|i:0; ... Oops, I didn't see this bit the first 37 times I read the manual on Sessions, I only looked at the top level Session handling functions; I just noticed the following buried under session_register(): http://us3.php.net/function.session-register Note: It is currently impossible to register resource variables in a session. For example, you cannot create a connection to a database and store the connection id as a session variable and expect the connection to still be valid the next time the session is restored. PHP functions that return a resource are identified by having a return type of resource in their function definition. A list of functions that return resources are available in the resource types appendix. That appendix explicitly lists ldap_connect()'s resource handle. So it sounds like I have to ldap_connect() and ldap_bind() every time the user clicks on my PHP app. Ouch. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] run a command on a remote host
How can I run a command on a remote host wiht php? I'm trying this line but nothing happen. passthru(rsh rubella /export/dat0/users/augur-se/bin/.upnotify -s 1045073262-82425_net2.nextelinternational.com -u http://wap.peru.com -a -y D--- -i Location -n); I try exec and system, too But if I run this from the command line of my machine the command run rightly. rsh rubella /export/dat0/users/augur-se/bin/.upnotify -s 1045073262-82425_net2.nextelinternational.com -u http://wap.peru.com -a -y D--- -i Location -n Thanks in advance, Ivone __ Do you Yahoo!? Free Pop-Up Blocker - Get it now http://companion.yahoo.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: goto label
Robert Cummings wrote: On Tue, 2003-12-09 at 08:14, Bogdan Stancescu wrote: Robert, I know your grief, been there, I know how it feels. I started my childhood with BASIC, which was /the/ GOTO programming language, learned Turbo Pascal when I was a teenager, and continued to use GOTO's (Pascal discourages but doesn't disallow GOTO's, so I was still able to cheat when there was a need for it). Well, later on when I started finding out how major projects are being developed, what structured programming really means and so on, I felt the way you feel now: cheated. Why in God's name is GOTO bad? It's SO useful! They're mad! Well, it simply isn't true -- the problem is that you have to change your mindset about programming, try to really structure the way you see a program, break it into efficient stand-alone functions, group those in classes, etc, and you'll see that there *is* no need for GOTO, ever. You do need to break out of loops, you do need to short a loop when a condition is met, you do need to break out of switches, if branches and the lot - but those tools you have in PHP. GOTO is not needed and harmful. Even simply learning to program without GOTO will coerce you into saner code. Sorry if my message sounded melodramatic or something, I remembered the frustration feeling so strongly from your message that I wanted to reinforce the other people's messages with a personal testimonial if you wish. U, I rarely use the goto statement, and I do not advocate it for regular everyday coding. I do know the difference between well structured code and otherwise. What I did say, is that goto label has it's uses, and sometimes it IS the best solution. Just because someone tells you something is bad, doesn't mean to say it is always bad. It's like someone saying salt is bad for you, and so you never take salt again and die from salt deficiency. People really need to change their mindset about being sheeple (yes sheep people) and blindly following preached dogma. I don't mind your message sounding melodramatic, but it doesn't explain in any way why goto shouldn't be used. It just asserts that you found out how major projects are done, which IMHO doesn't lend support to why one shouldn't use the goto statement. In actual fact it makes me think you are missing a few points. For instance properly structured programming is often about the functions, objects, and methods, not about the code within a function that performs the logic. For this reason the use of goto statements within a given function that facilitates faster cleaner code is sometimes the best solution not to mention its contents can be considered a black box by the user of the function. Also your response seems to indicate that you think I am a newbie coder, well that would be a bit of an oversight. I've been coding for over 10 years (some hobby, some academic, and some professional) using many different styles (functional, procedural, and OOP) and so I am plenty aware of design paradigms, re-usability, and clarity. I also have extensive experience refactoring old spaghetti code. Cheers, Rob. While goto may be useful and even elegant for experienced programmers (although I see no reason to use it myself with well structured programs...there's always break), its inclusion in a language causes some programmers (newbies and those who don't yet understand clarity, etc.) to make habits which are harmful. It allows them shortcuts which get things done, but often lead to bugs and hard to read code. opinion Personally, I don't think goto should ever be used. Well structured programs can always be written to not need a goto and always just as elegantly. It may take restructuring of code, but it can always be done, and in the end the result is clearer. You say that a funciton is a black box and while this is true for the user of a function, the maintainer of the code still has to deal with the contents of the function. If you wrote and understand it, then fine. The problem comes when others have to understand your code. Yes, a single goto isn't all that bad, especially when it is used right, but is it easier to screw up a code with a goto than a more structured statement, such as break. /opinion -- paperCrane Justin Patrin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: goto label
On Tue, 2003-12-09 at 17:45, Justin Patrin wrote: While goto may be useful and even elegant for experienced programmers (although I see no reason to use it myself with well structured programs...there's always break), its inclusion in a language causes some programmers (newbies and those who don't yet understand clarity, etc.) to make habits which are harmful. It allows them shortcuts which get things done, but often lead to bugs and hard to read code. This is a good point that I do agree with. But experience comes with knowledge about the tools, and goto is just another tool. opinion Personally, I don't think goto should ever be used. Well structured programs can always be written to not need a goto and always just as elegantly. It may take restructuring of code, but it can always be done, and in the end the result is clearer. The result is not always cleaner. Consider code with fairly complex considtional branching (parsers are often in this category). Contrast 20 break statements and conditional re-entry variable to properly flow through the code to the end of the function where cleanup is performed versus the same conditional branching complexity, with a single goto cleanup;. True one could put the cleanup in a function of it's own, but then the usage of the function is just as unwieldy since it must be populated with the data structures to cleanup. Alternatively an object could be used, but now the code is spread out when it would have been more clear in a single function with a label. You say that a funciton is a black box and while this is true for the user of a function, the maintainer of the code still has to deal with the contents of the function. If you wrote and understand it, then fine. The problem comes when others have to understand your code. Yes, a single goto isn't all that bad, especially when it is used right, but is it easier to screw up a code with a goto than a more structured statement, such as break. /opinion I agree that when one writes code, they should always give consideration to the person who must follow in their footsteps, but I still assert that sometimes the code is easier to follow for the person who reads it later when a goto is used than when multiple state variables are used to manage flow control. 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] run a command on a remote host
When you say remote host do you mean the server executing the script or the person accessing it? If you mean the latter, it is not possible. - Original Message - From: Ivone Uribe To: [EMAIL PROTECTED] Sent: Tuesday, December 09, 2003 5:44 PM Subject: [PHP] run a command on a remote host How can I run a command on a remote host wiht php? I'm trying this line but nothing happen. passthru(rsh rubella /export/dat0/users/augur-se/bin/.upnotify -s 1045073262-82425_net2.nextelinternational.com -u http://wap.peru.com -a -y D--- -i Location -n); I try exec and system, too But if I run this from the command line of my machine the command run rightly. rsh rubella /export/dat0/users/augur-se/bin/.upnotify -s 1045073262-82425_net2.nextelinternational.com -u http://wap.peru.com -a -y D--- -i Location -n Thanks in advance, Ivone __ Do you Yahoo!? Free Pop-Up Blocker - Get it now http://companion.yahoo.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] run a command on a remote host
Don't forget that this will be executed as the user that the webserver is running as. Hopefully that's not root in this case. Check out the docs for rsh, you can specify the username with the -l option. I don't know if that will accomplish what you want. Also, what do you mean by nothing happen. No output to the browser? The command does not execute? What error messages are in your webserver's error_log? I'm not incredibly well versed in rsh, but you couls potentially run into some issues with the -l option too. Check your error_log though, if it doesn't spell out what's wrong to you, it should atleast give some information that someone here might be able to expand on. On Tue, Dec 09, 2003 at 02:44:28PM -0800, Ivone Uribe wrote: How can I run a command on a remote host wiht php? I'm trying this line but nothing happen. passthru(rsh rubella /export/dat0/users/augur-se/bin/.upnotify -s 1045073262-82425_net2.nextelinternational.com -u http://wap.peru.com -a -y D--- -i Location -n); I try exec and system, too But if I run this from the command line of my machine the command run rightly. rsh rubella /export/dat0/users/augur-se/bin/.upnotify -s 1045073262-82425_net2.nextelinternational.com -u http://wap.peru.com -a -y D--- -i Location -n Thanks in advance, Ivone __ Do you Yahoo!? Free Pop-Up Blocker - Get it now http://companion.yahoo.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Brad Lhotsky [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] run a command on a remote host
Well, it is not possible directly, but you can try some of the following; $cmd = rsh -l user host command; // remote shell $cmd = rpc -l user host command; // remote procedure call $cmd = rexec -l user host command; // remote exec $cmd = ssh host command; // secure shell (recommended, but not always available) exec($cmd, $returnlines); // your php command for one of the above foreach($returnlines as $line) echo $line.br; // output results I haven't checked the syntax of the various commands, but I think this answers your question about a few options that might be available. rsh, rexec, rpc and ssh are defined best in Unix references, but many are also available if your php server is windows based. good luck, Warren Vail -Original Message- From: Nathan Taylor [mailto:[EMAIL PROTECTED] Sent: Tuesday, December 09, 2003 3:48 PM To: [EMAIL PROTECTED]; Ivone Uribe Subject: Re: [PHP] run a command on a remote host When you say remote host do you mean the server executing the script or the person accessing it? If you mean the latter, it is not possible. - Original Message - From: Ivone Uribe To: [EMAIL PROTECTED] Sent: Tuesday, December 09, 2003 5:44 PM Subject: [PHP] run a command on a remote host How can I run a command on a remote host wiht php? I'm trying this line but nothing happen. passthru(rsh rubella /export/dat0/users/augur-se/bin/.upnotify -s 1045073262-82425_net2.nextelinternational.com -u http://wap.peru.com -a -y D--- -i Location -n); I try exec and system, too But if I run this from the command line of my machine the command run rightly. rsh rubella /export/dat0/users/augur-se/bin/.upnotify -s 1045073262-82425_net2.nextelinternational.com -u http://wap.peru.com -a -y D--- -i Location -n Thanks in advance, Ivone __ Do you Yahoo!? Free Pop-Up Blocker - Get it now http://companion.yahoo.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] [Newbie Guide] For the benefit of new members
=== This message is for the benefit of new subscribers and those new to PHP. Please feel free to add more points and send to the list. === 1. If you have any queries/problems about PHP try http://www.php.net/manual/en first. You can download a copy and use it offline also. Please also try http://www.php.net/manual/faq.php to get answers to frequently answered questions about PHP (added by Christophe Chisogne). 2. Try http://www.google.com next. Searching for php YOUR QUERY may fetch you relevant results within the first 10 results, if you are lucky. 3. There is a searchable archive of the mailing list discussion at http://phparch.com/mailinglists. Many of the common topics are discussed repeatedly, and you may get answer to your query from the earlier discussions. For example: One of the repeatedly discussed question in the list is Best PHP editor. Everyone has his/her favourite editor. You can get all the opinions by going through the list archives. If you want a chosen list try this link : http://phpeditors.linuxbackup.co.uk/ (contributed by Christophe Chisogne). 4. Just put the following code into a file with a .php extension and access it through your webserver: ?php phpinfo(); ? This will display tons of info if php is enabled, or, it will ask you to download a file if php is NOT enabled. (contributed by Teren) 5. If you are stuck with a script and do not understand what is wrong, instead of posting the whole script, try doing some research yourself. One useful trick is to print the variable/sql query using print or echo command and check whether you get what you expected. After diagnosing the problem, send the details of your efforts (following steps 1, 2 3) and ask for help. 6. PHP is a server side scripting language. Whatever processing PHP does takes place BEFORE the output reaches the client. Therefore, it is not possible to access the users' computer related information (OS, screen size etc) using PHP. You need to go for JavaScript and ask the question in a JavaScript list. (You can access information SENT by the user's browser while requesting pages from your server. You can get the details about browser, OS etc as reported by this request. - contributed by Wouter van Vliet) 7. Provide a clear descriptive subject line. Avoid general subjects like Help!!, A Question etc. Especially avoid blank subjects. 8. When you want to start a new topic, open a new mail composer and enter the mailing list address [EMAIL PROTECTED] instead of replying to an existing thread and replacing the subject and body with your message. 9. It's always a good idea to post back to the list once you've solved your problem. People usually add [SOLVED] to the subject line of their email when posting solutions. By posting your solution you're helping the next person with the same question. [contribued by Chris W Parker] 10. Ask smart questions http://catb.org/~esr/faqs/smart-questions.html [contributed by Jay Blanchard) Hope you have a good time programming with PHP. Best regards, -- Integrated Management Tools for leather industry -- http://www.leatherlink.net Ma Siva Kumar, BSG LeatherLink (P) Ltd, Chennai - 600106 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] header function, I'm stumped
On Tue, 2 Dec 2003, Chris Hubbard wrote: All, dealing with header(location:...) again. and trying to understand what's happening. I've got the following code: header(Location:http://www.mysite.com/cp/ad/ad_details.php?id=;. $id); I'm kinda surprised I didn't see this mentioned.. Have you tried: header(Location: http://url.redirect/\n\n;); exit; // ? The browser may be particular about the headers. When you add the two newlines to the end, it makes it look like the end of the headers. It's good practice to explicitly exit each time you redirect. -- Kelly Hallman // Ultrafancy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] header function, I'm stumped
--- Kelly Hallman [EMAIL PROTECTED] wrote: On Tue, 2 Dec 2003, Chris Hubbard wrote: All, dealing with header(location:...) again. and trying to understand what's happening. I've got the following code: header(Location:http://www.mysite.com/cp/ad/ad_details.php?id=;. $id); I'm kinda surprised I didn't see this mentioned.. Have you tried: header(Location: http://url.redirect/\n\n;); exit; // ? You should definitely not try to add your own newlines to the end of a header like that. PHP might be able to gracefully handle it, but I wouldn't rely on it. As for the original question, put a space after your colon, and let us know how that works. Hope that helps. Chris = Chris Shiflett - http://shiflett.org/ PHP Security Handbook Coming mid-2004 HTTP Developer's Handbook http://httphandbook.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] [Newbie Guide] For the benefit of new members
Ma Siva Kumar mailto:[EMAIL PROTECTED] on Tuesday, December 09, 2003 4:00 PM said: 4. Just put the following code into a file with a .php extension and access it through your webserver: ?php phpinfo(); This will display tons of info if php is enabled, or, it will ask you to download a file if php is NOT enabled. (contributed by Teren) I think this point could do with having it's wording changed. My suggestion: Not sure if PHP is working or you want find out what extensions are available to you? Just put the following code into a file with a .php extension and access it through your webserver: ?php phpinfo(); ? If PHP is installed you will see a page with a lot of information on it. If PHP is not installed (or not working correctly) your browser will try to download the file. 6. PHP is a server side scripting language. Whatever processing PHP does takes place BEFORE the output reaches the client. Therefore, it is not possible to access the users' computer related information (OS, screen size etc) using PHP. You need to go for JavaScript and ask the question in a JavaScript list. (You can access information SENT by the user's browser while requesting pages from your server. You can get the details about browser, OS etc as reported by this request. - contributed by Wouter van Vliet) May I proppose the following rewording for the second paragraph: On the other hand you can access the information that is SENT by the user's browser when a client requests a page from your server. You can find details about browser, OS etc as reported by this request. - contributed by Wouter van Vliet Chris. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] header function, I'm stumped
?php ob_start(); $dom = $_SERVER['SERVER_NAME']; writeMessage($id) or die('cannot write' . $id); header('Location: http://' . $dom . '/cp/ad/ad_details.php?id=' . $id); exit(); ob_end_flush(); ? -- Jon Kriek www.phpfreaks.com www.jonkriek.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Write on image in faint color
There's a command line, open-source utility called ImageMagick (http://www.imagemagick.org/) available for all major platforms that allows you to do lots of powerful image manipulation on one file, or one thousand. You crop, scale, rotate, colour, draw on, place text over, compose, transform and create montages of images using this program. It has quite a steep learning curve, but the results are worth it! You can run this using PHP shell_exec() function if you want to execute the program from a web page, although be careful of the obvious security consideration involved in doing this. Hope it helps, Al Ryan A [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi, This was asked some time ago but cant find it in the archive, anybody remember how it was solved please write and tell me. Requirment: Write domain name in faint color on picture (a kind of watermark) Reason: I have 3 directories full of images that are original to our site and I spent a crapload of time scanning them and putting them up, I dont want others to just borrow the images and use them without giving us some type of credit... I found a package on google after searching that you just throw all the images in a folder and it generates the thumbs for you in a folder called thumbs, can i do the same for this too? ie. throw all the images in a folder, run the program and get www.sitename.com written on all the images? Any help and reminders appreciated. Cheers, -Ryan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] treu type fonts
G'day all I was wandering I have php installed with GD with freetype fonts compiled in I ran this php script ?php header(Content-type: image/gif); $im = imagecreate(400,30); $white = imagecolorallocate($im, 255,255,255); $black = imagecolorallocate($im, 0,0,0); // Replace path by your own font path imagettftext($im, 20, 0, 10, 20, $black, ./arial, Testing... Omega: amp;#937;); imagegif($im); imagedestroy($im); ? and nothing gets displayed on the screen. Also if i right click in the top right hand corner and click properties the type is gif image. Can any one tell me what I should double check and what to look for. As I am getting no errors messages, I guess that means that free type fonts support is installed correctly? or please correct me if im wrong. Thanks CJ The Glennies Group P.O. Box 5136 Studfield Post Office WANTIRNA SOUTH VIC 3152 Ph: 61 3 9800 3906 E-mail: [EMAIL PROTECTED] Website: glennies.com.au -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: problem with INSERT query
In article [EMAIL PROTECTED], [EMAIL PROTECTED] says... Hi all, I am trying to do a simple INSERT data into the database using the following php script but the problem here is that whenever I click submit, the script only insert a NULL value into the columns into the datadase instead the value I enter in the forms fieldSELECT query was successful but not INSERT.. A snip of the code are as follow: ?php //declare error variable $err = ; //set error variable $err .= check_tutor_name(); $err .= check_tutor_contact(); $err .= check_tutor_email(); $err .= check_tutor_profile(); //define connection string $dsn = mysql://root:[EMAIL PROTECTED]/table1; //connect to DB $db = DB::connect ($dsn); //check for any DB connection errors if (DB::isError ($db)) die ($db-getMessage()); $tutor_name = $db-quote($POST[tutor_name]); $tutor_contact = $db-quote($POST[tutor_contact]); $tutor_email = $db-quote($POST[tutor_email]); $tutor_profile = $db-quote($POST[tutor_profile]); I think your problem might be in the above lines; the superglobal variable is $_POST{'whatever'} - note the underscore in the name. SNIP code So, what could be the problem with the code I have wriiten??? Any help are appreciated. Irin. Cheers -- Quod subigo farinam A: Because it messes up the order in which people normally read text. Q: Why is top-posting such a bad thing? A: Top-posting. Q: What is the most annoying thing on usenet? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Reading email from sendmail
In article [EMAIL PROTECTED], [EMAIL PROTECTED] says... Good afternoon, all!! Is there a function or series of functions in PHP that will allow a PHP package to read email from a sendmail account, look for a specific information in the subject line, then be able to resend that email to a group of users?? I know mail can be used to send email but reading from sendmail???... Any information is greatly appreciated and profoundly useful. Robin 'Sparky' Kopetzky Black Mesa Computers/Internet Service Grants, NM 87020 If the 'sendmail account' can be a dedicated address, you can use sendmail's alias to direct any emails to a php script which does what you need. Cheers -- Quod subigo farinam A: Because it messes up the order in which people normally read text. Q: Why is top-posting such a bad thing? A: Top-posting. Q: What is the most annoying thing on usenet? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Constraint Violation when INSERT
Hi all, I got the error Constraint Violation when I did an INSERT . Gone thru the code umpteen times but to no avail..Wondering where my error was??...Below is a snip of the block of code: ? $dsn = mysql://root:[EMAIL PROTECTED]/tablename; $db = DB::connect ($dsn); if (DB::isError ($db)) die ($db-getMessage()); //create variables ready to go into DB $tutor_name = $db-quote($_POST[tutor_name]); $tutor_contact = $db-quote($_POST[tutor_contact]); $tutor_email = $db-quote($_POST[tutor_email]); $tutor_profile = $db-quote($_POST[tutor_profile]); $sql = INSERT INTO tutor (tutor_name, tutor_contact, tutor_email, tutor_profile) VALUES ($tutor_name,$tutor_contact,$tutor_email,$tutor_profile); $result = $db-query($sql); if( DB::isError($result) ) { die ($result-getMessage()); } ? --- Everything was fine and the INSERT works, user input was insert into the database successful using the same block of code but the next thing i know I got this error anyone know watz the proz here??? Hope to get some help soon. Thanks in advance=) Irin. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Constraint Violation when INSERT
Hi all, I got the error Constraint Violation when I did an INSERT . Gone thru the code umpteen times but to no avail..Wondering where my error was??...Below is a snip of the block of code: ? $dsn = mysql://root:[EMAIL PROTECTED]/tablename; $db = DB::connect ($dsn); if (DB::isError ($db)) die ($db-getMessage()); //create variables ready to go into DB $tutor_name = $db-quote($_POST[tutor_name]); $tutor_contact = $db-quote($_POST[tutor_contact]); $tutor_email = $db-quote($_POST[tutor_email]); $tutor_profile = $db-quote($_POST[tutor_profile]); $sql = INSERT INTO tutor (tutor_name, tutor_contact, tutor_email, tutor_profile) VALUES ($tutor_name,$tutor_contact,$tutor_email,$tutor_profile); $result = $db-query($sql); if( DB::isError($result) ) { die ($result-getMessage()); } ? -- - Everything was fine and the INSERT works, user input was insert into the database successful using the same block of code but the next thing i know I got this error anyone know watz the proz here??? Hope to get some help soon. Thanks in advance=) Irin. Don't you need to quote your strings? $sql = INSERT INTO tutor (tutor_name, tutor_contact, tutor_email, tutor_profile) VALUES ('$tutor_name','$tutor_contact','$tutor_email','$tutor_profile'); Martin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] CfP: International PHP Conference 2004 Spring Edition Amsterdam
Hi folks, [ http://www.phpconference.com/ ] time's running fast ahead - we're just announcing the Call for Papers for 2004's International PHP Conference Spring Edition Amsterdam. The date for this event for PHP enthusiasts from all over the world will be May 3rd to May 5th, 2004. The conference venue is the RAI conference center in Amsterdam. Submit your proposals at: http://www.phpconference.de/kt/input/ Like the International PHP Conferences in Frankfurt this conference will offer a first class programme presented by the creme de la creme of the PHP community to an international audience of PHP enthusiasts. We are happy to ask you to submit your proposals for the session programme. This time we extended the programme to have a one day full with hands-on power workshops. Organiser: Software Support Verlag Kennedyallee 87 60596 Frankfurt am Main Attn: Frank Stepan Tel. +49 69 6300 89 29 Fax. +49 69 6300 89 89 eMail: [EMAIL PROTECTED] The dates for the conference are: May, 3rd - 5th conference location: RAI Amsterdam The Topics: - General PHP - PHP Business - PHP Databases - PHP Design - PHP Extensions - PHP XML - PHP-GTK Call for Papers: If you want to present your talks at this unique event, please submit your proposals to us. The chair board will consist of 5 well-known members of the PHP community headed with Björn Schotte, editor in chief of the German PHP Magazine. Please submit your proposals at http://www.phpconference.de/kt/input/ Deadline for submitting the abstracts is December 29, 2003. You will be informed whether your suggestions have been accepted or not until January 05, 2004. The slides and codes used for the session will be made available to the conference participants after the the conference. Guidelines for the conference slides etc. will be sent to you when your suggestions have been accepted by the Conference Board. Please note that we can only accept sessions proposals if contributions for the slides etc. are available by April 27, 2004. Structure of the Sessions: The sessions are 75 min. long (incl. discussion at the end of the lecture). It is possible to split a session in an introduction and a continuing part. The presentation language is English. Target groups: - project managers - software developers - IT managers - web designers and web administrators - PHP enthusiasts Notice: 1. Travel expenses and lodging will be covered by us. Details on travel and accomodation will be given if session is accepted. 2. Every speaker will have free access to all conference sessions. 3. Every speaker should present at least two sessions. Those of you who want to present only one session, please contact the Conference Board at [EMAIL PROTECTED] 4. The language for communication with the organiser and the chair is english. See you soon, Björn. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] How to Calculate Similarity Percentage with Levenshtein function
Hi, I'm trying to obtain the similarity percentage for 2 Strings when using the Levenshtein function but the percentages doesn't seem to match the percentage returned by similar_text($str1,$str2,$match_percent); Below is what I use to calculate the similarity percentage $dist = levenshtein($str1,$str2); $str1len = strlen($str1); $str2len = strlen($str2); if($str1len $str2len) { $pct = ($str1len - $dist)/$str1len; } else { $pct = ($str2len - $dist)/$str2len; } $pct = $pct*100; What am I missing from the calculation? Thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] How to Calculate Similarity Percentage with Levenshtein function
Hi, I'm trying to obtain the similarity percentage for 2 Strings when using the Levenshtein function but the percentages doesn't seem to match the percentage returned by similar_text($str1,$str2,$match_percent); Below is what I use to calculate the similarity percentage $dist = levenshtein($str1,$str2); $str1len = strlen($str1); $str2len = strlen($str2); if($str1len $str2len) { $pct = ($str1len - $dist)/$str1len; } else { $pct = ($str2len - $dist)/$str2len; } $pct = $pct*100; What am I missing from the calculation? Thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Constraint Violation when INSERT
Hi all, I got the error Constraint Violation when I did an INSERT . Gone thru the code umpteen times but to no avail..Wondering where my error was??...Below is a snip of the block of code: ? $dsn = mysql://root:[EMAIL PROTECTED]/tablename; $db = DB::connect ($dsn); if (DB::isError ($db)) die ($db-getMessage()); //create variables ready to go into DB $tutor_name = $db-quote($_POST[tutor_name]); $tutor_contact = $db-quote($_POST[tutor_contact]); $tutor_email = $db-quote($_POST[tutor_email]); $tutor_profile = $db-quote($_POST[tutor_profile]); $sql = INSERT INTO tutor (tutor_name, tutor_contact, tutor_email, tutor_profile) VALUES ($tutor_name,$tutor_contact,$tutor_email,$tutor_profile); $result = $db-query($sql); if( DB::isError($result) ) { die ($result-getMessage()); } ? -- - Everything was fine and the INSERT works, user input was insert into the database successful using the same block of code but the next thing i know I got this error anyone know watz the proz here??? Hope to get some help soon. Thanks in advance=) Irin. Don't you need to quote your strings? $sql = INSERT INTO tutor (tutor_name, tutor_contact, tutor_email, tutor_profile) VALUES ('$tutor_name','$tutor_contact','$tutor_email','$tutor_profile'); Martin -- Yes, I actually quoted my string at the beginning but whenever i do an INSERT it actually insert a NULL value into the fields...why is this so???So I try not to quote the strings but I got a Contraints Violation errorWhat could be the problem?? -- Hope to get some help soon. All help are greatly appreciated. Irin. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] problem with INSERT query
[EMAIL PROTECTED] schrieb: Thanks alot for your help!!! It was only a spacing mistake... There should have no spacing in between each variables: VALUES ($tutor_name,$tutor_contact,$tutor_email,$tutor_profile); hi, a space after a comma shouldn't be a problem. your problem were probably your single quotes. it's a different between ... VALUES ('$tutor_name', ...); and ... VALUES ($tutor_name, ...); hth SVEN --- - So what was actually the difference between having single quotes for my string and without single quotes ??? Irin. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] treu type fonts
Hi, Wednesday, December 10, 2003, 11:53:27 AM, you wrote: c G'day all c I was wandering I have php installed with GD with freetype fonts compiled in c I ran this php script c ?php c header(Content-type: image/gif); c $im = imagecreate(400,30); c $white = imagecolorallocate($im, 255,255,255); c $black = imagecolorallocate($im, 0,0,0); c // Replace path by your own font path c imagettftext($im, 20, 0, 10, 20, $black, ./arial, Testing... Omega: c amp;#937;); c imagegif($im); c imagedestroy($im); ? c and nothing gets displayed on the screen. c Also if i right click in the top right hand corner and click properties the c type is gif image. c Can any one tell me what I should double check and what to look for. c As I am getting no errors messages, I guess that means that free type fonts c support is installed correctly? or please correct me if im wrong. Depending on where gd came from you may not be able to create gif files only read them. Try generating a png or jpeg -- regards, Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php