[PHP] Adianti Framework is released
Hi folks, Adianti Framework (www.adianti.com/tools) is a project being developed since 2007 by Adianti Solutions Ltd. The framework creator, Pablo Dall'Oglio says that the central idea of the framework is making agile the developement of enterprise applications. To do that, the framework has many visual components ready to be used, besides a productivity environment, Adianti Studio, that allows to design interfaces for the application. The framework also allows to create both Web Applications and Desktop Applications (using Gtk engine). This way, the developer needs to write just one code, and the result can be seen under the browser and also as a standard desktop application. The framework page brings a couple of tutorials. Three applications are made available as example. One live tutorial, one application for library management, and one issue management system. Source: Adianti Solutions (http://www.adianti.com)
Re: [PHP] Apache module PHP 5.3 on Windows
Sorry my mistake, I was looking in the wrong built. Thank you! - Original Message - From: "Adam Shannon" Newsgroups: php.general To: "Jonathan Tapicer" Cc: "Pablo Viquez" ; Sent: Wednesday, July 01, 2009 5:50 PM Subject: Re: [PHP] Apache module PHP 5.3 on Windows Yes, you need to use the V6 installer, I did the same thing with the V9 and it won't work. Only after uninstalling PHP did I see that line of text saying which one to use... On Wed, Jul 1, 2009 at 5:54 PM, Jonathan Tapicer wrote: What version, VC6 or VC9, TS or NTS? I use VC6 TS and the dll is there... On Wed, Jul 1, 2009 at 7:31 PM, Pablo Viquez wrote: > Hi, > > I just downloaded the new stable version of PHP 5.3 and I couldnt find the > php5apache2_2.dll file. > > Is the apache module on windows no longer supported? > > Thanks! > -- > 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 -- - Adam Shannon ( http://ashannon.us ) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Apache module PHP 5.3 on Windows
Hi, I just downloaded the new stable version of PHP 5.3 and I couldnt find the php5apache2_2.dll file. Is the apache module on windows no longer supported? Thanks! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] problem with string & floats in PHP
Hello, Im designing a website in which I have to read some data (numbers) from a txt file and then send this data to a function which prints a graphic with them. When I read the data I save it in an array and the numbers are in this format: 5.812E-08. I have read the php documentation about it, and I have use the example given there to check which type is the data saved in the array. The response I got is $vectorIc[1]== 5.812E-08 type is string I dont understand why. In the documentation it is clear that this kind of data should be considerer float, or thats what I understood. I cant continue with my web designing if I dont get to turn the vector elements into float numbers, because the function that prints the graphic gives errors when recieving strings. I would be very thankful if you could help me trying to solve this. In using PHP 4.4.7 and Apache 2.0.59. Thank you very much! _ Descubre la descarga digital con MSN Music. Más de un millón de canciones. http://music.msn.es/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] About exec function
Hello, I'm designing a website with php and the critical point of the design is to execute a program in the server, so after execution is finished, server will show the client some data and info. The program is called pspice, which analizes electronic circuits, works in msdos and in order to call him you need to write in the command the input file (which is created before we call the program) and the output file, which can have the same name as the input file, since they have a different extension. If everything works correctly after the execution of the proper command, a .out (the output file written in the command) file should be created with the data the server would later provide to the client. I have got to execute the program using the line: exec('c:\WINDOWS\\SYSTEM32\\cmd.exe /c start c:\\PHP\\PSPICE\\pspice1.exe ej1 ej1') The problem I have is that the execution never ends. The cmd window with the execution of the program appears and never ends, just keep simulating (and the execution should be over in less than a second). The .out file is created but it is empty. How can I make the execution of the program stop and continue executing the rest of the code of my php file? Thanks! _ Descubre la descarga digital con MSN Music. Más de un millón de canciones. http://music.msn.es/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Programacion orientada a objetos
HI Jairo! This is a list only in english. Please, check other list in spanish. Esta es una lista en inglés. Por favor, verificá otras listas en español. JP On 1/31/07, Jairo Torres <[EMAIL PROTECTED]> wrote: Señores buenas tardes. Tienen un buen ejemplo o manual para programación orientada a objetos en PHP con MySql. Muchas gracias. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Script to generate a site thumbnails
Hi People, I'm needing a script that generate a site thumbnail from a given URL. Anybody can help me? Thanks, -- Pablo Lacerda de Miranda Graduando Sistemas de Informação Universidade Estadual de Montes Claros [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Book Recommendation
Man, Anothers good books: - PHP|Architect's Guide to PHP Design Patterns, ISBN: 0973589825 - PHP 5 Objects, Patterns, and Practice, ISBN: 0973589825 On 4/8/06, Jim Lucas <[EMAIL PROTECTED]> wrote: > Paul Goepfert wrote: > > Hi all, > > > > Can anyone tell me a good php book to buy. I already have Web > > Database Applications with PHP & MySQL by O'Reilly. > > > > Thanks, > > Paul > > > > > Professional PHP5 by WROX > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Problem with require_once
Hey Guys, I have the code below: $file = $_SERVER['HTTP_REFERER'].'util/ClassUtil.php'; echo $file.''; require_once($file); $service = ClassUtil::loadClass('service.FormularioService'); And the output in browser: http://localhost/egressos/util/ClassUtil.php Fatal error: Class 'ClassUtil' not found in /home/pldm/projetos/egressos/src/controller/Controller.php on line 27 But, the file that I pass to require_once exist in the server... If someone know the problem, please sende a answer... Thank you, Pablo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Security Issues - Where to look?
[snip] I've heard that php is not particularly secure, making it problematic if you intend to create a web site with commerce, etc. Is there a particular news group that addresses security issues? I'm looking for some guidlines on ensuring that my site is secure from malicious hackers. [/snip] It's not so much that PHP is not particularly secure, but rather that some of the people who use it don't know how to make it work in a secure manner. Configured and coded properly a PHP application can be very, very secure. However, without careful configuration and good coding it's also possible to create very, very insecure applications using PHP. Or .NET. Or Java. Or Cold Fusion. Or JSP. It's not the technology that's insecure, but the method by which it's implemented. Why not check out these links: http://www.google.ca/search?q=php+security http://www.devshed.com/c/a/PHP/PHP-Security-Mistakes/ http://phpsec.org/ Cheers, Pablo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Using the echo tag...
[snip] I'm relatively new at coding PHP but I was hoping someone can help me with this. I'm trying to write the following code into my program but each time it runs, I get an error message. Can anyone help? print <<<< EOF $_SERVER['PHP_SELF'] EOF; Say that was a part of a HTML Form action tag, everytime I try to run it, I get an error message am I doing something wrong or do I have to break out of the here document to use this syntax? [/snip] What's the error message you're getting? That will be most helpful in trying to diagnose the problem. Likely, though, is the fact that you're trying to output $_SERVER['PHP_SELF'] within your heredoc syntax, without wrapping it in curly braces. It should be: {$_SERVER['PHP_SELF']} See http://www.php.net/manual/en/language.types.string.php#language.types.st ring.syntax.heredoc for more info. Cheers, Pablo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] protect password?
[snip] pablo... i fail to see how your suggestion is much more secure than placing the user/passwd information in a file that's outside the web access space, and then including the file. in either case, the user wouldn't be able to read the include file. [/snip] Greeting, Bruce. On a dedicated server there wouldn't be much difference. However if the site in question were on a shared host (which is usually the case) there would be a huge difference. On shared hosts since files to be included need to be readable by the user the server runs as their permissions must be set to: -rw-r--r-- And since every one else who has a site on the same server must also have files to be included set to be readable by the server user, one could easily write a trolling script to traverse the directories of other users on the site and grab whatever info they needed. The shared host I use for my personal site used to have this problem until I made them aware of it. In less than two minutes I was able to find several database usernames and passwords. They've since made changes to eliminate this problem. All that needs to be done is secure up the directory permissions and the problem goes away. By setting the file readable only by root this problem is completely eliminated. Unless a hacker has the root password, they will not be able to compromise the information in this file. This is how I understand it, at least. If Chris reads this perhaps he can confirm this for me? Cheers, Pablo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] protect password?
[snip] Some functions need you to provide username and password, for instance odbc_connect. Even though the username/password just has minimum access privileges to the resource, putting it there in clear text in a script gives me heartburn. How do people handle username/password in such kind of cases? I'm sure there must be some way to store critical information in some encrypted format but it's still readable to scripts for authentication purpose. But don't know how. Any ideas or pointer would be greatly appreciated. [/snip] Some time ago Chris Shifflet provided a nice suggestion on how to make your passwords more secure. It's still not rock solid, but far better than storing them in clear text. The methodology I present below (which Chris presented originally) assumes Apache as your web server. Though I've recently gotten into IIS administration I'm not sure of how you would specifically do this under IIS. Create a file outside of your webroot, and in it use SetEnv declarations to set a username and password as environment vars. SetEnv dbname username SetEnv dbpass password Chown this file such that it is only readable by root, and then (assuming you're on a shared host) have it included in your virtual host block of the server config file. If you're on a dedicated box include it in the configuration section for the site in question. Then when the server is restarted you will be able to access the username and password via $_SERVER['dbuser'] and $_SERVER['dbpass'] in your scripts. As the first response to your post, not exactly what you were looking for, but much more secure than plain text or even simple include files. HTH. Cheers, Pablo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] extracting foo.bar from path/to/file.php/foo.bar
[snip] What do I need to do to extract foo.bar from path/to/file.php/foo.bar [/snip] The manual is your friend ;o) http://www.php.net/basename/ HTH, Pablo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] reg ex help
[snip] The problem with that is there are about 40 different listings in the one field. Silver Small Corp;X^%\n#\n Gold Medium Corp;RE^%\n#\n Platinum Large Corp;YRE^%\n#\n being three of them so maybe this is a bettter way of listing it ... Silver Small Corp;X^%\n#\nGold Medium Corp;RE^%\n#\nPlatinum Large Corp;YRE^%\n#\n ...[/snip] Try this: $values = array(); // we'll put the extracted vars here $str = "This is supposed to be your string"; $tmpStr = explode("#\n", $str); foreach ($tmpStr as $foo) { if (strlen(trim($foo)) > 0) { array_push($values, substr($foo, 0, strpos($foo, ';'))); } } HTH, Pablo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] reg ex help
[snip] New to php so please bear with me. I'm trying to parse through a field that has some information in it, the information is stored with other information and is delimited in a certain pattern so I figure using reg ex I can get the information I want out of the text. So here is an example. Silver Small Corp;X^%\n#\n Gold Medium Corp;RE^%\n#\n Platinum Large Corp;YRE^%\n#\n Reall all I need is the information on Silver Small Corp, etc and the X all the rest is gibberish. Is Reg Ex the best way to do this or would it be some other way.[/snip] If the number of semi-colons is fixed, then explode will do the trick. $foo = 'Silver Small Corp;X^%\n#\n'; $bar = explode(';', $foo); echo $bar[0]; However if the number of semi-colons is not fixed, then substr in conjunction with strpos will do the trick. $foo = 'Silver Small Corp;X^%\n#\n'; $bar = substr($foo, 0, strpos($foo, ';')); echo $bar; HTH, Pablo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] private properties problem
Today I discovered a possible serious problem with the way the latest PHP versions handle private properties. Given the following code: function Test() { $this->var1 = 10; } } $c = new FinalClass(); $c->Test(); print_r( $c ); ?> I get the following result: FinalClass Object ( [var1:private] => 0 [var1] => 10 ) Now... PHP should have displayed an error when I was trying to set a value to this private member from the parent class. No error message was displayed. It created a local member which holded the value 10. But when trying to access this value from the parent class, it is not there. I think PHP should notify of the problem but it is not doing so. I have my error reporting level on E_ALL. Any ideas? Pablo Godel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Regex Help
Greetings folks. Thanks Murray and Philip for the quick responses. Adding the /s modifier worked perfectly. Cheers, Pablo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Regex Help
Hi, folks. I'm having trouble with a simple regex. I'm sure it's just something small that I'm missing but nothing I'm trying is working. In an HTML file I have comments like this: various html crap here Here's the regex I'm using: /(.*?)/ And then the call to preg_match_all(): preg_match_all($printable_reg, $str, $out); It's been quite a while since I've worked with regular expressions so I'm not sure what the problem is. The regex isn't throwing errors, it's just not matching the content located between the start print and end print comments. Can anyone lend a hand or give some advice? Cheers and TIA, Pablo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Fwd: [PHP] Error Handling
Hello Chuck On 9/9/05, Chuck Brockman <[EMAIL PROTECTED]> wrote: > What is a good way to capture errors that occur. I've tried the > following code in development, but it still spits out an error (Parse > error: syntax error, unexpected '}', expecting ',' or ';' in > X:\\\.php on line 7) > > // error handling test > > try{ > $test = 1; > echo $test1 > } Ooppsss You're missing a ; yoy might: echo $test1; } Good luck -- Pablo M. Rivas. http://www.pmrivas.com http://www.r3soft.com.ar --- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] enabling OpenSSL and curl for PHP on IIS
On Wed, 2005-08-24 at 23:30 +0200, Edin Kadibasic wrote: > Pablo Gosse wrote: > > I've tried that and that just results in PHP grinding to a halt. Any > > requests to PHP pages simply result in "Document contains no data" > > errors. > > Have you added c:\php to your system PATH? > > Edin Yup. c:\php is in the system PATH, just as described here: http://www.php.net/manual/en/faq.installation.php#faq.installation.findphpini and I also tried creating the PHPRC environment var as described here: http://www.php.net/manual/en/faq.installation.php#faq.installation.phprc to no effect. It's simply not reading the changes. I've even commented out the openssl and curl lines, and am now just changing the value of allow_url_fopen to Off, but that's not working. NOTHING seems to have any effect. Anyone else have any suggestions? This is very, very strange (and incredibly frustrating ...) Cheers and TIA, Pablo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] enabling OpenSSL and curl for PHP on IIS
On Wed, 2005-08-24 at 14:05 -0400, Marco Tabini wrote: > On 8/24/05 11:39 AM, "Pablo Gosse" <[EMAIL PROTECTED]> wrote: > > > Can anyone give any insight into what might be going wrong here? > > I think you just need to move your php.ini file to C:\WINDOWS... PHP is > looking for it there. > > Cheers, > > > Marco > > I've tried that and that just results in PHP grinding to a halt. Any requests to PHP pages simply result in "Document contains no data" errors. I've tried changing the registry entry for IniFilePath to c:\windows and moving the php.ini file there, but the same thing results - PHP just hangs and the pages return nothing. Other pages on the server work fine. Any other ideas? We really need to enable OpenSSL and curl and it's kind of difficult when you can't effect any changes to the php.ini file! Hoping someone can offer some advice here ... Cheers and TIA, Pablo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] enabling OpenSSL and curl for PHP on IIS
Hi, folks. I'm forced to work on a project using MS Access and running on IIS on a Windows Server 2003 box. I've uncommented the following lines in php.ini: extension=php_curl.dll extension=php_openssl.dll but even after I restart IIS I'm not seeing the changes reflect when I view the results of phpinfo(). One thing that I find strange is that when I look at phpinfo() I see the following: Configuration File (php.ini) Path C:\WINDOWS yet there is no php.ini file under C:\WINDOWS, rather it's in C:\php Can anyone give any insight into what might be going wrong here? Cheers and TIA, Pablo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] exec ping
On 8/21/05, Jasper Bryant-Greene <[EMAIL PROTECTED]> wrote: > Juan Pablo Herrera wrote: > > Thanks Jasper, > > well, i need make a explode of results of the ping. The idea is check > > a host and when the host don´ t response send a email. > > I don't explode the result of the ping. > > If it was me, I'd try opening a socket connection to the host instead, > and check to see if you can connect or not. Whether or not that is > suitable to your application I don't know... > > Jasper > Hi! I did following script: It's very simple, but i think that is working. I will add other options. JP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] exec ping
On 8/21/05, Jasper Bryant-Greene <[EMAIL PROTECTED]> wrote: > Juan Pablo Herrera wrote: > > Hi all! > > I have following script: > > $comando = system('ping 168.192.0.1', $nn); > > echo $nn; > > Well, i need that only show the first ten lines of the ping and kill > > the process. > > How can i make it? > > If I understand your question correctly... > > $comando = system('ping -c 10 168.192.0.1', $nn); > > Jasper > Thanks Jasper, well, i need make a explode of results of the ping. The idea is check a host and when the host don´ t response send a email. I don't explode the result of the ping. Thanks., JP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] exec ping
Hi all! I have following script: $comando = system('ping 168.192.0.1', $nn); echo $nn; Well, i need that only show the first ten lines of the ping and kill the process. How can i make it? Regards, JP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] RE: Problem using Metabase
[snip] I suspect that the problem is with file permissions. I recall that since Metabase uses include to load class files, the script will not exit when it fails to include a PHP class file. Assuming that is the case, make sure that all Metabase class files are readable by your Web server user. [/snip] The permissions seem fine. However, I've discovered something else. I was able to use Metabase without any trouble on a linux server to access a Postgres database. I then removed the call to MetabaseSetDatabase and changed the drive to odbc-msaccess, and the errors returned. Changed it back to pgsql or mysql and the errors go away. I just now tried this on the IIS box and got the same results. If I specify postgres I get an error telling me that postgres is not enabled in that php implementation, and if I specify mysql it works fine. If I change it back to odbc-msaccess, the errors are there. So, the error message I get is only triggered when I specify Access as the database. Does this provide any further insight? Cheers and TIA, Pablo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] RE: Problem using Metabase
[snip] It must be something in our PHP configuration that's causing the problem, but I'm pretty sure we have a cache extension installed. This PHP install was done rather quickly, unless there's a cache extension installed by default (which there is not as far as I understand, but I could be wrong ...) we likely didn't install one. [/snip] Sorry, I meant to say that we likely DO NOT have a cache extension installed. Can anyone think of any other reason why the order in which the class files are loaded would be changed on one server to the next? Cheers and TIA, Pablo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] RE: Problem using Metabase
[snip] > Here's my code: > > require("classes/metabase/metabase_database.php"); > require("classes/metabase/metabase_interface.php"); > > $error=MetabaseSetupDatabaseObject(array("Type"=>"odbc-msaccess", > "IncludePath"=>"classes/metabase"), $db); > > if($error!="") { > echo "Database setup error: $error\n"; > exit; > } > > $db->SetDatabase("etrakADB"); I tried that code here with PHP 4.3.11 and it works perfectly. Which version of PHP are you using? Are you using any PHP cache extension like APC or another? Metabase loads the class files by the right order but it is possible that a buggy caching extension may be causing that problem. You may also try loading the classes as workaround right after the includes you make in your script: require('classes/metabase/metabase_odbc.php'); require('classes/metabase/metabase_odbc_msaccess.php'); require('classes/metabase/manager_odbc.php'); require('classes/metabase/manager_odbc_msaccess.php'); [/snip] Thanks, Manuel. I tried what you suggested but it didn't work. The server this project is housed on is an IIS server running PHP 4.4.0. I installed the metabase package on a linux server, and was able to connect to a postgres database with no troubles at all. It must be something in our PHP configuration that's causing the problem, but I'm pretty sure we have a cache extension installed. This PHP install was done rather quickly, unless there's a cache extension installed by default (which there is not as far as I understand, but I could be wrong ...) we likely didn't install one. Thanks, Pablo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Problem using Metabase
Hi, folks. I've recently decided to use Manuel's Metabase instead of ADOdb as ADOdb doesn't support transactions for MS Access, however I'm getting the following error when running the sample code: Fatal error: Class metabase_manager_odbc_class: Cannot inherit from undefined class metabase_manager_database_class in C:\Inetpub\wwwroot\etrakFE\classes\metabase\metabase_odbc.php on line 13 Obviously this means that the metabase_manager_odbc_class is being defined before metabase_manager_database_class, thus throwing an error, but the problem is I'm not calling this manually, and have used the sample code exactly as it is in the manual. Here's my code: require("classes/metabase/metabase_database.php"); require("classes/metabase/metabase_interface.php"); $error=MetabaseSetupDatabaseObject(array("Type"=>"odbc-msaccess", "IncludePath"=>"classes/metabase"), $db); if($error!="") { echo "Database setup error: $error\n"; exit; } $db->SetDatabase("etrakADB"); Does anyone have any idea why I might be getting this error? As I said I'm using the sample code exactly as it is in the tutorial, and am not calling the metabase_manager_odbc_class myself. Cheers and TIA, Pablo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP, MS Access & Transactions
Hi, folks. I have the unfortunate task of writing a PHP front-end for a client-server application that is back-ended in MS Access. I've tried using the transaction functionality in ADOdb (PHP implementation of ADO) but it doesn't work seem to work correctly, even though it says it does. If I intentionally submit a malformed query as part of a series of inserts, the ADOdb transaction supposedly rolls back, but when I look at the database, the inserts carried out before the error occurs are still there. Does anyone know if it's possible to use transactions with Access via PHP? Cheers and TIA, Pablo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] header redirect not working
[snip] I can think of a few, and my first instinct is to check to see whether your script produces any errors in one environment that it doesn't in the other. If you're displaying errors, they can affect the behavior of your scripts when you're also using header(). Replace header() with echo and compare the behavior. Also, comparing php.ini can help you identify differences in configuration. Configuration directives can be modified through other means, but this is a good starting point (and a good candidate for version control anyway - inconsistencies can cause you to waste time and effort).[/snip] Hi, Chris. I turned on error reporting for that script in production and no errors occurred. However, and this is even stranger to me, if I add the following after the call to header() die('foo'); the page redirects to the correct url. I remove die('foo'); and it redirects to itself again. I'll take a look at the two ini files to see if I can spot any differences, but I'm stumped as to what in there might cause just this one page to redirect to itself rather than the prescribed URL. The form submits to a controller url, and then is validated using a form generation/validation class I use for all my applications. If the validation fails it redirects back to the form page, with the appropriate form id appended to the url. If the validation succeeds, the delete event method is called, at the end of which the redirect back to the main event page should occur, but is not for some reason, unless I add that line of code after it. I know the form is validating since the event is deleted, since, well, it is deleted, and there is no form id appended to the url when it is redirected. Any other ideas? Thanks, Pablo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] header redirect not working
[snip]Can you place the following code just before the header() line, and post what it prints? die($this->CMS_base_path); In other words, tell us what the $this->CMS_base_path field contains when that line is executed.[/snip] It contains 'https://cms.mydomain.com', which is what it is supposed to contain. It's redirecting to the correct domain, just the incorrect page. Thanks, Pablo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] header redirect not working
Hi, folks. I'm running into an incredibly bizarre problem with a header() redirect of which I cannot see the cause. We have a CMS here where I work, in two separate production and training environments. Last night I implemented a new events manager module, copying all necessary files from training to production, adding database tables, etc. etc. Everything worked, except for one redirect which happens after a user deletes an event. For some reason, the redirect is simply reloading the event detail page from which the user clicked the delete link. But the truly bizarre thing is that in the training environment it works!!! There is nothing different between the two files except for '-test' being added to the subdomain (so it's cms-test.mydomain.com instead of cms.mydomain.com) in any full paths. The code that deletes the event, and then redirects the user is: $conn->Execute("delete from cms_events where e_id = {$fd['e_id']}") or $this->CMS_error(2,$this->mod_name,$query,$conn->ErrorMsg()); header("Location:{$this->CMS_base_path}mods/events_manager/cms.events_ma nager.dsp.php"); Not to much to see here. If the query doesn't execute the CMS_error method is called, and the header would never be reached. However, the query does execute, the event is deleted, but instead of going to the appropriate location, it's simply redirecting back to: /mods/events_manager/cms.events_manager.event_detail.dsp.php?e_id=15 where 15 is whatever the number of the event that was just deleted was, and ergo it brings up an "Invalid event" error, and the user can then click a link at the bottom of the page to go back to the main events manager page. Can anyone think of any reason why the above code, just those two lines, would redirect correctly in one environment, yet simply redirect to the currently existing page in another? There are a number of other redirects in the events module that are working fine, so why this one would work in the training environment and not in the production environment is mystifying me. Cheers, and thanks very much in advance for any help. This one hurt my brain this afternoon. Pablo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Feedback on the various PHP-MVC implementations
Hi, folks. I'm looking for some feedback on a couple of the php mvc implementations out there. The two that I've seen referenced the most are php.MVC (http://www.phpmvc.net) and Phrame (http://phrame.sourceforge.net). I've looked around and found some okay opinions on both, but I'd really like to hear from some people on this list who have used one or both directly, or any other MVC frameworks that you feel are worth mentioning. I've looked through the archives but have not found much from people who have actually implemented any of these frameworks, just mainly comments of what they look like on the surface. If anyone here has any direct experience with either of the above frameworks, or with any other stable, mature frameworks please let me know. Cheers and TIA, Pablo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] mozilla & urlencode
echo "district)."\">"; http://foo.org/_private/directory.php#Montr%E9al+District+%234 works in IE6, but Mozilla will not accept it. Mozilla does not work. Am I approaching this wrong? Should I create my HTML this way? echo "district."\">"; If I do, Mozilla prferes this: http://foo.org/_private/directory.php#Montr%E9al%20District%20#4 or http://foo.org/_private/directory.php#Montr%E9al%20District%20%234 IE refuses it and prefers: http://foo.org/_private/directory.php#Montr%E9al+District+%234 I'm not sure, but I see two things that might be causing this. First, why are spaces, which should be translated as %20, being represented as a '+'? Second, you have a # in the actual bookmark name, which I would assume is not valid since the # denotes the beginning of a bookmark. So perhaps IE compensates for this, but Mozilla reads the bookmark as looking for because of the #4 at the end of the bookmark name. HTH, Pablo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP and SSH
Hi, folks. Has anyone had any issues using PHP with the libssh2 library? I had my sysadmin install it, but he's not certain we should be developing against it in a production environment since it's still alpha (0.10). I'm looking for opinions as to whether anyone out there has run into problems developing against it, or if the general consensus is that there are no critical concerns about using it as a core part of a large project. I personally don't think there are, since I don't think that PHP would have bindings to this library if it weren't, but I want to have some other feedback to give to my sysadmin? Anyone have any opinions? Cheers and TIA, Pablo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] array_diff odities
Howdy folks. I'm running into something strange with array_diff that I'm hoping someone can shed some light on. I have two tab-delimited text files, and need to find the lines in the first that are not in the second, and vice-versa. There are 794 records in the first, and 724 in the second. Simple enough, I thought. The following code should work: $tmpOriginalGradList = file('/path/to/graduate_list_original.txt'); $tmpNewGradList = file('/path/to/graduate_list_new.txt'); $diff1 = array_diff($tmpOriginalGradList, $tmpNewGradList); $diff2 = array_diff($tmpNewGradList, $tmpOriginalGradList); I expected that this would set $diff1 to have all elements of $tmpOriginalGradList that did not exist in $tmpNewGradList, but it actually contains many elements that exist in both. The same is true for $diff2, in that many of its elements exist in both $tmpOriginalGradList and $tmpNewGradList as well. Since this returns $diff1 as having 253 elements and $diff2 as having 183, it sort of makes sense, since the difference between those two numbers is 70, which is the difference between the number of lines in the two files. But the bottom line is that both $diff1 and $diff2 contain elements common to both files, which using array_diff simply should not be the case. However, when I loop through each file and strip out all the tabs: foreach ($tmpOriginalGradList as $k=>$l) { $tmp = str_replace(chr(9), '', $l); $tmpOriginalGradList[$k] = $tmp; } foreach ($tmpNewGradList as $k=>$l) { $tmp = str_replace(chr(9), '', $l); $tmpNewGradList[$k] = $tmp; } I get $diff1 as having 75 elements and $diff2 as having 5, which also sort of makes sense since there numerically there are 70 lines difference between the two files. I also manually replaced the tabs and checked about 20 of the elements in $diff1 and none were found in the new text file, and none of the 5 elements in $diff2 were found in the original text file. However, if in the code above I replace the tabs with a space instead of just stripping them out, then the numbers are again 253 and 183. I'm inclined to think the second set of results is accurate, since I was unable to find any of the 20 elements I tested in $diff1 in the new text file, and none of the elements in $diff2 are in the original text file. Does anyone have any idea why this is happening? The tab-delimited files were generated from Excel spreadsheets using the same script, so there wouldn't be any difference in the formatting of the files. This one has me confused as I really thought the simple code posted above should have worked. If anyone can pass along any advice I would greatly appreciate it. Cheers and TIA, Pablo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] html editor written in PHP
Has anyone seen an example of a HTML editor written in PHP (no JS)? You know the ones - for adding HTML tags to a text field, etc. I think what you're asking for is a logical impossibility. PHP is server side, so without javascript a browser-based wysiwyg editor would be impossible, since there would be no client-side functionality to respond to any action by the user. If I'm somehow being incredibly obtuse here and have misconstrued your question, I apologize. However I think that what you're thinking about just isn't possible. Cheers, Pablo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Exec don't work
Hi! I using php version 4.3.10. I have a script that used the exec function. Well it script only work from shell, but not work form web browser. My php.ini: safe_mode Off Off safe_mode_exec_dir no valueno value Have somebody experience in this problem? Regards, JP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Php defense
Hi there.. I`m defending the language, but people here want to migrate to asp.. They just keep on saying "php is not used for huge corporation solutions, there asp goes better". I know it isn´t correct, but I don´t know much about "well-known" websites using php technology. (I just don´t navigate enough time to know it) I think that could help a lot, since this people is highly influenced by that kind of facts.. (I mean, knowing that other companies trust this language to manage critical information). Does anybody know/have any web-sites listing using php? If you only know a few of those, it could help me too. Thanks in advance!! Pablo American Express made the following annotations on 04/22/05 06:58:25 -- ** "This message and any attachments are solely for the intended recipient and may contain confidential or privileged information. If you are not the intended recipient, any disclosure, copying, use, or distribution of the information included in this message and any attachments is prohibited. If you have received this communication in error, please notify us by reply e-mail and immediately and permanently delete this message and any attachments. Thank you." ** == -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Apache - IIS Migration
Hi there.. I´m using Apace 1.3.31 and PHP 4.3.8 in a Windows 2000 enviroment. I´ll have to migrate the whole site to Windows 2003 enviroment, using IIS 6.0.. Should there be any problem about that, or not? I mean, should it all go fine, or is it possible for the code to fail in some parts? Just in case you need to know, I´m using "register globals" on, and I´m also using some Pear functions (Excel_Spreadsheet). The people I´ve asked about this yet, have told me that it should go fine as long as I keep the same PHP version. (I should install PHP in the IIS, configure it to recognize the php files, and then copy the php files) Thank you all! Pablo American Express made the following annotations on 04/18/05 14:09:05 -- ** "This message and any attachments are solely for the intended recipient and may contain confidential or privileged information. If you are not the intended recipient, any disclosure, copying, use, or distribution of the information included in this message and any attachments is prohibited. If you have received this communication in error, please notify us by reply e-mail and immediately and permanently delete this message and any attachments. Thank you." ** == -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Simple Problem
I can't figure out what I am doing wrong, this sql string seems to filter out the information I want but it duplicates the all info, as 'num_rows' is total of rows in the table and not the correct value of the filtered information? $sql="SELECT products.productID, products.title, products.number_per_box, products.stock_level, products.image, users.username, users.email, users.userID FROM users, products WHERE products.userID = $userID"; $mysql_result=mysql_query($sql,$connection); $num_rows=mysql_num_rows($mysql_result); this is the old sql statement which works fine - $sql="SELECT productID, title, number_per_box, stock_level, image, userID FROM products WHERE userID = '$userID'"; $mysql_result=mysql_query($sql,$connection); $num_rows=mysql_num_rows($mysql_result); what I am I doing wrong. In the old query you're jut pulling records from one table. In the second, you're joining two tables, but you're still using the same WHERE clause, products.userID = $userID. This is causing multiple records to be returned, since there is nothing specifying how you are joining the users and products table so it correctly returns a match for every row in the user table. Change the where clause to: WHERE products.userID = $userID AND users.userID = $userID and this will force the query to limit results to those records in products that have a matching record in the users table. HTH. Pablo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Displaying Time Intervals
Hi, folks. I've added some code to our CMS that tracks the exact amount of time that a user is logged into the system. I'm going to use these stats to track how much time someone has spent practicing in the training environment before I give them access to our production system. Can anyone give me some advice on the best way to display intervals of time? Basically there are two timestamps - time_in and time_out, and I want to for each record display the difference between the two in the format of H:i:s. I'm pulling the timestamp fields from the database in the format of number of seconds since the epoch. Then, cumulatively for each day, I want to display the total time, also in the format of H:i:s. Can anyone give me some advice on how to do this? I thought of date() and strftime(), but I don't see how those would accommodate for someone who spends 30 seconds on the CMS in a single session, since that would need to be displayed as 00:00:30. Is there an existing class that provides such functionality, or should I just write one myself? Cheers and TIA, Pablo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] upload image file to my server
Hello Tomas: take a look at: http://www.php.net/manual/en/features.file-upload.php and for an example, take a look at. http://www.tek-tips.com/faqs.cfm?fid=5699 Good Luck. On Thu, 31 Mar 2005 17:48:37 -0800, Tomás Rodriguez Orta <[EMAIL PROTECTED]> wrote: > Hello, hard people. > > I want to do this, I like to upload image file, > What can I do?. > > somebody help me.? > > best regards TOMAS > > - > Este correo fue escaneado en busca de virus con el MDaemon Antivirus 2.27 > en el dominio de correo angerona.cult.cu y no se encontro ninguna > coincidencia. > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- Pablo M. Rivas. http://www.pmrivas.com http://www.r3soft.com.ar --- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] HTML meta tag and PHP
How can I write something like that? This is obviously not working as the " is assumed as the closing " for the meta tag. Sorry, I botched my previous reply and left the extra " after userId. It should be: "> Pablo. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] HTML meta tag and PHP
How can I write something like that? This is obviously not working as the " is assumed as the closing " for the meta tag. You haven't closed your opening php tag, which is why it's not working. "> Is how it needs to be to work. HTH, Pablo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Test Send
I can't send email. Right? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP4 and PHP5 in virtual Host
Hi! I have apache, php4 and php5 on my server. I use virtual host in this server. The virtual host have or not PHP4 using: php_admin_flag engine off/on in apache2.conf How can i use PHP5 or PHP4 or both? PHP4 is running as module and PHP5 is running as cgi. Regards, JP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP4 and PHP5 in virtual Host
Hi! I have apache, php4 and php5 on my server. I use virtual host in this server. The virtual host have or not PHP4 using: php_admin_flag engine off/on in apache2.conf How can i use PHP5 or PHP4 or both? PHP4 is running as module and PHP5 is running as cgi. Regards, JP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP Compiler for .NET platform
Hey folks. Has anybody played with this the PHP compiler for .NET, Phalanger? http://www.php-compiler.net/ I'd be interested to hear of any experiences people have had using this. Cheers, Pablo -- Pablo Gosse Webmaster, University of Northern British Columbia 250.960.5621 [EMAIL PROTECTED] -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] help me
http://www.php.net/date On Fri, 18 Feb 2005 12:07:14 +0530, K Karthik <[EMAIL PROTECTED]> wrote: > i am so surprised for the immediate reply.thank you so much. > i'll be thank ful again if you could help me finding the current date > and time using php. > thanks, > karthik > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- Pablo M. Rivas. http://www.pmrivas.com http://www.r3soft.com.ar --- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] a better way for the array
Hello Merlin: take a look to http://www.php.net/manual/en/language.types.array.php $para[5]=array('txt' => 'Europe'.$continent['name'], 'link' => '/'.$continent[name].'.htm', 'title' => 'Europe - Continent overview'); $para[]=array('txt' => 'America'.$continent['name'], 'link' => '/'.$continent[name].'.htm', 'title' => 'America- Continent overview'); $para[] will be 6,7,8,9... and so on On Fri, 18 Feb 2005 13:52:29 +0100, Merlin <[EMAIL PROTECTED]> wrote: > Marek Kilimajer wrote: > > Merlin wrote: > > > >> Hi there, > >> > >> I am wondering if there is a nicer way to save the data into an array > >> than I do. > >> > >> I do have a 2 dimensional array "$para". > >> > >> Currently I go like this: > >> > >> $para[1][txt] = 'Europe'.$continent[name]; > >> $para[1][link] = '/'.$continent[name].'.htm'; > >> $para[1][title] = 'Europe - Continent overview'; > >> $para[2][txt] = $country; > >> $para[2][link] = '/'.$continent[name].'.htm'; > >> $para[2][title] = $country; > >> > >> That becomes really difficult if you have more of them, and you want > >> to reorganize the ordering. Then you have to rename all numbers. > >> > >> Is there a nicer way to do that? > >> > >> Thank you for any hint, > >> > >> Merlin > >> > > > > $para = array(); > > > > $para[] = array('txt' => 'Europe'.$continent['name'], > > 'link' => '/'.$continent[name].'.htm', > > 'title' => 'Europe - Continent overview'); > > > > $para[] = array('txt' => $country, > > 'link' => '/'.$continent[name].'.htm', > > 'title' => $country); > > Thanx that is much better. > > However I have to start the array with 1 instead of 0 > and I cant remember and find the proper syntax. It was something like: > array(=>1 > > What was that again? > > Thanx, Merlin > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- Pablo M. Rivas. http://www.pmrivas.com http://www.r3soft.com.ar --- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Mssql Connection
Hi there.. I´m connecting to a Ms Sql Server 2000, with the system administrator´s name, and its password. It always works fine, but... I know it´s not the safest way of connecting, so I want to use some ordinary user names and passwords. The problem is that I just can´t make it work, it always throws username errors. How should I configure this, in order to connect to mssql with ordinary usernames and passwords from php code? Here is my function code: function conectar () { $conexion = mssql_connect("localhost","sa","apr"); if (!$conexion) { ?> # Can´t establish connection with database server pc. # Can´t establish connection with the specified database. http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] newbie.. $_GET & $_POST
Hi there.. I need to pass variables to a page through an html link. I do it like this: Export where 'buildQuery' is the variable I´m passing. In the destination page, I capture it with $_GET and that´s it. I want to know if there is any way of doing it without showing the variables in the direction bar. Thanks! Pablo American Express made the following annotations on 01/03/05 06:54:38 -- ** "This message and any attachments are solely for the intended recipient and may contain confidential or privileged information. If you are not the intended recipient, any disclosure, copying, use, or distribution of the information included in this message and any attachments is prohibited. If you have received this communication in error, please notify us by reply e-mail and immediately and permanently delete this message and any attachments. Thank you." ** == -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] newbie.. $_GET & $_POST
Hi there.. I need to pass variables to a page through an html link. I do it like this: Export where 'buildQuery' is the variable I´m passing. In the destination page, I capture it with $_GET and that´s it. I want to know if there is any way of doing it without showing the variables in the direction bar. Thanks! Pablo American Express made the following annotations on 01/03/05 06:43:25 -- ** "This message and any attachments are solely for the intended recipient and may contain confidential or privileged information. If you are not the intended recipient, any disclosure, copying, use, or distribution of the information included in this message and any attachments is prohibited. If you have received this communication in error, please notify us by reply e-mail and immediately and permanently delete this message and any attachments. Thank you." ** == -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] smtp server
Hi there.. I´m trying to use the mail function but I have a problem. I´m working in a LAN with more or less 30 pcs, that places inside a huge network, and I just can´t use the enterprise smtp server. How can i set a valid smtp server? I thought about installing some "good-free" smtp server on my own pc, and then use it for the mail function. What do you think of this idea? Would you recommend any free smtp server currently available? Thanks! Pablo Marotta American Express made the following annotations on 12/16/04 07:43:19 -- ** "This message and any attachments are solely for the intended recipient and may contain confidential or privileged information. If you are not the intended recipient, any disclosure, copying, use, or distribution of the information included in this message and any attachments is prohibited. If you have received this communication in error, please notify us by reply e-mail and immediately and permanently delete this message and any attachments. Thank you." ** == -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Text Parser
Hi there.. A newbie issue: I´m receiving this: "house , ball , door , roof , floor" And I want to obtain this: "'house','ball','door','roof','floor'" Maybe, I should use implode or explode, but I just can´t figure out how.. Help? American Express made the following annotations on 12/02/04 08:13:28 -- ** "This message and any attachments are solely for the intended recipient and may contain confidential or privileged information. If you are not the intended recipient, any disclosure, copying, use, or distribution of the information included in this message and any attachments is prohibited. If you have received this communication in error, please notify us by reply e-mail and immediately and permanently delete this message and any attachments. Thank you." ** == -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PHP arrays and javascript
i know this probally a simple question, but it has been stumping me for quite some time now. How do i pass a php array to a javascript? i tryed: var myarray = new Array(<?PHP echo $myarray; ?>); but it didn't work. Anybody got any ideas? You need to generate the javascript array from your PHP array. Example: In your script create a php array of the values you wish to use. Using indeces is not essential. If you do not use them, you can just use a counter var when you loop through the array to create the indeces for the JS array. 'item 1', 'second index'=>'item 2', 'third index'=>'item 3'); $jsVar = "var myArray = new Array();\n"; foreach ($arrayVar as $idx=>$val) { $jsVar .= "myArray['{$idx}'] = {$val}\n"; } ?> The final output of this will be: var myArray = new Array(); myArray['first index'] = 'item 1'; myArray['second index'] = 'item 2'; myArray['third index'] = 'item 3'; HTH, Pablo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Text Parser
Hi there... I need to get a procedure able to do this: 1) Receive a string. For example: "name age address location". 2) Process that string, inserting "comas" between the words in the middle. For example: "name,age,address,location". It´s important that the comas must be inserted after the first word, and before the last one. 3) Return that string. Any ideas? Thanks! Pablo American Express made the following annotations on 11/24/04 11:34:02 -- ** "This message and any attachments are solely for the intended recipient and may contain confidential or privileged information. If you are not the intended recipient, any disclosure, copying, use, or distribution of the information included in this message and any attachments is prohibited. If you have received this communication in error, please notify us by reply e-mail and immediately and permanently delete this message and any attachments. Thank you." ** == -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Load testing for PHP Applications
Hi folks. I'm wondering if anyone out there can recommend a good tool for load testing a large php application? Ideally it would be something fairly intelligent, that would follow links, remember what links it has followed and where any problems occurred, etc. Can anyone provide any recommendations? Cheers and TIA, Pablo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Session object destruction failed
Hi folks. Earlier today I received the following error when I tried to log out of my CMS: Session object destruction failed in [blah blah blah file info]. I googled this and took a look on bugs.php.net but couldn't find much useful info. Everything worked fine before, and has worked fine since, so I'm not overly concerned. I'd just like to know what caused it. Any ideas? Cheers and TIA, Pablo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PEAR Calendar
[snip] Greg Beaver wrote: My country is going to Hell [/snip] Don't worry, Greg. It's not really your country as much as it is your president ;o) We hold nothing against you, for you wrote PHPDocumentor! Cheers, Pablo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] 'Code Snippets' you couldn't live without
[snip]Extending PHP to have "shorthand" functions? Was that irony?[/snip] It most certainly was irony, Klaus. I was merely trying to illustrate the point that writing a custom function which does EXACTLY the same thing as a built in function is redundant. A number of functions within php do have aliases (sizeof() is an alias count() for example) but these are throwbacks to equitable functions in other languages. As I stated earlier, if your function does more than the built in function, then yes, you are increasing efficiency, but if all you're doing is creating a custom alias of which only you will know the useage, then you only increase obscurity. As for my favorite piece of reusable code, I hate preparing dates for insertion into a database when I have to deal with null values, etc. So I use a function which takes an array of date field names and a regular expression, then validates $_POST['field name'] against the regular expression and returns an array, $dates, each field of which contains either a date prepared for insertion (wrapped in single quotes) or simply the string 'null'. function _formatPostDates($dateArr,$regex) { $dates = array(); foreach ($dateArr as $date) { $dates[$date] = preg_match($regex,$_POST[$date]) ? "'{$_POST['release']}'" : "null"; } return $dates; } On a page where I have to deal with multiple date fields, this greatly increases the efficiency of validating the dates and makes things safer and easier when creating queries. Cheers, Pablo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] 'Code Snippets' you couldn't live without
[snip]Klaus Reimer wrote: > Murray @ PlanetThoughtful wrote: >> function asl($val){ >> function mfr(&$rset){ > > This may be ok for private projects but otherwise I don't think it's a > good idea to create "shorthand" functions. Other developers (and > especially new developers beginning to work on the project) are > getting confused. They must first learn what this functions are > doing. The names of these functions are not really helpful in > understanding what's going on.[/snip] I'm with Klaus on this one. I see the purpose of creating functions that eliminate repetitive behaviour by using native PHP functions and doing a little something extra with the results to suit your needs, but as for just using asl($val) instead of addslashes($val), well why not just extend the PHP source to make asl() an actual alias to addslashes()? My $0.02 (CDN). Pablo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Passing marked rows in a table
[snip] Pablo Gosse wrote: > [snip] > If the elements all live within the same form, you can add [] to the >end of the name/id attribute, and then all checkboxes with the > same name will be accessible in an array. So "checkboxname[]" will > show up as $_POST['checkboxname'] on the receiving end. [/snip] Todd Cary wrote: > Can I do $MyArray = $_POST['checkboxname']; > > And then access each array element >for ($i = 0; $i < (count($MyAray)); $i++) echo $MyArray[$i]; > > Todd [/snip] Yes, that should work fine. But remember the caveat that all elements using the [] notation must be in the same form. If you've got multiple forms on the page and expect to get all checkboxname values it will not happen using []. You'll need to use JS for that. Pablo. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Passing marked rows in a table
[snip] I create a list of records from a DB and each has a check box. What is the best way to select those that were checked after the form is submitted? [/snip] If the elements all live within the same form, you can add [] to the end of the name/id attribute, and then all checkboxes with the same name will be accessible in an array. So "checkboxname[]" will show up as $_POST['checkboxname'] on the receiving end. This is the best way, and most appropriate to this list since it is all PHP. HOWEVER, if the checkboxes are all contained in different forms (each form in a row with its own processing options), then you will need to assign a common name to each element (I usually call mine performMultiple), and then using Javascript loop through all elements on the page, checking for the proper name, and if found then adding the value to a comma-delimited list, the value of which will be set to a hidden input field before the form is submitted. HTH. Pablo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Error Code Airhead
[snip] > I'm sure I'm missing something really obvious here but > can't see it. There is a form where one of two promotional codes can > be entered. I check for the these codes and give the user an error > message if they enter the wrong code. First one doesn't work, second > one does with only one code. > > //always gives error message even if one of the two codes entered: if > ($Promotion_Sub == 'Checked' && ($code != 'D04E' || $code != > 'Y04KG')) { echo " > > Error > >vlink=\"#660099\"> > Error > > Sorry, that code is invalid. > - > //works: > if ($Promotion_Sub == 'Checked' && $code != 'D04E') { [/snip] I'm not really sure how to answer this! How does this relate to the US election? Isn't this an election list? HA HA HA HA, just kidding ;o) You need to check that the code entered doesn't match both valid codes. Try this instead: If ($Promotion_Sub == 'Checked' && $code != 'D04E' && $code != 'Y04KG') { Do error stuff } With the code you have above, it will always give the error message because you're checking to see if $code is not equal to the first value, OR if it is not equal to the second value. So with that, the code supplied might well match the first ('D04E') but since that obviously doesn't match the second, it's going to throw the error. HTH, Pablo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: [users@httpd] November 2, 2004
[snip] > This list gets enough "traffic" as is and a crapload of repeat > questions/questions that are easily solved by looking in google or > the manual (aka RTFM questions) and we don't need to add politics to > it [/snip] And further to this point, people who reply to off-topic posts only further congest the list and push the problem further. I know it might seem hypocritical of me to state this, since this is in itself a reply to an off-topic post, but I do so in hopes that everyone on this list will follow my lead and NOT reply to any more of these plebian rantings about other countries' (or, if you're an American citizen, your country's) elections (or other blatantly OT posts, for that matter). If nobody replies to these stupid posts, then they will just go away. It's like the Simpsons' Halloween Special piece where all the advertising billboard characters come alive and run amuck in Springfield, and the marketing company that created them tells Lisa that people must stop paying attention to them to make them go away. If people don't look at them, they will go away. Simple as that. If you nobody replies to OT posts, they will go away. Once again the Simpsons' shows us the way... Just my $0.02 (CDN). P. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Session and validation
[snip] I had this thread going yesterday. Then basically think it reached a stalemate. I'm wondering has anyone setup forms using session variables and validation. Validation where the validating is done on the same page, and the redirected on success ? [/snip] You need a class which will generate and validate your forms dynamically. Pear provides two packages (the second an extension of the first): http://pear.php.net/package/HTML_QuickForm http://pear.php.net/package/HTML_QuickForm_Controller I've never used these as I wrote my own library to handle this a few years ago, but from what I understand these two packages will do the trick. Basically it will work thusly: 1) On a page where you need a form, you declare a new form object, specify all your inputs, how they should be validated, etc., and these are then stored in the session. 2) On the receiving page you call the form validation object, passing in an identifier for which form should be validated. 3) If it validates your script will continue unfettered, else it will update the values in the session with the appropriate error message and redirect you back to the original form, which, since you are using session variables to display the inputs, will now be updated with the error messages. HTH, Pablo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Multiple permisions, different sessions.
Hi, I´m developing an intranet on Apache-PHP-Mssql. I need to know if there´s any way of managing users to have access to specific areas inside my site, and at the same time, managing other users, giving them permision to acces other areas only, because all of the codes and information I´ve found (at least for Windows), simply give permission "to acces" and pass the "login screen", but don´t limitate the users navigation priviledges. Thanks in advance! Paul from Argentina. American Express made the following annotations on 10/22/04 06:06:01 -- ** "This message and any attachments are solely for the intended recipient and may contain confidential or privileged information. If you are not the intended recipient, any disclosure, copying, use, or distribution of the information included in this message and any attachments is prohibited. If you have received this communication in error, please notify us by reply e-mail and immediately and permanently delete this message and any attachments. Thank you." ** == -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] fputcsv() error message
[snip] Fatal error: Call to undefined function: fputcsv() in /home/webdev/sites/tracking_site/scripts/report.php on line 19 Is there something that I am missing? The code that I had entered in: [/snip] http://ca.php.net/fputcsv -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Help With Error
[snip] Notice: Undefined index: 0 in L:\localhost\catalog\catalog_0.1.0\includes\classes\tree.class.php on line 77 [/snip] It's telling you that $data['0'], which is used twice in your query, is not a valid index (ie. it doesn't exist) for the $data array. Why don't you dump the $data array after it is set to see where the problem is: $data = $this->get_cat_coord($child); print_r($data); die(); Take a look at what comprises the $data array and you should find your problem. HTH, Pablo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Fatal error
In your script use set_time_limit(0), and look http://ar2.php.net/manual/en/function.set-time-limit.php for understand the function. Regards, JP > Dear members,I get an error,What does mean my error? : > Fatal error: Maximum execution time of 30 seconds > exceeded in /var/www/html/votting/vote_implement.php > on line 8 > > = > -DIGITAL SIGNATURE--- > ///Mohsen Pahlevanzadeh > Network administrator & programmer > My home phone is: +98213810146 > My email address is > m_pahlevanzadeh at yahoo dot com > My website is: http://webnegar.net > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] new connection with pg_pconnect
[snip] I then have the page main.php which has '.$dbconn.'<-'; ?> the scripts just dies whenever I include the pg_connect function... if I change echo '->'.$dbconn.'<-'; to echo '->==='.$dbconn.'<-'; I'll still see -><- on my page if I remove the pg_connect function, I'll see ->===<-; Basically, no changes to the page take effect when I have the pg_connect function in place... it just dies or something... [/snip] Hmmm, strange. I used your code, exactly as it is above (but with my username, password, db and server info) and it works fine. Check your error logs and see if there's anything showing up there and let us know what you find. Pablo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] new connection with pg_pconnect
[snip] I'm trying to add some new features to an existing project. The project uses pg_pconnect and sets it into a global var... What I'm trying to do is to create a new database class which connects to a different database on the same server. By the time my code gets reached, the pg_pconnect global var $conn has already been initialized. ... Is the persistent connection open only to the database in which it was opened for? How can I choose a different database? [/snip] Yes, a persistent connection will only be used when all the connection parameters are the same. Ergo a new database requires a new connection. That said, I would also like to point out that there is a bug which can be found with php and persistent postgres connections. http://bugs.php.net/bug.php?id=25404 The solution is to use non-persistent connections. I'd had a problem over the past few months wherein users of my CMS were getting logged out for no reason, and yesterday I was finally able to trace it to this. Switched to non-persistent connections and not one error has occurred since, so this might be something to keep in mind. Cheers and HTH, Pablo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Referring Page
[snip] > I am trying to set up a script that will do different things based on > the reffering page, without having to include the information in the > URL. Does PHP have a built in variable or function that would tell > the rest of the script what page the user came from? Any help is > much appreciated. [/snip] http://ca3.php.net/manual/en/reserved.variables.php#reserved.variables.s erver But be warned, they're not that reliable as some firewalls block/muck with them, and they can also be easily spoofed. Cheers, Pablo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] intenger
Please, i need output a intenger, what function can i use for this?. Print?, echo? Thank you. JP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Form Validation
Huang, Ou wrote: > I am currently working on a newsletter mailing list project and > developed a form in php. I would like to validate before it is > submitted. What would be the best way to validate a form? Write your > own routines or using a form validator. I just started learning PHP, > so don't have much experience on this. I am thinking using a form > validator but not sure where I can get it. > > Any suggestions would be appreciated! > > Thanks. http://pear.php.net/package/HTML_QuickForm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Sessions and Mozilla (Firefox)
Hi folks. I've got a quick question about sessions and Mozilla. I just noticed that if I open up a Mozilla window, log into my CMS, then open another Mozilla window (not by ctrl-n, but by selecting it from my programs menu) and bring up the login page in that new window, then it detects the session from the other window and redirects right to the CMS control panel. In IE, this will happen if I ctrl-n a new window, but not if I start a new instance of the browser from the program list. Is the correct behavior for sessions in Mozilla? I've searched the lists but I couldn't find anything which seemed to answer this. Cheers and TIA, Pablo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] creating a folder in php
Jay Blanchard wrote: [snip] > I want an IDE that will let me speak code into it. Anyone else want > anything? [/snip] Laetitia Casta? Email me off list to get delivery instructions. Thanks, Pablo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Upload problems
[snip] > Look in your php.ini for max_upload_size or something like it. [/snip] 'Twas an apache problem. Thanks the help. Cheers, Pablo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Upload problems
[snip] > What's the upload_max_filesize set to in your php.ini ? Under "File > Uploads" in the php.ini, you will find this value. [/snip] That's not it. That's set to 30M. This domain was just transferred over to a new server, and this problem did not exist on the old one, so while I am pretty certain it's something on the server side, I thought I'd throw it out in case anyone else might have run up against this. Thanks, Pablo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Upload problems
Hi, folks. I'm running into a strange upload problem and am not sure if it's a php or apache issue. I can't seem to upload any files bigger than 511k. 511k will upload fine, but 512k returns a "Document contains no data" error. I've tried this with a text file, adding and removing lines until it uploaded and wouldn't upload. I've also tried multiple file formats, and it's the same for all. Has anyone run into this before? I thought it might be a problem with the LimitRequestBody directive in the apache config file, but that directive is not used anywhere in the file. Any ideas? Cheers and TIA, Pablo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Memory Usage
Hi! I need management the use of the memory when a php script is execute. How can i do it?.I know mysql_free_result for free all memory associated with the result, is it all?. Regards, JP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Security Question (from Chris's OSCON 2004 talk)
Hi folks. Sorry if this gets posted twice, but I sent it originally almost an hour ago and it hasn't shown up on the list yet. Thanks to all for the replies to my question about security on shared hosting the other day. I've contacted my hosting provider and they will be fixing the issues I've pointed out to them. I've got a question about a section of Chris's article on PHP security from his OSCON 2004 talk. When talking about protecting database credentials, Chris mentions creating a file (readable only by root) with the following: SetEnv DB_USER "myuser" SetEnv DB_PASS "mypass" and then using this: Include "/path/to/secret-stuff" in the httpd.conf file such that they show up in your $_SERVER array. I assume that the include directive would be declared inside the section of the httpd.conf file which defines everything for my site? This is probably a stupid question but I want to make sure of what I'm asking my hosting provider before I send my email. I'm also going to be asking them to set another environment variable, INC_PATH, and then I'll use this to reference the files which I'm including from outside my webroot, such that even if someone reads the files within my webroot, they won't see either the db username or password, nor will they see the path from which I am including sensitive files. Thoughts? Cheers and TIA, Pablo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Security Question (from Chris's OSCON 2004 talk)
Hi folks. Thanks to all for the replies to my question about security on shared hosting the other day. I've contacted my hosting provider and they will be fixing the issues I've pointed out to them. I've got a question about a section of Chris's article on PHP security from his OSCON 2004 talk. When talking about protecting database credentials, Chris mentions creating a file (readable only by root) with the following: SetEnv DB_USER "myuser" SetEnv DB_PASS "mypass" and then using this: Include "/path/to/secret-stuff" in the httpd.conf file such that they show up in your $_SERVER array. I assume that the include directive would be declared inside the section of the httpd.conf file which defines everything for my site? This is probably a stupid question but I want to make sure of what I'm asking my hosting provider before I send my email. I'm also going to be asking them to set another environment variable, INC_PATH, and then I'll use this to reference the files which I'm including from outside my webroot, such that even if someone reads the files within my webroot, they won't see either the db username or password, nor will they see the path from which I am including sensitive files. Thoughts? Cheers and TIA, Pablo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Loop within Loop help please
[snip] I have a simplified bit of code below: What i'd like to do is have a count inside that loop that will trigger some action every 20 iterations of the foreach. Like this: [/snip] if ($count%20 == 0) http://ca3.php.net/manual/en/language.operators.arithmetic.php in the manual (look for Modulus). HTH. Pablo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Make cron file
sorry, my cuestion is about the construction of the job file with php. I send parameters via POST: day, hours, minute, sentence for execuite with cron. This is cached for a php file that make the job file. Well, my problem is make this php file.I think to use file() for this, but maybe somebody think other idea. Regards, JP > Jay Blanchard wrote: >> [snip] >> I need make a cron file, for example a .job file: >> #mi hodimeseq jobcomment 45 >> 11** 0-5 php -q /home/test/test.php # Make backup >> How can make it?. >> [/snip] >> >> Type crontab -e and the cron file will be openedunless you're on a >> Windows machine > in both cases, this is the wrong list to ask this. > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Make cron file
Hi! I need make a cron file, for example a .job file: #mi hodimeseq jobcomment 45 11** 0-5 php -q /home/test/test.php # Make backup How can make it?. Regards. JP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] php security on shared hosts
[snip] In short, what you've found is typical for most shared hosts [/snip] I've just been reviewing the way sites are housed on my host, and what directories are readable by the web server and I'm curious to get opinions on this. When I use Chris' file browser script, there is a folder called 'virtual' in the site root, and it is readable by the web browser. Inside /virtual there are three folders for every site, which I list below. -- site357 pablogosse.com admin357 -- Browsing these for my site I see the following: site357: 4096 ./ 20480 ../ 4096 fst/ 4096 info/ pablogosse.com and admin357: 4096 ./ 4096 ../ 4096 bin/ 4096 boot/ 4096 dev/ 4096 etc/ 4096 home/ 4096 initrd/ 4096 lib/ 4096 mnt/ 4096 opt/ 4096 proc/ 4096 root/ 4096 sbin/ 4096 tmp/ 4096 usr/ 4096 var/ 498subdomain 4096 mysql/ 7392 dump.xml Also, if I browse the fst/ folder inside site357, I get the same results as pablogosse.com and admin357. I'm then able to browse freely through all the above folders except /home and /root. I'm no security expert so I have to ask, is this indeed normal? Cheers and TIA. Pablo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] php security on shared hosts
[snip] I just published a free article on my Web site about shared hosting: http://shiflett.org/articles/security-corner-mar2004 In short, what you've found is typical for most shared hosts, and safe_mode (a directive created to help mitigate this problem a bit) does little to help. However, there are some things you can do as a developer, and I give some specific examples. [/snip] Hi, Chris. Thanks for that link. It was incredibly informative. I just took your code for the file browser and it was able to read the information in all users' webroots and all other directories and files readable by nobody:nobody, including database passwords, .htaccess files (which contained paths to password and group files), etc. There was no /etc/passwd file, but this is irrelevant as I was simply able to browse the /virtual directory to see a list of all users home directories, and from there their webroots, etc. I guess it is an inevitable fact that if you are on a shared host, any script executed from the browser is capable of reading any other script on the server which is set to be readable by the web server. I usually store all my files with sensitive information and class files outside the webroot, but under this setup, anyone could simply read the contents of the files in the webroot and use the information in those files to then read the files which are store outside of the webroot. Unfortunately I don't have access to my server config file (a 'find' command for httpd.conf returned no results), so is this something a host would usually change for individual users? Also, safe_mode is not enabled on this host so I while I assume that I could enable it using .htaccess for my site, that still would not prevent anyone else from reading my scripts since their scripts would not be running in safe mode, right? Thoughts? Cheers and TIA, Pablo. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php security on shared hosts
Hi folks. I recently set up hosting for my site and have noticed something which is making me nervous. I can't seem to include files outside of my webroot, so I wrote a script to test permissions using passthru to output the results of a bunch of ls -la commands to see what I did and did not have access to. Eventually I was able to read the directory which holds the root folders for all sites on the server, and from there I was able to read files (revealing the php source) from the webroot of another site. This to me is a huge security issue since if anyone has any sensitive information there, it could easily be accessed by anyone else hosting on the same server. And because I can't seem to include files from outside my webroot, if I stay with this company I'll be forced to include information such as database passwords inside my webroot, therefore exposing the information to every other user on the server, and that's just not acceptable. All of my experience until now has been in situations where the sites I've worked on have been hosted on dedicated servers, so this has never been a problem. Is this a common set up for shared hosting? Is there any way around this? Cheers and TIA. Pablo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Problems installing smarty on a shared host
[snip] You'll probably notice that the permissions for /home/pablogosse are like: drwxr-x--- with user:group pablogosse:pablogosse If you have permissions to, i would set up a directory like: /home/virtual/site357/fst/var/include/smarty/ And then set the include_path appropriatly. [/snip] Unfortunately I don't have write access to /var as it is owned by root. I've just discovered another thing which makes me even more nervous. I just wrote a script as a quick test and I was able to use file_get_contents to read a file out of another user's webroot. So, anyone who is storing passwords or other valuable information under their webroot risks having that information being easily accessible to anyone else hosting here. As I said earlier, most of my experience until now has been in situations where the sites I've worked on have been hosted on dedicated servers, and this has never been a problem. Is this a common set up for shared hosting? Is there any way around this? Cheers and TIA, Pablo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Problems installing smarty on a shared host
[snip] It should not matter, unless open_basedir is in effect, but that would be another error. I would check if the directories are right, you can start by using relative path. [/snip] Just the relative path from smarty.php, ../../../home/pablogosse/smarty/Smarty.class.php And I get a permission denied error. So it appears for sure that I can't read anything inside my home directory, or outside the webroot it would seem. Any ideas? Cheers and TIA, Pablo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Problems installing smarty on a shared host
[snip] > I'm trying to place the smarty directories outside my webroot to > minimize security risks, however given my experiences thus far, I don't > really see that being possible. It should not matter, unless open_basedir is in effect, but that would be another error. I would check if the directories are right, you can start by using relative path. [/snip] It appears I've found the problem. I used passthru(ls -l [dirname],$ret) to start reading from /home all the way up through the following: /home/ /home/virtual/ /home/virtual/site357/ /home/virtual/site357/fst/ and all returned complete directory listings and a return code of 0. Now, when I read through /home/virtual/site357/fst/var/ /home/virtual/site357/fst/var/www/ /home/virtual/site357/fst/var/www/html/ I see the files that I would see when I SSH in and ls -l the following paths: /var/ /var/www/ /var/www/html/ HOWEVER, when I attempt the passthru call on /home/virtual/site357/fst/home/ I get no results back, and the return code is 1. So it appears scripts running under the apache user cannot access that folder or anything beneath it Any ideas? Cheers and TIA. Pablo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Problems installing smarty on a shared host
I tried that and got the same error. I'm trying to place the smarty directories outside my webroot to minimize security risks, however given my experiences thus far, I don't really see that being possible. Would a viable solution perhaps to be to include the smarty directories in the webroot such that my scripts can access them, but to protect the directories via .htaccess to prevent direct execution of files from said directories, since my scripts will be including them but are themselves executed from valid locations? Cheers and TIA, Pablo -Original Message- From: Marek Kilimajer [mailto:[EMAIL PROTECTED] Sent: Saturday, September 25, 2004 1:52 PM To: Pablo Gosse Cc: [EMAIL PROTECTED] Subject: Re: [PHP] Problems installing smarty on a shared host Pablo Gosse wrote: > Hi folks. I've recently moved my site to a shared host, and this is the > first time I've had to set up my site in a really restrictive > environment, and I'm running into problems getting smarty installed. > > Using the basic example set up from the Smarty docs, when I run the file > I get the following error: > > Warning: main(Smarty.class.php): failed to open stream: No such file or > directory in /home/virtual/site357/fst/var/www/html/smarty.php on line 4 > > Fatal error: main(): Failed opening required 'Smarty.class.php' > (include_path='.:/php/includes:/usr/share/php:/home/pablogosse/smarty/') > in /home/virtual/site357/fst/var/www/html/smarty.php on line 4 You are including from file that is located in /home/virtual/site357/fst/var/www/html/, and the smarty class is in /home/pablogosse/smarty/? The paths seems strange, what if you try include_path = /home/virtual/site357/+ whatever is the relative path to Smarty.class.php from smarty.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Problems installing smarty on a shared host
Hi folks. I've recently moved my site to a shared host, and this is the first time I've had to set up my site in a really restrictive environment, and I'm running into problems getting smarty installed. Using the basic example set up from the Smarty docs, when I run the file I get the following error: Warning: main(Smarty.class.php): failed to open stream: No such file or directory in /home/virtual/site357/fst/var/www/html/smarty.php on line 4 Fatal error: main(): Failed opening required 'Smarty.class.php' (include_path='.:/php/includes:/usr/share/php:/home/pablogosse/smarty/') in /home/virtual/site357/fst/var/www/html/smarty.php on line 4 Now, as you can see by the value of my include path, I've got the path to smarty added, but it's still not finding the file even though /home/pablogosse/smarty/Smarty.class.php does indeed exist. Can anyone tell me why this is happening? As I said up until now I've been lucky enough to always have access to dedicated servers where setting this up was never a problem, but I know there's something I'm missing in understanding why this isn't working. Any help is appreciated. Cheers and TIA. Pablo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php upload script problems
Hello: When you want to know where is your error, set: error_reporting(E_ALL); http://www.php.net/manual/en/function.error-reporting.php the error is here: case "upload": echo"File UploadFile to upload:"; you might change : ID="Form1" and ID="File1" for : ID=\"Form1\" and ID=\"File1\" echo"File UploadFile to upload:"; Good Luck! On Fri, 24 Sep 2004 16:01:48 -0700, AMC <[EMAIL PROTECTED]> wrote: > Hi, > > I have the following php page. The page just opens up blank and I assume I > made an error I cannot see. I'm new to php and any help would be greatly > appreciated: > > > $extlimit = "yes"; //Do you want to limit the extensions of files uploaded > > $limitedext = array(".pdf"); //Extensions you want files uploaded limited > to. > > $sizelimit = "no"; //Do you want a size limit, yes or no? > > $sizebytes = "20"; //size limit in bytes > > $dl = "http://www.corrige2.bluehill.com/pdfs";; //url where files are > uploaded > > $absolute_path = "http://www.corrige2.bluehill.com/pdfs";; //Absolute path to > where files are uploaded > > $websiteurl = "http://www.corrige2.bluehill.com";; //Url to you website > > $websitename = "Corrigent"; > > switch($action) { > > default: > > echo "Upload Or Download href=$PHP_SELF?action=upload>Upload File href=$PHP_SELF?action=download>Download File"; > > echo "Return to $websitenamePowered by PHP > Uploader Downloader"; > > break; > > case "download": > > echo "File Download href=$PHP_SELF?action=upload>Upload File Return to > $websitename"; > > $list = " style=\"border-collapse: collapse\">"; > > $list .= "Click To > Download"; > > $dir = opendir($absolute_path); > > while($file = readdir($dir)) { > > if (($file != "..") and ($file != ".")) { > > $list .= " href='$dl/$file'>$file"; > > } > > } > > $list .= ""; > > echo $list; > > echo"Powered by PHP Uploader Downloader"; > > break; > > case "upload": > > echo"File Upload action=$PHP_SELF?action=doupload enctype=multipart/form-data > ID="Form1">File to upload: ID="File1">"; > > echo" ID="Button1">UploadPowered by PHP Uploader > Downloader"; > > break; > > //File Upload > > case "doupload": > > $dir = "dir"; > > if ($file != "") { > > if (file_exists("$absolute_path/$file_name")) { > > die("File already exists"); > > } > > $ext = strrchr($file_name,'.'); > > if (($extlimit == "yes") && (!in_array($ext,$limitedext))) { > > die("The file you are uploading doesn't have the correct extension."); > > } > > @copy($file, "$absolute_path/$file_name") or die("The file you are trying to > upload couldn't be copied to the server"); > > } else { > > die("Must select file to upload"); > > } > > echo "File Uploaded"; > > echo $file_name." was uploaded"; > > echo "Upload Another File href=$PHP_SELF?action=download> Download File Return > to $websitenamePowered by http://www.zachwhite.com/>PHP > Uploader Downloader"; > > break; > > } > > ?> > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- Pablo M. Rivas. http://pmrivas.ipupdater.com http://www.r3soft.com.ar --- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Errors from script running in CRON - MORE DETAILED INFO.
Hi again folks. Thanks to those who helped in trying to find the cause of my problem this afternoon. Sorry if the code in this message wraps, but I'm writing this through a tss connection and damned if I can figure out how to change the wrap point in outlook :o( The CMS logged a new error a couple of hours ago which I think might isolate part of the problem. The following is the error that was logged: -- Parse error: parse error, expecting `$' in /u0/path_to_classes/classes/adodb/adodb.inc.php on line 2713 Unable to include database connection file -- Line 2713 of adodb.inc.php is: if ($this->_fetch()) { The last line about being unable to include the database connection file is the error which is logged from my script, which (obviously) is thrown when the adodb.inc.php file can't be included. That this error is thrown and the monitor exits gracefully tells me that the monitor is working correctly. Below is the code from the file called by my crontab: #!/usr/local/bin/php http://www2-test.unbc.ca/'); define('LOCK_FILE','/path/cmsutilDEV/monitor/cms.monitor.lck'); define('DATE_STAMP',date('Y-m-d H:i:s')); define('TIME_STAMP',time()); chdir(UTIL_PATH); require_once UTIL_PATH.'/cms.monitor.inc.php'; $m = new CMS_monitor(); ?> The code in my script up to the point at which the problematic include file is called is: CMS_exit_monitor("User lock file exists"); } else { touch(LOCK_FILE) or $this->CMS_exit_monitor('err msg'); $f = fopen(LOCK_FILE,'w+') or $this->CMS_exit_monitor('err msg'); fwrite($f,DATE_STAMP) or $this->CMS_exit_monitor('err msg'); fclose($f) or $this->CMS_exit_monitor('err msg'); $this->CMS_db_connect() or $this->CMS_exit_monitor('Unable to connect to database'); } // rest of script omitted since it's not getting base the first conditional. So all that's happening is require_once is being called, but the parse error is coming in the required file, to which I have NEVER made changes. To me this might seem to indicate that it's something other than a bug in my code which is causing these errors, especially since if there really was a problem in the required file, this error would be thrown every minute. One other thing worth mentioning is that immediately before this error occurred there was no content scheduled for publishing. After this error occurred the monitor ran twice successfully (again with no content to be scheduled for publishing), then threw a parse error from one of my files. However the point at which the file is included (shortly after where the database error is thrown above) occurs before any external data is passed to a function, so I can't see how that could potentially trigger the error since the file is simply being included, and no external data is being used. So, there is no external data from any source being used before either of the above errors are thrown. Not sure if that helps narrow down the problem or not, but if it does any ideas would be greatly appreciated. Aside from these errors I'm just about ready to switch our site to the CMS, and while the errors aren't affecting the overall performance (some updates are delayed a minute or two by the errors occurring) I have to say it's making me nervous. Any help is greatly appreciated. Cheers and TIA, Pablo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php