Jump to content

JonnoTheDev

Staff Alumni
  • Posts

    3,584
  • Joined

  • Last visited

  • Days Won

    3

Everything posted by JonnoTheDev

  1. Use the photos database id as the array key for the textarea name value <textarea cols=40 rows=4 name="caption[".$photo['pho_id']."]"> then to process foreach($_POST['caption'] as $photoId => $value) { mysql_query("UPDATE gallery SET caption='".mysql_real_escape_string($value)."',update='".time()."' WHERE pho_id='".$photoId."'"); }
  2. Difficult as they both want to listen on port 80. Why not just run IIS to serve PHP and ASP.
  3. Keep the user on the same step if there is invalid input. Store each piece of data in a session variable. Create the application using the session data after the final step. Javascript is required to disable the button but I would just make it appear rather than be disabled. If your validation rules are in place then having a button disabled shouldn't matter anyhow
  4. Add this to the top of the script. Ammend the path to PEAR set_include_path(get_include_path().PATH_SEPARATOR.'/usr/share/pear/');
  5. set_include_path(get_include_path().PATH_SEPARATOR.'/inetpub/wwwroot/folder/'); include('myfile.php');
  6. Haha That is Maqs footer on all blog posts not code for you to add to your script!
  7. There are code examples on the paypal website for IPN
  8. Just define the path yourself and use something like set_include_path(get_include_path().PATH_SEPARATOR.'/inetpub/wwwroot/folder/'); within a common include (included on all pages)
  9. other way \n
  10. Use PEAR::Mail_mime to send emails with attachments, not the mail() function. It is not designed for this. I see this same issue posted over and over. http://pear.php.net/package/Mail_Mime
  11. you are missing a trailing ; on the previous line: "IP :".$_SERVER['REMOTE_ADDR']."/n/n".$enquiry;
  12. Why cant you just place the line to start the services in your: /etc/rc.d/rc.local And what is wrong with the chkconfig commands in my earlier post? Create an alias to /www/lampp/lampp for /sbin/service Then you can write: service lamp start
  13. If the string that needs to be returned comes from a database then you have no choice bar AJAX. Otherwise you could write a javascript function to do it and put an onClick() event handler on the button. If you can implement javascript then you can implement AJAX as it is javascript only responses are sent back in XML.
  14. No, you would need a javascript based editor.
  15. Set the scripts running as background processes then you do not need to wait exec("php /path/to/script1.php > /dev/null &"); exec("php /path/to/script2.php > /dev/null &");
  16. Yes, the IPN can talk back to your server over HTTP as the payment is being processed. You may also want to log the payees details i.e. name, address, email, payment ref, etc. You can also store failed transactions.
  17. what errors?
  18. You need to look at your JS function. get it to display an alert() when the function runs to test the call. You would also be better using an AJAX approach for this issue rather than reloading your pages.
  19. Yes you can, however your syntax has more bugs than the amazon basin. Here: <?php echo "<a href=\"view_images.php?delete=".urlencode($file)."\">delete image</a>"; if(strlen($_GET['delete'])) { $delete_image = "c:/images/".urldecode($_GET['delete']); unlink($delete_image); } ?>
  20. Just use WGET from your command line. Easy: cd to images folder: cd /var/www/html/mywebsite.com/images get images from the urls in the text file wget -i /path/to/images.txt Done
  21. That is like saying I don't like bricks so I will build my house with cardboard. The fact that you are so defensive of your programming makes it questionable. I assure you that with your method of implementation you will run into problems in the future. Read the following: http://socket7.net/article/php-5-static-and-inheritance
  22. As your objects have no internal properties set and are not truly instantiated by using the new className() syntax with methods referenced by $this I would say that your implementations are truly unorthodox. Your design is a bit spaghetti like. I would really focus on using php5 as 4 is not truly object orientated. Rather than using static method calls from one class to another as you have your methods should accept objects of the required type using class type hinting i.e. <?php class a { public function sayHello(b $b) { print $b->getName()." says: Hello World"; } } class b { public $name; public function __construct($name) { $this->name = $name; } public function getName() { return $this->name; } } $a = new a(); $a->sayHello(new b("Joe Bloggs")); ?> You can use as many arrays as you like within your object. Arrays work differently in C++. This is why your friend has his argument. In C++ you have to declare the size of the array and are stuck with that limit for the duration of the program. For this reason arrays are created dynamically outside of the main class.
  23. Haha The term OOP refers to objects within a system and their interaction with each other. I could create 100 classes that do certain things when instantiated but does mean my system is object orientated. This is a common misconception that if I have classes in my system I am an OO programmer - rubbish. It is the UML for your system that displays the OO concept in your system. Secondly static methods are used in various patterns for certain tasks i.e. instantiating objects. Lets say I want a new user object but it maybe a student, teacher or substitute class x { public static function generate($x, $name) { switch($x) { case 1: return new student($name); break; case 2: return new teacher($name); break; case 3: return new substitute($name); break; } } } $user = x::generate(1, "Joe Bloggs"); $user->getName(); Classes should not consist entirely of static methods or properties (unless you have a really good reason for this). However with php4 you can still use the static type operator with classes :: Using arrays within objects for the purpose of storing other objects is entirely feasible. For instance in my above example I could use this method to generate 20 student objects and they are placed within a 'classroom' object (as they are students of the class). I can easily get all the names of the students in the classroom. This is OO design! You should always use the new syntax to create an object if it has a constructor that requires parameters that will be set as the class properties: class student() { private $name; public function __construct($name) { $this->name = $name } public function getName() { return $this->name } } $user = new student("Joe Bloggs"); print $user->getName();
  24. Was all kinds of broken images when I looked last. Looks like you've sorted it.
×
×
  • 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.