Re: [PHP] most reliable way to test if using https
if( !preg_match(/HTTPS/, $_SERVER['SERVER_PROTOCOL']) ){ } That's what I have been using. HTH -- Ray Hauge Programmer/Systems Administrator American Student Loan Services http://www.americanstudentloan.com 1.800.575.1099 On Friday 13 January 2006 04:05 pm, James Benson wrote: What is the most reliable way to test if a connection is already using the https protocol, is their a PHP constant or something builtin already? Thanks, James -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Best way to do this: www.domain.com?page=var
You could also check to see if $_GET['page'] contains a value, and if it does not, then redirect it. Something like this: if($_GET['page'] == ''){ header(Refresh: 0; URL=http://www.domain.com/start.php?page=home;); } Granted that isn't validating the $_GET['page'] variable input for security, but that should at least get you going. Also, that assumes that all your pages use the GET query to specify which page they are on. If that's just for the initial page, then you'd have to do some more qualification. HTH -- Ray Hauge Programmer/Systems Administrator American Student Loan Services http://www.americanstudentloan.com 1.800.575.1099 On Monday 16 January 2006 03:14 pm, [EMAIL PROTECTED] wrote: On your web server you can configure 'default pages'. Apache and *nix type servers seem to favor the index.html type default pages while Microsoft's IIS goes for the Default.htm just to be different. But you can add default pages to a list in the order you want them accepted. For instance, if you use PHP a lot (which I think we all do :) but you have a lot of directories that just have static HTML in them, you might have: index.html index.php (or vice versa) as your default pages list. If it doesn't find any of those in the directory being accessed, then you should get your good old 404 error. Should just be a matter of adding start.php to your defaults list in whatever priority order you want. I think that'll do it for ya. If you're going through an ISP, they still may have a way that you can set your defaults, possibly through .htaccess or some other Apache type prefs setting mechanism. Good luck! -TG = = = Original message = = = Hello, What would be the best way to get a page variable like this: www.domain.com?page=home to show up when a user types in: www.domain.com My current fix is to have this: header(Refresh: 0; URL=http://www.domain.com/start.php?page=home;); .. on a index.php page on the root.. Is there a way I can do this and avoid having a page that just does redirection? Thanks for help. Cheers, Micky ___ Sent by ePrompter, the premier email notification software. Free download at http://www.ePrompter.com. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Str to Int
You should be able to typecast the variable like so: $cardID = (int)$cardID; You can also check which type it is showing up as with the function gettype(): http://www.php.net/manual/en/function.gettype.php Optionally you could use settype() to change the type of the variable: http://www.php.net/manual/en/function.settype.php HTH -- Ray Hauge Programmer/Systems Administrator American Student Loan Services http://www.americanstudentloan.com 1.800.575.1099 On Friday 20 January 2006 03:53 pm, Ron Eggler (Paykiosks) wrote: Hi, I need to do a type cast from string to int in folllowing code: [php] getPIN cardID='.intval(trim($cardID)).' quantity=1 / [/php] I need $cardID have converted to int. I thought it should work that way but it does not! But it's working if I'm putting [php] getPIN cardID=180 quantity=1 / [/php] in there. I got card ID as a var that is passed as get like: [php] $cardID = $HTTP_GET_VARS[cardID]; [/php] Can anyone help me in that issue? Thank you! __ Ron Eggler Intern 866-999-4179 www.paykiosks.net -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Testing
Sorry to kind of spam the list, but I recently switched email programs and my posts haven't been making it to the list. This is just a test... please ignore it :) Thanks, Ray -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Apache is not parsing .php files
On Thursday 26 January 2006 03:28 pm, Richard Lynch wrote: On Thu, January 26, 2006 2:19 pm, sanjay wrote: I have a strange problem while trying to run php based applications. Lets start with phpMyAdmin, a very popular open source tool to manage MySQL written in php. I have already installed phpMyAdmin and was running fine. One day suddenly when I pointed my browser at : http://localhost/phpMyAdmin Instead of running the phpMyAdmin browser opened a message window with options- Open With or Save to disk . I am sure its not browser problem because I tried on Firefox-1.5, Mozilla, Epiphany and Konqueror. One more point I would like to add here that if I write one small php program and save it in as php file (test.php) then http://localhost/test.php executes properly I am using Fedora 2 and apache2, php-4.3x and mysql-3.x were part of the Fedora installation. The only change I made in the /etc/php.ini file was to increase the memory limit from 8MB to 12MB. (Then restarted the http server) Now even php.ini file is in the original state but problem is still there. The http.conf file is unchanged. Can any one give me some sort of idea. My first WILD GUESS is that way long time ago, you changed httpd.conf and/or php.ini, but forgot to re-start Apache, and then tested, and everything worked, so you went on. Now, when you HAVE re-started Apache, your fix from ages ago is finally kicking in, and you have no recollection of that change. If you have log files or notes of changes made previously, especially to httpd.conf, php.ini, or .htaccess, review them -- Keep in mind that what you are calling your original httpd.conf and php.ini file are, in fact, the ones you modified oh so long ago. Another tack you can take is to go ahead and save what the browser is sending you and look at it and see what it looks like. PHP Source? Or something else? Also use telnet or curl (from another box) or similar to get the headers and HTML that is coming out from the broken pages. -- Like Music? http://l-i-e.com/artists.htm I ran into this a while ago. My hosting company did some updates and messed up the httpd.conf file. I eventually tracked it down to the php directives being a bit mangled. Make sure that Apache is loading the PHP module, and that you are telling apache how to handle php files. Since you have apache2, check the /etc/httpd/conf.d/php.conf file to make sure that LoadModule, AddHandler, AddType, and DirectoryIndex are all in there. HTH -- Ray Hauge Programmer/Systems Administrator American Student Loan Services http://www.americanstudentloan.com 1.800.575.1099 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Isolating a php directory on a main server
On Thursday 26 January 2006 03:48 pm, The Doctor wrote: How can one do this ?? CLient wants to isolate away so development code so that only he can upload it and no one in the world can see it. -- Member - Liberal International This is [EMAIL PROTECTED] Ici [EMAIL PROTECTED] God Queen and country! Beware Anti-Christ rising! Born 29 Jan 1969 Redhill Surrey UK If I'm reading this right, this sounds like more of a webserver issue. If you're using Apache, then you could probably put in a Directory directive to lock it down to his IP (if he is static). You could also put the user/pass authentication in there. -- Ray Hauge Programmer/Systems Administrator American Student Loan Services http://www.americanstudentloan.com 1.800.575.1099 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] session loss
This behavior could happen if your team is using load-balancing on multiple T-1s instead of a bonded connection. That would cause them to use different IPs/connections, and would normally close the session. That's a remote possibility, but that actually happened to me on one of our projects. -- Ray Hauge Programmer/Systems Administrator American Student Loan Services http://www.americanstudentloan.com 1.800.575.1099 On Tuesday 31 January 2006 04:12 pm, Richard Correia wrote: Which php version and platform? Thanks Rich On 2/1/06, Dave Goodchild [EMAIL PROTECTED] wrote: Hi all - does anyone know why, in certain cases, session variables are lost from the $_SESSION superglobal array? I am writing a session-driven app and for some reason the testing crew lose a certain variable while traversing forms but I cannot replicate the situation myself. Any knowledge of this will be appreciated! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Excell to CSV Date Calculations
Hello all, I have a script that takes a CSV file in as data and does some updates to the DB accordingly. Some of those values are dates. When I save the spreadsheet in Open Office to a CSV file, the dates are saved as the internal date format of Open Office. I need to figure out a way to convert that number into an actual date I know that this might not necessarily be a PHP question, but I was hoping to be able to solve this problem with PHP. I checked, and MS Excel is one day off from Open Office on the internal date values, which throws a huge wrench in my program, since not everyone has Excel here. So, there are two possible solutions to my problem. Find a way to make the date the text it is supposed to represent and save that in the CSV file, or use PHP to calculate the correct date. On a side note, I did figure out a function to be able to handle this in the spreadsheet, but the users will ask questions even if I show them time and time again how to do it. =CONCATENATE(MONTH(D2); /; DAY(D2); /; YEAR(D2)) Just trying to find an easier solution :) Thanks! -- Ray Hauge Programmer/Systems Administrator American Student Loan Services http://www.americanstudentloan.com 1.800.575.1099 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Excell to CSV Date Calculations
On Thursday 02 February 2006 01:38 pm, Ray Hauge wrote: Hello all, I have a script that takes a CSV file in as data and does some updates to the DB accordingly. Some of those values are dates. When I save the spreadsheet in Open Office to a CSV file, the dates are saved as the internal date format of Open Office. I need to figure out a way to convert that number into an actual date I know that this might not necessarily be a PHP question, but I was hoping to be able to solve this problem with PHP. I checked, and MS Excel is one day off from Open Office on the internal date values, which throws a huge wrench in my program, since not everyone has Excel here. So, there are two possible solutions to my problem. Find a way to make the date the text it is supposed to represent and save that in the CSV file, or use PHP to calculate the correct date. On a side note, I did figure out a function to be able to handle this in the spreadsheet, but the users will ask questions even if I show them time and time again how to do it. =CONCATENATE(MONTH(D2); /; DAY(D2); /; YEAR(D2)) Just trying to find an easier solution :) Thanks! -- Ray Hauge Programmer/Systems Administrator American Student Loan Services http://www.americanstudentloan.com 1.800.575.1099 Okay, I finally found the answer to my question after some more searching: date(d.m.Y - H:i:s,(($value - 25569)*86400)-7200); This is for Excel, but is off a day if you are using Open Office. I think that will just have to be documented and people limited to one program, unless anyone can think of a way to distinguish one CSV file from another. -- Ray Hauge Programmer/Systems Administrator American Student Loan Services http://www.americanstudentloan.com 1.800.575.1099 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP4 VS PHP5 Performance
Hello all, I've been poking around a little bit, and I haven't found a good link for showing the performance differences between the two versions of PHP. Mostly I was just curious what the numbers were. I've heard some conflicting opinions on the matter, and wanted to clear it up with some facts. I don't have the time to set up php4 and php5 on identical machines :( Thanks! -- Ray Hauge Programmer/Systems Administrator American Student Loan Services 1.800.575.1099 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Session Locking Up
Hello List, I'm having an intermittent problem where the session locks up for some of my users. When the session locks up, the browser just sits there waiting for a response from the server. It seems to be random, which makes it very difficult to debug. It also seems to happen system wide, and not just on a particular page (a home-made CRM). The server is running Apache 2.x and PHP 4.4.X on RHEL on a quad-processor server with 8 GB RAM. We do an hourly backup that does cause some delays, but the session lockups do not necessarily happen around that time. Could this be caused by the session garbage collection (we use the default PHP sessions), and if it is, what would/could be done to better the situation? Thanks, -- Ray Hauge Programmer/Systems Administrator American Student Loan Services 1.800.575.1099 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Session Locking Up
Hello List, I'm having an intermittent problem where the session locks up for some of my users. When the session locks up, the browser just sits there waiting for a response from the server. It seems to be random, which makes it very difficult to debug. It also seems to happen system wide, and not just on a particular page (a home-made CRM). The server is running Apache 2.x and PHP 4.4.X on RHEL on a quad-processor server with 8 GB RAM. We do an hourly backup that does cause some delays, but the session lockups do not necessarily happen around that time. Could this be caused by the session garbage collection (we use the default PHP sessions), and if it is, what would/could be done to better the situation? Thanks, -- Ray Hauge Programmer/Systems Administrator American Student Loan Services 1.800.575.1099 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] newbie problem
On Monday 20 February 2006 15:32, Robert Voogdgeert wrote: Robert Voogdgeert wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Dear php-users, When working with an HTML file with a form with form action=somename.php method=post the somename.php file is served (completely) to my browser as plain text after the 'submit' button is clicked on my machine (MacOS X). On the external webhost though everything is processed correctly... Is this related to some setting that I should change on my localhost? snip Is your localhost parsing php documents? If you're using Apache, do you have a line like this in you httpd.conf AddType application/x-httpd-php .php -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 [EMAIL PROTECTED] John, My httpd.conf has the following: IfModule mod_php4.c # If php is turned on, we repsect .php and .phps files. AddType application/x-httpd-php .php AddType application/x-httpd-php-source .phps Robert Is the file in one of your home folders, or in a folder that Apache is configured to check? (I've seen that happen from time to time) eg. file in /home/myhome/projects/file.php or file in /var/www/htdocs/file.php Also, was apache restarted after allowing PHP (if applicable) -- Ray Hauge Programmer/Systems Administrator American Student Loan Services http://www.americanstudentloan.com 1.800.575.1099 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Parse Error
Hi all, I am a noob and super confused right now. I have some really simple code and i am getting an error that reads: *Parse error*: syntax error, unexpected T_VARIABLE in */var/www/mysql_up.php* on line here is the code: html headtitleTest MySQL/title/head body !-- mysql_up.php -- ?php $host=localhost $user=ray $password=* mysql_connect($host,$user,$password) ; $sql=show status; $result = mysql_query($sql); if ($result == 0) echo bError . mysql_errno() . : . mysql_error() . /b; else { ? !-- Table That Displays the results -- table border=1 trtdbVariable_name/b/tdtdbValue/b /td/tr ?php for ($i = 0; $i mysql_num_rows($result); $i++) { echo TR; $row_array = mysql_fetch_row($result); for ($j = 0; $j mysql_num_fields(result); $j++) {/ echo TD . $row_array[$j] . /td; } echo /tr; } ? /table ?php } ? /body/html I am really confused because i cannot see any obvious errors. any help would be appreciated. Ray.
Re: [PHP] Parse Error
On Tuesday 21 February 2006 14:27, Ray Cantwell wrote: Hi all, I am a noob and super confused right now. I have some really simple code and i am getting an error that reads: *Parse error*: syntax error, unexpected T_VARIABLE in */var/www/mysql_up.php* on line here is the code: html headtitleTest MySQL/title/head body !-- mysql_up.php -- ?php $host=localhost $user=ray $password=* mysql_connect($host,$user,$password) ; $sql=show status; $result = mysql_query($sql); if ($result == 0) echo bError . mysql_errno() . : . mysql_error() . /b; else { ? !-- Table That Displays the results -- table border=1 trtdbVariable_name/b/tdtdbValue/b /td/tr ?php for ($i = 0; $i mysql_num_rows($result); $i++) { echo TR; $row_array = mysql_fetch_row($result); for ($j = 0; $j mysql_num_fields(result); $j++) {/ echo TD . $row_array[$j] . /td; } echo /tr; } ? /table ?php } ? /body/html I am really confused because i cannot see any obvious errors. any help would be appreciated. Ray. It looks like you need some semi-colons after assigning values to variables at the top of your file. If that's not the problem, let us know what line number this is happening on. It makes it a lot easier to spot the problem ;) -- Ray Hauge Programmer/Systems Administrator American Student Loan Services http://www.americanstudentloan.com 1.800.575.1099 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] CLI utility
Hello again, I was wondering if any of you knew of a good command line utility for php5 on linux? The box i write on has no X-windows. Ray. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] (array)
On Wednesday 22 February 2006 15:09, John Nichel wrote: Jay Paulson wrote: Just came across some code I haven't seen before and can't find anything on php.net or google about it (maybe I'm not searching for the right thing?). What is the following doing? // $dataobject is holding a bunch of variables like: // $dataobject-var1 // $dataobject-var2 // etc... (array)$dataobject; Is this making the $dataobject an associative array like: $dataobject[var1] $dataobject[var2] Or is it doing something different? Yes, I believe it's type-casting the object into an array. Do a print_r ( $dataobject ) on it before and after the casting. -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 [EMAIL PROTECTED] I was curious about this myself, so I took a look at the Types section of the PHP manual, and an array is really a compound type. With that in mind it makes sense that you could typecast to an array. http://www.php.net/manual/en/language.types.php -- Ray Hauge Programmer/Systems Administrator American Student Loan Services http://www.americanstudentloan.com 1.800.575.1099 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] displaying string combinations
hello, I have a bunch of "Banner" strings (ie. $banner1, $banner2, $banner3, $banner4). I have another set of "random" strings that randomly generate a value 1-4 ($RandBanner1, $RandBanner2, $RandBanner3,$RandBanner4). Now I want to display $banner1-4 randomly. I plan on doing this by: print "$banner".$RandBanner1; but that doesnt seem to work...Anyone got any other suggestions? Any help is greatly appricaited. Thanks in advance, Ray -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] suggestions for binary data in database
Hi, I have a site, http://rayh.co.uk which is basically my personal home page and nothing more than a hobby. However, on the site, i am currently storing images in the database, purely because i can. But i wonder, how much will the server load be affected when pulling binary data out of the database? compared to the file system? i assume its going to be quite a lot higher. DO you reckon it would be better to scrap that and store the images on the file system? Ray Hilton -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Sigh :)
Which version of mysql are you using? -- Ray On Wed, 2002-12-04 at 10:33, John Taylor-Johnston wrote: Hi, Can someone take a look at this again, please? http://news.php.net/article.php?group=php.generalarticle=126934 Your posts so far have proven fruitless. Thanks for trying. :) I do appreciate it. I will try to answer everyone at the same time. Someone mentionned it might be a problem with magic_quotes, but I didn't really follow. http://news.php.net/article.php?group=php.generalarticle=126990 I did test what he suggested: From John Holmes try this Doesn't work. :) Thanks. I did try: $sql = SELECT id,AU,ST,BT,AT FROM $table WHERE MATCH (TNum,YR,AU,ST,SD,BT,BC,AT,PL,PR,PG,LG,AUS,KW,GEO,AN,RB,CO) AGAINST ('.$search.' IN BOOLEAN MODE) ORDER BY id asc; It echos: ('\ready maria\' IN BOOLEAN MODE) It should echo: ('ready maria' IN BOOLEAN MODE) for it to work. But even if I add slashquotes, it won't do it. -- could you get the error message with mysql_error() and post it here? There is no error. I wish there was :) Thanks for trying. Doesn't work - Resembles +ready +maria hmm - how do you get your string ready maria? input name=search why '.$table.' and not '.$table.' with what you've got now, I believe you are looking for table name. Good idea. Done that. Doesn't change . :) Thanks. also, use double quotes for start and end of variables as in: $sql=select * from '.$table.' where var='some value other than a number' ; Doesn't work. :) Thanks. John -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Detecing a Number
If you are getting a number from a user via a form you can use javascript to verify that the user inputed a number... search google - validating forms that should give you some info. You could also verify that the data is a number by is_numeric or is_int... I think that when the data is POSTed that it will be a string so you can use is_numberic to verify if it is... http://www.php.net/manual/en/function.is-numeric.php On Wed, 2002-12-04 at 14:01, Stephen wrote: I have a repeating function to add. The user enters the number of how many numbers they want to add, then it repeats a form field. What I want to do is detect to make sure that the value they enter is a number. If not, don't do the do while loop and if it is, then go ahead and do it. How can I do this? Thanks, Stephen Craton http://www.melchior.us What is a dreamer that cannot persevere? -- http://www.melchior.us __ -- 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
Re: [PHP] Looping Addition
What type is $_POST['vars']? I think that it is a string...you might have to convert it to an integer... if( is_numeric( $_POST['vars'] ) ) { $vars = (int)$_POST['vars']; } else { echo Error: \$_POST['vars'] is not an integer.; } On Wed, 2002-12-04 at 14:26, Stephen wrote: Sorry for the uncontrolable emaling to the list but I'm in rather a stump. You may be hearing a lot from me over the next few days too. Anyway, I mentioned before my form with the addition that loops to the number of numbers the user wants to add. Now to the part of the actual addition, how could I loop that out also? Here's what I'm trying to do right now but naturally, it doesn't work: $output = 0; $current = 1; do { $output .= $num.$current + $current++; } while($current = $_POST['vars']); Any help would be great! Thanks! Thanks, Stephen Craton http://www.melchior.us What is a dreamer that cannot persevere? -- http://www.melchior.us __ -- 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
Re: [PHP] # of lines in a file
Might not be the most secure way, but very fast... $lines = `cat file.txt | wc -l` That will give you the number of lines...but again not the best method... On Mon, 2002-12-09 at 09:58, [EMAIL PROTECTED] wrote: Hey guys, I've been searching the manual for a way to grab the number of lines in a file and read a particular line from it, however I found no solution to my problem so I'm wondering if any of you out there could help me :-) - CS -- Ray Hunter email: [EMAIL PROTECTED] www:http://venticon.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Linux and Graphics
What functions do you want to use? You can review the functions in the manual and it will tell you how to configure php with them... On Mon, 2002-12-09 at 13:31, Todd Cary wrote: I am running PHP in a RedHat 7.3 environment and I notice that the graphic functions are not present. Since I am quite new to Linux, I would appreciate it if someone could explain to me what I need to do to have graphic functions. Many thanks. Todd -- Ariste Software, Petaluma, CA 94952 -- Ray Hunter email: [EMAIL PROTECTED] www:http://venticon.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] a simple test script for testing gd
There are some test scripts in the tests directory of the src. However, i do not know if there are any script for the testing of gd functions... On Mon, 2002-12-09 at 13:12, [EMAIL PROTECTED] wrote: Hello list, Anybody here who knows a simple php-script for the puspose of testing gd-related tasks eg like dynamic construction of buttons??? Oliver Etzel -- Ray Hunter email: [EMAIL PROTECTED] www:http://venticon.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Fractions
Just like math...find the greatest common denominator of the numerator and denominator and then divide each (numerator and denominator) by that number... ie: numerator = 8 and denominator = 12 so we have 8/12 then greatest common denominator is 4... so 8/4 = 2 and 12/4 = 3 thus, 8/12 = 2/3 On Mon, 2002-12-09 at 15:55, Stephen wrote: I know for a fact that you're all going to think, What the heck does he want fractions for!? I have a reason...I just won't tell you. :-P My problem is this. I want to simplify a fraction to simplest form but if I divide, I'll get a decimal which I can't use. How could I put it in simplest form without displaying a decimal to the user and if one does come up, a mixed number? Thanks, Stephen Craton http://www.melchior.us What is a dreamer that cannot persevere? -- http://www.melchior.us __ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Ray Hunter email: [EMAIL PROTECTED] www:http://venticon.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Fractions
If there are none in the math functions then you need to create your own or do a search at google to see if anyone has created some functions like that... On Mon, 2002-12-09 at 16:20, Stephen wrote: But how do you find it in PHP? - Original Message - From: Ray Hunter [EMAIL PROTECTED] To: Stephen [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Monday, December 09, 2002 6:12 PM Subject: Re: [PHP] Fractions Just like math...find the greatest common denominator of the numerator and denominator and then divide each (numerator and denominator) by that number... ie: numerator = 8 and denominator = 12 so we have 8/12 then greatest common denominator is 4... so 8/4 = 2 and 12/4 = 3 thus, 8/12 = 2/3 On Mon, 2002-12-09 at 15:55, Stephen wrote: I know for a fact that you're all going to think, What the heck does he want fractions for!? I have a reason...I just won't tell you. :-P My problem is this. I want to simplify a fraction to simplest form but if I divide, I'll get a decimal which I can't use. How could I put it in simplest form without displaying a decimal to the user and if one does come up, a mixed number? Thanks, Stephen Craton http://www.melchior.us What is a dreamer that cannot persevere? -- http://www.melchior.us __ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Ray Hunter email: [EMAIL PROTECTED] www: http://venticon.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Ray Hunter email: [EMAIL PROTECTED] www:http://venticon.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Format a currency values
Look at this function in the manual: number_format() HTH, Ray On Mon, 2002-12-09 at 17:38, Adriano Santos wrote: What should I do in order to view a currency format field? For example: I have a double-type field in my table that receives values in currenct, and I want to show the user the following message: print Your monthly fee is R$50,00 ? thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Know the path
Check out the filesystem functions: http://www.php.net/manual/en/ref.filesystem.php On Tue, 2002-12-10 at 12:05, Christian Ista wrote: Hello, I have a web site with several directories or subdorectories, I'd like to know when I call (include) php page, the path where I'm. Is it possible? Christian, -- Ray Hunter email: [EMAIL PROTECTED] www:http://venticon.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] command line output
try using -q Here is the usage: Usage: php [-q] [-h] [-s [-v] [-i] [-f file] | {file [args...]} -q Quiet-mode. Suppress HTTP Header output. -s Display colour syntax highlighted source. -w Display source with stripped comments and whitespace. -f file Parse file. Implies `-q' -v Version number -C Do not chdir to the script's directory -c path Look for php.ini file in this directory -a Run interactively -d foo[=bar] Define INI entry foo with value 'bar' -e Generate extended information for debugger/profiler -z file Load Zend extension file. -l Syntax check only (lint) -m Show compiled in modules -i PHP information -h This help On Tue, 2002-12-10 at 12:30, Bryan Koschmann - GKT wrote: Hello, I'm trying out a little script run from the command line. It simply outputs a number to send to Cacti. Is there any way to get it to NOT send all the stuff like this: X-Powered-By: PHP/4.2.3 Set-Cookie: PHPSESSID=ec0e2c10c8bd9e0a0ad02cfcc182dbfb; path=/ Expires: Thu, 19 Nov 1981 08:52:00 GMT Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 Pragma: no-cache Content-type: text/html 168 (the 168 is my outputted number) Thanks, Bryan -- Ray Hunter email: [EMAIL PROTECTED] www:http://venticon.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] XML Data push
You want the receiving page to be php that makes an xml page that is then pushed to be a processing page back to the user? I think some more detail might be needed... On Tue, 2002-12-10 at 12:35, Chris Boget wrote: I'm looking into doing something like the following: [best viewed w/fixed width font] User Request User Interface | ^ \/ | Receiving Page -- XML Data push -- Processing Page where the Receiving page is a controller and pushes data (as XML) to a processing page. What I'm not sure of is how I can push the data. I'd rather not use sessions and the data would be too large to pass as a get. I've looked at CURL but unless I'm missing something, I'm not sure that's what I need. I'm curious if someone can point me in the right direction? I don't need to know _exactly_ how to do this. In fact, I'd rather figure it out on my own. But as I'm not even sure where to start looking, coming up with that answer is much more difficult. So if any of you know where I can start looking to learn how I can do this, I'd be ever so appreciative! thnx, Chris -- Ray Hunter email: [EMAIL PROTECTED] www:http://venticon.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] XML Data push
Why do you want to push it to another file...why not do all the processing in one php file that calls many functions then passes that data back to the user. if you still want to pass data then you can do this... controller.php push xml data to a table that has id and xml fields...then redirect the user to process_news.php with the id like process_news.php?id=123 then in process_news.php you use the id to pull the xml data out of the database. However, this is still going to eat up resources on the server... Another alternative that i have been looking into for this is like so: have php file create, process and save xml filethen you can use cocoon to allow the user to view the xml file... (check phpbuilder on this one)... On Tue, 2002-12-10 at 12:58, Chris Boget wrote: You want the receiving page to be php that makes an xml page that is then pushed to be a processing page back to the user? I think some more detail might be needed... No, sorry if I wasn't clear. The processing page is a PHP script on the back end as well. The XML data being pushed to it would include specification as to what action(s) the processing page would take. A crude example would be something like the following. User clicks on a link for Current News. The URL for which is: www.domain.com/controller.php?request=CurrentNews controller.php would then push the following XML to process_news.php (yes, I know it's not well formed. just trying to show a quick example) newsitem actiondisplay/action range_start-7 days/range_start range_end0 days/range_end topicCurrent/topic /newsitem process_news.php would take that information, process it and spit out the relevant data to the user. Another possibility would be when an administrator wants to add a new News item. The form script would push something like the following to process_news.php: newsitem actioninsert/action headlineExtra!/headline newsbodyNewsBody/newsbody publishdateToday/publishdate /newsitem and it would take that information, process it and add the new record to the DB. That's basically what I'm trying to do. Chris -- Ray Hunter email: [EMAIL PROTECTED] www:http://venticon.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP question
Are PHP script supposed to run as the user or as the web server? Currently I'm running Red Hat 7.3 with apache 1.3.x and all my PHP scripts run as apache, not as the user. I'm wonder if I can run the scripts as the user and how do I fix this? Any help would be great! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How can I redirect to another php page
You could use an include statement in one of two ways. 1) you can just include the page that you want to show, however the url doesn't change it will still be select.php 2) if you want to sent them to yellow.php or green.php you could include an html page that had a meta-refresh in it set for 0 seconds to move them to the seperate pages. -Original Message- From: Teo Petralia [EMAIL PROTECTED] To: [EMAIL PROTECTED] Date: Thu, 9 Jan 2003 09:46:30 +1300 Subject: [PHP] How can I redirect to another php page Hi All! I would like to redirect the user to another php page accordingly to his/her chosen options, example: if ($Color == Yellow) { go to page else if ($Color == Green) go to page } Does anyone knows how to achieve the goal?? Thanks Teo -- 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
Re: [PHP] Newbee observation
Mail servers play a part in this too. Maybe the admins should pack up their servers and send them back too :) -Original Message- From: Hendrik van Niekerk [EMAIL PROTECTED] To: [EMAIL PROTECTED] Date: Thu, 9 Jan 2003 11:11:30 -0600 Subject: [PHP] Newbee observation Why does the webmaster not reject messages that are dates today's date eq there are numerous messages that have dates with year 2010 and up. A moron who does not have the correct computer date on his machine should pack it up and send it back to the company that sold it to them. JMHO -- 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
Re: [PHP] PostgreSQL/PHP: transactions: how-to abstract out?
Jean-Christian If you are only doing an insert then you do not need the transactions BEGIN and COMMIT because that is already done for you on a single insert. PGSQL is transaction based so if it does not go then it will not work. -Ray On Thu, 2003-01-09 at 22:23, Jean-Christian Imbeault wrote: Jason Sheets wrote: Manual Excerpt: If a second call is made to pg_connect() with the same connection_string, no new connection will be established, but instead, the connection resource of the already opened connection will be returned. You can have multiple connections to the same database if you use different connection string. You're right! I did some more testing and the problem is with my testing code. I don't know why but the following code times out *but*, PHP throws an error saying the code has timed out *but* calling connection_status() says the code did *not* time out! Any idea why connection_status() returns 0 when it should return 2?? My code: set_time_limit(2); echo set execution limit to 2 seconds BR; register_shutdown_function(timed_out); require_once(db_functions/sql_query.inc); $sql = BEGIN;; $res = sql_query($sql); $sql = insert into test(test) values('testing 4');; $res = sql_query($sql); //This will cause the script to time out $i = 0; while(true) {$i++;} $sql = COMMIT;; $res = sql_query($sql); function timed_out() { $status = connection_status(); if ($status == 2) { echo the script timed out BR; } else echo no time out. Connection status is $status BR; } The OUPUT: set execution limit to 2 seconds Fatal error: Maximum execution time of 2 seconds exceeded in /www/htdocs/jc/shut.php on line 16 no time out. Connection status is 0 Jc -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PostgreSQL/PHP: transactions: how-to abstract out?
You could try leaving off the ;... Try $sql = BEGIN Try $sql = COMMIT That should work... On Thu, 2003-01-09 at 22:23, Jean-Christian Imbeault wrote: Jason Sheets wrote: Manual Excerpt: If a second call is made to pg_connect() with the same connection_string, no new connection will be established, but instead, the connection resource of the already opened connection will be returned. You can have multiple connections to the same database if you use different connection string. You're right! I did some more testing and the problem is with my testing code. I don't know why but the following code times out *but*, PHP throws an error saying the code has timed out *but* calling connection_status() says the code did *not* time out! Any idea why connection_status() returns 0 when it should return 2?? My code: set_time_limit(2); echo set execution limit to 2 seconds BR; register_shutdown_function(timed_out); require_once(db_functions/sql_query.inc); $sql = BEGIN;; $res = sql_query($sql); $sql = insert into test(test) values('testing 4');; $res = sql_query($sql); //This will cause the script to time out $i = 0; while(true) {$i++;} $sql = COMMIT;; $res = sql_query($sql); function timed_out() { $status = connection_status(); if ($status == 2) { echo the script timed out BR; } else echo no time out. Connection status is $status BR; } The OUPUT: set execution limit to 2 seconds Fatal error: Maximum execution time of 2 seconds exceeded in /www/htdocs/jc/shut.php on line 16 no time out. Connection status is 0 Jc -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] DSO or static Module?
phpinfo() You can review the configuration command and in there view the command for apache... static = --with-apache=../apache_1.3.27 dso = --with-apxs=/path/to/apxs that should help you out or get you started...you can also verify in apache which module are built-in... On Wed, 2003-01-15 at 11:08, Lic. Carlos A. Triana Torres wrote: Hi all, Here is a question that might be too simple to be asked, but I need to know the answer: Is there a way to find out if PHP is compiled as a DSO or as a static module? Thanx -- Ray Hunter email: [EMAIL PROTECTED] www:http://venticon.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] please help
On Sun, 2003-01-19 at 12:57, JamsterJAM wrote: Hi, I have a problem. I have created a guestbook for my server and i have php installed. You enter deatils and the guestbook stores it in guestbook.dat.php file. The guestbook itself is also a php file. I have tryed it on other hosts and it has worked. When i run it on my server it doesnt store the data i have inputted and show it on the guestbook. This might be a bit confusing but if you could help me or forward it to someone who can help me i would be much abliged. JAM We probably need more info to get to the real problem. However, you are probably having a problem with the the webserver (php) writing to the file. Make sure that the webserver has permission to write to the file. -- Ray Hunter email: [EMAIL PROTECTED] www:http://venticon.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Job Opportunity
I apologize everyone...evolution is going crazy... Ray -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] mysql_connect error
Can someone please tell me why I'm getting this error: *Fatal error*: Call to undefined function: mysql_connect() in */webs/tom/www.bohabcentral.com/www/bohabs/auth.php* on line *4 *mysql_connect was working a week or so ago, and I haven't made any changes to the servers configuration. If someone could point me in the right direction I would love to get this function running again. TIA -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] mysql_connect problem..update
It turns out after some checking, the other admin on the machine ran a kernel update last week. I hadn't been testing any scripts over the last week myself so I didn't notice the issue until the other day. When I run a function_exists() for mysql_connect it comes back false. When I run phpinfo() there is no reference to mysql at all. I'm still kind of new to all this, and I'm just wondering what I need to do to get php and mysql talking again. Is there a service or command I can run to get things going again? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mysql_connect problem..update
Thanks, we're going to give that a try. -Original Message- From: Tracy Finifter Rotton [EMAIL PROTECTED] To: Tom Ray [EMAIL PROTECTED], [EMAIL PROTECTED] Date: Tue, 21 Jan 2003 10:25:55 -0800 Subject: Re: [PHP] mysql_connect problem..update Talk to the other admin. If you're using RPMs, you just need to install the php_mysql RPM, restart apache, and you should be up and running again. If you're compiling PHP from scratch, you'll have to do so again with --with-mysql in the configure command. But, as this is the default when compiling PHP from scratch, my hunch is the first option is what you really need. -- t On 1/21/03 10:01 AM, Tom Ray [EMAIL PROTECTED] wrote: It turns out after some checking, the other admin on the machine ran a kernel update last week. I hadn't been testing any scripts over the last week myself so I didn't notice the issue until the other day. When I run a function_exists() for mysql_connect it comes back false. When I run phpinfo() there is no reference to mysql at all. I'm still kind of new to all this, and I'm just wondering what I need to do to get php and mysql talking again. Is there a service or command I can run to get things going again? -- Tracy F. Rotton [EMAIL PROTECTED] http://www.taupecat.com/ ... I like the 49ers because they're pure of heart, Seattle because they've got something to prove, and the Raiders because they always cheat. -- Lisa Simpson, Lisa the Greek -- 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
Re: [PHP] Simple E-mail Question
you would put that in the $mailheaders variable. Something like $mailheaders = From: Joe Bloe [EMAIL PROTECTED]\r\n; $mailheaders .= Cc: Some Dude [EMAIL PROTECTED]\r\n; $mailheaders .= Bcc: Some Other Guy [EMAIL PROTECTED]\r\n; That should work for you. Just do this for whatever other headers you want to add to the mail -Original Message- From: Scott Saraniero [EMAIL PROTECTED] To: [EMAIL PROTECTED] Date: Wed, 22 Jan 2003 09:47:52 -0500 Subject: [PHP] Simple E-mail Question Hi, I'm using this line to send an e-mail with info: mail([EMAIL PROTECTED], $Event Ticket Form, $msg, $mailheaders); If I want to add mail recipients, or cc, or bcc, how would I do this? Thanks, Scott -- 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
Re: [PHP] AD authentication
Yes, I have used php-ldap to connect to exchange for authentication... -- Ray On Thu, 2003-01-23 at 17:52, Michael Hall wrote: -- I was wondering if anyone had any experience, suggestions, advice or pointers regarding the use of Win 2000 Active Directory servers to authenticate users in PHP scripts hosted on Linux. Are PHP's LDAP functions of use here? TIA Mick MICHAEL HALL Web Development Officer Batchelor Institute of Indigenous Tertiary Education W: [EMAIL PROTECTED](08) 8951 8352 H: [EMAIL PROTECTED](08) 8953 1442 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP vs. Perl/Mason
Everyone, I was wondering if there are any perl/php programmers that have used mason. I am trying to get the advantages/disadvantages of each? I am pro PHP, but my does is pro perl. What does everyone think about the benefits of one over the other? Thanks, Ray signature.asc Description: This is a digitally signed message part
Re: [PHP] Found a PHP bug!!!!!!!!!
U might want to do a type cast to integer from string... http://www.php.net/manual/en/language.types.type-juggling.php On Mon, 2003-01-27 at 13:47, Scott Fletcher wrote: I would need to use intval() to solve this problem Scott Fletcher [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... I'm referring to '08' and '09' that don't work Chris Shiflett [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... --- Scott Fletcher [EMAIL PROTECTED] wrote: Found a PHP bug ... if ($month == 01) I guess you mean: if ($month == '01') If so, this is not a bug. Otherwise, please explain what you think is wrong. Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Link acting as a submit button
(this is in a file called index.html) A href=javascript:go_where_my_variable_says('this.php');this page/a try this a href=javascript: go_where_my_variable_says('?php echo $PHP_SELF;?');this page/a -- BigDog -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] cms design xml-php ?
Is there any php book that discusses general design issues for cms's and webservices in php? I have not seen one dedicated to general design issues for cms' as web services in php. However, there are many great books on general design issues. Relating to various languages that can be done also in php. Those might be worth a look at. Also, what is your take on xml? Is it worthwhile waiting for v5 to be released before buying a xml-php book? There are some books that deal with xml + php that are fairly decent. However, I personally find that it is easier to separate the 2. For example, I have a great xml book and the php manual. The one thing that i notice is that when you combine the 2 then you end up missing somethings out of both. -- BigDog -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Link acting as a submit button
On Fri, 2003-07-25 at 05:30, Matt Palermo wrote: I just remembered (I'm not sure if it makes a difference) that I am using frames on this page. Does this matter at all? Thanks. Yes it matters tons with the javascript call. Here is some info on it...however, these questions are now javascript and not php... 1. make sure you pass in a valid page to your function. 2. make sure that you have a form that you are accessing. 3. make sure that when you access the form you are accessing the correct frame page. Example: when you set up the frames use the name attribute to assign names to the frames... so if you have a frame named frame1...then you can do this... frame1.document.forms[0].action.value = where; frame1.document.forms[0].submit; I might be off on this a little but that should get you started in the right direction. -- BigDog -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Freeze Pane
You could use frames for it and then set the scrolling on specific frames. -- BigDog On Fri, 2003-07-25 at 09:49, Jason Martyn wrote: This is probably under the category of javascript, however I would like ot know if it is possible to be done with php. Let's say I have a table that is 30 columns wide and so the entire table doesn't fit on the screen. Is it possible (with php) to freeze columns while scrolling across so you don't lose the original 2 columns? And since it probably isn't, can someone suggest a language that would cover this subject? Thanks, Jay -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Link acting as a submit button
Why do you have a submit button and a link to submit the form. Dont u want them to use the submit button for the form? -- BigDog On Fri, 2003-07-25 at 09:02, Jay Blanchard wrote: [snip] I found out that it works fine without the submit button that I had in there. When I take the submit button out, it works, if I put it back in there I get the error message again. Any ideas? [/snip] Are you naming the submit buttons? Not just value, but id or name? You must keep them seperate. HTH! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Link acting as a submit button
Good point...thanks for catching that I usually link into forms from other frames if I dont have a submit button in that form. -- BigDog On Fri, 2003-07-25 at 15:49, Comex wrote: [EMAIL PROTECTED] Ray Hunter: On Fri, 2003-07-25 at 05:30, Matt Palermo wrote: I just remembered (I'm not sure if it makes a difference) that I am using frames on this page. Does this matter at all? Thanks. Yes it matters tons with the javascript call. Here is some info on it...however, these questions are now javascript and not php... That's only if you're going between frames, if the whole form (as usual) is on one frame it works fine. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] The return of mysql_fetch_assoc()
$fooVar = mysql_fetch_assoc($result)[barColumn]; No bug here...mysql_fetch_assoc($result) is a function that takes a result set as an argument and returns only one row as an associated array...that is why you need to do $record = mysql_fetch_assoc($result); $fooVar = $record[barColumn]; That is logic when it comes from the database...database results are returned as rows with various column(s). This allows you to go through each row and pull out all the columns for that row. HTH, BigDog -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] xml and php
Make sure that you have all the dlls that are needed for php+dom. these dlls need to be in your windows path as well. Uncomment the dll in your php.ini file and restart the webserver. View a php page with phpinfo() as the only function in that page: ?php phpinfo(); ? See if you have dom in there. If not then follow the above steps again. If you dont have the dll then you will need to download the zip file from php.net. Now that you have dom you can load in xml files as dom objects and manipulate the object with the dom functions. -- BigDog On Thu, 2003-07-31 at 06:54, Steff wrote: Hello I'm a beginner in php. Sorry to disturb you but I have two problems and I hope you can help me. I use php 4.3.2(InetPub\Php is my php directory) under windows 2000 server with IIS 5.0. I want to manipulate xml file with Php (add some element, modify some element, delete some element and consult some element) but when I try domxml_open_file I obtain system error : Call to undefined function: domxml_open_file() I heard about use --with-dom but I don't see how and about php/win32 directory which I don't see. Can you help me ? Thanks Cordially Vauclaire Stéphane http://www.c-comnet.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] standardize @throws for phpdocumentor 2.0?
@throws constant|classname [description] I like that and the ability to link. -- BigDog -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Command line php....
Technically, yes it should however, I think this is a bug...are you running php 5b? -- BigDog - Original Message - From: John Nichel [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, August 05, 2003 9:07 PM Subject: [PHP] Command line php Can someone tell me why php waits for me to input something before it prints out the first line of the code below? Shouldn't it echo out the first line then wait for my input? #!/usr/local/bin/php ?php echo ( Enter MySQL admin username : [root] ); $username = rtrim ( fgets ( STDIN ) ); echo ( \n\n\nThe username is . $username . \n\n ); ? -- 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
Re: [PHP] Can't change include_path in php.ini
When you uncomment out the include_path in the php.ini file i believe that php still has an internal one that it falls back on. After you set a new include_path in php.ini do you restart apache and then check phpinfo() to see what the include_path is? -- BigDog On Fri, 2003-08-08 at 17:03, Machiste' N. Quintana wrote: Hi. I want to change the include_path of the php.ini. I tried uncommenting it, and changing the path, but everytime I use phpinfo() to check if it changed, it displays this as the include_path: .;c:\php4\pear And when it loads, it loads then reloads and reloads and etc. to give the effect of it blinking. What is going on? I have PHP 4.3.2, Apache 2.0.47, and MySQL 4.0.14 running on Windows XP Professional. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] global scope issue
/dir1/script1.php ?php include(/dir1/script2.php); print_r($test); //works great print_r($GLOBALS['test']); //does not work ? Works fine for me when I have the include as include( 'script2.php' ); Make sure that the include is correct...I figure that you dont have dir1 off of the root directory. -- BigDog -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Config files
I tend do do something similar here: I usually set up my arrays and then access them later using the GLOBALS superglobal array. For some projects I tend to use multidimensional arrays because I can do something like. $config['db']['name'] = 'something'; $config['db']['user'] = 'someone'; $config['db']['pass'] = 'password'; ... This can sometimes be an over kill, however that could work for you. -- BigDog On Wed, 2003-08-13 at 08:19, CPT John W. Holmes wrote: From: Hardik Doshi [EMAIL PROTECTED] I have following options for working with the configuration files with the relatively large web application. 1. Configuration variables using the DEFINE. 2. Array - Each configuration variable as an array element. 3. PHP.INI like config files. A combination of #3 and #2. Store the data in a php.ini-style config file and use parse_ini_file() to read it into an array. You could even merge the array into the $_SERVER (or any other superglobal) array so that your config vars are available in functions without having to make anything global. ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] dbx
Not sure i understand fully the question...however, you can set up your own error handling and that will allow you to do what you like with all errors. You can also trigger your own errors (however, this is limited to a certain type). http://us2.php.net/manual/en/ref.errorfunc.php -- BigDog On Mon, 2003-08-11 at 18:24, [EMAIL PROTECTED] wrote: hi there , i am interested to know more about dbx, especially the error handling $link = dbx_connect(DBX_MYSQL, localhost, db, username, password) or die (Could not connect); is there such an error feature where it can die to the screen with a custom error message instead of doing the error checking for every single query and connection ? and there is also no example of how to get a list of results like while ($row = $result-fetchRow()) { } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] This is getting ridiculous
Can we move this off list...many of us dont have time to mill through this...we are here to help. Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] functions/methods and what they should return
Each product that is in the database can have at least one attribute to it (i.e. color, size, etc.). Right now I've got a method in my Products class called ShowAttributes($id). This method, based on the ID passed to it, will query the db and ultimately return a string that makes up the drop down box for a form. Am I better off doing this sort of thing in a function or having the function only return the records I need and let the calling page handle the display of the records? I usually allow the function get only what i need, thus making it as simple as i possibly can. If you are using it as a drop down function for a form then i would get the data form a generic source and populate it with that information (i.e. i use arrays that hold data for forms, and query the database to find out which item in the dropdown should be selected. So in short: 1. Have a function return only what you need (meaning that it should be in the right format for you.) 2. Have the display page handle all the dropdown logic. -- BigDog -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] functions/methods and what they should return
function GetAttributes($id) { // query db // get records // return record array } function BuildAttributes($id) { $attributes = GetAttributes($id); // format $attributes // return HTML string } That is a good way...you have the functions only doing what they need to do. Thus splitting up some of the logic and presentation. In the GetAttributes function you could do any filtering...but mainly you dont want to do any presentation because u can now reuse that function other places. -- BigDog -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] I wish I knew more about multi-dimensional arrays
mysql result as a multi-dimensional array: while( $row = mysql_fetch_array($result) ) { $rows[] = $row; } now you have a multi-dimensional array that contains each row in rows... examples: row 1 col 1 - $rows[0][0] row 3 col 2 - $rows[3][2] hth -- bigdog On Fri, 2003-08-22 at 10:37, Verdon vaillancourt wrote: Hi, please don't chuckle (too loudly) at my attempts to learn ;) I'm trying to create what I think would be a multi-dimensional array from a mysql result set, to use in some example code I got off this list last week. The example renedring code I want to work with is... ?php $data = array('A', 'B', 'C', 'D', 'E', 'F', 'G'); $rowlength = 3; echo (table); for ($i = 0; $i sizeof ($data); $i += $rowlength) { echo (tr); for ($j = 0; $j $rowlength; $j++) { if (isset ($data[$i+$j])) { echo (td{$data[$i+$j]}/td); } else { echo (tdnbsp;/td); } } echo (/tr); } echo (/table); ? I trying to create the $data array from my query results like this... $sql = select * from table limit 0,5; $result = mysql_query ($sql); $number = mysql_numrows ($result); for ($x = 0; $x sizeof (mysql_fetch_array($result)); $x ++) { $data = implode (',',$result[$x]); } I had hoped this would get me the six arrays on the page (where I could then extract the values). I've also tried a number of similar approaches but am consistently getting six error messages on the page along the lines of Warning : implode() [ function.implode ]: Bad arguments. in I know I'm missing something basic and would appreciate any pointers. Thanks, Verdon -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] how to do this
Sessions, cookies or thru the get request -- BigDog On Sat, 2003-08-23 at 02:21, macromaniac wrote: well, i have to php pages and i want to send one argument from one to another. I tried a few things but I couldn't do it. is there a special way to do it? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] user-defined superglobals?
you can define your own superglobals by defining the vars first then accessing them thru the $GLOBALS var. example: ?php // file1.php $var1 = test1\n; $var2 = test2\n; ? ?php // file2.php include( 'file1.php' ); function test() { echo $GLOBALS['var1']; echo $GLOBALS['var2']; echo Test\n } test(); ? That should get you started with globals. -- BigDog On Sat, 2003-08-23 at 11:45, Matthias Nothhaft wrote: Hi List, is there a way (mybe in php5?) to define/declare a global var as a superglobal, so that I can use this var like the known superglobals ($_GET, $_SESSION, etc.) ??? If not, is there a list for feature requests? Regards, Matthias -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] finding out localhost :-P
Make sure that the user that you are connecting with has permissions to connect to mysql from that computer. You can check the user table in the mysql database to see the user and their associated permissions. I would suggest checking out mysql.com for additional information. -- BigDog On Sat, 2003-08-23 at 22:00, Pag wrote: Heres the problem. I have one of my client's site hosted on a crappy server, and i have it running with php+mysql ok, the thing is i need to connect to that site's mysql's database from a different site to get data. The problem is that on the origin site (the crappy server), to connect to the database, i use localhost. How can i find out the real server to connect to from the other site? I tried using the whole domain, like www.crappyserver.com, but doesnt work. :-P Thanks. Pag -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Interview questions
Everyone has given some great information. I have some ideas i would like to throw into the mix too. Here are some topics: 1. Questions regarding HTTP protocols. (SSL) 2. Questions regarding the server that you will be deploying on. If you are deploying to apache or iis they should be familiar. 3. MySQL questions. (setup, maintenance, sql, optimization) There are many ways to do this and they should give you some answer. 4. Also questions regarding development platform. Do they know how to work on the platform. I dont know how man people i have seen that develop on windows and deploy to linux and have no idea how to debug on linux. 5. Questions regarding development practices. - Coding standards - Design procedures and policies they have used. - Source code control: Cvs, Visual Source safe, etc. - Development life cycle. 6. What other techniologies do they know. Can these be utilized. Hope that gives you some more to think about. -- Ray -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP and Apache
Hi After installing Apache then PHP, i was told by php that apache wasnt configured, so i followed the instructions in the install.txt file. But everytime i view the files through the local host but i only see the written code, So how do i get this to work, assuming that Apache isnt giving the details to php to decode. I am using Win XP Apache 1.3.23 MYSQL 3.23.49 PHP 4.1.1 any ideas on how i can solve this and do you need any more info? Thanks Ray Mordy I.T CTC PLUS www.Ctcplus.com [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Installing PHP with MySQL RPM version
In the configure line --with-mysql=/path/to/mysql were is the path for RPM versions of MySQL. I have search the computer but it looks like the mysql files are all over the place. Database files are in /var/lib/mysql BIN files are in /usr/bin/, etc... use --with-mysql or --with-mysql-sock example: ./configure --with-mysql ./configure --with-mysql-sock=/var/lib/mysql/mysql.sock hth -- BigDog -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Installing PHP with MySQL RPM version
mark, from what i understand of the configuration script it will go out and look in various locations for the mysql libraries. If you want to specify something then I would suggest using the --with-mysql-sock and pass the socket file. I like to use the socket file and have always had great success with it even for mysql 4.0 -- BigDog On Tue, 2003-09-09 at 12:59, Mark McCulligh wrote: Thanks, If you just use --with-mysql it will use PHP's built-in mysql client lib 3.23.49, but I have MySQL 4.0.14 installed. Won't this make a difference. I want to make sure PHP is compiled this the right libraries for MySQL. Mark. Ray Hunter [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] In the configure line --with-mysql=/path/to/mysql were is the path for RPM versions of MySQL. I have search the computer but it looks like the mysql files are all over the place. Database files are in /var/lib/mysql BIN files are in /usr/bin/, etc... use --with-mysql or --with-mysql-sock example: ./configure --with-mysql ./configure --with-mysql-sock=/var/lib/mysql/mysql.sock hth -- BigDog -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Shopping Cart Solutions
Anyone have suggestions for open source shopping cart apps in PHP? Check out sourceforge.net...there are many there. Also try google and you will get tons of info. -- Ray -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] speaking of php editors
Check out vim or emacs... -- BigDog On Mon, 2003-09-22 at 17:41, Chris W. Parker wrote: Hey everyone. I am looking for an editor that will highlight the string {$array['index']['index']} within a string. For example: +- gray + | | | +-- red ---+ | | | | | $variable = The amount is {$amount[0]}.; Is there anything out there that does this? Thanks, Chris. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Editor - which to use?
PHP eclipse is also nice, you need eclipse from http://www.eclipse.org and then you install the PHP Eclipse module http://phpeclipse.sourceforge.net. Very easy to install, I am a big fan of Komodo, I also like Vim, Kate and Eclipse. I tried Zend Studio 1 and 2 but it didn't live up to the expectations that I had for the price. Eclipse offers tons of additional plugins and if you like java you can surely write your own php plugins too. There are many great db plugins that i use too. -- BigDog -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Calling PHP shell scripts with exec from within PHP goes awry?
On Mon, 2003-09-22 at 19:50, uvm wrote: I'm beggining to develop the theory that things go awry when using exec from within a webserver-executed PHP script to call a shell script itself written in PHP. Why are you trying to call a php script with exec...since it is php why not just call it directly instead of creating a process outside of the php you are in and then creating a php cgi to do the processing. It is easier to call parse the file with the php process that you are currently in. -- bigdog -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] TAR Error - 'Invalid block size'
I use the TAR.php file for extract tar.gz file. The tar file extracted fine, but the tar class raises the 'Invalid block size 351'. Why? And how can I discard this error. Basically, tar writes in block sizes of 512 bytes so you are receiving an invalid block size smaller than 512 which has a size of 351. Not sure how you can suppress these messages via TAR.php. However, if you get a new tar files that has the blocking correct you will not receive that error. -- BigDog -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] TAR Error - 'Invalid block size'
I use the TAR.php file for extract tar.gz file. The tar file extracted fine, but the tar class raises the 'Invalid block size 351'. Why? And how can I discard this error. Basically, tar writes in block sizes of 512 bytes so you are receiving an invalid block size smaller than 512 which has a size of 351. Not sure how you can suppress these messages via TAR.php. However, if you get a new tar files that has the blocking correct you will not receive that error. You might be able to use the -B option to tar to suppress the block size error. However, I have not tested that out before and I am not 100% sure of the results that you will see. But possibly an option. example: tar -xvfB file.tar -- BigDog -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Test Links...
Ive used curl to test stuff out with too...however, if on link i like to use wget to test it out. You might not have that option but I have seen others use fopen or file_get_contents. HTH, BigDog On Fri, 2003-09-26 at 10:15, Doug Coning wrote: Greetings All, I am creating a 'links' page and was wondering if there was a way in PHP to test the response of an outside link? I'm sure everyone here has clicked on a links page link and have a No Page Found error because no one is keeping the links uptodate. I was wondering if there was a way when a link was clicked to test the link first to see if it is still active. If it isn't active, I would like to remove the link from my database. Is there a command that tests the results of link? Thanks, Doug Coning American Web Studio http://www.americanwebstudio.com HTML / FLASH / PHP / MYSQL / FILEMAKER -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Test Links...
lol...if on linux... On Fri, 2003-09-26 at 12:35, Ray Hunter wrote: Ive used curl to test stuff out with too...however, if on link i like to use wget to test it out. You might not have that option but I have seen others use fopen or file_get_contents. HTH, BigDog On Fri, 2003-09-26 at 10:15, Doug Coning wrote: Greetings All, I am creating a 'links' page and was wondering if there was a way in PHP to test the response of an outside link? I'm sure everyone here has clicked on a links page link and have a No Page Found error because no one is keeping the links uptodate. I was wondering if there was a way when a link was clicked to test the link first to see if it is still active. If it isn't active, I would like to remove the link from my database. Is there a command that tests the results of link? Thanks, Doug Coning American Web Studio http://www.americanwebstudio.com HTML / FLASH / PHP / MYSQL / FILEMAKER -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php xvfb gives xauth command not found
$test=exec(/usr/bin/xvfb-run /usr/bin/njplot -psonly testfile 21); echo $test; Try $test=exec(/usr/bin/xvfb-run /usr/bin/njplot -psonly testfile ); -- BigDog -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php xvfb gives xauth command not found
$test=exec(/usr/bin/xvfb-run /usr/bin/njplot -psonly testfile ); Actually, I think that you can just run the command without the xvfb-run command... $test = exec(/usr/bin/njplot -psonly testfile ); that should just create the testfile.ps file and not fire up a x-window. The error with the xvfb-run is that the command cannot find the xauth command that it needs to set up the x server environment. Try the above one and see if that works for you...if not then install xauth and revert to running it in xvfb-run. -- BigDog -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP OOP x Procedural Performance
yes, the bottom line is code reuse...that is why there is oop. So that a developer can always reuse code saving money on development and thus if speed is an issue then adding more hardware. -- Ray On Wed, 2003-05-28 at 20:05, William N. Zanatta wrote: It is a known issue that function calls are expensive for the processor. The OOP let us better organize the code but, thinking in function (or method) calls it may be more expensive than in the procedural form. My question is, has anyone made any tests regarding the performance of OOP versus procedural language? Is it a good choice to code in OOP with PHP ? -=[ William N. Zanatta ]==[ [EMAIL PROTECTED] ]=- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] apache mod_php memory leak, need help.
Hello, I hope someone can help me or point me in a good direction. I have a database driven website, all ODBC to postgresql, that little by little eats up resources on apache. The child processes will start off at 30Mb of virtual memory and run up around 230Mb each child. (see below ps output) before they start dying. It does not even take 700 accesses per child to max out memory. I then start getting funny errors like access denied to file or could not open socket, or file not found. I read all to documentation and as far as I know, php should release any defined query resources once the script executes. I already code with odbc_close($conn); on all my pages. It is not feasible to use odbc_free_result() on every query, due to the complexity of scripts, but the documentation for odbc_free_result says you shouldn't have to. That is the only thing that I can think of that could be draining this much resources. Is there any good way to find out what is eating up the memory. Anyone else run into this. I'm running apache 1.3.27 with php 4.3.2 (happened in version 4.3.1 also) on mac OSX SERVER 10.2.4 Thanks in advance, Ray A. PS OUTPUT --- root 468 0.0 0.330992 2152 ?? Ss4Jun03 1:30.04 /usr/sbin/httpd www 1743 0.0 1.2 222600 10032 ?? S 8:00AM 2:16.31 /usr/sbin/httpd www 1767 0.0 1.1 220560 9592 ?? S 8:01AM 1:58.56 /usr/sbin/httpd www 1806 0.0 1.1 215800 9588 ?? S 8:13AM 1:46.92 /usr/sbin/httpd www 1876 0.0 1.1 210360 9532 ?? S 8:44AM 1:56.10 /usr/sbin/httpd www 1878 0.0 1.3 224304 10904 ?? S 8:44AM 2:13.93 /usr/sbin/httpd www 1879 0.0 1.2 219880 9912 ?? S 8:44AM 2:10.85 /usr/sbin/httpd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] apache mod_php memory leak, need help.
Just another note, it seems that for every page access, there is exactly 680k of memory that accumulates. Any php developer know of any odbc function that takes up 680k of overhead that might not be getting cleaned up? Thanks, Ray A. Hello, I hope someone can help me or point me in a good direction. I have a database driven website, all ODBC to postgresql, that little by little eats up resources on apache. The child processes will start off at 30Mb of virtual memory and run up around 230Mb each child. (see below ps output) before they start dying. It does not even take 700 accesses per child to max out memory. I then start getting funny errors like access denied to file or could not open socket, or file not found. I read all to documentation and as far as I know, php should release any defined query resources once the script executes. I already code with odbc_close($conn); on all my pages. It is not feasible to use odbc_free_result() on every query, due to the complexity of scripts, but the documentation for odbc_free_result says you shouldn't have to. That is the only thing that I can think of that could be draining this much resources. Is there any good way to find out what is eating up the memory. Anyone else run into this. I'm running apache 1.3.27 with php 4.3.2 (happened in version 4.3.1 also) on mac OSX SERVER 10.2.4 Thanks in advance, Ray A. PS OUTPUT --- root 468 0.0 0.330992 2152 ?? Ss4Jun03 1:30.04 /usr/sbin/httpd www 1743 0.0 1.2 222600 10032 ?? S 8:00AM 2:16.31 /usr/sbin/httpd www 1767 0.0 1.1 220560 9592 ?? S 8:01AM 1:58.56 /usr/sbin/httpd www 1806 0.0 1.1 215800 9588 ?? S 8:13AM 1:46.92 /usr/sbin/httpd www 1876 0.0 1.1 210360 9532 ?? S 8:44AM 1:56.10 /usr/sbin/httpd www 1878 0.0 1.3 224304 10904 ?? S 8:44AM 2:13.93 /usr/sbin/httpd www 1879 0.0 1.2 219880 9912 ?? S 8:44AM 2:10.85 /usr/sbin/httpd -- 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
Re: [PHP] Sybase and PHP
U just need the sybase client on the linux machine and the file that contains your TNS names... -- BigDog On Wed, 2003-06-25 at 23:26, Michael A Smith wrote: Hi, I want to connect to a Sybase database running on another windoze server without having to a buy a copy of sybase for linux. How can I compile PHP to have the sybase functions, but not the local database program. -Michael -- Michael A Smith [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Why Can't I get this to work
It depends on what data types are your fields in the database. U are quoting each value which might not be the case. You should check the mysql_error function to see what error the database is giving back to you.. -- BigDog On Sat, 2003-06-28 at 12:42, Ron Clark wrote: OK, normally I do not respond to my own posts, but I have been shown that I did not get the whole script. So here it is: for ($i=0; $i$number_of_alerts; $i++) { // Split each line $line = explode( , $ipfwlog[$i]); $line[1] = intval($line[1]); $IPFWsql = INSERT INTO Firewall_Logs (month, date, time, fw_name, kernel, fw_engine, rule_number, action, protocol, src_ip_port, dst_ip_port, direction, via, interface) VALUES ('$line[0]', '$line[1]', '$line[2]', '$line[3]', '$line[4]', '$line[5]', '$line[6]','$line[7]', '$line[8]', '$line[9]', '$line[10]', '$line[11]', '$line[12]'); $results = mysql_query($IPFWsql) or die (Could not execute query); } Again, any help with this issue is appreciated. Thanks, Ron Clark Ron Clark [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hello all, I have a php script that reads a flat text file with fields seperated by a space. I explode them into an array just fine, but when I try then to load that array into a mysql database, it doesn't work. Here is my script: for ($i=0; $i$number_of_alerts; $i++) { // Split each line $line = explode( , $ipfwlog[$i]); $line[1] = intval($line[1]); $IPFWsql = INSERT INTO Firewall_Logs (month, date, time, fw_name, kernel, fw_engine, rule_number, action, protocol, src $results = mysql_query($IPFWsql) or die (Could not execute query); } Any ideas why this does not work? I am completely stuck. Thanks in advance, RonC -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Another newbie
Jay, I would start out by reading up on the oop stuff and then maybe look at some software development sites...there are many and most have sufficient info to get you started. There are tons of design patterns out there which will more than help you code out too...(http://www.phppatterns.com) is a great site. Plus there are many great software design mags for php and other languages...that might be an option. I saved the best for last... There are so many great projects out there that you can help out with any of them...that will allow you to work and learn from others...also if you dont have the time then i strongly suggest review code from some projects...like horde that have a solid framework...by review the code u can see style and design stratiges... Hope that helps out... -- BigDog On Sat, 2003-06-28 at 14:10, Jay Fitzgerald wrote: I have been writing PHP for almost a year now and someone on phpfreaks told me the other day that my code was very sloppy. Since I want to more more into programming than design, can anyone recommend where to learn how to make sure your code is clean, optimized and as error-free as it can get? Even if it is the style of how to write the code, please let me knowI know noone can be the perfect programmer, but I would at least like to be a decent programmer :) Jay -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] New PCRE features
Thanks Andrei, we truly appreciate it...i will definitely put it to use... -- BigDog On Sat, 2003-06-28 at 18:28, Andrei Zmievski wrote: Some news on PCRE front: 1. I've upgraded the bundled PCRE library to version 4.3 which has some interesting new features. 2. I added new parameter to preg_match* functions that can be used to specify the starting offset of the subject string to start matching from. The offset can be positive or negative, like for substr(). 3. Also implemented support for named subpatterns (introduced with PCRE 4.3). This means you can do something like: ? preg_match('!(\d+)(?Pahh\.\d+)?!', 'ab 55.5 bb', $match); var_dump($match); ? With the result being: array(4) { [0]= string(4) 55.5 [1]= string(2) 55 [ahh]= string(2) .5 [2]= string(2) .5 } Note that the named subpattern is also available under a positional numeric key, as before. What this means for backwards compatibility is that you should not do count($match) anymore to obtain the number of captured subpatterns or number of matches. For latter, use the return value of preg_match* functions, and for former, you should already know how many subpatterns you have from your regexp. 4. You can use \Q..\E to ignore regexp metacharacters in the pattern. For example: !\w+\Q.$.\E$! Will match one or more word characters, followed by literals .$. and anchored at the end of the string. 5. You can use possesive quantifiers, similar to Java's regexps. These are: ?+, *+, ++, and {,}+ See PCRE docs or Java docs for more information. 6. There is now support for recursive calls to individual subpatterns. That is, instead of using (?R) you can use (?1), (?2) and so on. Or use named subpatterns: (?Pfoo) will refer recursively to named subpattern 'foo'. Once again see PCRE docs for more info. 7. There is a new feature by the name of callouts, but there is not interface to it yet. Basically, it allows user to receive control at a specified matching point in the pattern and inspect, continue, or interrupt the matching. I'm not sure how useful this would be for PHP users as the information provided is fairly low-level. See 'pcrecallout' PCRE man page for more info. If there are enough interested people, I will add support for it. That's about it for now. -Andrei What's a polar bear? A rectangular bear after a coordinate transform. -- Bill White ([EMAIL PROTECTED]) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] if and...
if( $biz == my_business $id_num == 1 ) { echo stuff...; } if $biz is a string and $id_num is an int... -- BigDog On Mon, 2003-06-30 at 19:09, Steve Marquez wrote: I am trying to get php to use two conditions. ?php if ($biz = my_business and $id_num = 1){ echo stuff } if ($biz = my_business and $id_num =2){ echo other stuff } ? My question Is, I am not sure if the and is correct, it does not work. Is there another way to do this? I have tried a plus (+), a (,) and nothing seems to work. Could someone please help? Thanks! Steve Marquez Marquez Design [EMAIL PROTECTED] www.marquez-design.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Validating XML strings
As of now i dont think that DOMXML functions support the validation of dtds or schemas...I have been looking for the past couple of days and did not find anything... I have not verified the xml extension for it but i doubt that that option is there either... -- BigDog On Tue, 2003-07-01 at 14:00, Moore, Christie wrote: I am parsing an xml string using the DOM package in php. Is there anyway to validate the xml string against a schema or a dtd with DOM. I know it is still experimental but I didn't know if something like that existed. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Minimizing Database Hits
Only if your code is calling the database...if $cart_contents is set on the page and you call the var $car_contents over and over then no...the initialization of the var is the only time if it is called in get_cart_contents()... -- BigDog On Tue, 2003-07-01 at 16:41, Ralph wrote: I wrote class that contains a function that retrieves users shopping cart items from database and then returns an array with qty, item number , item name, etc. So now whenever I want to retrieve the users cart I use the following: $cart_contents = $cart-get_cart_contents(); I then iterate through $cart_contents to display info. Now I am trying to minimize the number of hits to the database so my question is, am I querying the database every time I call on $cart_contents? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] outputting xml declaration
you can always print like so... print '?xml version=1.0?'; Then the parser does not try to parse inside the line. However, I dont know what will happen when you have short_open_tags in your php.ini file turned on...i usually turn it all of.. -- BigDog On Wed, 2003-07-02 at 07:33, Steven Apostolou wrote: Hello, The folowing code gives an error: print ?xml version=\1.0\?; This is probably because I print a questionmark? How can I avoid that an error is generated? Besides it's not an error in the way that it gives an errorstring but it writes the output in the error_log of apache... Greetings, -- Steven Apostolou [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Java Applet to PHP Communication
you want to use either dom or saxon to parse the xml within java. So your applet can call some class that loads, parses and then does something with the xml. Usually you want to use a sax parser for the speed, however you can use a dom parser to manipulate the dom tree... -- BigDog On Wed, 2003-07-02 at 05:02, Sharat Hegde wrote: Thanks Justin, Do you have any leads on where I can get info on accessing XML data using SOAP from a Java Applet. I know how to parse XML data. Regards, Sharat Hegde Phone: 6575800 Ext 4610 Direct: 6566615 -Original Message- From: justin gruenberg [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 02, 2003 1:27 PM To: Sharat Hegde Cc: [EMAIL PROTECTED] Subject: Re: [PHP] Java Applet to PHP Communication Sharat Hegde wrote: Hello, I need to be able to communicate from a Java Applet to a PHP program on the server to enable Live Connect for data. This is what I intend to do: In my web application, a Java Script program will call a Java Applet which then calls the PHP program on the server. The PHP program works like a servlet and passes the result back to the Java applet which passes the information back to the JavaScript program. How can a Java applet work with a PHP program? Are there any special precautions / programming issues involved? Thanks in advance With Regards, Sharat Not anything that you wouldn't have to pay attention to in passing stuff between applications in other instances. I'd use XML/SOAP to pass around the data. There are many reasons to do this, I wont list them here just because there are plenty of articles on the web advocating the use of XML. The added bonus is the buzzword factor. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php * Disclaimer: The information in this e-mail and any attachments is confidential / privileged. It is intended solely for the addressee or addressees. If you are not the addressee indicated in this message, you may not copy or deliver this message to anyone. In such case, you should destroy this message and kindly notify the sender by reply email. Please advise immediately if you or your employer does not consent to Internet email for messages of this kind. * -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] states
On Tue, 2003-07-01 at 16:55, Matt Palermo wrote: Does anyone know of any built in functions or options for the US states? Nope no built in function for this... I want to make a drop down menu and some other things which have the 50 states in it. Is there any shortcut for this with PHP, or do I need to do it all manually in HTML? Please let me know. Thanks. You can create your own function to build this for you. I have always put the 50 states in a database and used that for all my html and output requirements. You can google state abbreviations and use that in a database or file. -- BigDog -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Connect Active Directory using LDAP... please help :)
The big issue that you will face will be with getting the dn correct for it to work.. I have connected to ldap exchange to do authentication and pull user data and it was a real hassle to get the dn correct.. -- BigDog On Tue, 2003-07-01 at 15:41, Vince C wrote: Hi everyone, I tried to connect to Active Directory (AD) by using php. I heard that it could use LDAP to achieve it. I have written some code on my machine (Win2000) and try to connect to AD. It looks like the it could connect, bind, and even search (I determined base on the line I placed). However, it return 0 entries. If I used the same filter and use utilites lpd.exe on Windows 2000 Server (the AD machine). I could return some entries. I am hestitating whether do I made some mistake on my program, or something other than my code. Does anyone know what the problem is? Any comment are welcome! Thanks! Vince P.S. Here is my code: HTML HEAD !-- brandcheck.php -- TITLE Brand New Checking.. /TITLE /HEAD BODY pfont size =4AD Test/font/p table width =100% border=1 cellspacing=0 cellpadding=0 ?php $ldaphost= company.com; if(!($ldap = ldap_connect($ldaphost,389))){ die(ldap server cannot be reached); } else { $oudc = dc=company, dc=com; $dn2 = ; $password = ; echo pConnected and ready to bind...; if (!($res = @ldap_bind($ldap, $dn2, $password))) { print(ldap_error($ldap) . BR); die (Could not bind the $dn2); echo pCouldn't bind ; } else { echo pBinded and Ready to search; echo brLDAP = $ldap; echo broudc = $oudc; // $filter=((objectClass=user)(objectCategory=person)(|(sn=sorg))); $filter= sn=*; $sr=ldap_search($ldap,$oudc,$filter); echo pnumber of entries found: . ldap_count_entries($ldap, $sr) . p; echo brfilter = $filter; echo brsr=$sr; if (!$sr) { die(psearch failed\n); } else { echo p Searched and ready for get entries.; $info= ldap_get_entries($ldap, $sr); for ($i=0; $i$info[count]; $i++) { print (TR); print (TD width=15% . $info[$i][cn][0] . . $info[$i][sn][0] . /TD); print (TD width=85% . $info[$i][mail][0] . /TD); print (/TR); print brIn the display FOR loop; } echo br After loop.; } } ldap_unbind($ldap); echo pLDAP unbinded; } ? /table /BODY /HTML Thanks in advance! Vince -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Sending a PDF page
Try using the a shutdown function: http://us2.php.net/manual/en/function.register-shutdown-function.php and put all your logic that needs to run after the exit function. -- BigDog On Thu, 2003-07-03 at 13:18, Todd Cary wrote: [Sent this the first time to the wrong list] In this code: if ($prtpdf) { include letter_new.php; exit; } I create a PDF page, however I would like to continue within the script (not have the exit). If I do that, the PDF page is corrupted by the script code. What is the best solution for this? Todd -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP+MySQL on Apache running on WinXP
If i am not mistaken your phpinfo is picking up the bundled mysql package that comes with php. You should still be able to connect to mysql. However, if you downloaded the zip file instead of the installer then you should have a php_mysql.dll file that you can put in your path that php should pick up that might be different. I am not 100% up-to-date on the dlls that are available in the php zip file. -- BigDog On Mon, 2003-07-07 at 15:07, Vince wrote: I have set up a new development machine on my windows xp using APACHE version 2.0.46. Next, I set up PHP version 4.3.2 and MySQL version 4.0.13. Then, when I tested the installation, phpinfo() lists my CLIENT API VERSION for MYSQL as 3.23.49. 1. Is this normal? 2. If not, what have I done wrong? and 3. How do I fix it so that the correct version numbers appear? Thanks in advance == Vincent P. Vicente Manila, Philippines - Do you Yahoo!? SBC Yahoo! DSL - Now only $29.95 per month! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] New to PHP
here is what you can do: 1. buy a php book and go throw the basics. 2. read the php manual because it has tons of information. 3. write any type of program that you can to get familiar w/ language. 4. get a fundamental understanding of programming, object oriented programming Just my $0.02 for ya -- BigDog On Mon, 2003-07-07 at 15:27, Hiren Mehta wrote: Hi I am new to PHP and would like to learn more about it. Which would be the best place to start with besides the manual and what would you suggest is a pre-requiste for learning PHP. Thanks Regards, Hiren -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] I am receiving the same posting TWICE
Submit code that we can review. there is not enough info here for you to recieve a complete response to your question. -- BigDog On Mon, 2003-07-07 at 15:11, Noah Solodky wrote: Help! I am receiving the same posting TWICE how do I configure things to just get one copy of postings?? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php