[PHP] Sending no content-type header?
I'm running a few simple php scripts from the (windows) command line. Since I'm not using a web browser to view it, the HTTP headers are annoying and pointless. I've turned expose_php off in php.ini, but commenting out default_mimetype changes nothing, and setting it to an empty string sends a blank content-type header. Is there any way to do this? -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Sending no content-type header?
On Thu, 5 Dec 2002, Leif K-Brooks wrote: I'm running a few simple php scripts from the (windows) command line. Since I'm not using a web browser to view it, the HTTP headers are annoying and pointless. I've turned expose_php off in php.ini, but commenting out default_mimetype changes nothing, and setting it to an empty string sends a blank content-type header. Is there any way to do this? php.exe -q ~Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Sending no content-type header?
Ok, thanks a lot. For what it's worth, here's my simple .bat file for executing php files: @ECHO OFF IF NOT EXIST %1.php goto usage php.exe -q %1.php goto end :usage echo ÚÄÄÄ¿ echo ³ USAGE ³ echo ³Type php.bat (without quotes)³ echo ³ followed by the name of a³ echo ³valid php file without the .php³ echo ³extension. ³ echo ÀÄÄÄÙ :end Chris Wesley wrote: On Thu, 5 Dec 2002, Leif K-Brooks wrote: I'm running a few simple php scripts from the (windows) command line. Since I'm not using a web browser to view it, the HTTP headers are annoying and pointless. I've turned expose_php off in php.ini, but commenting out default_mimetype changes nothing, and setting it to an empty string sends a blank content-type header. Is there any way to do this? php.exe -q ~Chris -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law.
[PHP] Need Redirection Trick...
Hello Everyone, I have a simple problem that, I think, might require a little trick to be used. I have a list of products in a database that is organized by categories and subcategories. Categories can have as many subcategories as it wants, but some categories don't need to have a subcategory at all. In the following code cat refers to category and subcat refers to subcategory. cat_data and subcat_data refers to a multi-dimentional array, pulled from the DB, with values of an id and a name. example: cat_data[row_number][name_of_category] and cat_data[row_number][id]. Ok, before I ask the question, here's the code: [-- snip --] ?php include (nay_general.php); include ($include_path/base_db.class); // db $db = new base_db(); $cat_data = $db-get_cat_data(); for ($i=0; $i count($cat_data); $i++) { echo 'a href=' . $PHP_SELF . ?cat_id= . $cat_data[$i][id] . '' . $cat_data[$i][name] . /abr /\n; if ($cat_id) { $subcat_data = $db-get_subcat_data($cat_id); if ($subcat_data != 0 ($cat_id == $cat_data[$i][id])) { for ($j=0; $j count($subcat_data); $j++) { echo 'nbsp;nbsp;nbsp;nbsp;- a href=' . $PHP_SELF . ?cat_id=$cat_idsubcat_id= . $subcat_data[$j][id] . '' . $subcat_data[$j][name] . /abr /\n; } } elseif ($subcat_data == 0 ($cat_id == $cat_data[$i][id])) { $subcat_id = 0; header(Location: $PHP_SELF?cat_id=$cat_idsubcat_id=$subcat_id); } } } ? [-- snip --] What this does is it lists all the categories in the database, initially. When the user clicks on a category, the script will check if the category has any subcategories associated with it. One of two things should happen after this. First, it should list all the subcategories directly below the category it is associated with, with a little indention to specify that they are subcategories. The subcategories listed will be a link that passes over the cat_id and subcat_id GET variables to the same page. example:category 1 category 2 - subcategory 1 - subcategory 2 - subcategory 3 category 3 . . . This part of the script works fine. The second thing that should happen is that if there are actually no subcategories for the selected category then subcat_id should equal 0 and the script should redirect back to the same page with the GET variables of cat_id and subcat_id (which is equal to zero at this point). The problem is that I cannot redirect with a header() function because content is already sent to the browser at the beginning of the script (the list of categories). Is there any other way that I can redirect and send the variables of cat_id and subcat_id to the page in the second situation mentioned earlier? Register Globals is on. - Nilaab -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP includes without access to the default directory
On Thu, 5 Dec 2002, Gundamn wrote: I have a hosted account. As such, I am unable to use the default location for files when used with the include command. So could somebody tell me how I can either make it go to a different directory, or to link to something (and how to add the variable as the filename)? Thank you in advance. My usual approach is to have an includes/ directory, at the same level as the htdocs/ directory, and thus outside the webspace. In this includes/ directory I put an include.php file which includes any other files needed with include_once, like so: ? include_once INC_DIR . '/config.php'; include_once INC_DIR . '/functions.php'; ? In htdocs/ I put another include.php, which basically says: ? define ('INC_DIR', '../includes'); include INC_DIR . '/include.php'; ? In any subdirectories of htdocs/ I put a similar file, except one level deeper it'd be: ? define ('INC_DIR', '../../includes'); include INC_DIR . '/include.php'; ? For each subdir level, add a ../ to the define. On a hosted account, you may instead have to put your includes/ directory elsewhere. In this case, the include.php in htdocs/ would just be ? define ('INC_DIR', '/path/to/includes'); include INC_DIR . '/include.php'; ? and the sub-directory scripts just ? include '../include.php'; ? Either way, the goal though is to have an include.php file in each directory of your webspace that references a single include.php file with relative (../) paths. Coupled with keeping your includes outside the webroot, this can make include files a lot less troublesome. A bit of overhead, true, but it keeps my configs, db passwords, and library code entirely out of the webspace. I've used it successfully in a large site (150 user-accessible scripts, 25 library scripts, totalling about 1M of php) One big warning about include files... PHP's include functions work counter-intuitively in that all relative paths are relative to the script that caught the user's request. Thus if you have a bunch of scripts in a lib/ directory, they can't include each other without taking into account the path from the calling script... Thus why I try to define INC_DIR as early as possible if it's relative. Hope this helps... -- Morgan Hughes C programmer and highly caffeinated mammal. [EMAIL PROTECTED] ICQ: 79293356 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re:
Help need one on one I was wondering if anyone would be willing to be a mentor While im doing this project. Im using mysql and php To do a login script with username and passwords. And also to do insert to database from a register form. Then I want to do a online fantasy football league where you Can trade players and add/drop players of your roster. Please email me if interested. Thanks Karl james
[PHP] ANNOUNCE: Metastorage object persistence API generator
Hello, Finally I made time to release a full blown application based on MetaL compiler persistence module. Here is the release announcement that may also be found on the site: http://www.meta-language.net/news-2002-12-05-metastorage.html _ Released Metastorage generator Manuel Lemos, 2002-12-05 16:11:44 GMT Metastorage is an application that is capable of generating persistence layer APIs. It takes a component definition defined in the Component Persistence Markup Language (CPML), a XML based format, and generates classes and storage schemas in a given target programming language. Using CPML, developers can focus their efforts on the modeling of data structures that hold the information and the relationships between the entities that their applications deal with. Metastorage takes care of generating all the necessary code to store and retrieve such data structures from persistent storage containers like relational databases. The main goal of Metastorage is to drastically reduce the time to develop applications that traditionally use on SQL based relational databases. The generated APIs consist of a sets of classes that provide an Object Oriented interface to the objects of the classes modeled using CPML. The generated APIs are also capable of installing the data schema in the persistence container, which in the case of a relational database is the set of tables that will hold the persistent objects. This completely eliminates the need to write any SQL queries manually. CPML is independent of the type of persistent container. This means that while it can be used to model classes of persistent objects that may be stored in relational databases, such objects may as well be stored in other types of persistence containers. For instance, if an application needs to move a directory of objects with user information from a relational database to a LDAP server to increase the application scalability, the same CPML component definition would be used. Metastorage would then generate classes objects that implement the same API for interfacing with a LDAP server that is compatible with the API generated to interface with relational databases. This make the migration process easier and with reduced risks. Another possible benefit of the persistence container independence of the APIs generated by Metastorage, is the case where an application may need to run in environments where a SQL based database server is not available. In that case the same API could be generated to store persistent objects in flat file databases or plain XML files. For now, the current version of Metastorage only supports the generation of PHP code based on the database independent Metabase API. This means that it may also interface with PEAR::MDB database abstraction layer using its built-in Metabase API wrapper. In consequence, many types of relational databases are already supported. Since this is the first release of Metastorage, there is plenty of room for improvement in the possibilities of the generated persistence APIs and the level of optimization of the generated code. In the future it will be supported other languages besides PHP, other database APIs besides Metabase and other persistence containers besides relational databases. Metastorage is based on MetaL compiler persistence module. Like MetaL, Metastorage is Open Source and is distributed with BSD like software license. Downloadable archives and documentation with an example of component definition are available from the MetaL site. -- Regards, Manuel Lemos -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] ANNOUNCE: Metastorage object persistence API generator
Hello, Finally I made time to release a full blown application based on MetaL compiler persistence module. Here is the release announcement that may also be found on the site: http://www.meta-language.net/news-2002-12-05-metastorage.html _ Released Metastorage generator Manuel Lemos, 2002-12-05 16:11:44 GMT Metastorage is an application that is capable of generating persistence layer APIs. It takes a component definition defined in the Component Persistence Markup Language (CPML), a XML based format, and generates classes and storage schemas in a given target programming language. Using CPML, developers can focus their efforts on the modeling of data structures that hold the information and the relationships between the entities that their applications deal with. Metastorage takes care of generating all the necessary code to store and retrieve such data structures from persistent storage containers like relational databases. The main goal of Metastorage is to drastically reduce the time to develop applications that traditionally use on SQL based relational databases. The generated APIs consist of a sets of classes that provide an Object Oriented interface to the objects of the classes modeled using CPML. The generated APIs are also capable of installing the data schema in the persistence container, which in the case of a relational database is the set of tables that will hold the persistent objects. This completely eliminates the need to write any SQL queries manually. CPML is independent of the type of persistent container. This means that while it can be used to model classes of persistent objects that may be stored in relational databases, such objects may as well be stored in other types of persistence containers. For instance, if an application needs to move a directory of objects with user information from a relational database to a LDAP server to increase the application scalability, the same CPML component definition would be used. Metastorage would then generate classes objects that implement the same API for interfacing with a LDAP server that is compatible with the API generated to interface with relational databases. This make the migration process easier and with reduced risks. Another possible benefit of the persistence container independence of the APIs generated by Metastorage, is the case where an application may need to run in environments where a SQL based database server is not available. In that case the same API could be generated to store persistent objects in flat file databases or plain XML files. For now, the current version of Metastorage only supports the generation of PHP code based on the database independent Metabase API. This means that it may also interface with PEAR::MDB database abstraction layer using its built-in Metabase API wrapper. In consequence, many types of relational databases are already supported. Since this is the first release of Metastorage, there is plenty of room for improvement in the possibilities of the generated persistence APIs and the level of optimization of the generated code. In the future it will be supported other languages besides PHP, other database APIs besides Metabase and other persistence containers besides relational databases. Metastorage is based on MetaL compiler persistence module. Like MetaL, Metastorage is Open Source and is distributed with BSD like software license. Downloadable archives and documentation with an example of component definition are available from the MetaL site. -- Regards, Manuel Lemos -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: [PEAR-DEV] ANNOUNCE: Metastorage object persistence API generator
* Manuel Lemos wrote: Here is the release announcement that may also be found on the site: Where's the PEAR context within the marketing text? -- 35 Kundenportale mit 24.000 Nutzern erstellen. Bei geringen Kosten und einer großen Anzahl an Modulen (DMS, CMS, CRM, Community-Funktionen). Wie das geht? = mailto:[EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: [PEAR-DEV] ANNOUNCE: Metastorage object persistence API generator
Where's the PEAR context within the marketing text? Please, don't start any troll/flame war. Arnaud. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] empty string parameters to backslashes?
Hey all - I'm trying to track down a problem with someone else's code. Our hosting service changed PHP versions on us (up to 4.0.6), and everything broke. I think I have tracked down at least part of the problem. We have a function: funA($args) { $file = substr($args[0],0, -1); //file to open from path $alt = $args[1]; //if invalid/no file, use this file $name = $args[2]; //the name associated with the tabs $size = $args[3]; //size to make the box (optional) print funA START: file: . $file . , name: . $name . , alt: . $alt . , size: . $size . BR; . . . } Called like this: funA(nameString, , , 177); But the output of the print statement looks like this: funA START: file: productBrief, name: \, alt: \, size: 177\ So where did the darned backslashes come from? Any ideas? thanks, andy wallace [EMAIL PROTECTED] -- Have you been SCROOMed? http://www.scroom.com Andy Wallace, Publisher [EMAIL PROTECTED] Get the Opera Browser!http://www.opera.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] MySQL ?
1. there is a MySQL mailing list, details can be found on mysql.com 2. i just did a really simple search on php net for mysql table, and got the following amongst a few results: mysql_field_table() mysql_list_tables() mysql_tablename() it would be good if you could search the php (and mysql) sites before posting. Justin on 06/12/02 3:08 AM, hacook ([EMAIL PROTECTED]) wrote: I am really sorry but i can't find any good mySQL good mailing list... How can i make a little php function to check if a table exists ? Thanks a lot, Hacook Justin French http://Indent.com.au Web Development Graphic Design -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Need Redirection Trick...
On Friday 06 December 2002 11:35, [EMAIL PROTECTED] wrote: Hello Everyone, [lots of irrelevant stuff snipped] The second thing that should happen is that if there are actually no subcategories for the selected category then subcat_id should equal 0 and the script should redirect back to the same page with the GET variables of cat_id and subcat_id (which is equal to zero at this point). The problem is that I cannot redirect with a header() function because content is already sent to the browser at the beginning of the script (the list of categories). Is there any other way that I can redirect and send the variables of cat_id and subcat_id to the page in the second situation mentioned earlier? Register Globals is on. 1) BEFORE you output anything make your check whether you need to redirect. After all, if you're going to be redirecting, why output anything at all? or 2) Use the output buffering functions. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * /* Do not drink coffee in early A.M. It will keep you awake until noon. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Need Redirection Trick...
Nilaab, This sounds similar to what I was trying to do recently, i.e creating dependent dropdown boxes. Here's a link to a demo of the code that might be of interest to you. http://www.onlinetools.org/tools/easyselectdata/index.html Cheers. Roger -Original Message- From: @ Nilaab [mailto:[EMAIL PROTECTED]] Sent: Thursday, December 05, 2002 7:36 PM To: Php-General Subject: [PHP] Need Redirection Trick... Hello Everyone, I have a simple problem that, I think, might require a little trick to be used. I have a list of products in a database that is organized by categories and subcategories. Categories can have as many subcategories as it wants, but some categories don't need to have a subcategory at all. In the following code cat refers to category and subcat refers to subcategory. cat_data and subcat_data refers to a multi-dimentional array, pulled from the DB, with values of an id and a name. example: cat_data[row_number][name_of_category] and cat_data[row_number][id]. Ok, before I ask the question, here's the code: [-- snip --] ?php include (nay_general.php); include ($include_path/base_db.class); // db $db = new base_db(); $cat_data = $db-get_cat_data(); for ($i=0; $i count($cat_data); $i++) { echo 'a href=' . $PHP_SELF . ?cat_id= . $cat_data[$i][id] . '' . $cat_data[$i][name] . /abr /\n; if ($cat_id) { $subcat_data = $db-get_subcat_data($cat_id); if ($subcat_data != 0 ($cat_id == $cat_data[$i][id])) { for ($j=0; $j count($subcat_data); $j++) { echo 'nbsp;nbsp;nbsp;nbsp;- a href=' . $PHP_SELF . ?cat_id=$cat_idsubcat_id= . $subcat_data[$j][id] . '' . $subcat_data[$j][name] . /abr /\n; } } elseif ($subcat_data == 0 ($cat_id == $cat_data[$i][id])) { $subcat_id = 0; header(Location: $PHP_SELF?cat_id=$cat_idsubcat_id=$subcat_id); } } } ? [-- snip --] What this does is it lists all the categories in the database, initially. When the user clicks on a category, the script will check if the category has any subcategories associated with it. One of two things should happen after this. First, it should list all the subcategories directly below the category it is associated with, with a little indention to specify that they are subcategories. The subcategories listed will be a link that passes over the cat_id and subcat_id GET variables to the same page. example:category 1 category 2 - subcategory 1 - subcategory 2 - subcategory 3 category 3 . . . This part of the script works fine. The second thing that should happen is that if there are actually no subcategories for the selected category then subcat_id should equal 0 and the script should redirect back to the same page with the GET variables of cat_id and subcat_id (which is equal to zero at this point). The problem is that I cannot redirect with a header() function because content is already sent to the browser at the beginning of the script (the list of categories). Is there any other way that I can redirect and send the variables of cat_id and subcat_id to the page in the second situation mentioned earlier? Register Globals is on. - Nilaab -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Need Redirection Trick...
Great Jason, thanks a lot. I was just looking for some direction and I think you just helped me find it. Thanks for taking the time to look at my problem.:) - Nilaab -Original Message- From: Jason Wong [mailto:[EMAIL PROTECTED]] Sent: Thursday, December 05, 2002 11:46 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] Need Redirection Trick... On Friday 06 December 2002 11:35, [EMAIL PROTECTED] wrote: Hello Everyone, [lots of irrelevant stuff snipped] The second thing that should happen is that if there are actually no subcategories for the selected category then subcat_id should equal 0 and the script should redirect back to the same page with the GET variables of cat_id and subcat_id (which is equal to zero at this point). The problem is that I cannot redirect with a header() function because content is already sent to the browser at the beginning of the script (the list of categories). Is there any other way that I can redirect and send the variables of cat_id and subcat_id to the page in the second situation mentioned earlier? Register Globals is on. 1) BEFORE you output anything make your check whether you need to redirect. After all, if you're going to be redirecting, why output anything at all? or 2) Use the output buffering functions. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * /* Do not drink coffee in early A.M. It will keep you awake until noon. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] MySQL ?
Hi, Friday, December 6, 2002, 2:08:42 AM, you wrote: h I am really sorry but i can't find any good mySQL good mailing list... h How can i make a little php function to check if a table exists ? h Thanks a lot, h Hacook function table_exists($table){ return (@mysql_query('SELECT count(*) FROM '.$table)); } //usage $con = @mysql_connect(host , user , password); $table = database.table; if(table_exists($table)){ echo Table $table exists. br; }else{ echo Table $table does not exist.br; } -- regards, Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] md5 question
Hey. Is there a way to get the actual word/phrase from the long string that the md5 hash creates. Lets say, is there a way find out what b9f6f788d4a1f33a53b2de5d20c338ac stands for in actuall words ? Lee -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] md5 question
On Fri, 6 Dec 2002, conbud wrote: Hey. Is there a way to get the actual word/phrase from the long string that the md5 hash creates. Lets say, is there a way find out what b9f6f788d4a1f33a53b2de5d20c338ac stands for in actuall words ? In all cases, an md5sum string means, You've got better things to do besides trying to figure out what this string means, trust me. ;) Check RFC 1321. http://www.ietf.org/rfc/rfc1321.txt ~Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php