Jump to content

ignace

Moderators
  • Posts

    6,457
  • Joined

  • Last visited

  • Days Won

    26

Everything posted by ignace

  1. Here's an expanded example of your train in OO, for brevity most functions do not include code: namespace Railway; /* used as a flyweight */ class Passenger { } class PassengerFactory { const ECONOMY = 2; const BUSINESS = 1; private $economyPassenger; private $businessPassenger; public function __construct() { $this->economyPassenger = new Passenger; $this->businessPassenger = new Passenger; } public function makePassenger($class = self::ECONOMY) { if ($class === self::BUSINESS) { return $this->getBusinessPassenger(); } else { return $this->getEconomyPassenger(); } } public function getEconomyPassenger() { return $this->enconomyPassenger; } public function getBusinessPassenger() { return $this->businessPassenger; } } class Station {} class StationRoute {} class Schedule { private $stationRoute; private $timeTable; } class Train { private $id; private $locomotive; private $wagons = array(); private $stationRoute; private $schedule; public function __construct($id, Locomotive $locomotive, Array $wagons, StationRoute $route, Schedule $schedule) {} public function board(Passenger $passenger) {} public function attach(Wagon $wagon) {} } /** @internal */ class SplFixedArray { public function isAtCapacity() { return $this->count() === $this->getRealSize(); } public function getRealSize() { return count(array_filter($this->toArray())); } } /** @internal */ class Locomotive extends SplFixedArray { public function __construct($maxWagons) { parent::__construct($maxWagons); } } /** @internal */ class Wagon extends SplFixedArray { public function __construct($capacity) { parent::__construct($capacity); } }
  2. Selects the puppy, and it's mother and father: SELECT c.dogname as child, m.dogame as mother, f.dogname as father FROM dog c JOIN dog m ON c.mother_id = m.id JOIN dog f ON c.father_id = f.id WHERE c.id = '$dogid';
  3. Yes. since '$password' !== "$password" assuming $password contains "foobar" the previous would print: '$password' !== "foobar" More explanation about this can be found here: http://www.php.net/manual/en/language.types.string.php#language.types.string.syntax.double
  4. $passwordSQL = crypt('$password');Should be $passwordSQL = crypt($password);Also you should put an exit(); after every header('Location: ..');
  5. * You should put an exit(); after every header('Location: ..'); * You should use mysqli everywhere and don't mix them. * I don't think it's okay for anyone being logged in to just delete any account (even his own). * Use prepared statements.
  6. <!doctype html> <html> <head> <meta charset="utf-8"> <title>Untitled Document</title> <link href="moon.css" type="text/css" rel="stylesheet"> </head> <body> <?php include 'moonphase.php'; $moon = new MoonPhase(); ?> <?php printf( 'The moon is currently %d days old, and is therefore %s. It is %.2f km from the centre of the Earth. The next new moon is at %s.', $moon->age(), ($moon->phase() < 0.5 ? 'waxing' : 'waning'), $moon->distance(), gmdate('G:i:s, j M Y', $moon->next_new_moon()) ); ?> <div id="wrapper"> <img src="moon.php?p=0.1" width="200" height="200" alt="moon"> <img src="moon.php?p=0.2" width="200" height="200" alt="moon"> <img src="moon.php?p=0.3" width="200" height="200" alt="moon"> <img src="moon.php?p=0.4" width="200" height="200" alt="moon"> <img src="moon.php?p=0.5" width="200" height="200" alt="moon"> <img src="moon.php?p=0.6" width="200" height="200" alt="moon"> <img src="moon.php?p=0.7" width="200" height="200" alt="moon"> <img src="moon.php?p=0.8" width="200" height="200" alt="moon"> <img src="moon.php?p=0.9" width="200" height="200" alt="moon"> <img src="moon.php?p=0.95" width="200" height="200" alt="moon"> </div> </body> </html> Is all you need, remove all other PHP code from your moonphrase.php file
  7. My rank on this forum should not be of any concern, speak freely Well I assumed you were talking about the snippet in your post. I misread, and I agree he should use the entire hash not shop it off at 29 characters.
  8. davidannis variables are not stored on disk, they are stored in memory and the extra bytes do not make it more or less secure.
  9. By simply checking if they are logged in. If they are simply redirect them to the screen they would go after logging in. if ($user['is_admin'] == 1) { // can see it } else { // can't see it }
  10. 1 & 2. By simply making the documents not publicly accessible. For those who want to download a document, they need an URL with an encrypted limited-time key which allows them to download the document for say 12 hours. 3. We are not going to write the program for you. 4. What backup methods are available at your host?
  11. Please read the forum guidelines before posting. Always surround posted code with code tags.
  12. Like ricmetal already said you can view source to find the used CMS. You can also try to find the back-end using simple paths like /admin, /cp, /back, ..
  13. More like not to post a link to your actual production server. Real estate agencies have a rule where they do not publish (or only partly publish) real estate info to lure more interested parties (how that works, no idea). I am guessing the add.php, in some way, exposed/removed the properties they have.
  14. He changed it. Since he was not capable of removing the link, he just altered the contents of add.php to die.
  15. Please read the forum guidelines. Always surround your code with code tags. http://www.phpfreaks.com/page/rules-and-terms-of-service#toc_forum_guidelines
  16. Welcome, please read the forum guidelines before posting. Specifically the section that tells you to surround code with the proper code tags. Nobody wants to read a wall of text. http://www.phpfreaks.com/page/rules-and-terms-of-service#toc_forum_dos
  17. Try that: if (preg_match('!<PaymentID>(.*?)</PaymentID>!', $returned, $match)) { echo $match[1]; }
  18. We need the error you get and your current code to be able to help you.
  19. Start debugging, why does it not print anything on screen. Using var_dump you can print the type of a variable to screen like shown in the below example: <!doctype html> <html> <head> <meta charset="utf-8"> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <title>Invoices</title> </head> <body> <?php $xml = simplexml_load_file("saft_solverde_wgres_FAC2-01-2013-500272484.xml"); echo '$xml->Invoice: '; var_dump($xml->Invoice); foreach($xml->Invoice as $Invoice) { echo $Invoice->InvoiceNo . '<br>'; } ?> </body> </html>
  20. Use code tags. Nobody here wants to go through a big wall of text.
  21. The problem is in your 3rd file, line 312 column 5. If you want something more specific you'll probably gonna need to post some more info, like the error you get and your current code.
  22. It's name="answer[1]" this way when the form is posted you get $_POST['answer'] to be an array. For more information: http://www.php.net/manual/en/faq.html.php#faq.html.arrays
  23. Why do you have four tables with questions instead of just one?
  24. Isn't that the same as: $(':input').bind('keyup change input', function() { // code here });
  25. It appears I was confused about your intentions. <!doctype html> <html> <head> <meta charset="utf-8"> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <title>Invoices</title> </head> <body> <?php $xml = simplexml_load_file("saft_solverde_wgres_FAC2-01-2013-500272484.xml"); foreach($xml->Invoice as $Invoice) { echo $Invoice->InvoiceNo . '<br>'; } ?> </body> </html>Try that.
×
×
  • 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.