Jump to content

gizmola

Administrators
  • Posts

    5,945
  • Joined

  • Last visited

  • Days Won

    145

Everything posted by gizmola

  1. Are these all separate pages, each with a header() & footer()?
  2. Ok, so there's lots of things that could effect this behavior. -What php version? -In the directory in question give us an ls -lath
  3. Probably this is because you are destroying the resource variable by passing it as a parameter by value. Resource variables are special variables that can't be copied or serialized. You didn't provide enough code to show us where the problem is because we don't have your WriteText() method. In terms of design however, it really doesn't make sense to have this line: $ps->WriteText($ps->ps, 'Hello World', 100, 100); While that's probably where you're having issues, it also doesn't make sense for you to pass a member variable ( ->ps) to a method of the same object, when you can refer to that variable using $this->, which you've done elsewhere in your code. That code should be something like: $ps->WriteText('Hello World', 100, 100); And inside the WriteText() method you would have: function WriteText($str, $x, $y) { PS_some_func($this->ps, $str, $x, $y etc....)
  4. seb213, When you query a relational database, you get a result set. It could have no rows, 1 row, or a million rows. The result set exists inside the database server. In order for the client who was querying the database to get rows from the database, you need to have the client perform a "Fetch". Each "fetch" will return one row. So the code you provided, basically calls a particular kind of "fetch" for mysql --- in this case a "fetch_assoc" that returns you an array in the form of an associative array. This in a while loop because the assumption is that you will want to keep fetching rows until all the rows in the result set have been returned. mysql_fetch_assoc() will return false when there are no further rows to fetch, which is why this code works.
  5. explode on the ' ' character. You'll get two strings -- the first one is the one you want.
  6. I know this is an old topic, but I never did provide the answer, which is --- you have to do individual updates statements for each.
  7. Why would he suggest Sharepoint? What are your requirements. We can't really give you an informed opinion about the suitability of a solution without those. While I have known developers who are relatively nimble in regards to their use of a web development platform, most developers focus on a particular set of tools, and have a preference. At the end of the day, if you are comfortable with a particular developer, you are best off going with what that developer has the most expertise with. Usually, people use asp.net because they are most comfortable in a microsoft environment, running windows servers. If that sounds like you, then asp and ms sql server is the way to go. If you're not looking for that, then there are cost advantages to going with a LAMP plaform. Obviously, those of us here on phpfreaks are biased towards Lamp.
  8. Set up a php array. Depending on the number of elements, you can use rand() to return one at random. For example, if you created a 20 element array: $text[] = 3849; $text[] = 2238; // etc. echo $text[rand(1, 20)];
  9. Not unless you have some sort of indicator in the pmessages table that gets set when a person reads a message.
  10. I would suggest you check out a variety of different ones at http://www.opensourcecms.com/ Another PHP based cms aside from Joomla that is quite popular these days is Drupal.
  11. I'm glad you stuck it out, and paid attention to and followed the advice in the replies. Hopefully we can get you using the code tags from here on out as well.
  12. Not really. Would it help if any of us showed you one of the thousands of websites we've developed? You have a bug in your code somewhere. If you don't figure out what it is, you might as well just give up on learning PHP. I don't mean this to come off as insulting, but "dropping data from the table" whatever you mean by that, so that you can accomplish an update of a value in a single column of an existing table, is absolutely incorrect. If, you would like to provide us *all the scripts you are working with in their current form* and the describe of the table, someone here will probably figure out what your error is.
  13. Sorry for not looking at the code. Above and beyond what I wrote previously, I assumed the code simply generated an attempt, but didn't actually output it. Since it's being output, you have the size of the html page that is ultimately being returned, which is again, completely variable. If however, the code simply checked the random combination for a match and discarded it if it did not match, then it would only be on the server.
  14. It's still possible. What would be required is the use of a header command. You'd probably have to set a cookie so that the system knew that this was not the first time the page was visited. Don't know what the application of this idea is good for, since you haven't provided any detail.
  15. It requires little to no bandwidth, because PHP is a serverside scripting language, meaning that php scripts run on the server. What this particular script does require is processing time, and the results are unpredictable because you are generating random combinations while looking for a specific combination. PHP does have a processing time limit that is configurable on the server, so it's always possible that the script could exceed that time on a particular run, and timeout, returning no results.
  16. As devil's advocate, one of the goals of oop is "information hiding". The idea is that the class should hide the details of the internal data structures. Passing giant arrays around from method to method is a procedural approach. I'm not saying that you should change that approach just for the sake of an OOP principle, but if the arrays are large and complicated, it could in fact be a more modular approach to instead instantiate objects that have methods which return the results of computations done on the internal data, as it's needed, with all the internal querying and fetching being private to appropriate object classes. The idea is that, if you need to change the internal data structures, you don't have a whole host of functions that are suddenly broken because the structure of the data no longer matches what they were working with.
  17. No. The script example I provided assumed a generic script. We don't have any information from you about your database structure, so the best we can do is hypothesize. Often people use AUTO_INCREMENT to provide a numeric primary key on the table. My example assumed such a mechanism. I could easily write a script that would query the image table, and provide a list of the file names and the images. This would be "generic" in that the next time someone uploaded an image it would be reflected in the list. We don't know what the application is or what you are trying to do. You haven't provided any code to look at. We're just guessing at this point.
  18. So, the answer to your question about access is that currently everyone has access to the .swf. I'm afraid we are missing some important information to help you go any further. First off, in regards to "Intranets", there is nothing special about an intranet. It's simply an internal network, and just about everyone these days that has a router in their house to share broadband has an "Intranet". This is facililitated by the use of "non-routable IP addresses" which are ranges of IP's that were specificallly set aside so that companies could have internal networks. What allows this to work is that the router acts as a proxy for all outbound connections. So in general, this Network Address Translation (NAT) functionality is permissive going inside out. Since these ranges are non-routable, workstations inside the NAT range can't be accessed anyways. You can think of this as -- "I can call you from my company, but you won't know my extension". Most people are familiar with the non-routable IP ranges: 192.168.x and 10.x. Workstations or servers you're communicating with never see the internal IP, only the IP of the router that is providing the proxy service. When you first posted, I assumed that what you meant was that the "server" was inside the internal network. I'm guessing that is not the case now, so the first thing you need to know is, what is the IP or range of IP's provided by the router, for people on the Intranet who need to access this material without a login. If you can ascertain that information, then it's possible to utilize the IP range based security previously described. Since this is the basic rule you are looking to implement (People on the Intranet should be "logged into the site without a username/password) then the best solution is to utilize the IP to bypass the usual login.
  19. Sure thing. All the triple = does is insure that you have equivalence both in terms of the value and the php variable type.
  20. Ok, so I think i understand what you have. First off, forget about trying to find a query that will provide you what is in essence an arbitrary WHERE clause. Build your drop down list explicitly in your PHP code. Once the form is processed, depending on the value from the Option, you will set the WHERE clause appropriately to get the list of numbers you require. $sel = Text all leads Text all leads and sups ---etc. SEL; echo $sel; I'd suggest you create a function to do that, based on a switch statement, which could be something like: function buildRecipeClause($option) { $where = ''; switch ($option) { // Leads and Sups case 1 : $where = "dept='T_LEAD'"; break; case 2 : $where = "dept='T_LEAD' OR dept='T_SUP'"; break; case 3 : etc. default : } return $where; } You concat this where clause onto your numbers query, to get the list of people who should get the page emails.
  21. CV, Yes, didn't mean to gloss over what you said -- was just trying to provide a few more details about the ajax. The meta - refresh iframe sounds like a good hack.
  22. what you are asking for doesn't make sense. You want to get 2 different groups of departments and then GROUP BY on dept, yet you don't actually want the 2 groups? In looking at your original code, there's no reason to even be doing the query, because all you're doing is creating a drop down list, and it seems you are trying to force that list to have a single value in it. I'm completely confused -- perhaps it would be better if you explained what you want to achieve and why.
  23. You don't really need an image. Basically, this technique is generally described as ajax polling. You need an xmlhttprequest routine, and on the php side a counter script. In javascript you can set a timer using the setTimeout() function. setTimeout() takes the name of a function to call as it's first param, so if you create a function that does something, and then you call setTimeout() in that function, and specify the function name, you get a timer that will continue as long as that page is open. As CV stated, the only question is how often should this function run? Every time it does run it's going to execute this script on your server, so if you have a lot of users, this could put a lot of load on it.
  24. Yes I did see that query. Unfortunately, it suffers from the same problem I was just describing. It does work if there's a row, but then again so does mine, and it doesn't require the correllated subquery. They are in essence the same, only the original one is more efficient. If you feel that query is getting you close to what you need, go with it. Do however test it out for yourself. For example, if your table is empty, do you get any results?
×
×
  • 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.