Jump to content

cpd

Members
  • Posts

    883
  • Joined

  • Last visited

  • Days Won

    5

Everything posted by cpd

  1. Depends where you've added it. Plus you don't want to use addslashes if your using mysql_real_escape_string. It defeats the purpose. Read up on what mysql_real_escape_string actually does and you'll learn a lot more about sanitising data.
  2. If your getting undefined in your javascript it suggests you haven't set your id attributes within your input tags correctly. Without all the code I doubt we'll be able to draw a thorough conclusion.
  3. Firstly, wrapping entire HTML pages inside functions isn't recommended. It's not wrong because it would theoretically work but I would strongly recommended/advise/insist on you not using that method for displaying pages for countless reasons; one being its probably one of the worst practices. With regards to your error, would you be able to tell us what the error your receiving is? And welcome to the forums, hopefully we'll be able to help you out
  4. Your anti injection function prohibits people from using common characters and words. E.g. in that previous sentence I used "from". You shouldn't be doing that as its anti-input, not anti-injection. regarding the sql_regcase function: it was deprecated in PHP V5.3.0 and shouldn't be used any longer. If your using a MySQL database you should look into mysql_real_escape_string as this is a built in "anti-injection" function for MySQL. Other DBMSs have their own methods.
  5. We're here to provide help and support on programming. We're not here to write pages upon pages of code for you. What your asking would require a long essay because you haven't even grasped the basics of PHP and MySQL. If you truly want someone to do it for you, I suggest you post in the "Freelancer" forum as this is essentially what your asking.
  6. There are a number of ways you could make it dynamic which are dependent on how you go about getting your topics? More code needed. An example could be putting a COUNT function in your SQL query which gets all your topics (Again dependent on whether or not you get all the topics in one query. That would be the most efficient way of doing it). SELECT *, COUNT(pinned) AS `totalPinned` FROM.... You can then test for whether or not $pin is equal to the totalPinned. But this is all dependent on your methods prior to the code you've outlined already.
  7. $_SERVER['REMOTE_ADDR'] is the IP of the client, not the server. Oops, getting all confused with the different SERVER possibilities :\. Thank you for correcting me!
  8. From what your saying, it sounds like you mean your initial SoapClient instantiation is taking too long? I somehow doubt that's the case as the instantiation of the SoapClient class merely identifies the Web Service and the functions you can execute. Are you sure your __soapCall isn't the line taking too long?
  9. I'm going to hazard a guess and say the MSSQL driver isn't installed with your php. You will need to download it from a third party source as Microsoft no longer support it, they've branched into sqlsrv (windows platform only) and a pdo ODBC (linux only) connection to Microsoft SQL server. However the ODBC method is still under development, can't remember if there's a stable relesase or not; I think there is.
  10. Upgrading isnt an issue at all as your only extending the amount of possibilities available. At byte level your literally adding more bytes, that's all. All the values in a mediumint type are available in an int type. Regarding the length, there will be a maximum value which can be set in a mediumint type and it will be X characters long. You can shorten the maximum length by setting a value but mediumint will have a limit itself, can't remember what the limits of any of the integers types are at the minute but you can look it up.
  11. There are very few hosts which allow remote connections to their MySQL databases for security reasons so the likely hood of someone allowing you to do this is very small, not impossible though. Out of interest, what's the purpose for connecting dream weaver to the MySQL host?
  12. In the hypothetical situation the REMOTE_ADDR server variable wasn't set then your code would error but every seb server requires an ip address. I suopose you could write your own server which doesn't require an ip Address but it wouldn't be able to connect to the Internet.
  13. I'm 99% sure the server majority, if jot all, of the SERVER variables are always set. Therefore, they are always accessible and you do not need to test if they are set.
  14. Azarian, in answer to your question regarding where you should really put the data and as an extension to what has already been said, anything out through the construct function would generally be static information assigned to internal private variables which are used later on when executing other functions within the class. For example, an SQL class may include the database information in the construct function as a parameter which gets assigned to an internal variable. This information could then be called when executing your connect method. If you have multiple sets of database details, they can all be loaded into the SQL class on instantiation and called individually on an "as needed" basis. Hopefully that makes sense?
  15. You should never need to do this because the server should always have an ip address. $ip = $_SERVER['REMOTE_ADDR']; The above should work fine.
  16. Following on from a discussion in the IRC #help chat I wanted to open a discussion on the best method to upload an file to a remote server through a web service. It is a little more complex than that simple explanation so let me go into more detail. You have the client accessing a website which is hosted on ServerA, through their computer which is the files origin. The web service is housed on ServerB and the remote upload target server is ServerC. I'm looking to upload the file through the web service on ServerB. The purpose of this is to prevent ServerA from knowing the target location for the upload, ServerC. ServerA must be able to take the file from the computer, pass it to the web service on ServerB which streams it through to ServerC. The file shoul not be saved on any one of the hops through to ServerC, it should be streamed straight through. Computer (file) ---> ServerA (Apache) ---> ServerB (Web Service) ---> ServerC (File target location) If youn think this is possible, what is your best suggested method of uploading the file. Currently, I'm looking at using cURL and the SoapClient to access the web service and upload the file. I'm yet to research if this is possible and would like to know if anyone else has a better method/suggestion? Regarding my job, I just need to connect ServerA with ServerB and stream the file somehow for the clients computer...
  17. cpd

    PHP mail

    2 questions. Firstly, does anyone know if the bug with the mail function was ever fixed? I never heard anything of it after a while and if not it could be the cause. Secondly, there may be some sort of dns issue perhaps? Sometimes it's resolved successfully, and others its not?
  18. You definitely needed the limit statement. A typical example of the syntax would be: "SELECT * FROM tblName ORDER BY id ASC LIMIT 0,30" So you need to add the limit statement back into your query. I would personally include it in the main part of your query making it easier to read, for me anyway. Like I previously said, you need to review your code which sets the $max variable however, I'm not entirely convinced this is where the error is. Usually the errornisnjust before whatever the SQL server spits out at you so perhaps they an error with your BETWEEN statement. Can we also try to keep our toys in our own prams please.
  19. Change the field type to DATE and alter your code to format the date as YYYY-MM-DD. Then either write a script to convert existing dates, even though you don't have the year :s, or do it manually (long).
  20. Additionally, your unique ID isn't truly unique. You could MD5 hash something else and the first 4 characters could be the same. For it to be truly unique you require the full MD5 hash.
  21. I thinks ODBC has a fair few more years in it, at least while MySQL is still around haha. Just so you know, using a PDO connection shouldn't effect your code too much. All that would need changing is a bit of syntax and a bit of additional code required for binding parameters. Anyway, I'll leave you be with your project, I've rambled enough.
  22. I'm not referring to whether or not using MVC determines OOP; I realise I said quite literally a model defines OOP in MVC which was wrong and is not what I was getting at so I apologise for that. What I meant was, the model is there to access the data without it being passed thrgh the controller which does a load of other stuff. It's completely dependent on your design concept though so taking it out isnt wrong, it's an idea and ideas can't be wrong .
  23. If you don't see the problem with Singletons and how they can be misused then you should stop right there and go read up on it. Most of the time, Singletons are as bad as globals. They break encapsulation and make it nearly impossible to unit test. Whilst I agree it can be over complicated for some jobs I would not remove the model. I only say this because of experience. By removing the model you are no longer object oriented and you require the controller which does a load of template stuff you don't need. It defeats the purpose. Arguably its dependant on how our using the MVC concept but the point still stands. For simpler jobs I would look into an entirely different method which better suits my requirements.
  24. It wouldn't surprise me but they were reluctant to discuss anything other then their docs at this particular event. I did question however, what would happen if - in the very unlikely and possibly impossible - google crashed and burned. Every-bodies documents would go
  25. You should consider a PDO connection as well. I know you say you need an ODBC (reasons for this I'm unsure of) but perhaps try a PDO connection instead. I know Pascal Data Objects work with SQL Server 2005 so one would assume the PHP Data Object, which Pascal Data Objects is vaguely based on, would work. I do understand you've got it working as well but exploration could lead to a better solution. Depends if your willing to, and can, put the time in; sometimes time isn't on a programmers side.
×
×
  • 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.