Jump to content

ManiacDan

Staff Alumni
  • Posts

    2,604
  • Joined

  • Last visited

  • Days Won

    10

Everything posted by ManiacDan

  1. You need to provide a LOT more information than that. What sites? What technology? Which poker? Also, generally speaking gambling robots are illegal and a violation of the gambling sites' terms of service. -Dan
  2. The PHP function nl2br or the HTML tag <pre> -Dan
  3. There's nothing special about this wordpress code aside from the fact that it uses the colon syntax rather than the curly brace syntax. It only APPEARS to be custom wordpress code, when in reality it's just regular old PHP. Simply stick the relevant IF statements inside your loop here. -Dan
  4. Per the first page of google results, the proper way to change the URL of an iframe is by using iframeObj.contentWindow.location; NOT .src. -Dan
  5. Per my #2, the answer is "don't do this at all." Mysqldump is a standalone program that comes with mysql and performs this exact operation for you. If you really MUST have a function that does this, this one is untested but should work for you: function datadump ($table) { $result .= "# Dump of $table \n"; $result .= "# Dump DATE : " . date("Y-m-d H:i:s") ."\n\n"; $result .= "INSERT INTO `{$table}` VALUES "; $rs = mysql_query("SELECT * FROM `{$table}`"); while ( $row = mysql_fetch_array( $rs ) ) { $values = array(); foreach ( $row as $value ) { if ( preg_match("/-?\d*(\.\d+)?/", $value) ) { $values[] = $value; } else { $values[] = "'" . mysql_real_escape_string(str_replace("\n", "\\n", $value)) . "'"; } } $result .= '(' . implode(',', $values) . '),'; } return trim($result, ','); } Note that I didn't muck around with mysql_num_rows, mysql_num_fields, or addslashes. None of those were necessary. -Dan
  6. 1) You never put any data into $row. 2) mysqldump will do all this for you. -Dan
  7. I think your professor (if you have one) would be better at answering this question, but generally "functional" requirements describe how something "functions" (works). "Non-functional" requirements describe the product, but not it's functionality. This site is a forum (functional) which is blue (non-functional). -Dan
  8. Look into JPGraph as well. -Dan
  9. What Pikachu gave you will work exactly right, you may not be printing the right variables. Right before this IF check, do: var_dump($_COOKIE);var_dump($_SESSION); See what comes out. I bet the variables aren't set the way you think they are. To be clear, what we think you're saying is: "I want $variable to be the value of EITHER $_COOKIE['name'] OR $_SESSION['name'}, whichever is set. If both are set, use the $_COOKIE variable." If that's not what you mean, rephrase the question. -Dan
  10. Also note that if you get this working, you may be violating your ISP's customer agreement. Generally they don't allow the customers on "residential" connections to run a web server. -Dan
  11. Or: array_sum(range(1,100)); PFMaBiSmAd is the most correct since that would be the fastest calculation, but there are plenty of ways to solve this problem. -Dan
  12. To find out what a function does, read the manual entry for that function. Output buffering is a complicated topic, you don't need it unless you know you need it. -Dan
  13. The header() function cannot operate properly if anything has been sent to the browser. As PFMaBiSmAd pointed out, line 3 of your functions file has output. You must remove it in order for header() to work. -Dan
  14. Both of those files are accessible, but one of them isn't a valid image. You will have to copy them to the local filesystem and perform your operations on them there. This is a bad idea, however, since in my tests it took nearly 4 seconds to even OPEN these files. This webserver is too slow to be relied upon for your own site's functionality. -Dan
  15. He's looking for a REMOTE file's existence, I think. -Dan
  16. Answered this on devshed!
  17. That thread on devshed is worth a read (and there's a link in that thread to another devshed thread about ads), but you're right, there isn't a clear cut solution. I like the idea of narrowing the page somewhat and using sidebar ads. Last.fm and IGN both do "background ads" which appear to be wrapping the site content. The sides of my screen are blue gradients. It wouldn't kill me if they were ads for Norton. It would annoy me if they were flashing, noisy ads for spam software (hint: devshed did this). I don't know, honestly. While you're right that social networks are stealing all your traffic, that also means that your bandwidth bills are lower. With lower traffic, can you optimize the forums and kill a few servers from your cluster? How many do you run? I've run sites as large as 400 enormous machines, and as small as a single VPS. -Dan
  18. Because you have to alter the table (which takes a long time) every time you have to add a new language. If you designed it my way, you can say: SELECT id, text FROM lang WHERE language = 'swedish'; You could also have a second table holding id/value pairs for the languages so you can say: SELECT id, test FROM lang WHERE language = 3; If you continue down your path, you will have to add a new column for every new language, which will lock the table (and prevent your site from working while the operation completes). -Dan
  19. Hey, it's THE PHPFreak! Sorry if I was harsh, but we've been having this very same argument on devshed (link) for MONTHS and nobody seems to notice that it's killing the forum over there. Was the dog food simply a test, or just really terrible context sensitivity? Normally this kind of ad is related to whatever word it decides to bind to, so if I say "email" the ad will be for Outlook or something, but there were 4 different dog food ads all binding to random words. If you need assistance, PM me. -Dan
  20. $lang = array(); $rs = mysql_query('SELECT id, english FROM lang'); while ( $row = mysql_fetch_array($rs) ) { $lang[$row['id']] = $row['english']; } Add debugging and whatnot, but that's the structure. Also, your table design is wrong, you should make 3 columns: id, language, text. This way, you can add a new language without adding columns. -Dan
  21. @Crayon: Don't worry, it takes more than a misunderstanding to make me hate you forever. You're still invited to my birthday party. If the admins of this site (whoever they may be) have signed a contract with a third-party ad serving company that gives them no control over the content or frequency of the ads, that's a bad business decision. You heard it first right here, straight from the keyboard of a professional web developer with a degree in IT management. (I'm also a senior architect for a profitable ad-supported company with 20,000,000 users) Also, as a quick thought experiment (for Crayon and others): who are the "customers" of this site? Are they the small mod team, who come to this site to moderate the forums without any intention of ever clicking on any of the ads? Are they the small group of professionals who come to this site to provide help without any intention of clicking the ads? Or are they the "freeloaders" who are using this help forum to receive help? Yes, it seems greedy for them to come on here and say "I'm getting something for nothing and I'm annoyed!" However, that's not what they're saying. They're saying "I'm agreeing to view your ads and possibly click them if they're relevant to my interest. In exchange, you provide me with the information I seek. Your ads are now costing me more than what I believe the information is worth." You provide a service, they pay for that service by consuming it. It's a difficult concept, but it's how network television works. Much different interpretation, isn't it? Serving ads is a balancing act. Once your ads start covering the content, you lose that balance. -Dan PS - Yes, I'm being a jerk above, and I'm doing it on purpose. DevShed lost the fight to retain their customers and I actually like PHPFreaks. I hope someone with decision making powers reads this and the ads disappear and are replaced with reasonable, context-sensitive ads like google ads. If I happen to be the victim of random testing and the future ads will be related to the words that trigger them, I'll still be annoyed that mousing over a paragraph runs the risk of hiding that paragraph.
  22. You don't know how to get them into an array? Instead of echoing them, do $arrayVariable[] = $whateverYouAreEchoing; Then: $arrayVariable = array_unique($arrayVariable); sort($arrayVariable); -Dan
  23. Is anyone else getting those intolerable hover-over ads on every page of PHPFreaks now? It seems to have happened over this past weekend. For instance, right now on this page I see: Each underlined word above, when hovered over, causes an ad for dog treats to pop up on my computer. This happens in all 4 browsers I have installed, whether I'm logged in or not. We just had the "intrusive ad" conversation on DevShed. That's why I became a member here. As a professional web developer, I understand the difficulties of running a website on ad revenues. But you know what? This is a technical forum. I'm here to give advice on PHP. How is PHP related to Nylabone? It isn't. These ads are overly intrusive, annoying, and probably aren't giving you much money, considering that they have nothing to do with the contents of the page. Maybe a donations system, or actual context-sensitive ads would help. If my screen is obscured by another ad for dog food while I'm trying to type about PHP, my wandering may recommence. -Dan
  24. 1) I have no idea what you mean. Generally the PHP code is the beginning of the file, and the HTML is the end. It's not a rule per se, but it allows your PHP script to generate errors and default values for your HTML. 2) Name the radio buttons the same NAME and they will be grouped together. You have no named for your inputs (any of them) so your form will never work. Spelling: Maiden, Personal. 3) I don't know what you're trying to do with renaming things, but this is a breakdown of the technology you're using: HTML - A completely client-side markup system, it makes things look pretty and formats text. It also generates "dumb" forms and inputs for the user to type into. HTML can perform NO actions. CSS - An offshoot of HTML, CSS handles stying HTML elements. CSS has "rules" that allow you to make fake dynamics on your site, mouseover actions and the like. Not a programming language. No actual actions. JavaScript - A client-side programming language, JavaScript executes on the USER'S computer, not on your server. Javascript interacts with the current page as it appears on the user's computer. JavaScript has access to what the user types as they type it, but is insecure because the user can modify it. JavaScript should be used to improve the user experience but not replace your server. AJAX, which you're not using, is a subset of javascript that allows you to make asynchronous calls from JavaScript to your webserver to retrieve live information without reloading the page. PHP - PHP is a server-side language. It runs on your server, NOT the user's computer. The user must make an individual request for every PHP page you run. PHP pages start, run, output, then die before the user sees anything. PHP pages are ignorant of each other and have no idea if the user is visiting for the first time or the millionth time. You must build session tracking into your site if you wish to maintain state. As for your file itself, you're using a custom rules-based validation parser (and you appear to be doing it wrong, the include might go after the rules), so I can't help much there. -Dan
  25. I suggested three tables, do you have three? What do you mean by "all i need is how to get session for my user id"? Google for PHP login systems, they're mostly session based. -Dan
×
×
  • 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.