Jump to content

sasori

Members
  • Posts

    332
  • Joined

  • Last visited

Everything posted by sasori

  1. based on the screenshot, does this mean i should place my own IP in that?
  2. how will i know sir?,
  3. let's say im running my mysql console using my wamp service how am i gonna connect to my live free hosting account's mysql server ? i tried this syntax, -h test.test.com -u myuser -p mypassword; but it doesn't work ???
  4. does it have to be always a 4 digit number ?
  5. i saw this code snippet from the book that im reading i don't understand what that 0000 means (from the the argument of the constructor of the Exception class, and also i don't know what the Exception class contains) <?php class PGSQLConnection extends Exception { $message = "Sorry cannot connect to PostgreSQL server"; parent::__construct($message,0000); } ?>
  6. i found the solution ftp_nlist($this->connect,"www"); and it worked.. hurray...
  7. Warning: ftp_nlist() expects parameter 1 to be resource, boolean given in C:\wamp\www\test2\oop\class.ftp.php on line 27 Warning: Invalid argument supplied for foreach() in C:\wamp\www\test2\oop\class.ftp.php on line 28 new error
  8. help, my code is not running..the error says Warning: ftp_login() expects parameter 1 to be resource, null given in C:\wamp\www\test2\oop\class.ftp.php on line 27 Warning: ftp_nlist() expects parameter 1 to be resource, null given in C:\wamp\www\test2\oop\class.ftp.php on line 28 Warning: Invalid argument supplied for foreach() in C:\wamp\www\test2\oop\class.ftp.php on line 29 <?php class ftpconnector { private $dir; private $user; private $pwd; function __construct($dir) { $this->dir = $dir; $connect = ftp_connect($this->dir); } public function setUser($user) { $this->user = $user; } public function setPwd($pwd) { $this->pwd = $pwd; } public function connectnow() { $result = ftp_login($connect,"{$this->user}","{$this->pwd}"); $list = ftp_nlist($result,"www"); foreach($list as $value) { echo $value."<br/>"; } } } $test = new ftpconnector("yourtestaccount"); $test->setUser("username"); $test->setPwd("password"); $test->connectnow() ; ?>
  9. ok sir..i won't do it again..thanks again
  10. ok cool, thanks for the response..am enlightened now.. by the way..i posted it on the wrong section because i get much really fast help in the PHP help section of this forum..more than the OOP part .. ( based on my daily queries )
  11. in abstract class that has abstract methods, we have to implement them in the child class of that abstract class right? if a single abstract method is not implemented..an error comes out right? how bout in interfaces?, let's say i didn't implement one of its methods? it will produce error as well? so this means none of those two types of classes has a capability of leaving a single method unimplemented in the child class that extends and implements them am i right? (just for verification, am a bit confused, ..a bit)
  12. ok cool, nice answer. thanks
  13. when using magic methods such as __get and __set is it ok to declare them with the use of modifiers such as private, public,protected and etc..? like for example, public function __get($property); public function __set($property, $value); or am i wrong? and the correct usage is like function _get() function _set() with no modifiers in the beginning of declaration.. (am confused about this magic stuff)
  14. even if some errors occur, the email is still being sent,. however, these scripts are written in a book , i followed exactly, i just changed the variables,.thanks for the helps
  15. hello, i created this 3 scripts as follows (question is at the bottom) //class.emailer.script and it works fine class emailer { protected $sender; private $subject; private $message; private $recipients; function __construct($sender) { $this->sender = $sender; $this->recipients = array(); } public function setSubject($subject) { $this->subject = $subject; } public function setMessage($message) { $this->message = $message; } public function addRecipients($recipient) { array_push($this->recipients,$recipient); } public function sendMail() { foreach($this->recipients as $recipient) { $result = mail($recipient, $this->subject,$this->message,"FROM: {$this->sender}\r\n"); if($result) echo "mail successfully sent to {$recipient}<br/>"; } } } //class.extendedmailer.php second script that extends the emailer class class ExtendedEmailer extends emailer { function __construct() { } public function setSender($sender) { $this->sender = $sender; } } ?> ///here is the trigger script to execute the 2 scripts above include_once('class.emailer.php'); include_once('class.extendedmailer.php'); $spam = new ExtendedEmailer(); $spam->setSender("[email protected]"); $spam->setSubject("777777"); $spam->setMessage("testing ulit"); $spam->addRecipients("[email protected]"); $spam->sendMail(); now the question is, how come there is this error Warning: array_push() [function.array-push]: First argument should be an array in C:\wamp\www\test2\oop\class.emailer.php on line 29 Warning: Invalid argument supplied for foreach() in C:\wamp\www\test2\oop\class.emailer.php on line 34 whenever i tried to use the setSender() of the class.extendedmailer.php, but when it is not included in the trigger script and i instantiate the class.emailer.php alone, everything works fine and the email is being sent ... kindly tell me the problem by the way, i leaved the extendedmailer.php constructor so that i can make use of the setSender function of it, but it seems it did go the right way
  16. this is kewl..its working now..thanks sir
  17. I created a test mailing script and ofcourse i saved it on my localhost using wamp i executed the script and it produces and error, ..the online version works fine <?php /** * @author rmbapc * @copyright 2008 */ class emailer { private $sender; private $recipients; private $subject; private $message; function __construct($sender) { $this->sender = $sender; $this->recipients = array(); } public function addRecipients($recipient) { array_push($this->recipients, $recipient); } public function setSubject($subject) { $this->subject = $subject; } public function setMessage($message) { $this->message = $message; } public function sendMail() { foreach($this->recipients as $recipient) { mail($recipient, $this->subject,$this->message,"FROM: {$this->sender}\r\n"); echo "mail successfully sent to {$recipient}"; } } } $testmail = new emailer("[email protected]"); $testmail->addRecipients("[email protected]"); $testmail->setSubject("testing only"); $testmail->setMessage("the quick brown fox jumps over the lazy dog"); $testmail->sendMail(); ?> Warning: mail() [function.mail]: Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:\wamp\www\test2\oop\index.php on line 39 mail successfully sent to [email protected] the question is, what am i gonna add in the code so that i can make it work to send emails by just using my localhost ..i don't know what to do in the php.ini stuff
  18. ok cool..very well said. thanks
  19. i creadted this test script and saved as interface.dbdriver.php <?php /** * @author rmbapc * @copyright 2008 */ //interfaced.dbdriver.php interface DBDriver { public function connect(); public function execute($sql); } ?> and then i created another file and saved as class.mysqldriver.php <?php /** * @author rmbapc * @copyright 2008 */ //class.mysqldriver.php include("interface.dbdriver.php"); class MySQLDriver implements DBDriver { } ?> i tried to run the class.mysqldriver.php and the error says Fatal error: Class MySQLDriver contains 2 abstract methods and must therefore be declared abstract or implement the remaining methods (DBDriver::connect, DBDriver::execute) in C:\wamp\www\test2\oop\class.mysqldriver.php on line 12 now my question is, "why does the error says, 2 abstract methods?" when infact i made an interface and not an abstract right?
  20. daemn..it worked.. thanks sir
  21. please help me guys, i don't know how to use the ternary operator in my code ??? <?php /** * @author rmbapc * @copyright 2008 */ require_once('emailer.class.php'); require_once('extendedmailer.class.php'); require_once('htmlemailer.class.php'); $emailer = new emailer('[email protected]'); $extendedemailer = new ExtendedEmailer(); $htmlemailer = new HtmlEmailer('[email protected]'); if($extendedemailer instanceof emailer)? echo "extended is dereived from emailer":"not derived from";//not working help please /*echo "Extended Emailer is derived from Emailer.<br/>"; if($htmlemailer instanceof emailer) echo "HTML Emailer is also derived from Emailer.<br/>"; if($emailer instanceof htmlEmailer) echo "Emailer is derived from HTMLEmailer<br/>"; if($htmlemailer instanceof ExtendedEmailer) echo "HTML Emailer is Derived from Emailer<br/>"; */ ?>
  22. oh ok..am not going to close this topic yet.. ill get back to this sqlite thingy.
  23. oh ok..so this means, there is no sqlite manager on live free hosting cpanel accounts at all?
  24. just like what i've said before, sqlite manager is built-in with my wamp on localhost..but on a live free hosting account cpanel, i don't see any sqlite manager, that's what am asking, on how will you be able to see the sqlite manager on a live free hosting account?
  25. cool now i can see that sqlite is enabled on my free hosting account.."but", how am i gonna see the "sqlite manager" ?
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.