Jump to content

br0ken

Members
  • Posts

    421
  • Joined

  • Last visited

    Never

Everything posted by br0ken

  1. You're not far off. Try this... <?php $flash = 'http://www.testsite.com/banner.swf'; $page = basename($_SERVER['REQUEST_URI']); if ($page == 'index.php' || $page == '') { ?> <object width="550" height="400"> <param name="movie" value="<?php echo $flash ?>"> <embed src="<?php echo $flash ?>" width="550" height="400"> </embed> </object> <?php } else { echo '<img src="banner.jpg" alt="Image Banner"/>'; } ?> You have to remember that people can just go to http://www.testsite.com to access your homepage. The REQUEST_URI will be empty but they will still be on the homepage so you need to check for that to. Also, the flash file URL needs to be wrapped in embed tags.
  2. It might work for Apache on Windows but I'm not entirely sure as I only use a LAMP setup. I also read that there was a mod_rewrite implementation for IIS but again, my knowledge is limited to Linux. Try googling "mod_rewrite Windows" or "mod_rewrite IIS"
  3. That's a pretty vague question but here goes... You need to create a class for each entity. I was always taught you should have a class for each noun (this is only mostly true). For example, you would need a Teacher class and a Student Class. You would Also need a Lesson class. Hopefully this will help but if not, try and be more specific with your question.
  4. They could use a browser add on that doesn't send the HTTP_REFERER value. This would cause the PHP variable $_SERVER['HTTP_REFERER'] to be empty. In your script, if this value is empty you could try $_SERVER['HTTP_FORWARDED_FOR']. If they are using a proxy then this value will contain their IP
  5. You could use mod_rewrite (assuming you're using Linux/Apache) to rewrite your URL's. You could rewrite the following URL structure: .com?l=LETTER&a=ARTIST to .com/LETTER/ARTIST Google mod_rewrite and you should find what you're looking for
  6. I had a similar problem when calling mysqldump via the exec command last week. My problem was wrapping all variables in single quotes. If your variable content (ie. the new filename) has a space in it, the command would be parsed incorrectly. Have you tried running the command directly via the Terminal? If so, what error did you get?
  7. It's definitely a PHP server as I'm running a PHP eCommerce site on the server. Here is the code copied from the source. <script type="text/javascript" src="http://www.sunglassessave.com/js/index.php?c=auto&f=,prototype/prototype.js,prototype/validation.js,scriptaculous/builder.js,scriptaculous/effects.js,scriptaculous/dragdrop.js,scriptaculous/controls.js,scriptaculous/slider.js,varien/js.js,varien/form.js,varien/menu.js,mage/translate.js,mage/cookies.js,js/effects.js,jquery/jquery-1.4.1.min.js" ></script> If I include each file separately it works fine and it works fine in Firefox.
  8. I'm using some software tha combines JS using PHP. This works fine except in IE6. In IE6 the file isn't treated as Javascript; instead it is opened as a PHP file to download. Beacuse of this the JS isn't parsed and therefore doesn't work! Can any one help?
  9. It may be small but sometimes clients require it. Also, manually configuring Apache will allow me to learn a lot about it and how it functions. I have not got as far as installing PHP yet. I decided to compile it first and then once everything was working, install PHP. I've compiled Apache multiple times using commands similar to: sudo ./configure --prefix=/etc/httpd \ --enable-so \ --enable-mods-shared=all
  10. Thanks for the reply but I'm trying to learn about Apache by manually compiling it. I think this is the best way to learn about the software and will help in optimising it for each different system I use it in.
  11. I've installed Apache (httpd) but can't load any pages. I've tried accessing localhost and 127.0.0.1 but neither work. The page loads and loads but I always get the error Connection Interrupted. Any one know what could be the problem? I'm running Ubuntu and the latest version of Apache if that helps.
  12. br0ken

    PHP CDN

    Thanks, I didn't see that!
  13. br0ken

    PHP CDN

    I'm trying to write my own CDN to get an A rating on Y-Slow. I've put a script on another server that takes a URL in the query string. It then fetches that file and saves it on the server before sending it the client. The script checks each time to see whether it has a copy of the file before retrieving it, and if it does, it sends it's cached copy. This works well but for some reason Y-Slow still says it isn't on a CDN. Does any one if there is anything else I need to do for it to be seen as a CDN? I've read up on it but it seems that having the content on a different server should be enough. Thanks in advance
  14. Like Jon23d days, the functions.php does not exist. Once you correct your include then all three errors will go away.
  15. I'm working with the Magento eCommerce framework. It allows you to customise default features by overriding classes. The actual classes are huge so I've written some example classes to illustrate my problem. <?php class Top { public function go() { echo 'Top <br />'; } } class Middle extends Top { public function go() { echo 'Middle<br />'; parent::go(); } } class Bottom extends Middle { public function go() { // Here I want to call Top's go function while bypassing Middle completely } } I declare a instance of Bottom and inside it's go function I need to call Top's go function. I can't call Middle's go function as the processing inside messes with my work in Bottom. I hope this helps
  16. Hi, I have extend a class because I need to override a certain function. The class I am overriding also overrides another class. The function I need to override calls it's parents function when it is complete. I have rewritten the function I need to override but I need to call it's parent function. Basically, there are three classes and from the third class I need to be able to access the first class. Is there anyway a class can get it's parent's parent? I know there is parent::function() but I need something like parent::parent::function() but this doesn't work! Thanks
  17. Thanks for the quick reply Corbin. The class in mind was a database class so I think the singleton will work as I will always only ever want one instance. I will look into more. Thanks
  18. Hello All, I'm trying to write a efficient object orientated system. I've got a database class that I want to be usable by all classes. Is there an efficient way of doing it without declaring it as a global? Once a class has been instantiated is there a way to fetch that rather than declaring a new instance? Thanks
  19. Hi, I was wondering if any one had a function or a tutorial on how to detect whether the user is a spider such as GoogleBot or not. Thanks in advance
  20. Hi All, I've written my own database backup script. It's been working fine for over a year now but suddenly has stopped working for one of my sites. After processing for a minute or so I get the following error: CGI Timeout The specified CGI application exceeded the allowed time for processing. The server has deleted the process. The time out is set to 0 (infinite) so I know it can't be that. Also, this is not the normal timeout error. The script does run for quite a while but it has never done this.
  21. I'm writing a small spider like application that requests a lot of pages. I know there is a lot of different ways to do this and I was wondering which way would be the most efficient. The methods I know are fopen, fsockopen and file_get_contents. Also, what's the difference between fopen and fsockopen? Thanks!
  22. I have an automatic backup script that runs first thing in the morning. Each morning this runs I get an error report with this error. Because of this the backup doesn't complete and is therefore useless. What would actually cause this deadlock? Thanks
  23. Your INI file stores configuation values for PHP. There are two in particular which relate to your code. ini_set("SMTP", "localhost"); ini_set("smtp_port", 25); You'll only have to modify these if your SMTP server isn't running on localhost or using the default port 25. Your code will probably work, depending on your host. Try it and if you get any errors post them here.
  24. You need to break the system down. Firstly you'll need to create a MySQL database so learn about PHP and MySQL. Your database will only need to be simple. You'll need a user table to store userID, password and maybe the date of the last login. You'll also need a news table which will store the news title, content, date and other information you need. Once you've done this write a script that extracts this information and puts it into a form and then write a script that takes that form content and updates the database record. Again, research PHP & MySQL; there's tons of tutorials on Google about this. With this done learn about sessions and create a login page. If you break the whole thing down into smaller sections the project will become much easier. If you get stuck along the way post your code in this thread and people will help you. This way you'll learn as you go along.
  25. Unska's code works the best. Regex isn't faster in working with strings. It is more powerful than string functions but slower.
×
×
  • 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.