[PHP] Re: [PEAR] PEAR DB PAGER array_push
[EMAIL PROTECTED] wrote: Salut! is there a good way to present data from table (many fields / not only one) into $itemData instead of array_push (line 12 .. 16) ? == ?php /** * PEAR DB */ require_once 'DB.php'; $db= DB::connect(mysql://valerie:@localhost/valerie); $query = 'SELECT id, name FROM country'; /** * PEAR Pager Wrapper (this is the file stored * in the /examples/ dir of the PEAR::Pager package). * @see http://cvs.php.net/pear/Pager/examples/Pager_Wrapper.php */ require_once 'Pager/Wrapper.php'; $params = array( 'mode'= 'Jumping', 'perPage' = 30, 'delta' = 5, ); $page = Pager_Wrapper_DB($db, $query, $params); echo $page['links']; ? table border=1 tr thID/th thCountry/th /tr ?php foreach($page['data'] as $country) { echo 'tr'; echo 'td'. $country['id'] .'/td'; echo 'td'. $country['name'] .'/td'; echo '/tr'; } ? /table == HTH Regards, -- Lorenzo Alberton http://pear.php.net/user/quipo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Silly OOP question
I've always wondered this about OOP and maybe you guys can answer this question. I'm writing a php application and I'm trying to figure out the correct way to right the oop part of this application. for instance. I have a project.class file that has functions for dealing with individual projects because you break down ideas into singular entities in OOP(as I understand it) But what if I wanted to deal with multiple projects such as getting a list of the projects in my database, should I create a function in the project.class to handle the now plural request, or should I create a projects.class file that has a function called getProjects. Hopefully I'm explaining this question right. It makes sense in my own head. :-) Thanks, Brent
[PHP] Re: Silly OOP question
Brent Clements wrote: I've always wondered this about OOP and maybe you guys can answer this question. I'm writing a php application and I'm trying to figure out the correct way to right the oop part of this application. for instance. I have a project.class file that has functions for dealing with individual projects because you break down ideas into singular entities in OOP(as I understand it) But what if I wanted to deal with multiple projects such as getting a list of the projects in my database, should I create a function in the project.class to handle the now plural request, or should I create a projects.class file that has a function called getProjects. Hopefully I'm explaining this question right. It makes sense in my own head. :-) Thanks, Brent Well, if I get you right, you have a class named Project holds information about a project. Now you want a list of the current projects. I'd make a new class, named ProjectList or something similar, that can be used to administrate your projects. class Project { public $name;// The project's name public $ownerID; // The user ID of the project's owner /* The constructor. Note: this only works in PHP5 */ public function __construct ($id) { $db = mysql_connect(); // Get project info... $this-name= $result['name']; $this-ownerID = $result['owner']; } } class ProjectList { public $projects = array(); public function __construct () { $db = mysql_connect(); $query = mysql_query('SELECT id FROM projects'); $result = mysql_fetch_array($query); foreach ($result as $project_id) { $this-projects[$project_id] = new Project($project_id); } } public function listProjects () { return $this-projects; } public function addProject ($name, $owner) { // ... } public function deleteProject ($id) { // ... } } -- Daniel Schierbeck Help spread Firefox (www.getfirefox.com): http://www.spreadfirefox.com/?q=user/registerr=6584 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php mail() error
Hello, On 11/14/2004 03:49 AM, Curt Zirzow wrote: Requiring authentication is one common solution to not leave relaying opened. Common but not the *only* way. That is irrelevant because most servers that issue the message above only allow relaying with prior authentication. FYI, the class that I suggested implements both SMTP and POP3 based authentication. Maybe if you try them you will realize that I am provide a plain simple solution for the problem of the original poster because it consists only in replacing the mail() calls to the smtp_mail() provided with these classes: you know we're going down the same road that took up to much of my time from the last time. You simply dont comprehend that your solution is *not* the only solution and take offence to that. No, I take offence when you label as spam the messages that I post suggesting solutions that solve the original poster problem. We are just on the same road from the last time because you are still being childish and acting imaturely trying to insult me on a public forum. You are only making a fool of yourself because you reveal that a) you are not providing any solution (sending people to go and figure what their problem is on Google is not a solution), b) you are underestimating my knowledge of many years about this subject. Sometimes I forget names. But then when I notice the pattern of labeling as spam my messages helping others in PHP mailing lists, some bells ring. This is the very first time i ever labeled your stuff as spam. It is not the first time you try to offend me and obstruct my attempts to help PHP users, that is the pattern. There aren't many people that get keep protesting against my messages of helping others with ready to use PHP components that I have developed for many years to solve problems like they present. I have no problem with your solutions, I've simply stated that it may not be the only solution. Basically you have no clue what the problem is. That is why your reply was to go and figure in Google. If you had a clue, you would realize that a) this is a frequently posed problem, b) the solution is that it requires authentication because that is the default configuration for Microsoft SMTP servers. You can suggest other solutions (which you didn't) but those require changing the SMTP server configuration, which is usually beyhond the users possibilities. -- Regards, Manuel Lemos PHP Classes - Free ready to use OOP components written in PHP http://www.phpclasses.org/ PHP Reviews - Reviews of PHP books and other products http://www.phpclasses.org/reviews/ Metastorage - Data object relational mapping layer generator http://www.meta-language.net/metastorage.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: php mail() error
Hello, On 11/14/2004 04:11 AM, Curt Zirzow wrote: Im using the php mail() function to try send an email to a user that has just registered. mail($HTTP_POST_VARS['emailaddress1'], 'Matchmakers Website Registration' , 'Welcome'); But when I get the following error back.: Warning: mail(): SMTP server response: 550 5.7.1 Unable to relay for [EMAIL PROTECTED] Can someone help me out, by telling me what it means or what Im doing wrong? (Thank you Jason for the introduction! :-) That means your SMTP server requires authentication to relay messages. The mail function does not support SMTP authentication. for the record.. and to not mislead several people.. 550 simply means the message was not accepted. There are several other reasons why this will happen. The text after the 550 usually signifies what exactly the problem is. Yes, but 550 with the text in front of 5.7.1 Unable to relay for [EMAIL PROTECTED] is a common message presented by servers that only relay with prior authentication. If you had enough real world experience with SMTP servers you would know that. Again.. a simple google search reveals the other issues that may be involved. Your tool's *may* solve the problem, but it isn't 100% http://support.microsoft.com/default.aspx?scid=kb;en-us;q289553 quote While there are several causes for this error, the most common one is that there may be no recipient policy for the expected domain in the Exchange 2000 organization or the Exchange 2003 organization. /quote http://support.microsoft.com/?kbid=304897 http://www.eudora.com/techsupport/kb/1593hq.html Man, try to learn this for once. It is standard for Microsoft SMTP servers to be configured by default to not allow relaying messages to foreign domains without requiring prior SMTP authentication. Although, it is possible that the problem may be slightly different, that is not the default, so it is unlikely that just performing SMTP authentication would not solve the problem. Trust the voice of experience, it has been this way for years. Many people have already posted the same problem in this list since a long time ago and I have never heard of anybody that posted this same problem and used my classes with SMTP authentication without success. I developed the smtp_mail() function wrapping these classes precisely to make the solution straightforward for the users that just have to make a minimal change from the mail() calls to smtp_mail(). I do not use Microsoft software. I developed this because I had many requests from Microsoft users. Try it yourself on standard Microsoft SMTP server installation and you'll see. http://www.phpclasses.org/mimemessage http://www.phpclasses.org/smtpclass http://www.phpclasses.org/sasl -- Regards, Manuel Lemos PHP Classes - Free ready to use OOP components written in PHP http://www.phpclasses.org/ PHP Reviews - Reviews of PHP books and other products http://www.phpclasses.org/reviews/ Metastorage - Data object relational mapping layer generator http://www.meta-language.net/metastorage.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Hacking attempt
One of our customers how has Hacking attempt on their index.php instead of their regualr page. What caused this and how do we get the regualr page back? -- Member - Liberal International This is [EMAIL PROTECTED] Ici [EMAIL PROTECTED] God Queen and country! Beware Anti-Christ rising! Alberta on 22 Nov 2004 Boot out Ralph Klein - Vote Liberal!! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Hacking attempt
and what exactly is a hacking attempt? The Doctor wrote: One of our customers how has Hacking attempt on their index.php instead of their regualr page. What caused this and how do we get the regualr page back? -- Raditha Dissanayake. -- http://www.radinks.com/print/card-designer/ | Card Designer Applet http://www.radinks.com/upload/ | Drag and Drop Upload -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP+Oracle+Apache
Good day, I use Apache2+PHP5+Oracle8 under WindowsXP I want use php with Oracle. I uncommented strings in php.ini: ;extension=php_oci8.dll ;extension=php_oracle.dll ;extension=php_dbase.dll Now when I start apache it say me that this extensions are not present in extensions dir (But they are exactly here!) Can anybody help me? --- Best regards, Evgeniy Sudyr -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Silly OOP question
At 12:34 14-11-2004, Brent Clements wrote: I've always wondered this about OOP and maybe you guys can answer this question. I'm writing a php application and I'm trying to figure out the correct way to right the oop part of this application. for instance. I have a project.class file that has functions for dealing with individual projects because you break down ideas into singular entities in OOP(as I understand it) But what if I wanted to deal with multiple projects such as getting a list of the projects in my database, should I create a function in the project.class to handle the now plural request, or should I create a projects.class file that has a function called getProjects. Hopefully I'm explaining this question right. It makes sense in my own head. :-) If I get what you're doing right, then you need to break it down more, if you wanna go truly OOP ... and create an array of objects. Something like: $arrProjects[] = new project($projectname); and then have an object for each idea, that are handled by the projects, like: class Project { var $project_name; var $arrIdeas[]; function Project($projectname) { $this-project_name = $projectname; } function add_idea() { $this-arrIdeas[] = new idea(); } } Just remember that PHP isn't a true OOP language, so going OOP may not necessarily be the best solution always. OOP makes certain types of projects easier to code, and some projects would be almost impossible to do without OOP (like anything you wanna do where you need to use scope to avoid major headaches), but because PHP isn't compiled or a true OOP language, OOP in PHP hampers performance, and that hampering is exponential with the complexity of the objects. FWIW Rene -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Database Search and seperate results page
After googling for quite some time I'm back asking here. I want to be able to seperate by search and results into two pages. My form is set up on Search.php I have set actionsearchresults.php Couple of questions: I have my array of user selected options from my form element - Ind[] I gather the processing of the array needs to be done first before posting. I tried this: searchresults.php?Ind=?php echo((isset($_POST[Ind[]]))?$_POST[Ind[]]:) ? but all I saw in the searchresults.php url was ..?ind = ? Does the searchresults page need to use the GET method to gather up the variables? Thanks Stuart -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHPINIPATH/PHPINIDIR/PHPININAME?
I wonder why the CLI version of PHP doesn't consult environment variables to override some default settings. This mechanism is used by all the other interpreters that I use (e.g.: perl with PERLLIB/etc, python with PYTHONHOME/PYTHONPATH/etc, ruby with RUBYOPT/RUBYLIB/RUBYPATH/etc). PS: I am aware of -c. It would be nice to have something like PHP_INI_PATH/PHP_INI_DIR/PHP_INI_NAME though... Regards, dave -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re:[SOLVED] [PHP] Database Search and seperate results page
--- Stuart Felenstein [EMAIL PROTECTED] wrote: -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Overwriting offset methods of ArrayObject
Hello, I just tried to overwrite a method of ArrayObject like this: class MyArrayObject extends ArrayObject { public function offsetGet($key) { echo Here I am\n; return parent::offsetGet($key); } } $o = new MyArrayObject(); $o['test'] = 'test'; echo $o['test']; I think this should output the text Here I am because I have overwritten the offsetGet method of ArrayObject which is called if I access an array element of this object. But it doesn't. My method is simply ignored. Then I've written a simple Object which implements the ArrayAccess interface like the ArrayObject object does. And then I have done the same as above but this time I don't extend ArrayObject but my own object. This works. My overwrite method is called I'm confused. Why can't I overwrite the method in ArrayObject? Is this a bug? Or are the methods of ArrayObject marked as final? But even then I must get an Cannot override final method error. Some hints if I misunderstood something? If not I'm going to file a bug report. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Silly OOP question
On Sun, 2004-11-14 at 09:30, -{ Rene Brehmer }- wrote: Just remember that PHP isn't a true OOP language, so going OOP may not Please define true OOP language and provide a few examples that meet your criteria. Then show how other examples like PHP fail to meet your true OOP criteria. Don't forget, if a language has OOP as a subset, it still has true OOP capabilities. Also it might help to clarify if you mean PHP in general or PHP4 and below. necessarily be the best solution always. OOP makes certain types of projects easier to code, and some projects would be almost impossible to do without OOP (like anything you wanna do where you need to use scope to avoid major headaches), but because PHP isn't compiled or a true OOP PHP is runtime compiled to bytecode. It's just as compiled as any other language. With a good compiler cache it's just as compiled as java. language, OOP in PHP hampers performance, and that hampering is exponential with the complexity of the objects. You're shitting us all right? Exponential? Really? could you show us some benchmarks on how it's exponential? Let's not be sowing seeds of FUD on the PHP general list. Cheers, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHPINIPATH/PHPINIDIR/PHPININAME?
On Sun, 14 Nov 2004 21:53:52 +0700, David Garamond [EMAIL PROTECTED] wrote: I wonder why the CLI version of PHP doesn't consult environment variables to override some default settings. This mechanism is used by all the other interpreters that I use (e.g.: perl with PERLLIB/etc, python with PYTHONHOME/PYTHONPATH/etc, ruby with RUBYOPT/RUBYLIB/RUBYPATH/etc). PS: I am aware of -c. It would be nice to have something like PHP_INI_PATH/PHP_INI_DIR/PHP_INI_NAME though... print_r($_ENV); -- Greg Donald Zend Certified Engineer http://gdconsultants.com/ http://destiney.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Test post from a new client
This is a test post from a new client. I'm trying to decide whether or not to keep it. Please post a reply so that I can see how it shows up. Thanx, Robb
[PHP] File Handing Windows / Linux
Hiya! I am trying to make some code which gets a handle to a directory, but has different code for my localhost (Windows) and for online (Linux server). Basically, I want either of the below lines. Say if the first fails, it must be on Linux and then it uses the line below. The two example lines are: @ $handle = opendir(c:/websites/mywebsite/extra/photos/.$_GET['page']./); @ $handle = opendir(/home/mywebsite/public_html/extra/photos/.$_GET['page']./); Had a search on google, but not really sure what to look for! Love, Steve XxX -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHPINIPATH/PHPINIDIR/PHPININAME?
Greg Donald wrote: On Sun, 14 Nov 2004 21:53:52 +0700, David Garamond [EMAIL PROTECTED] wrote: I wonder why the CLI version of PHP doesn't consult environment variables to override some default settings. This mechanism is used by all the other interpreters that I use (e.g.: perl with PERLLIB/etc, python with PYTHONHOME/PYTHONPATH/etc, ruby with RUBYOPT/RUBYLIB/RUBYPATH/etc). PS: I am aware of -c. It would be nice to have something like PHP_INI_PATH/PHP_INI_DIR/PHP_INI_NAME though... print_r($_ENV); What should I see in it? -- dave -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Silly OOP question
Daniel, Thanks for the insight, this is what I had thought. I just wanted to get a peer's validation of my thought process. You hit what I thought was right, right on the head. -Brent - Original Message - From: Daniel Schierbeck [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Sunday, November 14, 2004 6:54 AM Subject: [PHP] Re: Silly OOP question Brent Clements wrote: I've always wondered this about OOP and maybe you guys can answer this question. I'm writing a php application and I'm trying to figure out the correct way to right the oop part of this application. for instance. I have a project.class file that has functions for dealing with individual projects because you break down ideas into singular entities in OOP(as I understand it) But what if I wanted to deal with multiple projects such as getting a list of the projects in my database, should I create a function in the project.class to handle the now plural request, or should I create a projects.class file that has a function called getProjects. Hopefully I'm explaining this question right. It makes sense in my own head. :-) Thanks, Brent Well, if I get you right, you have a class named Project holds information about a project. Now you want a list of the current projects. I'd make a new class, named ProjectList or something similar, that can be used to administrate your projects. class Project { public $name;// The project's name public $ownerID; // The user ID of the project's owner /* The constructor. Note: this only works in PHP5 */ public function __construct ($id) { $db = mysql_connect(); // Get project info... $this-name= $result['name']; $this-ownerID = $result['owner']; } } class ProjectList { public $projects = array(); public function __construct () { $db = mysql_connect(); $query = mysql_query('SELECT id FROM projects'); $result = mysql_fetch_array($query); foreach ($result as $project_id) { $this-projects[$project_id] = new Project($project_id); } } public function listProjects () { return $this-projects; } public function addProject ($name, $owner) { // ... } public function deleteProject ($id) { // ... } } -- Daniel Schierbeck Help spread Firefox (www.getfirefox.com): http://www.spreadfirefox.com/?q=user/registerr=6584 -- 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] Silly OOP question
Brent Clements wrote: or should I create a projects.class file that has a function called getProjects. Yes, that's a possibility. You can even create more stuff in this Projects class like createProject, removeProject and stuff like this. If these tasks are pretty static and you don't need multiple instances of the Projects class then you can implement it completely statically so you don't need to instanciate the class: class Projects { private static $projects = array(); public static function getAll() { return self::$projects; } public static function add(Project $project) { self::$projects[] = $project; } } So now you can do this to get the projects: $projects = Projects::getAll(); Adding objects to the list can be done by the constructor of the Project class: function __construct() { Projects::add($this); } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP file permission
What is the optimal PHP file permission? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP file permission
depends on what you need it for Jerry Swanson wrote: What is the optimal PHP file permission? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] File Handing Windows / Linux
On Monday 15 November 2004 00:34, Steve Vernon wrote: I am trying to make some code which gets a handle to a directory, but has different code for my localhost (Windows) and for online (Linux server). Basically, I want either of the below lines. Say if the first fails, it must be on Linux and then it uses the line below. The two example lines are: @ $handle = opendir(c:/websites/mywebsite/extra/photos/.$_GET['page']./); opendir() returns FALSE if directory cannot be opened for any reason. You can also use file_exists(), is_dir(). -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- /* Hodie natus est radici frater. [ Unto the root is born a brother ] */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: File Handing Windows / Linux
Steve Vernon wrote: Hiya! I am trying to make some code which gets a handle to a directory, but has different code for my localhost (Windows) and for online (Linux server). Basically, I want either of the below lines. Say if the first fails, it must be on Linux and then it uses the line below. The two example lines are: @ $handle = opendir(c:/websites/mywebsite/extra/photos/.$_GET['page']./); @ $handle = opendir(/home/mywebsite/public_html/extra/photos/.$_GET['page']./); Had a search on google, but not really sure what to look for! Love, Steve XxX if(false === ($handle = opendir(c:/websites/mywebsite/extra/photos/.$_GET['page']./))) { $handle = opendir(/home/mywebsite/public_html/extra/photos/.$_GET['page']./); } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: PHP file permission
regular php page, some mysql queries and print html on the screen. On Sun, 14 Nov 2004 18:19:28 +0100, M. Sokolewicz [EMAIL PROTECTED] wrote: depends on what you need it for Jerry Swanson wrote: What is the optimal PHP file permission? -- 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] Database Search and seperate results page
On Sunday 14 November 2004 22:31, Stuart Felenstein wrote: After googling for quite some time I'm back asking here. I want to be able to seperate by search and results into two pages. Sadly, you're really not learning much from this list ... My form is set up on Search.php I have set actionsearchresults.php Couple of questions: I have my array of user selected options from my form element - Ind[] I gather the processing of the array needs to be done first before posting. I tried this: searchresults.php?Ind=?php echo((isset($_POST[Ind[]]))?$_POST[Ind[]]:) ? but all I saw in the searchresults.php url was ..?ind = ? ... print_r()/var_dump() $_POST[Ind[]], what do you see? Nothing I bet. Why? See manual PHP and HTML for details. Basically the contents of your form elements named 'Ind[]' have been placed in an array named 'Ind' and lives inside $_POST, ie $_POST['Ind'], and you can print_r() to see what it contains. Does the searchresults page need to use the GET method to gather up the variables? Yes, if you're using this method to pass them on: searchresults.php?Ind... Unfortunately, you can't just stick $_POST['Ind'] in there: searchresults.php?Ind[]=$_POST['Ind'] There are 2 way you can do this: a) Pass the individual elements of $_POST['Ind'] or b) serialize() $_POST['Ind'], pass it as a single element, then on the receiving page unserialize() it Conceptually (a) will probably be easier to understand so: you need to build a string which looks like: Ind[1]=value1Ind[2]=value2...Ind[n]=valuen which you append to your URL like so: searchresults.php?Ind[1]=value1Ind[2]=value2...Ind[n]=valuen This can be done using a foreach() on $_POST['Ind'], and implode(). Remember to validate each item as you go along. And PLEASE, stick: error_reporting(E_ALL); ini_set('display_errors', TRUE); on top of all your pages whilst you're developing. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- /* Aw, screw it. It probably isn't all that good anyway. Cartman, what are you talking about? You love Terrance and Philip! Yeah, but the animation is crappy. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Database Search and seperate results page
--- Jason Wong [EMAIL PROTECTED] wrote: Sadly, you're really not learning much from this list ... I partially disagree. I think it might be better for me to take a more elementary approach to the language before getting moving on to specific project issues. ... print_r()/var_dump() $_POST[Ind[]], what do you see? Nothing I bet. Why? See manual PHP and HTML for details. There are 2 way you can do this: a) Pass the individual elements of $_POST['Ind'] or b) serialize() $_POST['Ind'], pass it as a single element, then on the receiving page unserialize() it I posted a few hours prior to your response that this was solved. I am using the $_POST method. On the results page I check to see if there are any elements set and then move on to implode. It's working. Though I have some other things to figure out ;) Stuart -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] alert function
In html, there is the alert() function that makes a popup with a ok button. Is there such a thing in php? example: if ($lastname == ) { print brbrcenterfont face=arial color=redEnter a name!/font/center; } but that changes my page setup. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Silly OOP question
At 17:14 14-11-2004, Robert Cummings wrote: On Sun, 2004-11-14 at 09:30, -{ Rene Brehmer }- wrote: Just remember that PHP isn't a true OOP language, so going OOP may not Please define true OOP language and provide a few examples that meet your criteria. Then show how other examples like PHP fail to meet your true OOP criteria. Don't forget, if a language has OOP as a subset, it still has true OOP capabilities. Also it might help to clarify if you mean PHP in general or PHP4 and below. True as in parts of the OOP not being optional, like it is in PHP. You can fudge around the OOP principle in PHP and still get it working. necessarily be the best solution always. OOP makes certain types of projects easier to code, and some projects would be almost impossible to do without OOP (like anything you wanna do where you need to use scope to avoid major headaches), but because PHP isn't compiled or a true OOP PHP is runtime compiled to bytecode. It's just as compiled as any other language. With a good compiler cache it's just as compiled as java. Compiled to byte-code is only the same as pre-compiled in most other programming languages. language, OOP in PHP hampers performance, and that hampering is exponential with the complexity of the objects. You're shitting us all right? Exponential? Really? could you show us some benchmarks on how it's exponential? Dynamic object creation will always hamper performance relative to the object complexity. It's true for all languages ... it's within seconds though on a non-dedicated server, but depending on what you do, it's not that hard to break 30 secs exec time on PHP that way. Let's not be sowing seeds of FUD on the PHP general list. Then it might be good to read instead of interpret. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHPINIPATH/PHPINIDIR/PHPININAME?
On Sun, 14 Nov 2004 23:42:58 +0700, David Garamond [EMAIL PROTECTED] wrote: Greg Donald wrote: print_r($_ENV); What should I see in it? RTFM http://www.php.net/manual/en/reserved.variables.php#reserved.variables.environment -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] alert function
In html, there is the alert() function that makes a popup with a ok button. Is there such a thing in php? Actually, that's a JavaScript function. You can't do the same thing in PHP although you can use PHP to create the JavaScript. Printing an error message, like you already had, is probably a better choice, though (IMHO). Larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Silly OOP question
On Sun, 2004-11-14 at 13:27, -{ Rene Brehmer }- wrote: At 17:14 14-11-2004, Robert Cummings wrote: On Sun, 2004-11-14 at 09:30, -{ Rene Brehmer }- wrote: Just remember that PHP isn't a true OOP language, so going OOP may not Please define true OOP language and provide a few examples that meet your criteria. Then show how other examples like PHP fail to meet your true OOP criteria. Don't forget, if a language has OOP as a subset, it still has true OOP capabilities. Also it might help to clarify if you mean PHP in general or PHP4 and below. True as in parts of the OOP not being optional, like it is in PHP. You can fudge around the OOP principle in PHP and still get it working. True OOP is a programming paradigm you can choose or not choose to adhere to. Even in a purist OOP model, some person could implement their entire application in a procedural manner by creating a single Program object and using that object's methods as though they were non OOP procedures. So thusly, if I choose to only use OOP features in my code, then PHP is as pure as any other pure OOP model, by your own understanding. Thus the ability of PHP to be OOP is entirely dependent on the developer. necessarily be the best solution always. OOP makes certain types of projects easier to code, and some projects would be almost impossible to do without OOP (like anything you wanna do where you need to use scope to avoid major headaches), but because PHP isn't compiled or a true OOP PHP is runtime compiled to bytecode. It's just as compiled as any other language. With a good compiler cache it's just as compiled as java. Compiled to byte-code is only the same as pre-compiled in most other programming languages. Semantics. Until any langiage compiles to pure 1s and 0s, it's all about bytecode. Even C compiles to assembler which is really just a low level bytecode. language, OOP in PHP hampers performance, and that hampering is exponential with the complexity of the objects. You're shitting us all right? Exponential? Really? could you show us some benchmarks on how it's exponential? Dynamic object creation will always hamper performance relative to the object complexity. It's true for all languages ... it's within seconds though on a non-dedicated server, but depending on what you do, it's not that hard to break 30 secs exec time on PHP that way. There is a performance loss in any OOP system over a non OOP system, because the great things like polymorphism have a pricetag. However, your original comment specifically narrowed the field of attention to PHP, which is not valid narrowing since it makes it seem like there are OOP implementations that do not have performance overhead for such features. If there are, I'm sure you can tell me a few. Let's not be sowing seeds of FUD on the PHP general list. Then it might be good to read instead of interpret. To read is to interpret. Otherwise you're just looking. You moment you give anything meaning you have made an interpretation. Albeit the interpretation may be based on globally shared rules, or personal subjective ideals. Either way, your writing was not IMHO based on globally shared rules, but rather on your own personal subjective ideals, which again IMHO, were promoting FUD for PHP OOP. Cheers, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Test post from a new client
Robb Kerr wrote: This is a test post from a new client. I'm trying to decide whether or not to keep it. Please post a reply so that I can see how it shows up. Thanx, Robb FUBAR -- Daniel Schierbeck Help spread Firefox (www.getfirefox.com): http://www.spreadfirefox.com/?q=user/registerr=6584 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Silly OOP question
Brent Clements wrote: I've always wondered this about OOP and maybe you guys can answer this question. I'm writing a php application and I'm trying to figure out the correct way to right the oop part of this application. for instance. I have a project.class file that has functions for dealing with individual projects because you break down ideas into singular entities in OOP(as I understand it) But what if I wanted to deal with multiple projects such as getting a list of the projects in my database, should I create a function in the project.class to handle the now plural request, or should I create a projects.class file that has a function called getProjects. Hopefully I'm explaining this question right. It makes sense in my own head. :-) Thanks, Brent Who cares whether or not PHP is an object oriented language? If it has OO features, you can call it whatever you like, I'd still be happy. -- Daniel Schierbeck Help spread Firefox (www.getfirefox.com): http://www.spreadfirefox.com/?q=user/registerr=6584 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Silly OOP question
Klaus Reimer wrote: you can implement it completely statically so you don't need to instanciate the class Well, it might be useful to have more than one list of projects, ie if you want all design-related projects, or all PHP-projects. -- Daniel Schierbeck Help spread Firefox (www.getfirefox.com): http://www.spreadfirefox.com/?q=user/registerr=6584 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] paypal ipn - subscriptions
I'm creating a subscription service where customers will signup and pay $X per month to have access to this service. I've done the easy part, which is communicating back and forth with paypal. Anytime a transaction is made, it's sent to my ipn.php script. The part I'm having difficulty with is figuring out how to manage who does and doesn't have access to the service based on what paypal sends me. It looks like there are 6 different transaction types possible for subscriptions. subscr_signup subscr_cancel subscr_modify subscr_failed subscr_payment subscr_eot For example, what if someone cancels their subscription? I don't think I can turn off their service immediately because their month might not be over yet. Another thought. Would I just mark their account active if they are subscr_signup or subscr_payment and leave it at that unless paypal tells me otherwise (from subscr_failed, or subscr_cancel, or subscr_eot). OR should I record the date of the subscr_signup or subscr_payment and only allow them access for one month after that date? Anyone have experience creating something like this? Would really appreciate hearing how you did it. Or if you haven't, but have ideas, let me know! Thanks! Nate
[PHP] Re: Silly OOP question
Brent Clements wrote: I've always wondered this about OOP and maybe you guys can answer this question. I'm writing a php application and I'm trying to figure out the correct way to right the oop part of this application. for instance. I have a project.class file that has functions for dealing with individual projects because you break down ideas into singular entities in OOP(as I understand it) But what if I wanted to deal with multiple projects such as getting a list of the projects in my database, should I create a function in the project.class to handle the now plural request, or should I create a projects.class file that has a function called getProjects. Hopefully I'm explaining this question right. It makes sense in my own head. :-) Thanks, Brent Brent, there are many ways so skin a cat, but one way to solve your problem in an OO manner would be a container class, call it projects or what you will. An example(not tested) could be: ?php class Container { private projects = array(); // Contains projects private projectsLoaded = false; ... other methods ... public function getProjects() { if (!$this-projectsLoaded) { $this-loadProjects(); } return $this-projects; } private function loadProjects() { //code to load the projects into the project array $this-projectsLoaded = true; } } ? In your main code you can have something like: $container = new Container; foreach($container-getProjects as $project) { $something = $project-someMethod(...); ... ... } Hope this helps. . . Dusty -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Silly OOP question
Dusty Bin wrote: snip /snip foreach($container-getProjects as $project) { snip /snip Sorry about the typo, of course it should read: foreach($container-getProjects() as $project) { Dusty -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Silly OOP question
Daniel Schierbeck wrote: you can implement it completely statically so you don't need to instanciate the class Well, it might be useful to have more than one list of projects, ie if you want all design-related projects, or all PHP-projects. But then you might need a class to organize these Project Lists. Maybe THIS is then well suited for static methods ;-) -- Bye, K http://www.ailis.de/~k/ (FidoNet: 2:240/2188.18) [A735 47EC D87B 1F15 C1E9 53D3 AA03 6173 A723 E391] (Finger [EMAIL PROTECTED] to get public key) signature.asc Description: OpenPGP digital signature
[PHP] Mysql 4.1.7 + PHP 4.3.9
Is this a possible combination ? Work is trying to compile PHP4 against 4.1, I havent even tried it apart from against PHP5. It says in the manual that the mysqli driver is the only one compatible with 4.1, although I have managed to compile both mysql and mysqli in php5, and run my apps ok as i was in php4 using the mysql driver. Is the only difference the OLD_PASSWORD stuff ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: paypal ipn - subscriptions
Hello nate, Am 2004-11-14 11:46:57, schrieb [EMAIL PROTECTED]: I'm creating a subscription service where customers will signup and pay $X per month to have access to this service. I've done the easy part, which is communicating back and forth with paypal. Anytime a transaction is made, it's sent to my ipn.php script. The part I'm having difficulty with is figuring out how to manage who does and doesn't have access to the service based on what paypal sends me. It looks like there are 6 different transaction types possible for subscriptions. For example, what if someone cancels their subscription? I don't think I can turn off their service immediately because their month might not be over yet. This is handled by you and your program... Another thought. Would I just mark their account active if they are subscr_signup or subscr_payment and leave it at that unless paypal tells me otherwise (from subscr_failed, or subscr_cancel, or subscr_eot). OR should I record the date of the subscr_signup or subscr_payment and only allow them access for one month after that date? The last one... I do not use paypal but a bank (VISA/Master/...) and I let my $USER pay for 3m, 6m. After this time the account will expire. For the 1m I using auto-renew and I have the permission to make banktransfers automaticly. If the bank reject, the Accout expires... ...and if not it will be renewed 1m. Anyone have experience creating something like this? Would really appreciate hearing how you did it. Or if you haven't, but have ideas, let me know! Thanks! Nate Greetings Michelle -- Linux-User #280138 with the Linux Counter, http://counter.li.org/ Michelle Konzack Apt. 917 ICQ #328449886 50, rue de Soultz MSM LinuxMichi 0033/3/8845235667100 Strasbourg/France IRC #Debian (irc.icq.com) signature.pgp Description: Digital signature
[PHP] Atom 2 RSS Script? Anyone got one?
hi all, im all tired out of searching, just cant seem to find a script that will convert atom 0.3 to any rss format. Does anyone have one or know where i can get hold of one? I know about 2rss.com but they insert ads as i understand it so that just wont do :) thanks for any links or help.. -- Nick W -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] unable to use vars in foreach
I'm using PHP 5.0.2 Here is a snippet of my code $post=$_POST;//this is actually happening in an include somewhere else and autoprepended. Works just fine. $modules = simplexml_load_file(MODULES); foreach ($modules-module as $mod) { echo $mod-postName.'br'; if (isset($post[$mod-postName])) { die('in post'); . echo-ing the postName works just fine, but when I get to the checking whether or not the val is set, I get the error: Warning: Illegal offset type in unset in /var/www/. If I replace $post[$mod-postName] with a hardcoded val, it works $post['news'] The values of $mod-postName are names of checkboxes. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] unable to use vars in foreach
On Sunday, November 14, 2004, at 08:24PM, Jonathan Villa [EMAIL PROTECTED] wrote: $modules = simplexml_load_file(MODULES); Are you certain that MODULES has been defined()? And what do you get when you print_r($modules)? -ryan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] unable to use vars in foreach [updated question]
So, searching php.net (I swear I did before...) I found this at http://us2.php.net/language.types.array You cannot use arrays or objects as keys. Doing so will result in a warning: Illegal offset type. Neverthought that my var was an object, just thought maybe a string. My new question is, how can I convert this object to a string? Or get the val of it Here is my XML module name=News postNamenews/postName pageLevelPermissionsNews : Add authenticatedPagenews.add.php/authenticatedPage navDisplay page=/news/news.add.phpAdd/navDisplay /pageLevelPermissions pageLevelPermissionsNews : Current authenticatedPagenews.current.php/authenticatedPage navDisplay page=/news/news.current.phpCurrent/navDisplay /pageLevelPermissions pageLevelPermissionsNews : Archived authenticatedPagenews.archived.php/authenticatedPage navDisplay page=/news/news.archived.phpArchived/navDisplay /pageLevelPermissions /module -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] unable to use vars in foreach
On Sunday, November 14, 2004, at 08:24PM, Jonathan Villa [EMAIL PROTECTED] wrote: $modules = simplexml_load_file(MODULES); Are you certain that MODULES has been defined()? And what do you get when you print_r($modules)? -ryan Yes MODULES is defined. It's defined in an include file. In my loop, when I echo the $mod-postName the values print just fine. My issue is in the conditional. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHPINIPATH/PHPINIDIR/PHPININAME?
Jordi Canals wrote: On Sun, 14 Nov 2004 23:42:58 +0700, David Garamond [EMAIL PROTECTED] wrote: Greg Donald wrote: print_r($_ENV); What should I see in it? RTFM http://www.php.net/manual/en/reserved.variables.php#reserved.variables.environment Um, am I missing something here? ITTRFMTR (is that the right fine manual to read?) I originally asked why the php cli binary cannot be told to look for php.ini in a custom location specified via an environment variable (it only accepts the -c command line argument). All other interpreters I know can. So if there _is_ an env var to do that, what is it? I didn't see it and certainly strace doesn't show my /usr/bin/php doing any getenv() during startup. Regards, dave -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHPINIPATH/PHPINIDIR/PHPININAME?
David Garamond wrote: Um, am I missing something here? ITTRFMTR (is that the right fine manual to read?) I originally asked why the php cli binary cannot be told to look for php.ini in a custom location specified via an environment variable (it only accepts the -c command line argument). All other interpreters I know can. So if there _is_ an env var to do that, what is it? I didn't see it and certainly strace doesn't show my /usr/bin/php doing any getenv() during startup. Regards, dave perhaps people had trouble reading your post properly because of all the CAPS. -- Raditha Dissanayake. -- http://www.radinks.com/print/card-designer/ | Card Designer Applet http://www.radinks.com/upload/ | Drag and Drop Upload -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] unable to use vars in foreach
On Sunday, November 14, 2004, at 08:36PM, Jonathan Villa [EMAIL PROTECTED] wrote: On Sunday, November 14, 2004, at 08:24PM, Jonathan Villa [EMAIL PROTECTED] wrote: $modules = simplexml_load_file(MODULES); Are you certain that MODULES has been defined()? And what do you get when you print_r($modules)? -ryan Yes MODULES is defined. It's defined in an include file. In my loop, when I echo the $mod-postName the values print just fine. My issue is in the conditional. AHA! Here's what I think's going on (sorry I don't have time to investigate it myself) $mod-postName is a simplexml object. Due to some php5 magic, when used it a situation that calls for a string (like echo $xmlobj), it echos the proper value. However, when using it as an array subscript does not appear to qualify as this situation. To solve this try either: $post[(string)$xmlobj] OR $post[strval($xmlobj)] I hope this is clear and helpful. -ryan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] unable to use vars in foreach [updated question]
On Sunday, November 14, 2004, at 08:44PM, Jonathan Villa [EMAIL PROTECTED] wrote: So, searching php.net (I swear I did before...) I found this at http://us2.php.net/language.types.array You cannot use arrays or objects as keys. Doing so will result in a warning: Illegal offset type. Neverthought that my var was an object, just thought maybe a string. My new question is, how can I convert this object to a string? Or get the val of it See my post from about 1 minute ago. -ryan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] unable to use vars in foreach
ah yes thanks both worked... I had written a function to this... I knew there had to be a much easier way!!! On Sunday, November 14, 2004, at 08:36PM, Jonathan Villa [EMAIL PROTECTED] wrote: On Sunday, November 14, 2004, at 08:24PM, Jonathan Villa [EMAIL PROTECTED] wrote: $modules = simplexml_load_file(MODULES); Are you certain that MODULES has been defined()? And what do you get when you print_r($modules)? -ryan Yes MODULES is defined. It's defined in an include file. In my loop, when I echo the $mod-postName the values print just fine. My issue is in the conditional. AHA! Here's what I think's going on (sorry I don't have time to investigate it myself) $mod-postName is a simplexml object. Due to some php5 magic, when used it a situation that calls for a string (like echo $xmlobj), it echos the proper value. However, when using it as an array subscript does not appear to qualify as this situation. To solve this try either: $post[(string)$xmlobj] OR $post[strval($xmlobj)] I hope this is clear and helpful. -ryan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Array from database table
How do I get the data from a mysql database into and array that looks like this Array ( [0] = 1 [1] = 2 [2] = 3 [3] = 4 [4] = 5 [5] = 6 ) The table has three fields but I only need the data from one field. $query=SELECT amenityID FROM property_amenity where listingId = '$listingId'; -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Sessions: I don't get it!!
I'd like to do something with sessions that should be easy. But I'm new to this, and obviously I'm missing something somewhere... I want to use cookies if the visitor allows, but tack the session info (SID) get style on the URL of a linked page *only if* the visitor blocks cookies. I've tried a lot of variations, but nothing really works. I either get the entire SID value in the URL (even if cookies are accepted), or the SID doesn't show up in the URL, which means it works only with visitors who accept cookies. Below is my most recent attempt. simple.php detects whether the visitor accepts cookies by forcing a page reload (my thanks to Chris Shiflett), then attempts a redirection, based on whether cookies are accepted. Doesn't work. Anyone got any ideas? TIA. - ? # simple.php ini_set('session.use_trans_sid', 0); ini_set('session.use_cookies', 1); ini_set('register_globals', 0); session_start(); if (! isset($_GET['cac'])) { header('Set-Cookie: accept_cookies=yes'); header('Location: ' . $_SERVER['PHP_SELF'] . '?cac=1'); } $_SESSION['accepts_cookies'] = isset($_COOKIE['accept_cookies']); $_SESSION['session_num'] = session_id(); if ($_SESSION['accepts_cookies']) { header('location: simple2.php'); } else { header('location: simple2.php?'. strip_tags(SID)); } die; ? -- ? # simple2.php //ini_set('session.use_trans_sid', 0); //ini_set('session.use_cookies', 1); //ini_set('session.use_only_cookies', 1); //ini_set('register_globals', 0); session_start(); ? html head titleProcessing Error/title meta http-equiv=Content-Type content=text/html; charset=iso-8859-1 /head body ? echo Old Session ID: . $_SESSION['session_num'] . br; echo This Session ID: . session_id() . br; echo SID: . SID . br; ? blockquote ? echo ? /blockquote /body /html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Array from database table
Richard wrote: How do I get the data from a mysql database into and array that looks like this Array ( [0] = 1 [1] = 2 [2] = 3 [3] = 4 [4] = 5 [5] = 6 ) by using mysql_fetch_row() or mysql_fetch_array() The table has three fields but I only need the data from one field. $query=SELECT amenityID FROM property_amenity where listingId = '$listingId'; -- Raditha Dissanayake. -- http://www.radinks.com/print/card-designer/ | Card Designer Applet http://www.radinks.com/upload/ | Drag and Drop Upload -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Sessions: I don't get it!!
Looks like you're making it way more complicated than it needs to be. PHP will automatically tack on the Session ID tag to your local url's, but only if it needs to. There is no need to append the SID to url's manually. Nate -Original Message- From: Don [mailto:[EMAIL PROTECTED] Sent: Sunday, November 14, 2004 9:54 PM To: [EMAIL PROTECTED] Subject: [PHP] Sessions: I don't get it!! I'd like to do something with sessions that should be easy. But I'm new to this, and obviously I'm missing something somewhere... I want to use cookies if the visitor allows, but tack the session info (SID) get style on the URL of a linked page *only if* the visitor blocks cookies. I've tried a lot of variations, but nothing really works. I either get the entire SID value in the URL (even if cookies are accepted), or the SID doesn't show up in the URL, which means it works only with visitors who accept cookies. Below is my most recent attempt. simple.php detects whether the visitor accepts cookies by forcing a page reload (my thanks to Chris Shiflett), then attempts a redirection, based on whether cookies are accepted. Doesn't work. Anyone got any ideas? TIA. - ? # simple.php ini_set('session.use_trans_sid', 0); ini_set('session.use_cookies', 1); ini_set('register_globals', 0); session_start(); if (! isset($_GET['cac'])) { header('Set-Cookie: accept_cookies=yes'); header('Location: ' . $_SERVER['PHP_SELF'] . '?cac=1'); } $_SESSION['accepts_cookies'] = isset($_COOKIE['accept_cookies']); $_SESSION['session_num'] = session_id(); if ($_SESSION['accepts_cookies']) { header('location: simple2.php'); } else { header('location: simple2.php?'. strip_tags(SID)); } die; ? -- ? # simple2.php //ini_set('session.use_trans_sid', 0); //ini_set('session.use_cookies', 1); //ini_set('session.use_only_cookies', 1); //ini_set('register_globals', 0); session_start(); ? html head titleProcessing Error/title meta http-equiv=Content-Type content=text/html; charset=iso-8859-1 /head body ? echo Old Session ID: . $_SESSION['session_num'] . br; echo This Session ID: . session_id() . br; echo SID: . SID . br; ? blockquote ? echo ? /blockquote /body /html -- 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] Converting a string into ASCII and a bit more - newbie
Hi, My question could have quite stright forward answer or the question itself might be silly but being a newbie, I'll ask it anyway. First I am trying to convert each character in a string into their respective ASCII codes and then keep these again in a string. Such as: string : ABCDEFGHIJ, expect to see in the result : 65666768697071727374 Then I would like to further manipulate this result with some math, say add 10 to each pair (the ascii code) so the new result becomes: 75767778798081828384 For my first attempt I tried: $x=1 while ($x=strlen($string)) { $holder = ord(substr($string, $x, 1)); $result = $result . $holder; } and failed since it takes ages to process and does not really return a proper value/result but repetitive number such as 1.. I have also tried a 'for' example I found which failed as well. I truely hope an expert here could show me some light and point me in the right direction. I have 2 sets installed on my PC as PHPDEV423 and XAMPP 1.4.9 (set to use php4) and it fails in both. Thanks in advance, Alp P.S.: I hope I have posted this in the correct NG -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP postfix mail problem no recipient problem on SUSE 9.1
I have a PHP script to send an email that I know is correct. Ever since I installed SUSE 9.1I get a no recipient error from postfix. I know others have had this problem but after an extensive search I can find no solution. As of yet no one seems to know, or is not willing to tell how to fix this config problem that SUSE screwed up when they released 9.1. I have also heard it is still a problem in 9.2 as well. So here is some incentive, I will send $25 via paypal to the first person who can tell me how to fix this. BTW using some other mail function that isn't part of the core PHP isn't a solution. If you want to see the error on your own SUSE 9.1 install just run the PHP test mail program and look at the mail logs. ?php $message = This is a Test Message ; mail('[EMAIL PROTECTED]', test message, $message); ? -- Chris W Not getting the gifts you want? The Wish Zone can help. http://thewishzone.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Pulling data from a table into a array
I am using mysql_fetch_row to pull data from a table to fill an array But I am not getting the data into the array the way I whant it to be. $query = SELECT amenityID FROM property_amenity where listingId = '$listingId'; $results = mysql_query($query); if ($results) { while ($list=mysql_fetch_row($results)) { $checked[]=$list; } } print_r($checked); This is what it is putting out Array ( [0] = Array ( [0] = 1 ) [1] = Array ( [0] = 7 ) [2] = Array ( [0] = 9 ) [3] = Array ( [0] = 10 ) [4] = Array ( [0] = 12 ) [5] = Array ( [0] = 14 ) [6] = Array ( [0] = 24 ) [7] = Array ( [0] = 25 ) [8] = Array ( [0] = 37 ) [9] = Array ( [0] = 38 ) ) This what I what the Array to look like Array ( [0] = 1 [1] = 2 [2] = 3 [3] = 12 [4] = 25 [5] = 37 ) What can I do to make it come out this way. The database table looks like this I only whant the data from the amenityID in the order it finds it in the table ID listingID amenityID 1 1 4 2 1 2 3 2 1 4 1 10 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Converting a string into ASCII and a bit more - newbie
Alp wrote: $x=1 while ($x=strlen($string)) { $holder = ord(substr($string, $x, 1)); $result = $result . $holder; } and failed since it takes ages to process and does not really return a proper value/result but repetitive number such as 1.. I think you forgot to increment $x. Add an $x++ at the end of your loop and it works. And by the way: It's better to write $result .= $holder if you want to append a string to another. That's shorter and (more important) faster. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php