Jump to content

premiso

Members
  • Posts

    6,951
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by premiso

  1. That is exactly what it is saying. If you wish to fix the errors on your form where you re-populate the fields here is an example of what to use: <input type="text" name="uname" value="<?php echo isset($_POST['uname'])?$_POST['uname']:'';?>" /> The ? and : are the Ternary operators. It is basically a short If/Else statement: If uname isset then use that value, else just use a blank value. Hope that helps ya.
  2. strtotime $day_50 = strtotime($date . " -50 Days"); Unsure if it accepts the Y-m-d format, but if it does that would work.
  3. setcookie() On the manual in the notes section Set the value parameter to false and it will attempt to kill the cookie.
  4. The second webhost has a higher error_reporting level than does the first. Add this line to the top of your script: <?php error_reporting(E_ALL & ~E_NOTICE); And it will remove the notice errors.
  5. Missed this one as well: mail($to, $subject, $message, 'From:' . $from); Same error, you missed the concatenation period.
  6. You probably have "checkbox" as the name for both boxes. The name needs to be somewhat unique or an array. echo $row['item'] ."<input type='checkbox' name='checkb[]' id='checkbox'><BR />" ; Notice I renamed it to checkb as well, as "checkbox" may cause issues. This would avoid them.
  7. echo 'Email sent to:' . $to . '<br />'; You were missing the concatenation operator (if that is the correct term) Note the periods.
  8. Look into the date function.
  9. while ($i < 49999){ //write to the file //remember to increment the $i value $i++; }
  10. They use Sessions to store the data and pass it to the preview script. If the preview is good, they use those session variables set to insert it into the database.
  11. SELECT sum(votes) as votes, response from responses WHERE qid = $qid GROUP BY qid Unsure if my SQL is correct, but that should get you what you want.
  12. Using FF3 under XP: [attachment deleted by admin]
  13. Contact your host and request the support. They may charge a fee to install it. Other than that no. Yes, it can. But this can open up security risks to your box if not setup properly and more over your internet connection "may" not be able to handle the traffic, and if you want to run other software on the box, Office Suites/Games, this will dramatically decrease the performance of the webserver.
  14. Look into the JSON functions. You can use GET or POST (preferably POST) to send the array to PHP via AJAX if you want. If my mind remembers correctly, the array in javascript should have a .toString() function and that would be what you want to pass over GET/POST.
  15. What signifies an ID number. The key of the array index or the value. Use either or. The echo statement was to just show you it can be done and a rough example of how it is done. If you want the index use $key if you want the value of that index use $val. Simple as that. However, seeing as you want to use them in a MySQL statement, I would suggest looking into array_keys and implode: If you want to use the keys: $query = mysql_query("SELECT * FROM table WHERE id IN('" . implode("', '", array_keys($arr['somearray'])) . "') ORDER BY id"); Of the values: $query = mysql_query("SELECT * FROM table WHERE id IN('" . implode("', '", $arr['somearray']) . "') ORDER BY id"); Using the above two methods (either or) will be way more efficient than looping through your code and running a query for each item.
  16. foreach ($arr['somearray'] as $key => $val) { echo "{$key} => {$val}<br />"; } foreach
  17. $ip = $_SERVER['REMOTE_ADDR']; //Everything seems good, lets insert. $query = mysql_query("INSERT INTO users (username, password, email, ip) VALUES('$username','$password','$email', '$ip')"); You will have to add ip to the column as a varchar(15) for that to work, but that should get you rolling. Just a note you may have to update their IP each time they login as it can and will change (unless they have a static which is rare). EDIT: Changed to varchar of 15
  18. If this is the case, you are better off using that method above. stristr is really for locating an item inside of a string. So let's say I wanted to see if the following contained "dog" in it: $string = "The quick black dog ran over the neighbors yard."; if (stristr($string, "dog") !== false) { echo "We have a dog!"; } Just so you understand there is a a correct way to utilize stristr. I would say how you were using was the incorrect way and you should use the comparison operator ==.
  19. <?php //set this to true to rotate link offer or false to show fake website $go = false; //fake website $site = 'http://www.example.com'; $redirect = $site; $sites = explode("\n",file_get_contents('sites.txt')); $aff_link = $sites[array_rand($sites)]; if (($go === true) || ($_REQUEST['trkid'] == 12)) { if ($_REQUEST['trkid'] != 12 ) { $redirect = "track.php?trkid=12"; } else { $referer = $_SERVER['HTTP_REFERER']; if (($referer == "") || (strpos($referer,$_SERVER['HTTP_HOST']))) { $redirect = $aff_link; } } } echo '<meta http-equiv="refresh" content="0;url='.$redirect.'">'; exit; ?> Give that code a try and see if it works right for you.
  20. I do not think so. stristr seemed to be right on key for what you were trying to do.
  21. mysql_num_rows if (mysql_num_rows($result) < 1) { echo "Query returned no results."; } Where $result is the resource of mysql_query
  22. I think your main issue is your slashes. Your IF statement is fine, and to ken's remark about stristr not returning correct values is false, however how your if statement is setup it can give a false positive. <?php $returnlink = ""; // initialize the variable to make sure nothing else is added. if (isset($_GET['lid'])) { if (stristr($_GET['lid'], '1') !== false) { // use the === operator to test a true/false condition $returnlink = "<a href=\"http://www.premiermoviegroup.com\">PremierMovieGroup.com</a>"; // the // are not escape characters no need to escape them echo '<img src="images/PMGlogo_med.png">'; } else { $returnlink = "<a href=\"http://www.farewaymovies.com/test\">FarewayMovies.com</a>"; // the // are not escape characters no need to escape them echo '<img src="images/FarewayMoviesLogo.png">'; } } else { echo 'No location set.'; } ?> Honestly Ken, if you would have taken the extra 2-3 minutes to read the post and the code he posted you might of been some help instead of confusing everyone on this topic. And actually posted something helpful instead of your one line answer of
  23. Sorry I did miss the "between" part. http://www.pakiguys.com/php/find-time-between-two-dates-in-php.html Maybe more of the function for you. As far as it being a little much, I think you are underestimating what you are wanting to do.
  24. http://snippets.dzone.com/posts/show/3044
×
×
  • 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.