Re: [PHP] Object References Problem
Since i see from your code, you are trying to create an object which maintains a list (collection) of instances of another object. Is that correct? Or you are trying to inherit a class from a parent class? Then it's a little bit different story. If this is the case, just tell me and I'll provide you with another example. The confusion comes from using 'parent' and 'child' as names for the class variables. I'll give you an example for the first case just keeping your name convention, but in general it's a good idea to use some more natural (descriptive) names for your variables, and especially to avoid 'parent/child' convention if the classes are not really inherited classes. So, here it is the example, feel free to ask in case there is something unclear in it: // class Object_1 defines the parent object class Object_1 { var $_children; function Object_1() { $this->_children = array(); } function addChild($child) { $this->_children[] = $child; } function getChildren() { return $this->_children; } } // class Object_2 defines the child object(s) class Object_2 { var $_myName; function Object_2($name) { $this->_myName = $name; } function getName() { return $this->_myName; } } // implementation, the long way $MyParentObject = new Object_1; $MyChildObject_1 = new Object_2("child object 1"); $MyChildObject_2 = new Object_2("child object 2"); $MyChildObject_3 = new Object_2("child object 3"); $MyParentObject->addChild($MyChildObject_1); $MyParentObject->addChild($MyChildObject_2); $MyParentObject->addChild($MyChildObject_3); // implementation, the short way $MyParentObject->addChild(new Object_2("child object 4")); $MyParentObject->addChild(new Object_2("child object 5")); // list all children registered in the parent object foreach ($MyParentObject->getChildren() as $achild) { echo $achild->getName() . ""; } ?> Hope this will help, Boyan Gareth Williams wrote: Hi there, I'm having trouble with passing objects as references. What I want to do is something like this: class object_1 { var $my_chld; var $my_array; function object_1() { $this->my_array = array('id' => 0, 'name'=>''); $this->my_child = new object_2($this); } } class object_2 { var $my_parent; function object_2(&$parent_object) { $this->my_parent = $parent_object; } function set_parent() { $this->my_parent->my_array['id'] = 1; $this-> my_parent->my_array['name'] = 'test'; } } $instance = new object_1(); $instance->my_child->set_parent(); echo "instance: ".$instance->my_array['name'].""; echo "parent: ".$instance->my_child->my_parent->my_array['name'].""; The above code give the output: instance: parent: test where I want it to give: instance: test parent: test but somewhere along the way, the reference to the parent object is being broken. I've looked all over the place, and I can't find the answer to this. Can somebody please help me? Cheers, Gareth -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] OOP, dynamic class extention
Hey guys, you can extend a _class_ from an existing _class_ but not from a _string_constant_ (Ex1 - MY_BASE_CLASS is evaluated to constant of type string) neither from a _string_variable_ (Ex2 - $my_base_class_var is a variable of type string). To be able to use different base classes with the same name just change the reference to the different settings files that contain the class declared with the same name but with different functionality, perhaps in the following way: Or even (much) better create a single base class in a single configuration file and different modified instances of that class used for each of the different configurations you may have. Boyan Jackson Miller wrote: On Thursday 30 October 2003 02:15 pm, Marek Kilimajer wrote: Can you show it once again. In your first email you use a constant, not variable. Sure. In my first email I said that I had tried with a variable too (but didn't show the code). Ex1 gives a "cannot inherit from undefined class" error Ex2 gives a "parse error, expecting T_STRING" Ex1 (with constants): // settings to be set on install of the app define("MY_BASE_CLASS","base_class"); define("MY_BASE_CLASSFILE","base_class.php"); // require the class file require_once(MY_BASE_CLASSFILE); class my_child_class extends MY_BASE_CLASS { // yada yada } ?> Ex2 (with variables): // settings to be set on install of the app define("MY_BASE_CLASS","base_class"); define("MY_BASE_CLASSFILE","base_class.php"); $my_base_class_var = MY_BASE_CLASS; // require the class file require_once(MY_BASE_CLASSFILE); class my_child_class extends $my_base_class_var { // yada yada } ?> Also, just to be clear: base_class.php class base_class { function base_class() { echo "it works"; return true; } } ?> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Templates/Separate content from presentation
Harry Fuecks (phpPaterns(), see the link below) has a quite interesting opinion concerning php and the use of templates, with which I generally agreed, after spending some hard time to investigate the most suitable for me templating ideology/approach/system. I would suggest you first read this article and then decide whether to 'succumbing to the lure of templates' or to find your best way to use php itself as a template engine. 'Templates and Template Engines' http://phppatterns.com/index.php/article/articleview/4/1/1/ Some more resources that may help answering your question: 'Compiling a list of PHP Template Engines' http://www.phppatterns.com/index.php/article/articleview/69/1/11/ http://www.bernhardseefeld.ch/archives/67.html http://www.phpbuilder.com/mail/php-general/2003042/1730.php http://www.massassi.com/php/articles/template_engines/old/ http://www.scripps.edu/~jesusmc/cachedtpl/CachedTemplate.html http://zend.com/zend/trick/tricks-nov-2001.php Cheers, Boyan Nedkov -- Pedro Pais wrote: Hi! I've coded in PHP for a while, but I had to leave it for some time. Now I'm back, and I'd like to know what's currently being used to separate content from presentation, besides Smarty (that seems to be Google's top choice)? Thanx -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mail() another example - error
This time your script is ok, the connection to the SMTP server is established, but because the host name of the machine that executes your php script is not a valid host name in the SMTP server's local network, the server refuses to accept your request for security reasons (smtp relaying blocked for external hosts). To avoid this you have (at least) 2 options: - to use the SMTP server of your provider, i.e. SMTP server for which you are a valid local network host. Keep in mind that the SMTP server does not care about the host name you provide in your code ('$senderFrom = "[EMAIL PROTECTED]";'), but just takes the real host name of machine executing the script. - to find and use an open relay SMTP server, that smells very much to a spamming activity, so I strongly suggest you to don't do that. Boyan -- [EMAIL PROTECTED] wrote: I use this script: /** in php.ini - localhost [mail function] SMTP = mail.serbis.com; only win32 sendmail_from = [EMAIL PROTECTED]; */ $msg = "this is a test"; $senderFrom = "[EMAIL PROTECTED]"; $receiverTo = "[EMAIL PROTECTED]"; $subject = "test of the mail function"; $mailHeaders = "From: $senderFrom\n"; $mailHeaders .= "Reply-to: $senderFrom\n"; $mailHeaders .= "Message-Id: 16295644\n"; mail($receiverTo, $subject, $msg, $mailHeaders); ?> I got this error: Warning: mail(): SMTP server response: 550 not local host ojpp.myftp.org, not a gateway in D:\htdocs\ojpp\functions\mail\2.php on line 19 thanks, for any help. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problems using gethostbyname() to resolve *.net.au
the firewall is configured to block pings from outside - security reasons - so called stealth mode Dan Anderson wrote: Some domain names on .net.au are not being resolved when I use gethostbyname. I can whois them on http://whois.ausregistry.net.au/and fine them, but they can't be pinged. Anybody know why this might be? Thanks in advance, Dan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problems using gethostbyname() to resolve *.net.au
[snip] ... I can whois them on http://whois.ausregistry.net.au/and fine them, but they can't be pinged. Anybody know why this might be? [snip] I'm just answering your question why they can't be pinged. You are perfectly right that 'gethostbyname($hostname) has nothing to do with pings as a matter of fact' and then I just wonder why do you try to resolve your gethostname() problem by pinging the hosts, if you know what the answer is. Possible reason for the problem could be that your DNS provider doesn't have a record in its database for the domain name you try to resolve. Solution - try to find a script (I have such class but written in Delphi) with functionality similar to nslookup so to be able to define another DNS server for the resolving query. This script should also be able to send queries to more than one DNS server if you wish to minimize the amount of the domains unresolved. Or change your DNS provider with another one more reliable. HTH Boyan -- Dan Anderson wrote: the firewall is configured to block pings from outside - security reasons - so called stealth mode No, you are wrong. gethostbyname($hostname) correctly resolves my servers, and I have disabled pings for security reasons. gethostbyname($hostname) has nothing to do with pings as a matter of fact. It performs a whois lookup and returns the ip address of $hostname. -Dan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Showing high and low flash clips
Suppose we have a recordset $rs returned by query like that: SELECT mediaID, filename, languageID FROM yabady a INNER JOIN yohoho b on a.ID = b.ID ORDER BY mediaID then to build the array you can write: for ($i = 0; $i <= $rs->getRowCount() - 1; $i++) { $row = $rs->getRow(); $data = array('mediaID'=> $row['mediaID'], 'filename' => $row['filename'], 'languageID' => $row['languageID']); } Haven't tested it, but have a similar code in one of my scripts here that works fine. Boyan -- [EMAIL PROTECTED] wrote: Hi there, i'm stumped on a problem, i am trying to create an admin tool, which will database files which are ftp'd to the server first. A drop down list of flash files are viewed, and they are seperated into high and low clips with a language key joined to them. They are stored in the database like: mediaID filename languageID bandwidth What i am having problems with is that when editing the record, i would like to list each with both a high and low pulldown with a language list, although there is an issue here as each clip has its own entry into the database so its coming out sequentially and i would like it showing the 2 drop downs and the language joined to these. The issue is storing the primary key of these files, so when i hit update it will update each file record. So when abstracting the data, i am trying to push both files into an array with a language. I want it to look like Array ( [0] => Array ( [0] => Array ( [mediaID] => 3 [filename] => news_hi.swf [languageID] => 1 ) [1] => Array ( [mediaID] => 4 [filename] => news_lo.swf [languageID] => 1 ) ) [1] => Array ( [0] => Array ( [mediaID] => 3 [filename] => news_hi.swf [languageID] => 1 ) [1] => Array ( [mediaID] => 4 [filename] => news_lo.swf [languageID] => 1 ) ) ) How is it possible ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Documentation procedure
http://phpdocu.sourceforge.net/ http://www.callowayprints.com/phpdoc/ http://sourceforge.net/projects/phpdocu/ http://www.stack.nl/~dimitri/doxygen/ Ahbaid Gaffoor wrote: Is there any utility that can be run against a php script to generate documentation of the functions in that script? Sort of like javadoc is for java code thanks Ahbaid -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: [PHP-DB] Unsuscribe
try to do this here: http://www.php.net/mailing-lists.php [EMAIL PROTECTED] wrote: Unsubscribe -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Apache1.3.28 vs PHP4.3.3
For getting up and running php on WinXX box you need only: LoadModule php4_module D:/PHP4.3.3/sapi/php4apache.dll AddType application/x-httpd-php .php To avoid the problem with removing 'mod_php4.c' try to find 'ClearModuleList' directive in httpd.conf and comment it, then restart the server once again Hope this help, boyan -- [EMAIL PROTECTED] wrote: Apache 1.3.28 / PHP 4.3.3 hello, I tried to configure php as module SAPI of the apache web server, I put this line: LoadModule php4_module D:/PHP4.3.3/sapi/php4apache.dll AddModule mod_php4.c AddType application/x-httpd-php .php When I tested the configuration, I got this error: Cannot remove module mod_php4.c: not found module list I removed the "AddModule mod_php4.c" directive, restart the server, but remain the same problem Thanks for any help, I will really aprecciate your support, bye. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] anyway to return more than one value?
One possible solution could be to write a simple class that will hold all data you need at one single place: class MyData { var $_resultArray; var $_rows; var $_fields; function MyData($resultArray, $rows, $fields) { $this->data = $data; $this->rowcounr = $rowcount; $this->fildcount = $fildcount; } function getResultArray() { return $this->_resultArray; } function getRows() { return $this->_rows; } function getFilds () { return $this->_fields; } } To put some data in that object write: $data = new MyData($theResultArray, $rows, $fields); To get back your stuff in your code use something like: $theResultArray = MyData->getResultArray(); $rows = MyData->getRows(); $fields = MyData->getFields(); This is only an example code, you should adjust it according your needs hth Boyan -- Chris W. Parker wrote: Hi list. Ok I know it's not possible to "return" more than one value. But I'm going to explain what I'd like to do so maybe there's an easy way to do it. I've got some functions that query a database and turn the result into an array and return that array. What I'd like to do is not only return the array of results but ALSO return a row count and field count of that result. Here is some pseudo code: function get_results() { // query database $result = query($sql); // turn result set into a useable array $theResultArray = get_results($result); $rows = mysql_num_rows($result); $fields = mysql_num_fields($result); return $theResultArray; return $rows; return $fields; } Ok I know that won't work but that's just basically what I want to do. The only way around this I've come up with is to stick all the values into ANOTHER array and return then and then dissect that array in the calling function, but that just seems messy. All of a sudden the word "reference" came to mind. Is that what I want to use? Any help would be appreciated. Thanks, Chris. -- Don't like reformatting your Outlook replies? Now there's relief! http://home.in.tum.de/~jain/software/outlook-quotefix/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] anyway to return more than one value?
[snip] > ... Someone also suggested I use > a new class. Sounds like a good idea, but might be overkill > for what I'm doing. [/snip] .. if you spend some time moving closer to the object oriented approach (php classes in this case) you may find that the development could be much more clear and easy ... and then will never come back to the functional/procedural way of programming -- Chris W. Parker wrote: Hi list. Ok I know it's not possible to "return" more than one value. But I'm going to explain what I'd like to do so maybe there's an easy way to do it. I've got some functions that query a database and turn the result into an array and return that array. What I'd like to do is not only return the array of results but ALSO return a row count and field count of that result. Here is some pseudo code: function get_results() { // query database $result = query($sql); // turn result set into a useable array $theResultArray = get_results($result); $rows = mysql_num_rows($result); $fields = mysql_num_fields($result); return $theResultArray; return $rows; return $fields; } Ok I know that won't work but that's just basically what I want to do. The only way around this I've come up with is to stick all the values into ANOTHER array and return then and then dissect that array in the calling function, but that just seems messy. All of a sudden the word "reference" came to mind. Is that what I want to use? Any help would be appreciated. Thanks, Chris. -- Don't like reformatting your Outlook replies? Now there's relief! http://home.in.tum.de/~jain/software/outlook-quotefix/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] anyway to return more than one value?
sure, no point to discuss that issue here -- Robert Cummings wrote: On Wed, 2003-11-05 at 21:22, Andre Volmensky wrote: [snip] .. if you spend some time moving closer to the object oriented approach (php classes in this case) you may find that the development could be much more clear and easy ... and then will never come back to the functional/procedural way of programming [/snip] I have been interested in learning about classes, but I have not had any real need for them, I'm sure I could have used them A LOT but have been able to do without them. What are the real advantages using classes? And when do you think they should be used? It ABSOLUTELY amazes me how this list is so cyclic. Every couple of weeks or so the exact same questions rotate back to the head of the "already been answered, but someone needs to ask it again" list. Sure they get a wee bit of a rewording-- for instance "what is better OOP or procedural?" or "What are the real advantages using classes? And when do you think they should be used?" Anyways, just pointing out something I notice over and over again. Cheers, Rob. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Input Validation of $_SESSION values
[snip] > ... Short of any severe bugs in PHP's core, there is no way for a > user of your Web application to modify session data ... [/snip] It seems that statement is not completely correct considering the topic discussed in the paper 'Session Fixation Vulnerability in Web-based Applications' (http://secinf.net/uplarticle/11/session_fixation.pdf). I am also interested in the session security issue so any comments on that publication are welcome. hth, Boyan -- Chris Shiflett wrote: --- Pablo Gosse <[EMAIL PROTECTED]> wrote: In all honesty I don't know enough about how one would go about attempting to hack the values of a session other than through hacking into the session files, so if anyone has any input on this please pass it along. Well, you basically hit the nail on the head (which means you're right, in case that phrase makes no sense to anyone). Short of any severe bugs in PHP's core, there is no way for a user of your Web application to modify session data. This data can be modified by you (so users can potentially modify session data if you have a flaw in your logic, notably $_SESSION['foo'] = $_GET['foo']), or by physical access to the session data store (/tmp, a database, or whatever). So, as far as writing PHP goes, concern yourself with ensuring all data is filtered prior to being stored in the session. A strict naming convention can help here. As far as the environment goes, there are of course many more factors, but you basically want to protect your session data store as you would personal user data or anything else like that. Hope that helps. Chris = My Blog http://shiflett.org/ HTTP Developer's Handbook http://httphandbook.org/ RAMP Training Courses http://www.nyphp.org/ramp -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Input Validation of $_SESSION values
Yes, you are right, it was my misunderstanding, sorry guys. Anyway, hope that posting was useful concerning the subject of the discussion. Boyan -- CPT John W. Holmes wrote: From: "Boyan Nedkov" <[EMAIL PROTECTED]> [snip] > ... Short of any severe bugs in PHP's core, there is no way for a > user of your Web application to modify session data ... [/snip] It seems that statement is not completely correct considering the topic discussed in the paper 'Session Fixation Vulnerability in Web-based Applications' (http://secinf.net/uplarticle/11/session_fixation.pdf). I am also interested in the session security issue so any comments on that publication are welcome. No, the statement is still correct. The paper discusses how malicious users could possibly set the SESSION_ID to a predetermined value and then hijack the session because they know it's value. They still cannot directly change session variables that your script is creating. In order to combat session fixation, use the session_regenerate_id() function: http://us2.php.net/manual/en/function.session-regenerate-id.php ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Unique ID
Dimitri Marshall wrote: Hi there, Here's my situation: I'm making a message board and I've decided the best way to go about the structure is to have 3 tables, two of them will be "Posts" and "Replys". Now, in order for this ti work, each post has to have a UniqueID - same with the replys. Looking at another program, I can see that one way to do this is to do it by rows (ie. count how many rows, add 1, then that is the ID). It would be unique because no two rows would be 1 for example. The problem I can see is that the database would become incredibly huge (size wise I mean). I want to delete the posts after 30 days, and if I delete the row, then that would mess up the row system. Any suggestions? Dimitri Marshall A standard solution in this case is to use one common table for all messages, both 'posts' and 'replays', distinguishing them by 'type' (TypeID, say 1 for post, 2 for replay), and then build a parent/child relationship between both type of messages in that table. In this way each message will have unique id. When you need all or some 'post' messages, use a query for selecting TypeID = 1, resp. TypeID = 2 for 'replay' messages. Concerning the deletion of a message (post or replay), you should write a query which will recursively delete the message selected as well as all child messages assigned to that (parent) message. The easiest way to do this is to use triggers, but that depends on the database you work with. To get closer to this approach and to find some nice examples, check out the following resources: http://www.sqlmag.com/Articles/Index.cfm?ArticleID=8826 http://www.sqlteam.com/item.asp?ItemID=8866 http://msdn.microsoft.com/library/default.asp?url=/library/en-us/acdata/ac_8_qd_14_5yk3.asp http://www.yafla.com/papers/sqlhierarchies/sqlhierarchies.htm HTH, Boyan -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help with scripts to add records to a database
Rolf Brusletto wrote: Mark wrote: Sorry guys, I have tried all the suggestions so far with no luck. Regards, Mark Mark - After the mysql_query($query); line add the following line echo mysql_error(); run the script and try to add something again, if there is an error, it will tell you via mysql_error(); echo it out to the browser, and get back to me :) do the same with the variable $query - insert a line echo $query into your code just before the query execution and check carefully the query string returned by that line -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] OOP clarification: Messages between objects
Robert Ian Smit wrote: I am trying to implement a generic form handler that is capable of printing the form and checking the user input. I want this application to be useful in the end, but I also use it to explore OOP in PHP. .. I'd like the zipcode object to ask a question to find out what country we're dealing with and then apply the check of the input depending on the answer. Although these questions are specific to my application, I guess my real question is more general. When you have a containerobject that stores different kinds of elements, how do you give the elements the ability to learn about their surroundings so they can alter their behaviour? Since I see you are interested in an OOP solution of your problem, I'll try to answer you taking that point of view. Altering the object behavior depending on a given context (surrounding variable(s)) could be done easily by performing PHP's class inheritance and polymorphism. In your case you can use an abstract class, say class ZipCode, which defines the functionality of a generic zipcode object, independent of any country standard. We call this class abstract because no objects will be created as direct instances from it. Then for each country standard you can have a class, inherited from the ZipCode abstract class, in which the format() method is overridden so to implement appropriate for that standard reformatting algorithm. When you create new zipcode object for a given standard, first check the context variable (say $country) and them make decision which subclass to use for creating the new zipcode object. In this way by calling the format() method of the created zipcode object, different algorithms for reformatting the zipcode provided will be implemented. Perhaps this short explanation will be more clear considering the example code below. In this example we have an abstract class ZipCode, and 2 subclasses - ZipCodeUS and ZipCodeDE, representing the zipcode formatted accordingly (fake) 'USA' and 'Germany' standards. Check out the implementation code at the end of the example by giving 'US' and 'DE' values to the $country variable. HTH, Boyan -- -- example /** * class ZipCode * abstract class, never used for creating objects * represents a generic zipcode object */ class ZipCode { // data members var $_zipcode; var $_zipcodeFormated; // constructor function ZipCode($value) { $this->_zipcode = $value; } // abstract method, // to be overriden in class instances function format(){} // data member accessor function getCode() { return $this->_zipcodeFormated; } } /** * class ZipCodeDE * represents zipcode according the 'DE' standard; * incherited from ZipCode, with overriden format() method **/ class ZipCodeDE extends ZipCode { function format() { // move the number part at the begining $tmp = explode(' ', $this->_zipcode); $tmpf = array($tmp[1], $tmp[0], $tmp[2]); $this->_zipcodeFormated = implode(" ", $tmpf); } } /** * class ZipCodeUS * represents zipcode according the 'US' standard; * incherited from ZipCode, with overriden format() method **/ class ZipCodeUS extends ZipCode { function format() { // move the number part at the end $tmp = explode(' ', $this->_zipcode); $tmpf = array($tmp[0], $tmp[2], $tmp[1]); $this->_zipcodeFormated = implode(" ", $tmpf); } } // // test implementation $a_zipcode = 'AA 1234 BB'; $country = 'DE'; if ($country == 'US') { $ZipCode = new ZipCodeUS($a_zipcode); $ZipCode->format(); } if ($country == 'DE') { $ZipCode = new ZipCodeDE($a_zipcode); $ZipCode->format(); } echo "zipcode '" . $a_zipcode . "' formated according the '" . $country . "' standard: " . $ZipCode->getCode() . ""; ?> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php and apache
Jen wrote: Hi there. New to the PHP space here and I'm trying to set things up. (if I'm on the wrong newsgroup, please let me know...) I've got Apache 1.3.27 running and I have downloaded PHP 4.3.4 on my computer. Next, I created a test.php file which contains: phpinfo(); ?> That's it - real simple. I just want to see it work on the server, but when I open up that page in a browser, it just displays those tags, exactly as I typed them. If I go to http://localhost, I get a page that says, "If you can see this, it means that the installation of the Apache web server software on this system was successful. You may now add content to this directory and replace this page." Now, maybe I'm just not putting test.php in the right directory? I'm not sure. Apache is running from d:/apache/apache/ and PHP is located in d:/php/. Any help would be appreciated! Thanks. read install.txt located in d:/php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Usings functions and variables from a base class
[EMAIL PROTECTED] wrote: Hi there i am having problems using a functions from a base class in a sub class. I am using a perticular function from the base class which is private in a public function in the sub class which is checking for a variable which is set in a function in the base class. Anyway, its doesnt seem to register that variable for some reason. I have initiated the base class in the constructor like parent::DB; , what do you reckon is the problemo ? hmm .. smells like a reference problem, but difficult to say without any line of example code, could you provide us with some pls? By the way, what do you mean by 'perticular function from the base class which is private in a public function in the sub class'? What for trick is that?? Hope to hear more from you, Boyan -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem with Apache 1.3.28 / PHP 4.3.3
[EMAIL PROTECTED] wrote: I had problem in the configuration of Apache 1.3.28 and PHP 4.3.3 as SAPI module, they are run well as CGI module, I put this lines for it: ScriptAlias /php/ "D:/PHP4.3.3/" AddType application/x-httpd-php .php Action application/x-httpd-php "/php/php.exe" as SAPI module, I put this lines: LoadModule php4_module D:\PHP4.3.3\sapi\php4apache.dll AddModule mod_php4.c AddType application/x-httpd-php .php A friend told me that remove the line "AddModule mod_php4.c", I got this error: d:/program files/apache1.3.28/apache/conf/httpd.conf: Syntax OK Cannot remove module mod_php4.c: not found in module list If I leave the line "AddModule mod_php4.c", I get this error: Module mod_php4.c is already added, skipping d:/program files/apache1.3.28/apache/conf/httpd.conf: Syntax OK Cannot remove module mod_php4.c: not found in module list thanks for any help. bye. I answered your question few days ago but didn't hear any reaction, so I'm reposting the same text with hope this time it will be more useful Cheers, Boyan -- Original Message Subject: Re: [PHP] Apache1.3.28 vs PHP4.3.3 Date: Thu, 06 Nov 2003 00:59:58 +0100 From: Boyan Nedkov <[EMAIL PROTECTED]> To: [EMAIL PROTECTED] CC: [EMAIL PROTECTED] References: <[EMAIL PROTECTED]> For getting up and running php on WinXX box you need only: LoadModule php4_module D:/PHP4.3.3/sapi/php4apache.dll AddType application/x-httpd-php .php To avoid the problem with removing 'mod_php4.c' try to find 'ClearModuleList' directive in httpd.conf and comment it, then restart the server once again Hope this help, boyan -- [EMAIL PROTECTED] wrote: > Apache 1.3.28 / PHP 4.3.3 > > hello, I tried to configure php as module SAPI of the apache web server, I > put this line: > > LoadModule php4_module D:/PHP4.3.3/sapi/php4apache.dll > AddModule mod_php4.c > AddType application/x-httpd-php .php > > When I tested the configuration, I got this error: > > Cannot remove module mod_php4.c: not found module list > > I removed the "AddModule mod_php4.c" directive, restart the server, but > remain the same problem > > Thanks for any help, I will really aprecciate your support, bye. > -- 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] include/require not allowed in classes?
Ryan, Pavel, Pavel Jartsev wrote: Ryan A wrote: ... > class ads_DB extends DB_Sql { var $Host = $MR_Host; var $Database = $MR_Database; var $User = $MR_User; var $Password = $MR_Password; } > I think, Your problem is here. If i remember correctly, then PHP4 doesn't allow to initialize "var"-s with non-constant values. Initializing data members ("var"-s) of a class with non-constant values is completely legal operation in PHP, so I don't think this could be a reason for the problem. Concerning the original question: Ryan A wrote: > > Are includes/requires not allowed in classes? Includes/requires are not allowed inside the class declaration; if you try to do that the parser will complain with error message like "Parse error: unexpected T_INCLUDE_ONCE .." or something similar depending on which include/require statement is used. > if the answer to that is no, then whats wrong in my code? At first glance I see at least one confusing think in the code provided: /* public: constructor */ function DB_Sql($query = "") { $this->SetConnectionParameters(); $a0 = 'edoc_'.'ssap'; $a0 = $GLOBALS[strrev($a0)]; $a1 = 'admin'.'_'.'name'; $a1 = $GLOBALS[$a1]; $a2 = 'eciovni'; $a2 = $GLOBALS[strrev($a2)]; $a3 = 'do'.'main'; $a3 = $GLOBALS[$a3]; $a4 = md5($a1.$a3.$a2); I don't see the point of re-setting values of $a0 .. $a3, perhaps this is a kind of debugging action - can't be sure, you should check that by yourself. Now, possible solution of the problem how to use a global file with connection parameters with multiple classes: 1. Include 'connection parameters' file in the file where the class 'ads_DB extends DB_Sql' is declared; 2. Add a new manhood (function) to the class 'ads_DB extends DB_Sql' as follows: function SetConnectionParameters() { global $MR_Host, $MR_Database, $MR_User, $MR_Password; $this->Host = $MR_Host; $this->Database = $MR_Database; $this->User = $MR_User; $this->Password = $MR_Password; } 3. Call this method (function) once in the constructor of the 'ads_DB extends DB_Sql' class, like: /* public: constructor */ function DB_Sql($query = "") { $this->SetConnectionParameters(); // <=== $a0 = 'edoc_'.'ssap'; $a0 = $GLOBALS[strrev($a0)]; $a1 = 'admin'.'_'.'name'; $a1 = $GLOBALS[$a1]; $a2 = 'eciovni'; $a2 = $GLOBALS[strrev($a2)]; $a3 = 'do'.'main'; $a3 = $GLOBALS[$a3]; $a4 = md5($a1.$a3.$a2); if(($a4 != $a0) && rand(0,1)) { .. 4. See what will happen .. :-)) Hope that helps, Boyan -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Parse error?
Frank Keessen wrote: Hi Guys, Sorry to trouble you on a saturday night (at least in The Netherlands...).. Get a parse error on line 42, but i can't see what is causing the trouble. (Parse error: parse error in /home/.sites/95/site92/web/admin/editreis.php on line 42) if(is_array($_POST['accomodatieid'])) { foreach($_POST['accomodatieid'] as $Key => $Value) { $query = 'INSERT INTO ttra(reisid, accomodatieid) VALUES ('. $id2 .', '. $Value .')'; $result = mysql_query($query) or die ("Error in query: $query. " . mysql_error()); }; } else { $query = 'INSERT INTO ttra(reisid, accomodatieid) VALUES ('$id2', '.$_POST['accomodatieid'].')';<- THIS IS LINE 42 $result = mysql_query($query) or die ("Error in query: $query. " . mysql_error()); } Thanks for the help! Regards, Frank if(is_array($_POST['accomodatieid'])) { foreach($_POST['accomodatieid'] as $Key => $Value) { $query = "INSERT INTO ttra(reisid, accomodatieid) VALUES ('" . $id2 . "', '" . $Value . "')"; $result = mysql_query($query) or die ("Error in query: $query. " . mysql_error()); } } else { $query = "INSERT INTO ttra(reisid, accomodatieid) VALUES ('" . $id2 . "', '" . $_POST['accomodatieid'] . "')"; $result = mysql_query($query) or die ("Error in query: $query. " . mysql_error()); } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] php's variables & javascript
Try something like that: "; echo "width="; echo $size; echo ";"; echo ""; ?> Cheers, boyan -- Boyan Nedkov [EMAIL PROTECTED] > -Original Message- > From: burak delice [mailto:[EMAIL PROTECTED]] > Sent: Monday, May 27, 2002 11:59 PM > To: [EMAIL PROTECTED] > Subject: [PHP] php's variables & javascript > > > hi everyone, > > I want to make a php that include javascript that use a php > variable. Code is below: > > $size = GetImageSize ("images/$resim"); > echo " > wdth=";$size;echo";"; > echo ""; > ?> > > (I am calling that php file as below) > http://localhost/Aksu/web/getimage.php?> resim=K00.jpg > > But > explore gives me an javascript error that > syntax error. Why? and how can do my purpose? > > thanks > burak delice > > > > > > -- > 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