Jump to content

gizmola

Administrators
  • Posts

    5,945
  • Joined

  • Last visited

  • Days Won

    145

Everything posted by gizmola

  1. What is wrong with it? Well you do an insert followed by an update on every execution. What you need here, is to query for the existence of the user. You can either use mysql_num_rows() or do a SELECT count(*) as countof WHERE user... query. Based on that result, you either insert the new row, or do your update. Mysql does have a syntax -- http://dev.mysql.com/doc/refman/5.0/en/insert-on-duplicate.html that might work for you in one query. What you will need to try it out is to create a unique index on the user column in the table. You'll need to implement one or the other approaches.
  2. Domains are simply a function of the DNS system. The DNS system does one simple thing: turn domain names into IP addresses. So first and foremost a subdomain is defined in your DNS system. In DNS you have a zone file for every domain you own which defines the name to IP address conversion. With a domain you can define in your zone file any number of subdomains you want. In terms of websites, in the old days, webservers could only support one website per IP address combination. This was amended to support the addition of of an http host header in http 1.1 which facilitated the addition of vhost capabilities. In DNS you can have many different names all resolving to the same IP address. As IPv4 addresses have become a precious commodity, it has become common practice for people to host many different websites on the same server, with the same public IP address. This works, because browsers now send the http host header, and websites will read this header and determine which website to serve up for a given client request. In a nutshell, subdomains are entirely a DNS function, while websites are a function of the webserver.
  3. No worries, it happens to all of us at some point that we miss the forest for the trees. The important thing is that you got the more complicated things sorted out, and were able to get the graph and data generated in the first place.
  4. One of the mods removed your other thread, as I guess he felt it was redundant, when we already have this area for feedback. Overall, I think you made a nice clean, aethetically pleasing wordpress theme. I don't know that the header logo really fits the subject matter -- it looks a little artsy-crafty, or maybe something that would go well on a blog about the environment or gardening. Given that there is a robust market for wordpress themes you might have success selling it.
  5. Hey TLG, Yeah sometimes people get too close to something and they don't realize that what they believe is the best approach is actually not. Maybe you can point him to this thread. I agree that the dark scheme isn't the best, nor is the oversized logo which is confusing, as to what it is saying about the site. There is this giant weird cigar chomping razorback... but how does that relate to what the site is about? At first glance, it's hard to understand what the site is doing? Is it a site for rating companies, or is a job search site? Why should an average visitor want to interact with this site? You may still be in the process of developing things, but just in testing the zipcode search, things seem to be a bit off there, as I did a search on my zipcode here and it came back showing cities that are anywhere from 5-20 miles away as being 1.5 miles away. The design of the rating categories just doesn't seem well done to me. This is not how most people look at the aspects of a job: "Managers" - What is this relative to? If i'm a janitor, this is a rating of the head janitor? Why would i care about this if I'm going to be working in sales. "Difficulty", "Fun" - Totally subjective and at the same time non-descript. Hours, Pay, Flexibility... the same. To me these general categories just undercut any possible value this site could have. People want information like: benefits, salary ranges, and perks. What would be more interesting to someone in looking at a company... seeing that they provide free breakfast of fruit, cereal and bagels, or that someone rated them as "Fun of 3.5?" Those numbers are worthless without criteria, and even then I don't see much value in arbitrary numbers from anonymous people who could just be shills for the company. Furthermore, my experience as a maintenance man is probably going to be very different from the experience of someone who is a director of marketing. The entire concept of this site is deeply flawed, as far as I'm concerned. I bring a lot of this up, as it reminds me of the famous "websites that suck" book, where they make the case that the design of a site needs to match it's intention and should be in support and harmony with the concept and brand.
  6. Looks good. I do question how you intend to make money with this site however.
  7. This is not a php problem. It seems you misunderstand some of the basics of html. When you have an html page, I'm sure you know that when you want to include an image, that requires a tag. You can not just spit out image data in the middle of html and expect that to work. You were on the right track initially when you developed a script that accepts parameters and returns an image. To include that on a page simply requires that you reference your image script inside an tag. All that you really require with the form is to have the period parameter filled in in your serverside code by getting the appropriate $_POST[] variables and adding them to the url.
  8. PHP doesn't support named parameters unfortunately. If you have a list of optional params you have to specify all the ones you need up to the option you require. There's no way to cherry pick one option in the way you were attempting to.
  9. Looks like you have a start going, using the imagecreatefrom... You just need to add in the writing part -> http://us.php.net/manual/en/function.imagettftext.php There are things in the code you pasted that involve what appears to be adding a watermark image, but it doesn't look like you need that. Also whatever image type you are starting with (png, jpeg or gif) you would want to stay with that image type throughout. Since your base image is a png, then stay with that. As for a button, you just need an html form, or javascript attached to a button. That's not really a php question, but if there's something specific to php rendering of that content let us know once you have something started. Your script, which is the one you have already started, should be something like getimage.php or whatever makes sense for your system. I'm not clear from your description of how the script will get the parameters it needs in terms of knowing what needs to be written to the image or any inherent security or control concerns, since this involves the facebook/like system. One way that might make sense is to have this button pass a url parameter of the person's facebook id, or whatever is available from the facebook api. I haven't done anything with facebook so I can't speak to that from firsthand knowledge. I think it's safe to have that passed as a url parameter, so in php you get something like that in php from the $_GET[] superglobal. So if your url generated was something like: getcoupon.php?fid={facebook id} then inside getcoupon.php you'd get it via $_GET['fid']. When you generate the image and write the text to it, you can just return it directly after you set the headers. Something like this should work: $file = 'tacocoupon.png'; header("Content-Description: File Transfer"); header("Content-Disposition: attachment; filename=$file"); header("Content-Type: image/png"); header("Content-Transfer-Encoding: binary"); imagepng($im);
  10. Welcome to the site. I looked at a couple of your videos and there's some good stuff there. Good information and you speak well.
  11. FlannelBeard, What you want to do can be done fairly easily using the GD Functions. You will need the freetype extension as well. Take a look at the manual and if you have specific questions let me know. It will allow you to load in your base image and draw text on it, and return a customized version. You can save the image first and return it, or just return it directly to the browser. GD is the basis of most of the graphing and charting libraries out there, and in general is just great stuff. http://us.php.net/manual/en/book.image.php
  12. You can either have the stats in this table, or not. You can have a seperate stat table but I'm not sure if that's really helpful for you here, since it seems the stats are the current aggregate totals for the player on that team. However, if you have detail game info in a seperate table, then yeah it makes sense not to duplicate that redundantly in this table. As you say, use the from-todate range to get the sum() of the data in a query.
  13. Well, the average load on the server is usually under 5. tho i think i know why 127.0.0.1 isnt working. the bind in my.cnf is set to my actual ip and not the localhost or 127.0.0.1. I think i set it up like that because from my understanding 127.0.0.1 would have prevented outside connections from a diff server connecting to mysqld. Well since switching to the IP i havent gotten anymore of those errors about cant find mysqld.sock. who knows maybe this fixed it. Well you probably should listen on all ports, or include 127.0.0.1. That way you don't add overhead to your nic when the server really only wants to talk to itself over the loopback. Or as you say, if you don't need this server to talk to any other servers, you should change it to 127.0.0.1.
  14. No you are right. You need a row for every player/team/time frame combination. When a player changes team, you in essence close out that row by setting the todate to the day of the trade. Also what I tend to do is make the todate of an active row be the largest mysql data possible. These rows should be mysql DATE types so that you do not need to do date math inside your php code. The only problem i see is that you ahve the full player name in there. Players should be in their own table. I assumed you already had this. Then you would just have the player_id number in this table. As for getting the data from yahoo or any other place, seems to me to just be a screen scraping exercise. There are other sources for data of course like: http://www.hockeydb.com/
  15. I'll be the first to say that this seems like you're chasing your tail. You could be getting the error intermittently because you are running out of mysql connections. In terms of the networking: define('MYSQL_HOST', 'localhost'); tried changing to define('MYSQL_HOST', '127.0.0.1:3306'); and it breaks my site You would not want to set the MYSQL_HOST to the ip/port. Mysql already is configured to use its well known port '3306'. If you really want to try that change the host to 127.0.0.1, which should be the same as localhost if your box is configured correctly. However, I suspect that your real problem, since it's intermittent, is that you are running out of mysql connections. If the application is using persistent connections (mysql_pconnect) this is a frequent problem. If it's just simply load related, then take a look at upping the number of mysql connections allowed. Login to your mysql server using the mysql command line client as the root user, and run show processlist show variables Will show you all the current configuration settings for the running server, but in this case: select @@max_connections; If you're even coming close, this might be a good indicator that you're running out of connections. Cross reference your max_connections setting from your /etc/my.cnf.
  16. There is nothing to rewrite. $r=intval($r) and $r = (int)$r do the same thing -- convert $r to a php "integer" type variable. They just use different methods to get to the same place. Substitute the $r = (int)$r for the intval line. The syntax is "casting" the variable to the type shown in the parens ie. (int). In most cases php will do internal typecasting for you, but this is a special case where if someone tried to enter a string as the url parameter, all that will happen in the casting process is that php will set $r to be '0'. Your code seemed to handle this fine. Show me the exact code you have and I'll look at it again. There is logic where it is checking to see if isset($r) which doesn't make any sense from what I can see. That probably can go away.
  17. Yeah there is a point at which, for this problem, regex isn't the best solution. You might be better off having a little procedural code that finds the location of 'from' and 'join' and looks at all the string after that.
  18. Yes, however, in the notes of the page, you might take a look at this link: http://www.printsmadeeasy.com/code_samples/php/text_generation.html The guy wrote some fairly sophisticated code you can get from his link that looks like it might fit your need, or at least provide a starting point. It purports to do what you are asking for.
  19. On top of Ignace's great advice, there's this article which should help you out: http://mobileorchard.com/tutorial-json-over-http-on-the-iphone/
  20. Try this instead: if (fsockopen($settings->survival_server, $settings->survival_port, $errno, $errstr, 0.1)) {
  21. http://www.phpfreaks.com/forums/index.php?board=8.0
  22. The beauty of php is that you simply add to the value. . $result['tmap'] + 1 .
  23. No worries, the solved mod has gone awol. We all long for its return
  24. This site is read by many experts who are happy to help you if you put in the effort. Zend Studio is nice when you know what you're doing, but it might be overwhelming for you, and you don't have to use an IDE. Any simple ascii text editor willl also work. For example, notepad++ which is free and works on windows as well. I personally don't use xampp but I know many people do. Have you made a simple script with <?php phpinfo(); in it, and got that to run? Here's what you need to do: -Come up with the specification for what your bot will do. Since you're starting out, don't pick anything too difficult. -Think about how to break down the problem into pieces. -start with a skeleton, and get the first thing working. You can have stubs for pieces you haven't figured out yet. Once you have some code going, people here might actually help you. The only other thing I can suggest to you, is that if you absolutely must have urgent one one one help, figure out a budget and advertise for someone to help you write your code. We have a freelancing forum you can use to advertise for help. It also might help you if you tried to find someone who can work with you who speaks your native language, whatever that is.
×
×
  • 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.