Jump to content

Irate

Members
  • Posts

    354
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by Irate

  1. What do you get when you alert success: function(data){ alert(data); }?
  2. That'd be HTTP_CLIENT_IP. Anyway, you can realize what you're trying to do with a getIP() function, something similar to this. function getIP() $ip; { if(isset($_SERVER['HTTP_X_FORWARDED_FOR']) && $_SERVER['HTTP_X_FORWARDED_FOR != "unknown") // test forwarded_for and if not unknown { $ip = $_SERVER['HTTP_X_FORWARDED_FOR']; } elseif(isset($_SERVER['HTTP_CLIENT_IP'])) { $ip = $_SERVER['HTTP_CLIENT_IP']; } else { $ip = $_SERVER['REMOTE_ADDR']; } return $ip; }You can then use the return value of getIP() as INSERT for your MySQL query. require_once('getIP.php'); $mysqli = new mysqli(...); // initialize new MySQLi connection $mysqli->query("INSERT INTO `yourtable` (ip) // assume you have a field named ip VALUES ( `".getIP()."`);"); // carry on with your code
  3. You are sure that you have jQuery and the appropriate plugin installed on your Operating System? You can try echoing out the script via PHP if that doesn't work, too.
  4. Following errors occurred: PHP Warning: include(copyright.php) [<a href='function.include'>function.include</a>]: failed to open stream: No such file or directory in C:\inetpub\wwwroot\index.php on line 143 PHP Warning: include() [<a href='function.include'>function.include</a>]: Failed opening 'copyright.php' for inclusion (include_path='.;C:\php\pear') in C:\inetpub\wwwroot\index.php on line 143
  5. Object-orientated programming is a feature of PHP since PHP 3, but it got upgraded in PHP 5 to be an actual key feature of PHP and as such, the PHP parser now treats objects differently than it did with PHP 3. As mentioned before, unless you want to write programs with objects, you will most likely never use it. You'll stumble across the mysqli class with XAMPP, so I do recommend learning about objects.
  6. Psst, try checking if you covered yourself against these vulnerabilities
  7. Also, when you're operating with values of input field, parseFloat() or parseInt() the valu and save it in a variable, that way, you don't need to iterate over the same value over and over again.
  8. javascript: URLs are hopelessly outdated and shouldn't be used. Try to use unobstrusive JavaScript, or, ideally, use jQuery, that's much easier.
  9. Maybe the friends of Times New Roman? Web designing is the second priority one must set when building a web site; while web development takes care of the major and important security features and functionality, web designer make the site attractive and a feast for the eyes which almost equals the importance of actual programming. Shortly said, CSS is not to be underestimated, but in a forum full of PHP freaks, I'd say that PHP is still our priority
  10. Could you show us the code to the ShareCount object?
  11. Yeah, it should work with arrays and objects, but since I usually work with JavaScript, I return objects when possible.
  12. You can return an object and work with it in other functions, like you have an object defined and assigned to a variable, you return the variable and you can use all the methods you need.
  13. <?php $obj = new ShareCount( the_permalink() ); ?> should work if you have the function working in the same scope and have the function return an URL via return.
  14. Mmm, you're welcome. If you need more help with array_push(), go here: http://php.net/manual/en/function.array-push.php
  15. Functions shouldn't affect global variables. You can define the variables outside of the functions and pass a reference to the variables inside of the function.
  16. require_once() requires a file to be loaded only once so that no redirect loops occur and, like require(), it requires the file referenced to exist, otherwise it throws a fatal error and the script breaks. include() and include_once() work analog to require_once() and require_once(), just that script parsing is not stopped if the file is not found (it'll display a warning E_NOTICE, though).
  17. Try using a for loop. <?php $array1 = array(...); $array2 = array(...); for($i = 0; $i < 4; $i++) { array_push($array1[i], $array2[i]); return $array1; } ... ?>
  18. Pretty straightforward, the URL you are redirecting to keeps redirecting itself to its URL. Look into how an URL is made and post again?
  19. What part do you not understand about the jQuery and how do you think this could work with MySQL?
  20. thatmsg = $("#msgdialog"); Right there. Edit: Sorry, didn't see the globally part.
  21. Why would you even need to have 2 regexps for that? You can test for two conditions with an if statement...
  22. Both options are possible as there is never only one solution to a problem. But I'm glad that you could be helped here.
  23. Basically, the ternary operator is like an if ... else ... statement. $array['key'] ? echo "Array key exists." : echo "Array key does not exist."; could be written as if($array['key'){ echo "Array key exists."; } else { echo "Array key does not exist."; }
  24. If you do not intend to place anything inbetween the <div>s, add a style attribute, set it to display: none; and change it at runtime with JavaScript if you need something displayed in it. That way you can be sure the document stays the same unless you want something to be displayed.
  25. Oh, I'm just asking if you knew where it was saved. Is it a unique entry for each member? If so, you can easily select it with an SQL Query.
×
×
  • 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.