Re: [PHP] strip tags but preserve title attributes
On Tue, Dec 15, 2009 at 6:44 AM, Wouter van Vliet / Interpotential pub...@interpotential.com wrote: And if that doesn't suit your needs - you might want to take a look at this: http://sourceforge.net/projects/simplehtmldom/ +1 I've never used the html2text library, but simplehtmldom is very easy to use and has worked very well for me. Brady -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] register_globals and sessions
On Wed, Nov 25, 2009 at 3:01 PM, Allen McCabe allenmcc...@gmail.com wrote: *Warning*: Unknown: Your script possibly relies on a session side-effect which existed until PHP 4.2.3. Please be advised that the session extension does not consider global variables as a source of data, unless register_globals is enabled. You can disable this functionality and this warning by setting session.bug_compat_42 or session.bug_compat_warn to off, respectively in *Unknown* on line *0* It sounds like you're trying to use $_SESSION without having a session_start() call first. I have Googled this extensively, and the solutions other people tried (turning off the warning) don't work for me; I don't have permission to my PHP settings (currently working on a free-hosted site). There are many settings that can be changed using the function ini_set (http://php.net/ini_set) and display_errors is one of them. That said, it is always best to fix stuff like this than just hiding it. When you just hide errors/warnings/notices things don't always work reliably. HTH, Brady -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Question about includes
On Tue, Nov 24, 2009 at 6:22 AM, Al n...@ridersite.org wrote: This bothers since the current working directory is effectively where my original script resides; is it not? If so, doesn't the include Net/SMTP.php on line 206 look for the path relative to it and not in /home1/youstart/php/? When including a file with a relative path PHP starts at the beginning of the include_path and checks each directory until it finds the file or reaches the end of the list. In this case it will start with the current directory since you've got the . as the first entry in the include path. When using relative paths, it's relative to the script with the include statement. So if you have a script myscript.php that includes mail.php, that include will be relative to myscript.php. Then when you include smtp.php from mail.php, the relative path will be relative to mail.php, not myscript.php. It looks like you're using PEAR classes, but the pear directory isn't in the include path. Try adding that path to your include_path by editing your .htaccess or using ini_set(). HTH, Brady -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Upgrading PHP versions
We are currently using PHP version 5.2.6. in production, and I'd like to upgrade to the latest 5.3.1 Before upgrading production, upgrade your staging server and do QA. Any big changes like this should be tested in staging before being pushed to production. Also take a look at http://php.net/ChangeLog-5.php to be sure you know what has changed between 5.2.6 and 5.3.1. My Assumptions: - I can simply download the Windows binary file, and install it. I don't use PHP on Windows, but I would never make this assumption. Things never seem to be as easy as I expect them to be. Try on a staging server before making a change like this in production. - None of the 5.2.6 code will break That's a big assumption. The only way I know of to test it is running the code on a box with 5.3.1 and test it. Will there be a momentary interruption of web services during the install? Will the current PHP applications stop working during the upgrade? I've never used IIS, so I may not be helpful here. If you're using Apache on Windows you'll need to restart Apache is generally a very fast operation. Brady -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Netbeans IDE 6.5
On Tue, Oct 27, 2009 at 5:50 PM, Skip Evans s...@bigskypenguin.com wrote: Any Netbeaners out there know how to install syntax highlighting stuff? 1 - Exit NetBeans 2 - Unzip the file in your ~/.netbeans/ folder. 3 - Start NetBeans 4 - Select the new color profile from Tools - Options - Fonts and Colors - Profile dropdown I would suggest upgrading to the latest NetBeans as well, it's worth it. Brady -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Strange behaviour with uploaded files .. XAMPP on Windows
On Mon, Oct 26, 2009 at 6:31 PM, Angus Mann angusm...@pobox.com wrote: When I use a form to upload a file, using $_FILES['uploadedfile']['name'] and move_uploaded-file($_FILES['uploadedfile']['name'], $targetpath) strange effects happen. The file is uploaded to the target directory just as it should. But when I access this directory as a network share on a different machine, the file is not visible. This sounds more like a windows permissions problem than PHP or XAMPP related. Make sure the user that is connecting to the network share has rights to view files on the windows box. It sounds like the user that is running XAMPP has full control (or at least read/write/delete) to that directory, but the user connecting to the network share doesn't. When I go to delete the file, or the entire uploads folder, the file is not deleted, nor the folder. If the folder contains anything I put there manually (ie. not uploaded as above) that is deleted, but the uploaded content remains. Yeah, definitely sounds like a permissions issue. I'm not much of a windows admin, but this looks like it might help: http://www.mydigitallife.info/2007/05/25/how-to-take-ownership-and-grant-permissions-in-windows-vista/ HTH, Brady -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] $_SERVER[REMOTE_ADDR] returning ::1
On Sep 17, 2008, at 957PM, David Rocks wrote: I am running a test PHP web app on my local machine that uses REMOTE_ADDR and most of the time ::1 is returned as the IP addr and sometimes it is 127.0.0.1 . I am on OS X 10.5.5 and using APACHE 2. PHPINFO always returns ::1 for REMOTE_ADDR. Is this a PHP or a APACHE 2 thing? I saw the same thing on my OS X box, and decided to disable IPV6 for now. Edit httpd.conf and change: Listen 80 to Listen 0.0.0.0:80 and when you restart Apache it'll always return 127.0.0.1 Brady -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: uploading file outside WEB Root
On Sep 12, 2008, at 516AM, Luke wrote: Could you use a symbolic link? If on Linux 'ln -s /fpath/foldername'? Not sure how to do this on Windows Windows 2k and up do support symbolic links, take a look at http://technet.microsoft.com/en-us/sysinternals/bb896768.aspx Brady -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem with function
On Sep 12, 2008, at 544AM, Jochem Maas wrote: the current error_reporting/display_errors settings. and learn about error_log() and how to 'tail' the error log (fuck knows how you go about that on windows ... then there are reasons I have a Mac ;-)) The ability to tail error logs is one of the main reasons I have cygwin installed on my windows machine at work. Once installed if you add the cygwin\bin dir to your path you don't even have to be in a cygwin prompt to use tail and the other *nix goodness it provides. http://bradym.net/windows/making-the-windows-command-prompt-usable Brady -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: uploading file outside WEB Root [0T]
On Fri, Sep 12, 2008 at 12:47 PM, Robert Cummings [EMAIL PROTECTED] wrote: Microsoft sucks because they didn't make their symbolic linking methodology public knowledge and charge additional fees to obtain the Win2k system kit they suggest you use to make the links in the first place. Wel from what I read their symbolic links only support directories. That's a half-ass done job IMHO. It should be possible to link anything. Directories, files, sockets, pipes, devices, what have ya. I guess that's the advantage of nixes... everything is pretty much a file and symbolic links for files are well implemented and supported :) True, I forgot to mention that. Junctions only work with directories, which is a step in the right direction, but definitely not as good as real symbolic links. Brady -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Anything like XAMPP?
On Sep 10, 2008, at 950AM, Ben Stones wrote: There's a bug, I believe with XAMPP where from XAMPP CP you click 'admin' under MySQL, when WinMySQLadmin comes up, the icon in the right (traffic light) is always red, and there's no option to start the service anymore... Click the Start button on the control panel. As you know, clicking Admin will launch WinMySQLadmin, which is useless if MySQL isn't running. Brady -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] The Best PHP Editor.
On Sep 10, 2008, at 821PM, jmatt wrote: Hi, I was using NVU to edit PHP but when I upload the index.php file back there will always be a slight error in disorientation. Example using NVU I edited the text just a bit then bam..The webpage became really funny What is the best to edit my PHP file? Please search the list archives rather than starting up this thread again. It comes up about once a week... http://marc.info/?l=php-general -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Shopping Carts/Checkout Software
On Sep 8, 2008, at 809AM, Charlene wrote: The company I work for is going to be creating the catalog to a small store (~100 items). The customized catalog will include the front end that the shoppers will use as well as the back end data entry. We need shopping cart/checkout software, preferably PHP (since that is what we will be using for our site) and uses MySQL as the database. We want to be able to hook our customized software into the software package (ie we're not using their data entry into the catalog). We don't want to be limited to just one shopping cart/ checkout software package and this may become a product we use for more sites. I haven't used it yet myself, but just from playing with the demo I'd try magento first. http://www.magentocommerce.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Creating single row for multiple items.
On Aug 31, 2008, at 904PM, Tom Shaw wrote: My array looks very similar to this. I need to create a single row for the items that have the same order number for CSV export. I'd prefer to do this PHP wise instead of SQL. But would appreciate any help I can get. Please send an example of what you are trying to do. If you just want to put each item in the array on a single line in a csv file, this will do it: $fp = fopen('file.csv', 'w'); foreach ($arr as $line) { fputcsv($fp, $line); } fclose($fp); but from your description, that doesn't sound like what you are looking for. If you send a sample line, we can help you better. Brady -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Debugging PHP scripts
On Aug 29, 2008, at 851AM, Edward Diener wrote: I have not looked into PHP IDEs at all so far. Any recommendations ? Thanks ! Please don't start this up again. Check the PHP IDE Needed thread that has been active for the past several days or search the list archives. http://marc.info/?l=php-general Brady -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help with an error...
On Jul 24, 2008, at 1052AM, [EMAIL PROTECTED] wrote: $result = mysql_query($query) Missing a ; at the end of the line. $mailsend = mail([EMAIL PROTECTED],The IP's that Attacked $hostname, The following are ip's that have try to attack your system.\r\n\r\ You can't execute code inside of a function call the way you're trying to do. Instead do something like: $message = The following are ip's that have try to attack your system. \r\n\r\; Then in your code below, anywhere you have an echo statement, replace it with $message .= code here. For example: $message trtd align= \'left\'$row[0]/tdtddiv align=\'right\'$row[1]/div/td/tr; Then after you're done building your $message for the email, mail([EMAIL PROTECTED],The IP's that Attacked $hostname, $message); I'd suggest taking another read of the manual page for the mail function: http://php.net/manual/en/function.mail.php - the email is sent when you make the call, not created and stored in a variable when executed. Brady -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Most popular per month
On Jul 11, 2008, at 555PM, Ryan S wrote: before the next days counter starts this data is stored in a table which has a simple structure like this img_id1 int,img_id2 int (etc till img_id10) That sounds like a painful db structure to deal with if you want to add more images in the future. I'd suggest a structure more like: img_id date_viewed counter Where counter is simply the number of times the specified image was viewed on that day. I just finished writing a blog post about a similar requirement that may help - http://bradym.net/mysql/logging-requests-with-mysql . Now the client wants a little extra functionality, and with me sucking at maths I need some help please, basically he now wants to have a chart with all the 50 images there and showing _via percentages_ instead of the present 1-10 display which ones are the most popular till date. You get the percentage simply by dividing the number of requests for a specific image by the total number of requests for all images. So if you had the following data: img1 - 50 views img2 - 20 views img3 - 15 views img4 - 10 views img5 - 5 views To get the total, you would just add all those views together (100) in this case. Then for the percentages just divide each one by 100, ie: $img1_percent = 50 / 100; Also, if i am not mistaken there was some charting software to display this kind of data in pie and line charts... anybody know what i am talking about? because i cant find such a link in my bookmarks. There are several options for charting, here's a post I came across earlier in the week with some options: http://free-wiz.blogspot.com/2008/07/best-free-chart-apis.html . Brady -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Multiple words str_shuffle
On Jul 6, 2008, at 305PM, Ron Piggott wrote: I am trying to scramble individual words and/or phrases. When it is a phrase I would like to keep the letters of each word together, with a space between each one. The code I have so far is below. I use PHP 4.4.7. The code below is fine for a single word; it is phrases that I am now trying to accommodate. $orig_phrase = 'rise and shine'; // Split the phrase into an array with each word as an element $array_phrase = explode(' ',$orig_phrase); // Cycle through the array processing one word at a tie foreach($array_phrase as $key = $value) { // $orig_value is used in the do while loop to ensure that the shuffled string is not the original string. $orig_value = $value; // Shuffle the string, and continue to do so until the returned string is not the original string do{ $value = str_shuffle($value); } while($value == $orig_value); // Uppercase value $value = strtoupper($value); // Insert a space after every letter $value = chunk_split($value,1,' '); // Set array value to newly formatted version $array_phrase[$key] = $value; } // I'm using nbsp; so it will echo and be obvious that there are two spaces between words. $scramble_phrase = implode('nbsp;nbsp;',$array_phrase); echo $orig_phrase; echo 'br /'; echo $scramble_phrase; Everything after the do...while loop can be easily combined into one line; I left it as separate lines for clarity. Brady
Re: [PHP] Class Load twice
On May 31, 2008, at 211AM, Yui Hiroaki wrote: I just do not want to load mail() when load.php is load. if you know how to solove it, please teach me it! *MyClass.php*** ?php $objRef=new MyClass(hui7gutWSFrh6zt); $objRef-buff(); mail([EMAIL PROTECTED],test,test); class MyClass{ Private $google; function __construct($googleKEY){ $this-google=$googleKEY; } public function buff(){ echo $this-google; } } ? Because the call to the mail function is outside of the class definition, it will be executed as soon as the file is included. If you want the email to be sent by the class, it needs to be done within one of the class methods (functions). Brady -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: scanned in manipulate to a pdf
On May 27, 2008, at 923AM, Bastien Koert wrote: Interesting to know, however the OP's question was about using PHP to run the scanner, not on the already present PDFs in the FS. That's not how I read the question, but clearly I could be wrong... Could / Would you be willing to share you solution on merging the PDFs? That is something that I am interested in... I've been meaning to suggest that the OP look at pdftk (http://www.accesspdf.com/pdftk/ ) - though it's not a PHP solution, it's a great tool for working with PDFs. It can make otherwise tedious, time consuming tasks with PDFs quick and easy. Brady -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Improving development process / help with developer setup
On May 19, 2008, at 520AM, robert mena wrote: So, in order to allow phpunit to be ran, have the firefox/IE support and use xdebug I have two basic options: a) stay with windows, install XAMPP (or any other all-in-one). And live with the fact that some things will have to be taken care of (such as PATH differences between unix/windows) This is what we do where I work. XAMPP has been configured and put into Perforce (our revision control system) so anytime a change is made or we decide to update to a new version of XAMPP, all the devs need to do is grab the latest version. This makes it very nice when people need help setting something up as we all have the exact same setup. We've created some template vhost files for setting up new sites, so getting a new site setup on the local machine is much easier now, especially for those devs who still don't know all that much about Apache. Once a vhost file is working properly, we check it into perforce so that if we need to reinstall XAMPP later, or if someone else needs to work on the site it's as simple as getting the latest version of the file from perforce. For the path differences, we are starting to move the include_path setting out of .htaccess where we've been setting it and into the vhost configuration for the site. Of course this also needs to be done on the server, but it only takes a couple minutes to do. I'd much rather be using a Mac or Linux at work and using vmware for IE testing, but that's not up to me. b) switch to linux with the development stack, enable a windows server to be connected from rdesktop so they can test the IE I would get feedback from your devs about this before making such a drastic switch. Personally, I'd love to ditch windows on my box at work, but I know that some of the devs I work with would not be very happy about that. It also depends on what software your devs are using, and if it's available on Linux. Sure, there are alternatives to everything, but learning to use and becoming efficient with an alternative isn't nearly as productive as continuing to use the same tools. Brady -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Can I install a newer version of php over an older version
On May 14, 2008, at 854PM, Tony M wrote: Can I install a newer version of php over an older version ? I am new to php and am in the process of installing it and reading various tutorials. I always suggest using XAMPP (http://xampp.org) or a similar package that will install MySQL, PHP and Apache all for you in one bundle on development machines. It's much faster, easier to manage and it just works! That said, I don't advocate using XAMPP on a production server. For a production server it's worth taking the time to install each individually so you know exactly how each one is configured. Brady -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] xml processing cdata
The last comment on http://php.net/manual/en/function.simplexml-load-string.php is what you need: simplexml_load_string($xmlstring, 'SimpleXMLElement', LIBXML_NOCDATA); Brady On May 9, 2008, at 1250PM, Chris W wrote: I have an xml file with a cdata element like the one below. How would I use the php xml functions to extract that cdata and save it as a pdf file? attach id=2 display-name=207069.pdf file-name=207069.pdf obj- type=1 system=0 ![CDATA[eJysumVQW1/0NtoWK95CcXe3EFxK8QDBCQ5 .. ]] /attach The code I have is this... $in = fopen(test.xml, 'r'); $XMLStr = ''; while (!feof($in)) { $LineNumber++; $XMLStr .= fgets($in); } $XML = simplexml_load_string($XMLStr); foreach($XML-props-attachments-attach as $Attachment){ print_r($Attachment); } The output looks like this... SimpleXMLElement Object ( [EMAIL PROTECTED] = Array ( [id] = 2 [display-name] = 207069.pdf [file-name] = 207069.pdf [obj-type] = 1 [system] = 0 ) ) -- Chris W KE5GIX Protect your digital freedom and privacy, eliminate DRM, learn more at http://www.defectivebydesign.org/what_is_drm; Ham Radio Repeater Database. http://hrrdb.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Categories like wordpress
On May 1, 2008, at 743AM, Richard Heyes wrote: Is this how its done or am I barking up the wrong tree? You have multiple options: 1. Fully normalised, where you have three tables - one for your articles, one for your categories and a link table. This is the route that I would suggest, it's the most flexible and fastest to query. Just to expound a little... images table: - image_id - image_filename category table - category_id - category_name image_category_mapping table: - image_id - category_id Then when you want to get all of the images for a category: SELECT image_id, image_filename FROM images JOIN image_category_mapping ON images.image_id = image_category_mapping.image_id WHERE category_id = 10; Getting all the categories an image is in: SELECT category_id FROM image_category_mapping WHERE image_id = 42; It seems like more work than the route you described, but it's way more flexible, and as Richard pointed out, it's fully normalized. Brady -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Categories like wordpress
On May 1, 2008, at 843AM, Richard Heyes wrote: it's the most flexible and fastest to query. Mmm, that's debateable. Not knowing the ins and outs of MySQL I'd hazard a guess that reading an extra 255 bytes from the table file might be faster in some circumstances than opening two extra table files. And I don't see why it's more flexible...? Good point, I should have said can be more flexible and faster to query. I've found that every time I try to do something like this without having a mapping table that I eventually end up wanting to move to the mapping table setup. Of course that might just be because I'm so used to doing it that way. Certainly that doesn't mean that other solutions are wrong or bad in any way. I need to learn to not speak in absolutes. :) The latter two solutions I suggested are certainly easier to work with and (with todays hardware), speed isn't always a factor. Yes, another great point. Brady -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] auto generated PDF
On Mar 30, 2008, at 227AM, Alain Roger wrote: i want to implement on my web portal electronic invoicing system. basically data will be stored into PostgreSQL DB. If you're not set on building it yourself, you might take a look at Bamboo Invoice - http://bambooinvoice.org/. Brady -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] why use {} around vraiable?
On Mar 20, 2008, at 922AM, Lamp Lists wrote: $query = mysql_query(SELECT * FROM table1 WHERE id='{$session_id}'); For a non-array value, the curly braces are unnecessary: $query = mysql_query(SELECT * FROM table1 WHERE id='$session_id') WIth an array element, you have to either use the curly braces or do as you have and end the string, concat the value and start the string again as needed. $query = mysql_query(SELECT * FROM table1 WHERE id='{$clean['id']}') When dealing with array elements, I use the curly braces method. IMO it's cleaner and easier to read. I would use: $parameters = array( 'param1' = $_POST[param1], 'param2' = $_POST[param2] ); This is how I do it as well. does it really matter? is there really difference or these are just two styles? IMO, it's a matter of preference and style. There may be performance differences between the two, but I doubt that either one is so much worse than the other that it would have a noticeable impact on your script in most situations. Brady -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] question about php with sql database
On Mar 18, 2008, at 1008PM, Sudhakar wrote: 1. are the connection statements ex = $conn = mysql_connect($hostname, $user, $dbpassword); etc does these remain the same or are they different. http://php.net/mssql 2. unlike in mysql with phpmyadmin which is browser based to access databases and tables how to access sql server for the same functionality http://www.mylittleadmin.com/en/welcome.aspx 3. can anyone provide a link about a manual for using sql database with php http://php.net/mssql -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Crop part of existing pdf
On Mar 3, 2008, at 614PM, gary liang wrote: Is there any command line tool, which is able to crop part of pdf file? I ask for command line tool, because it can be used in php code. Any hint? Depending on what exactly you mean by cropping a pdf, pdftk may be what you need. http://www.accesspdf.com/pdftk/ Brady -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mysql test and error
On Feb 24, 2008, at 1135AM, hE wrote: hi, I found an e-book in the net about php and mysql and with its sample program I am trying to test whether I have mysql working correctly or not. the following program gives error message. why? What exactly does the error message say? We can help troubleshoot errors much better with error messages. :) html headtitleTest MySQL/title/head body !-- mysql_up.php -- ?php3 Change ?php3 to ?php - everywhere in your code. By the fact that it's using ?php3 I'm guessing this is a very old tutorial. I'd strongly suggest using a more recent tutorial. There have been lots of changes since PHP3 and there's no reason to start with such an old version. Here are some places to start: http://devzone.zend.com/article/627-PHP-101-PHP-For-the-Absolute-Beginner http://hudzilla.org/phpwiki/index.php?title=Main_Page I also strongly suggest taking some time to go through the manual. Browse through the different sections and get an idea for what is available. Obviously I'm not suggesting you memorize the manual, but I've found it very helpful to occasionally browse through a section or two in the manual, I always seem to find functions I wasn't aware of before. This really helps in deciding the best way to solve a problem. if ($result == 0) echo “bError “ . mysql_errno() . “: “ . mysql_error() . “/b”; Is this all on one line in your code? If not it needs to be inside curly braces, though this could be just a case of long lines be broken up by your email software. For consistency and readability, especially when starting with a new language, I tend to always use curly braces - even if not needed. 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 ?php3 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”; } ? One last suggestion, indent your code. For example: 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 } ? While it's not necessary, I find it much easier to read and troubleshoot code when indented. Brady -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mysql test and error
On Feb 24, 2008, at 200PM, hE wrote: The following program gave the error: Parse error: parse error in C:\apache\htdocs\mysqltest.php on line 10 Did you copy/paste the code? If so maybe the quotation marks are the fancy smart quotes like MS Office likes to use. Try replacing your quotes with regular old quotation marks. Brady -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] js to php help
On Feb 19, 2008, at 712AM, tedd wrote: Hi gang: I have a date picker in javascript working, but I need to take the date selections to php. Here's the link and code: http://www.webbytedd.com/a/calendar/index.php How can I get what is selected in javascript to POST? Have you tried placing the form before the Calendar.setup() calls? Seems like I had to do that when I used that javascript calendar widget. Brady -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] More than one values returned?
On Feb 18, 2008, at 531PM, Teck wrote: Is it possible to return more than one values in PHP? Yes, in the form of an array. return $x; return $y; Only one return statement can be used. http://us.php.net/manual/en/functions.returning-values.php Brady -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] separating strings from extensions
On Feb 17, 2008, at 256PM, Daniel Brown wrote: On Feb 17, 2008 5:37 PM, nihilism machine [EMAIL PROTECTED] wrote: i am using this code to get the extension of a filename: $extension = strtolower(strrchr($fileName,.)); how can i get the text BEFORE the . (period) You can STFW and RTFM. This list should never be your first place to ask simple questions. PLEASE start using the PHP manual! http://php.net/pathinfo http://php.net/basename Brady -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] help me out with form details converted into pdf file save it one place as well as send mail attactment
On Feb 13, 2008, at 426AM, pretty wrote hi any one help me out, im using cronofirm, i need to field form details will converted into pdf as well as it will go maill attachment doing this in joomla, atleast i need this only php with out joomla. For sending email: The standard mail function http://php.net/mail I've found that for sending anything more than the simplest email, it's usually easier to use something like PHPMailer (http://phpmailer.sf.net ). For creating PDF files, here are a few options: http://fpdf.org http://www.ros.co.nz/pdf/ http://framework.zend.com/manual/en/zend.pdf.html Saving the pdf and sending it as an email shouldn't be difficult: Step 1 - Generate the PDF Step 2 - Save it somewhere on the server Step 3 - Email the PDF as an attachment. I don't fully understand your question, so hopefully this is somewhat helpful. If you have specific questions about parts of the process we will be able to help you better. Best is if you start writing the code and ask questions when you get stuck so we can see what's going on and offer ideas. Best of luck, Brady -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: [Slightly OT] Apple MacBook MAMP and Logic
I don't use a mac myself but a colleague does. He seems to have apache and PHP installed on the machine but he generally uses the Xampp package. I don't know if this is the official home page or but but start here: http://www.apachefriends.org/en/xampp-macosx.html Thanks Colin, That's what I use on PC so it will probably do me fine on Mac too. I've been using XAMPP on Windows for a few years, so when I bought a MBP in December I was happy to find that they have a version for OS X as well. The one thing I didn't like about it is that on OS X you have to type in your password every time you want to start or stop anything. So I wrote some simple applescripts that I use instead of the included control panel that handle the authentication for me. If anyone is interested, just contact me off-list and I'll gladly share these simple scripts. Brady -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] determine file-upload's tmp-filename
On Jan 26, 2008, at 357PM, Michael Fischer wrote: hi there, is there a way to determine the tmp-filename of a file upload while the upload is still in progress? I'm not sure when it becomes available, but $_FILES['file_name'] ['tmp_name'] is the only place I know of to find the temporary name. the tmp-file is stored in /tmp and it's name is something like PHP. what i would like to do is: i want to upload a file via a html-form and while the upload is in progress make repeatedly ajax-requests to a php-script on the server that replies the size of the tmp file (the amount of data that was already uploaded). So in this script i need to know what the tmp- filename is. You could try doing a print_r($_GLOBALS); in that script to find out if there are any other helpful places to check. HTH, Brady -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] FPDF
On Jan 18, 2008, at 1014AM, Balasubramanyam Ananthamurthy wrote: I'm fetching content from database and printing it on the browser. I want add an link on the same page Click here to view it in PDF. Is it possible to do it using FPDF? If yes, how can I do this? Yes, this can be done with FPDF. Go to http://fpdf.org, click on scripts and you'll find multiple examples with MySQL, one with PostgreSQL and even one with MS Access. FPDF has pretty good documentation and lots of example code to browse. I suggest using the forum on fpdf.org to ask specific questions as you'll likely get better help there than on this list, simply because it's focused specifically on fpdf. Brady -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] checking user input of MM-DD-YYYY
I'm having users enter dates in MM-DD- format. is there a way to check if what they have entered is invalid (like if they enter 1-15-2008 instead of 01-15-2008) ? Why not use something like http://www.dynarch.com/projects/calendar/ to make it easier for the users? Along with being easier, the widget will format the input however you like. You can even have it displayed to the user in one format and post it to your form in another format. Of course there should also be an alternative method for those with JS turned off, but my experience with users entering dates by hand has been way too painful not to use a JS calendar widget. Just my two cents, Brady -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] question about $_POST ['something'] array
On Jan 14, 2008, at 1127PM, Lukáš Moravec wrote: I have one question about $_POST ['something'] array... I am trying to use a form and php in a same file and when I am using the form for the first time, Any $_POST index which I use in the form is not defined (which is logical)...how can I remove any warning about undefined index of $_POST array... Check if it is set before using it: ?php if(isset($_POST['anything']) { $anything = $_POST['anything']; } ? Be sure to validate and filter all input before using it! http://devzone.zend.com/article/1793-PHP-Security-Tip-8 http://www.sitepoint.com/article/php-security-blunders http://phpsecurity.org/ Brady
Re: [PHP] PHTML files showing as blank pages
On Jan 5, 2008, at 639AM, A.smith wrote: I'm having a problem getting .phtml files to display in a web browser. I can successfully display a test.php page as per PHP install instructions but the phtml files show up blank (in firefox or IE). A blank page often means that there's an error of some kind, but error reporting is turned off. Put the following code in the file that's giving you problems to turn on errors, then reload the file in your browser to see what you get: ini_set('display_errors',1); Brady -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Does a package like this exist
On Jan 4, 2008 9:33 AM, Christoph Boget [EMAIL PROTECTED] wrote: Not wanting to re-invent the wheel, I'm wondering if there is a package out there that can read in an HTML file and allow you to manipulate and dissect it much like you can in javascript? For example, functionality similar to (though, not necessarily the same as) getElementById(), .innerHTML, etc. Hopefully you're using PHP5: http://php.net/dom to interact with the DOM http://php.net/tidy to cleanup the HTML if needed If you're on PHP4: http://php.net/domxml Brady -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] handling ' with mysql/php insert and select
when I type the word blah's to my text box variable, and then insert it into mysql after being ran through mysql_real_escape_string(), it does: insert into contract (contract_id, responsibility) VALUES (15, 'blah\\\'s') It looks like magic quotes is turned on. Take a look at http://us2.php.net/magic_quotes. and when I run that select statement in PHP it prints blah\'s on the screen. I want it to print back blah's without the \. So what are my options? run every variable through stripslashes(); before printing them to the screen? Using stripslashes is a nice quick fix, but for a long term solution turn off magic_quotes and then update your data to remove the extra slashes. A simple way to do that is to loop through your database records, run stripslashes and update the database. As always be sure to backup your database before doing this, just to be safe! :) HTH, Brady -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] best way for PHP page
i would like to improve my coding quality when i use PHP code and for that i would request your help. in my web developer experience, i have to confess that i've never succeeded in spliting PHP code from HTML code. There's a myth that by separating html and php your code is cleaner, it's a little more than that. What you should consider doing is separating the business logic from the display logic. The business logic includes things like database calls, data calculations, etc. Display logic is what the page actually looks like. This will likely include both HTML and PHP, but the PHP will be limited to echoing out variables, as you should have already done all calculations. One very good way to do this separation is by using the MVC pattern - http://en.wikipedia.org/wiki/Model-view-controller . I've found that using the MVC pattern helps me to write cleaner, more maintainable code as you always know where the code for a given function is located. Need to edit what the page looks like? It's in the view. Need to edit your database calls? It's in the model. Anything else? It's in the controller. There are lots of great frameworks out there that use the MVC pattern. Personally I use and recommend CodeIgniter (http:// www.codeigniter.com) - it's been a great one for me, but there are plenty of other well written frameworks out there if CodeIgniter isn't a good fit for you. HTH, Brady -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Change case of HTML tags
If you're using PHP5, you can use the tidy functions - http://us2.php.net/tidy. The default settings output html tags in lower-case. For tidy config settings, see http://tidy.sourceforge.net/docs/quickref.html Brady On Dec 19, 2007 1:10 PM, Christoph Boget [EMAIL PROTECTED] wrote: I've been looking through the docs but haven't found an internal function that does what I'm looking for. Perhaps I missed it? Or perhaps someone can point me in the right direction? I'm looking for a routine that will convert tags to lower case. For example, if I have HTML HEAD TITLEThis is the Page Title/TITLE /HEAD Body Here is the Page Text /Body /HTML I want to convert only the tags to lower case. So HTML becomes html and so on; I don't want anything else touched. This may seem kind of silly but I'm working with an XMLDocument object in javascript and when I serialize it to string format, for some reason all the tags are made into uppercase. I'm taking the serialized string, posting it back to the server and using it on the back end. I figure that since I can make it so that the serialized string is lower case on the front end, perhaps I can convert it on the back. Any ideas/pointers? thnx, Christoph -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Cookies are now driving me crazy....
On Nov 28, 2007 12:08 PM, Jason Pruim [EMAIL PROTECTED] wrote: if ($res) { // now see if user's id exists in database if (mysql_num_rows($res,0) { You need another ) on that last line: if (mysql_num_rows($res,0)) { You might want to consider getting an editor/ide that will higlight parse errors for you, makes life much easier. :) My ide of choice is EasyEclipse for PHP ( http://www.easyeclipse.org/site/distributions/php.html ), and there are lots of other great editors out there too. This is not meant to start another my editor is better than yours thread, just a suggestion. Brady -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Create PDFs with a strict layout automatically
David Christopher Zentgraf wrote: Thanks, but by now I'm pretty much sold on the idea of FPDF and creating PDFs on the fly, inserting data I need as I go. Is there any advantage using pdftk? The only advantage would be that others could create the PDFs and give them to you. I used this setup to allow region offices to send me the PDF that they wanted to be used for generating reports for their users. I gave them a list of field names and they were able to choose which ones to include on the report, which order, etc. FPDF is a great way to go - I've used it for other projects. Thought I'd share this method so you'd have more options. :) Brady -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Create PDFs with a strict layout automatically
David Christopher Zentgraf wrote: On 27 Nov 2007, at 17:57, Brady Mitchell wrote: FPDF is a great way to go - I've used it for other projects. Thought I'd share this method so you'd have more options. :) Very much appreciated. :o) I do want to include graphics dynamically as well, not just form data, so I think your approach wouldn't be quite as suited anyway(?). Yeah, it sounds like your project is better suited for FPDF than I originally thought. I saw template and that made me think of using pdftk to fill in PDFs generated elsewhere. Brady -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Create PDFs with a strict layout automatically
David Christopher Zentgraf wrote: I'll certainly play around with it to see what it can do, but right of the bat it seems that templates aren't supported the way I would like them to. Importing a PDF is possible, but apparently they can only be treated like images. I had a similar situation where I needed to fill in the blanks on an existing PDF file. I used the createFDF function from http://koivi.com/fill-pdf-form-fields in combination with pdftk (http://www.accesspdf.com/pdftk/) to merge the fdf data and pdf file into one. Take a look at the fill_form and flatten options of pdftk. Brady -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Saving a dynamic file
Depends on what you are planning to do with the file. Saving it to PDF is also possible, take a look at http://fpdf.org and http://htmldoc.org/. Brady -Original Message- Hi!! I'm in the need of saving to a file a dynamic page that I generated from a PHP script, taking data from a table!! So far I have figured out two options: 1) Save the page as a XML document so it can be editable in a word processor later. Do I have to write line by line until I'm done with the document? 2) Use a class to convert save the dynamic page into a Word document. Is there any other options available?? Regards MIGUEL GUIRAO AGUILERA Logistica R8 - Telcel Tel: (999) 960.7994 Este mensaje es exclusivamente para el uso de la persona o entidad a quien esta dirigido; contiene informacion estrictamente confidencial y legalmente protegida, cuya divulgacion es sancionada por la ley. Si el lector de este mensaje no es a quien esta dirigido, ni se trata del empleado o agente responsable de esta informacion, se le notifica por medio del presente, que su reproduccion y distribucion, esta estrictamente prohibida. Si Usted recibio este comunicado por error, favor de notificarlo inmediatamente al remitente y destruir el mensaje. Todas las opiniones contenidas en este mail son propias del autor del mensaje y no necesariamente coinciden con las de Radiomovil Dipsa, S.A. de C.V. o alguna de sus empresas controladas, controladoras, afiliadas y subsidiarias. Este mensaje intencionalmente no contiene acentos. This message is for the sole use of the person or entity to whom it is being sent. Therefore, it contains strictly confidential and legally protected material whose disclosure is subject to penalty by law. If the person reading this message is not the one to whom it is being sent and/or is not an employee or the responsible agent for this information, this person is herein notified that any unauthorized dissemination, distribution or copying of the materials included in this facsimile is strictly prohibited. If you received this document by mistake please notify immediately to the subscriber and destroy the message. Any opinions contained in this e-mail are those of the author of the message and do not necessarily coincide with those of Radiomovil Dipsa, S.A. de C.V. or any of its control, controlled, affiliates and subsidiaries companies. No part of this message or attachments may be used or reproduced in any manner whatsoever. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] POST on redirects?
Use sessions. Store the variables you need in the session, then redirect. After redirect get the values you need from the session. http://us3.php.net/manual/en/ref.session.php Brady -Original Message- From: Tony Di Croce [mailto:[EMAIL PROTECTED] Sent: Friday, July 28, 2006 2:56 PM To: php-general@lists.php.net Subject: [PHP] POST on redirects? In a couple of my scripts, I do something like the following when I detect an improperly submitted form: **if( !valid_string( $_POST['firstname'] ) ) { $return_url = https://www.abc.com/checkout_phase1.php?error=FirstName Required; header( location: $return_url ); exit(0); } Recently I changed the code so that a big variable that was being passed via GET (IE, as a param in the URL) is instead being POST'd... (typically, via a hidden INPUT elem in a form)... Unfortunatley, this broke my error handling logic... Is it possible to add POST variables to a redirect? How? -- Free Linux Technical Articles http://www.linuxtecharticles.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Enterprise grade CMS+Ecomm
-Original Message- The question I have to answer is Do I write everything by myself from scratch and spend 3-6 months doing it? Or do I spend that same amount of money on a prebuilt system and spend 1 month integrating our new branding? The answer to this question depends heavily on your needs. What kind of functionality do you need to get out of your website? If you are looking for a website that is similar to others in function, than I would definitely suggest looking at an existing CMS package. Even if you will need some custom functionality, it may be worth the time and effort to create your own module for an existing system. But again, that depends on the complexity of the system you need. The answer doesn't even have to be specifically one way or the other. It could be a mixture of the two. Perhaps I use something like Drupal (which I have no experience with) for the CMS part and write my own ecommerce application. Or perhaps I write my own basic CMS and purchase an ecommerce application? I would suggest that you take a look at the different CMS options as well as the community released modules / plugins. You may well find a CMS that has a module that will meet your needs, or be close enough that you could take the code and customize it to what you are looking for. As for a CMS, I just watched a video on Drupal 4.7 and it looks quite interesting. Opinions? I'm currently migrating from a Mambo site to Drupal. My main reason for doing so is the multi-site functionality. We have a few different websites that we maintain for different business goals, but we want them all to authenticate against the same database due to the fact that some of our users will need to use all of the sites. Using drupal it is very simple to setup several sites on one codebase, and telling them to all authenticate against the same database table is very easy. The other nice thing is that you can setup drupal to share the sessions table as well, so logging into one site logs you into all of the sites at once. Having said that, Drupal is a little more difficult to understand than some of the other CMS systems. At least it was for me, but that probably reflects more on me than on Drupal. ;) For a single site setup I would probably stick with Joomla, but that's just a preference. The bottom line is that there are lots of great CMS options, and the best way to choose one is to know exactly what you want from a CMS and compare them with that in mind. Good luck, Brady -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Class ADODB - Method GenID() in MySQL
-Original Message- I am using the ADODB class to connect to a MySQL server. I am trying to generate an ID with the method GenID(), but when I tried this: $id = $db-GenID('table'); The value of $id is equal to zero. I know that MySQL doesn't use sequences like PostgreSQL does (I've used this code in a PostgreSQL project), but in the documentation of ADODB I saw that it is possible to use it. Is there any trick about how to make it work? From the ADOdb Manual: GenID() will automatically create the sequence for you if it does not exist (provided the userid has permission to do so). Does the MySQL user have permission to create tables? Since ADOdb fakes sequences by creating a table, that could be a problem. Brady -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] php-html rendering
-Original Message- I need to render/convert the entire site to normal html pages so that it can be loaded onto a cd and given out. Does any class program exist that can help me do this? Save yourself a lot of work and use HTTrack. http://www.httrack.com/ Brady -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Convert PHP to javascript
-Original Message- Could someone help me to convert this snippet of PHP code to JavaScript? If by help me you mean do it for me than I can tell you that nobody is going to do it. Start working on it, and ask questions when you get stuck, we're here to help, not do your job Brady -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] php-html rendering
-Original Message- Save yourself a lot of work and use HTTrack. http://www.httrack.com/ Very very interesting, thank you! If you have tried this and have downloaded dynamic pages/sites (eg: PHP pages) please tell me if you had any link problems from one page to another. I've used this program to download dynamic websites for presentations and have never had problems with links. Of course, I always suggest testing before trying to use something in any kind of presentation. It probably wouldn't hurt to use something like Xenu Link Sleuth ( http://home.snafu.de/tilman/xenulink.html ) to check the links, but as I said, I've never had a problem. Brady -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] php-html rendering
-Original Message- Quick question; If the site is updated with new pages/links is there anyway of specifying to HTTrack to get just the new pages or does it get the whole site again? Yes, there is an option to just update the downloaded site. I've never actually used that option though, so I'd take it for a test drive before counting on it. Brady -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Syntax to call a class' methods in your own class
This works: $rs= $this-conn-GetAll(SELECT title FROM content WHERE page_id= ?, $id); You can't iterate through an array like you are trying to do. Using the GetAll() function returns an array, you have to use the Execute() function to be able to iterate through $rs like you are trying to do: $rs= $this-conn-Execute(SELECT title FROM content WHERE page_id= ?,$id); This fails: while (!$rs-$this-conn-EOF) { // iterate through $rs } Try: while(!$rs-EOF) { // do whatever $rs-MoveNext(); } You may want to take a look at the phpgacl (http://phpgacl.sf.net) class, it has integrated ADODB so it may be a good example for you to follow. HTH, Brady -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PHP Notice: Undefined index
Any idea why this bit of code if(yes == $_POST['submitter']) { mysql_select_db($db,$myconnection); $sql = INSERT INTO `$db`.`$table` (name,email,comments,entrydate) values ('$name','$email','$comments','$entrydate'); mysql_query($sql) or die(print mysql_error()); } is provoking this message in my Apache error log? [Fri May 19 19:05:10 2006] [error] PHP Notice: Undefined index: submitter in /home/jtjohnston/domains/jtjohnston.ca/public_html/comments.php on line 29 Undefined index means that the index does not exist, ie: the submitter value is not being set when the form is posted. Check the form that is posting the data and make sure that there is a value for submitter. FWIW, usually when I get this error it's because I managed to spell something wrong.. HTH, Brady -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Warning: chmod(): Operation not permitted ?
chmod() can only change the permissions of files that are owned by the user running the command. In most cases, this is the user that the web server runs on. That confuses me, because who's the user here? Is it just the system administrator or the application? This is the user that Apache (or whatever webserver) is running as. If you're using Apache, look at your httpd.conf file to find out who that user is. If you're creating files successfully, you can just look at the owner of that file to find out who it is. Is safe_mode enabled? From the manual (http://us3.php.net/chmod): Note: When safe mode is enabled, PHP checks whether the files or directories you are about to operate on have the same UID (owner) as the script that is being executed. In addition, you cannot set the SUID, SGID and sticky bits. So, if you're running in safe mode, the php file, and the files that you need to modify have to be owned by the same user. Say you have process.php which is operating on the uploaded files, and it is owned by the jondoe user. The files that you wanted to chmod() would also have to be owned by jondoe, which is probably not the case. Apache is often run under the apache, www, or nobody user. HTH, Brady -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Session Array Disappears
You're missing the session_start() call at the beginning of your code. I'm surprised it works at all without that.. http://www.php.net/manual/en/ref.session.php http://www.php.net/manual/en/function.session-start.php Brady -Original Message- From: Webmaster [mailto:[EMAIL PROTECTED] Sent: Monday, April 24, 2006 1:49 PM To: php-general@lists.php.net Subject: [PHP] Session Array Disappears Hello, The site I'm working on works like this... Requires a login that uses sessions to remember username and email address. Upon being verified, the user is presented with a page that displays several questions regarding their background. Upon submitting the background page, a script checks to make sure all background questions were answered. If not, the page is redisplayed with a warning to answer all questions. If they are all present, a second page is displayed asking about a specific topic. Submitting the second page calls up the code provided below. In reading the www.php.net/manual/en/ref.session.php page, I'd like to point out we do not use cookies. The session id is propagated in the URL (although it's not visible in the URL bar). Also, session.gc_maxlifetime is set to 5400. We are using PHP 4.3.4. Not very often, but once in a while, I'll get an email warning me that a submission was denied because $_SESSION['Q'] is empty. I'm wondering, hoping and/or praying that someone out there can look at this small script and let me know if I'm doing something wrong with the built in function array_pop, perhaps I don't understand sessions at all or perhaps it is a server issue. It's very confusing because other session variables (name and email from the login page) are not emptied, just $_SESSION['Q']. Here's my code with some documentation: ?php /* $_SESSION['startQA'] contains 11 elements and is generated by a previous page in the site. Once the visitor clicks the page two submit button, the above SESSION variable comes into play again. This script takes that array of elements and does the following: 1. Assign session array to local array 2. Removes the last elemental value using array_pop 3. Removes the last elemental value using array_pop 4. Assign local variable the value of the a POST element 4a. Create a new session array and populates the first element equal to POST element 5. Runs through and populates the remaining 9 elements 5a. Total of 10 elements are now populated, 0 thru 9 6. Double checks the existence of each element 6a. if an element is missing, email me a warning and end program */ //Assign Session array to local variable // Step 1 $thisQarray = $_SESSION['startQA']; //Remove the last element of the original array // Step 2 $area = array_pop($thisQarray); //Remove last element of bgq array and assign to taking_test_at // Step 3 $from_location = array_pop($thisQarray); //Assign test version to variable // Step 4 $testVersion = $_POST['version']; //Start building the final Session Array // Step 4a $_SESSION['Q'] = array($testVersion); //Populate rest of Session Array // Step 5 for ($newBGQCounter=0; $newBGQCountercount($thisQarray); $newBGQCounter++) { $_SESSION['Q'][$newBGQCounter+1] = $thisQarray[$newBGQCounter]; } //test for existense of session array elements if ( ($_SESSION['Q'][0] == ) OR ($_SESSION['Q'][1] == ) OR ($_SESSION['Q'][2] == ) OR ($_SESSION['Q'][3] == ) OR ($_SESSION['Q'][4] == ) OR ($_SESSION['Q'][5] == ) OR ($_SESSION['Q'][6] == ) OR ($_SESSION['Q'][7] == ) OR ($_SESSION['Q'][8] == ) OR ($_SESSION['Q'][9] == ) ) { SEND ME AN ERROR EMAIL END PROGRAM } ? Thank you all very much, R -- 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] redirect using php
-Original Message- In JSP I have access to a function called sendRedirect() to send a user from one page to another, usually after some processing completed. Is there a similar function in PHP? Take a look at the header() function. http://php.net/header To redirect you can use: header(Location: http://www.example.com/;); Brady -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] HAXPLORER - any info?
-Original Message- Does anyone know anything about this, and if they do - have any thoughts on how it may have gotten on the server and how to secure against it in the future? Just trying to help out a friend here. Without knowing the exact setup of the server, we can't help much. Any service running on the system that allows people to access the system could be the culprit, or it could be weak passwords on the server, it could even be a piece of poorly written php code that allowed someone to get control. I would suggest that your friend make a list of the things he has running on his server and spend some time googling for security issues with those services/programs. Brady -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] mysql_fecth_array() and function call as parameter
I have done the following to my code hoping that the fix would work $query1 = mysql_query(SELECT months FROM Month WHERE m_id = month(curdate())); //echo $query1 . br /; $query1_data = mysql_fetch_assoc($query1); echo $query1_data . br /; returns Array (The word that is) Use: print_r($query1_data) or var_dump($query1_data) to see everything in the array. If you want to use echo, you'd have to echo each index of the array one at a time with something like: echo $query1_data[0]; http://php.net/echo http://php.net/print_r http://php.net/var_dump switch ($query1_data) { You can't switch on an entire array. Switch is used to check the value of a variable (which could be an index of the array, but not the entire array). Something like this should work: switch($query1_data[months]) { } http://php.net/switch In your original posting you have lines like the following in your switch statement: if($query2 == 31) As someone mentioned, mysql_query returns a resource ID, you then have to use mysql_fetch_assoc (or one of the other mysql_fetch_* functions) to get an array that you can use as you are trying to do. So after doing: $query2_data = mysql_fetch_assoc($query2); You could do: if($query2_data[dayNum] == 31) In your switch statement you are checking for the full name of the month, but your query will be returning the month number. Since you don't have a default case on your switch statement, $return is never being set, so $month = $this-determineMonth(); is not setting $month to anything, which is why you are getting error messages. http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html Brady -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] mysql_fecth_array() and function call as parameter
-Original Message- I finally got the function to work. However I have a problem with another function. It is almost exactly like the origional function but in this function I am determining the days instead of the month. I made the same changes to the days function as I did to the month function. However no value is being set to be returned. I can't find my error. My function is below: snip switch ($query1_data[months]) { case January: case March: case May: case July: case August: case October: case December: Once again, in your switch statement you are checking for the full name of the month, but your query will be returning the month number. Since you don't have a default case on your switch statement, $return is never being set, so $day = $this-determineDay(); is not setting $month to anything, which is why you are getting error messages. http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html Brady -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] deleting muliple feilds from a table using an array
-Original Message- example code: //implode the value of the submitted form //$del will look like 38, 40, 43 $del = implode(,, $idd); //create query for the deletion of values from submited form $query = delete From news where id = '$del'; //execute query mysql_query($query) or die(mysql_error()); //echo sucess message echo(bcenterThe Post has been deleted.../b/center); here is what my problem is... This code will only delete the first value of $idd. what i think is wrong is i have the incorrect syntax to delete multiple feilds from a table if some one can help me it would be greatly appreactiated. $query = delete From news where id IN($del); Take a look at http://dev.mysql.com/doc/refman/5.0/en/where-optimizations.html. The user comments are helpful. Brady -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Creating a Window without JavaScript that is on top
Personally, I think that posting a way to allow php to communicate with javascript OR any other language is relevant for a php-general list, don't you think? To use the value of a PHP variable in javascript, you create a javascript variable and then echo the value of the php variable. For example: Say you have a $price variable set in your PHP script and you want to use that in a JavaScript. ?php $price = 50; ? script language=javascript type=text/javascript var price = ?php echo $price; ?; /script Assuming you put this in a .php file, PHP will parse the file and echo the price before the javascript makes it to the browser, so if you look at the source of the document you'll see: script language=javascript type=text/javascript var price = 50; /script HTH, Brady -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: PDFLib or some free solution?
-Original Message- [EMAIL PROTECTED] wrote: Hi, I have to create some flyers and invoices (simple stuff) in one my project. Could you please give me some directions? Take a look at http://ros.co.nz/pdf/. It hasn't been updated for awhile, but it works great as is. I'm using it to generate nametags and reports in various applications. Brady -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PDFLib or some free solution?
-Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 21, 2006 7:27 AM To: Pure Web Solution Cc: [EMAIL PROTECTED]; php-general@lists.php.net Subject: Re: [PHP] PDFLib or some free solution? As I said in prev post, there is a problem with converting HTML to PDF: FAQ 19. Can I convert an HTML page to PDF with FPDF? Not real-world pages. But a GPL C utility does exist, htmldoc, which allows to do it and gives good results: http://www.htmldoc.org Does it has anything with building flyer using php and html tags? I've started looking at htmldoc for some upcoming projects. You can generate a flyer (or any other kind of document you want) using HTML and convert it to HTML very easily. Take a look at http://www.easysw.com/htmldoc/examples.php for examples using htmldoc. Brady -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Advice updating MS Access data to remote MySQL host that only allowslocal access
-Original Message- I wonder if anyone has any ideas? As I can't just run an update locally and connect to the remote MySQL host, I was scheduling a periodic export of an access table to csv format, ftping it to the server, and then running an update script on the remote host (simplehost.com). It just seems convoluted, and frought with difficulties. There has to be a easier way to update the transaction status table? First schedule an automatic upload of the .mdb file to the server. (Not sure how to do this, google is your friend for this part.) Then write a PHP Script that will: 1 - Connect to the Access DB and query for the data you need 2 - Insert that data into the mySQL database Then schedule a cron job to run the script at a set time each day (or whatever frequency you need). Take a look at the ADODB Class (http://adodb.sf.net) for connecting to MS Access from PHP. I used it once for a project where I had to use an Access DB and it was actually pretty smooth. I now use ADODB for all of my DB connections. :) HTH, Brady -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] no newline after ? in the resulting HTML
Why there is no newline afer pHello World/p ? Is it a PHP bug or the tutorial should be updated? The tutorial is fine. The sample code mentioned: html head titlePHP Test/title /head body ?php echo 'pHello World/p'; ? /body /html Contains a line break after the pHello World/p is echoed . Check your code, if you don't have that line break, PHP is not going to create it for you. Brady -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] testing text body emails
If you have a linux box, use mutt or pine. Also, most Windows mail clients allow you to turn off HTML mail. Check your client documentation / help files. Brady -Original Message- From: Mark Steudel [mailto:[EMAIL PROTECTED] Sent: Monday, February 13, 2006 1:40 PM To: php-general@lists.php.net Subject: [PHP] testing text body emails Im using phpmailer to send emails, with htmlbody and an alternate textbody. Any suggestions on how to test the text only body? Thanks, Mark -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] can't output sql query with php code.
?php echo 'select name=month \n'; $month_query = mysql_query(SELECT m_id, months FROM Month); while ($r = mysql_fetch_array($month_query)); Remove the semi-colon at the end of the above line and it works like a charm. { $v = $r[m_id]; $out = $r[months]; echo option value=$v$out/option\n; } echo '/select\n'; ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Missing characters
Example Page1.php === $name_pro = VC++ V2.4 print td width='200' class='texto2' a href='page2.php?page=value=$name_pro' $name_pro /a/td; Use urlencode (http://php.net/urlencode): print td width='200' class='texto2' a href='page2.php?page=value=.urlencode($name_pro).' $name_pro /a /td; Brady -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] can't output sql query with php code.
Doesn't work - ?php $month_query = mysql_query(SELECT m_id, months FROM Month); while ($row = mysql_fetch_array($month_query)) { $val = $row[m_id]; $out = $row[months]; echo option value=$val$out/option; } ? You're missing the select tags. while ($r = mysql_fetch_array($Equip_query)) { $val = $r[equip]; echo option value=$val$val/option\n; } On a seperate note, if all you are doing with the $val variable is using it to echo, it's not needed. Put brackets { } around the var to echo ie: {$r[equip]} - makes it easier to read later when you come back to tweak your code. Brady -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Need some PHP file retrieval magic....
-Original Message- I need to take a web site done in ASP, retrieve it, change the .asp to .html, make sure that the links don't break, make sure that query strings get coverted, etc, etc, etc so that I can take a portion of the current (*SHUDDER*) web site and place it on CD's so that our reps can have electronic catalogs. Previously this was all done somehow by hand, but the former idiot didn't document the process. This is not a PHP solution by any strech, but have you considered using something like the HTTrack Website Copier? (http://www.httrack.com/) I've used it to generate a copy of websites that were then burned to CDs for presentations. It works very well and is available for several platforms. Sorry that this is not PHP related, but in my mind it's a question of using the right tools for the job. Brady -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Embedded Player
-Original Message- My reason for using an embedded player was basically just for design purposes, but perhaps that is not a good idea. I did not consider the fact of not being able to leave the site while listening, and since these are as long as 40 minutes, this might get annoying. Perhaps keeping your current setup and adding a link that opens an embedded player in a popup window would be a good compromise. That way people who just want to stream the sermons can do so, and with the player in a popup window they could still surf the web while listening. As far as file format, it might be worth looking into using the OGG Vorbis format. There are players on Windows/Mac/Linux that support the format and it uses compression, so the file sizes should be a bit smaller than mp3s. Take a look at http://www.vorbis.com/ for more info. Just some ideas.. Brady -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] printing keys and values of array
-Original Message- i need some help with printing an array, i would like to print the keys and the values of them example : I use the dump_array posted by examancer at the following address: http://www.phpbuilder.com/board/showthread.php?t=10213508 when debugging, it should work well for you. Brady -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Weird html - No real cr
Hi Yes, but I assume that echo hrKontroll rad i textfil:$rowsInTextFile av $totalRowsInTextFilebr; would render a newline ? /G Echo does not automatically add a newline, you would have to use \n to get newlines with the echo statement: echo hrKontroll rad i textfil:$rowsInTextFile av $totalRowsInTextFilebr; Will display the line break in the webpage as expected, but to get the source code displayed to have the line break you would need to use: echo hrKontroll rad i textfil:$rowsInTextFile av $totalRowsInTextFilebr\n; Brady -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php