Jump to content

joquius

Members
  • Posts

    319
  • Joined

  • Last visited

Everything posted by joquius

  1. you'll need the page open to run the php script or have some other page open it. You could get a javascript page to load the page after 5 minutes and run the query on the load of the page.
  2. you'd need a page open which would refresh itself after 5 minutes
  3. [code] foreach ($unallowed as $badword) { preg_replace ("/$badword/", "", $text); } [/code]
  4. Actually you can add the link in the mysql_query function, if 2 mysql connection are made to specific which to use. If there's only one connection you can leave it empty.
  5. Well you could always just use mail() to send the email and add a link to the file on your server within the content.
  6. Form data is always posted (as blank if empty) so you're better off doing this: [code] if (isset ($_GET['submit'])) {   foreach ($_GET as key => $value)   {     if ($key != "submit" && $value == NULL)     {       $error = "fields missing";       break;     }   } } [/code]
  7. suppose so, at any rate I'm looking for ways to move loops which output html from php to javascript to reduce the strain on my server and the bandwidth in use.
  8. I don't usually ask questions but this is kind of a "wondering". I have a script which loads different pages and remembers the history of the loaded pages by using cookies in the form of tabs. Now at the moment this script saves only the link to each page and each page has to reload itself again (each page contains data from a DB) which is not too fast and makes the tabs a bit untabish. Now what I'm thinking is about preloading the $result for each window query in the php, and then transferring those to javascript, and then playing around with the windows in javascript. What do you think? On the one hand I don't know if it's good to preload about 6 queries with about 20 rows each (about 1k per row) Any ideas or advice from someone with a lot of background in coding? Thanks in advance for any feedback.
  9. When dealing with weeds it will never avail you to cut them down, you have to root them out if you want to get anywhere
  10. first off, you wanna change that long list of mysql_results to this while ($data = mysql_fetch_array ($result)) { $field = $data['field']; // and all other stuff which was in the for() loop } actually...should look like this: [code] <?php if ($logged_in) { echo "My Contacts"; include "database.php"; $name = $_SESSION['username']; mysql_connect ($connect, $username, $password); mysql_select_db ($database) or die( "Unable to select database"); $sql = "SELECT * FROM ".$name."_contacts"; $result = mysql_query ($sql) or die (mysql_error()); while ($data = mysql_fetch_array ($result)) {     $first = $data['firstname']; //etc } } else {    echo "You are not logged in. You need to be logged in to use My Contacts.<br /><a href=\"index.php\">Log In</a>"; } ?> [/code]
  11. Well it's just the case, beyond this stuff you're going into messing with the guy's computer.
  12. if you're talking about a forum or such just don't let anonymous users post and add a email verification for the registration.
  13. hmm... well I'd normally add a cookie, user specific and ip ban so that whenever they came in with any of the same of those the ban would insert itself again. dunno
  14. depends on the code but you're going to need some basics in php before you integrate php code in your page
  15. first change userfile1-5 to userfile_1-5 [code] for ($_POST as $name => $value) { if (preg_match ("/userfile_[1-5]{1}/", $name)) {   $name = explode ("_", $name);   $num = $name[1];   $file = $value; //do stuff with these values } } [/code] this what u wanted?
  16. as far as I can see your homepage is a .html file. for the script to be parsed by php you need to make the index a .php file.
  17. I think it's actually "PHP. Help!". Maybe the freelancing forum dunno. I dunno anything don't ask me.
  18. mighty stuff but methinks it's the wrong forum for it hmm...
  19. from php.net Example 1. A simple gethostbyname() example [code] <?php $ip = gethostbyname('www.example.com'); echo $ip; ?> [/code]
  20. If it's working on and of maybe check out $link and make sure it isn't getting mixed up with a different connection if you have more db's on the same server. Other than that is it completely random when it doesn't work?
  21. can you preload the DB you're searching through into arrays and export them to java at the beginning of the page? or do you not want to do such a thing.
  22. generally it's better to use a hidden form field and set value="<js>document.attrib</js>" // yes i know <js> doesn't exist (wish it did) then just load those values using $_POST['field']; sadly you will need a page refresh as java prints only after php.
  23. umm better change some code here. I would no advise the following: [code] $sql = "SELECT * FROM `table` WHERE `field` = '$value'"; $result = mysql_query ($sql); if (mysql_num_rows ($result) != 0) { ?>first html piece<? } else { while ($data = mysql_fetch_array ($result)) {   ?>second html piece<? } } [/code] OR = || <> = !=
  24. change it to if ($page == "") { // (== not =) echo "Home Page"; } else { echo $page; }
×
×
  • 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.