Jump to content

samshel

Members
  • Posts

    837
  • Joined

  • Last visited

Everything posted by samshel

  1. what do u want to do ? if page is not register.php and alarmes.php u want to allow ? if ($_SERVER['PHP_SELF'] != "/alarmes.php" && $_SERVER['PHP_SELF'] != "/register.php") { } else { echo ""; } OR generally got with == for != AND should be used. not necessary but thumb rule
  2. imagecopymerge(); will merge ur images.. to get samples in the first place u will have to use imagecopyresampled().
  3. check if this is what u r looking for : imagecopyresampled()
  4. if ($_SERVER['PHP_SELF'] != "/alarmes.php" || $_SERVER['PHP_SELF'] != "/register.php") { } else { echo ""; }
  5. yes u can store it as bool and add the value of checkbox and field name in the same insert query.
  6. instead of "outputting" something in PHP CLI files, you can directly write to the file you want using simple file functions.
  7. echo out ur query... $sql="INSERT INTO application (IGN, Rank, Age, Kdr, Whyjoin, Preclan, Hack, Email, Mapmode, Reco, Refer, Agree) VALUES ('$_POST[id]','$_POST[Rank]','$_POST[Age]','$_POST[Kdr]','$_POST[Whyjoin]','$_POST[Preclan]','$_POST[Hack]','$_POST[Email]','$_POST[Mapmode]','$_POST[Reco]','$_POST[Refer]','$_POST[Agree]')"; echo $sql; $res = mysql_query($sql,$con) or die(mysql_error()); if(mysql_insert_id($res)) { echo "Thank You !!"; } else { echo "Insertion Failed !!"; }
  8. <?php $dt1 = "2009-02-26"; $dt2 = "2009-03-26"; $tm1 = strtotime($dt1); $tm2 = strtotime($dt2); $dt = Array (); for($i=$tm1; $i<=$tm2;$i=$i+86400) { if(date("w",$i) == 6) { $dt[] = date("l Y-m-d ", $i); } } echo "Found ".count($dt). " Saturdays...<br>"; for($i=0;$i<count($dt);$i++) { echo $dt[$i]."<br>"; } ?>
  9. <?php $con = mysql_connect ( "myhost" , "databasename" , "pass" ) or die(mysql_error()); mysql_select_db( "databasename" ) or die(mysql_error()); not sure but u can try this...the code is breaking just before mysql_error()...
  10. post ur whole code, u might be missing a semicolon or closing bracket somewhere. it generally never shows PHP code in the error.
  11. Parse errors show line number where the problem is.. so u can easily pinpoint the problem.
  12. using sessions is safe...u can also try if(!isset($_SESSION['login_username']) || trim($_SESSION['login_username']) == "")
  13. always put ur code in between [ code ] [ / code ] tags. remove space in the tags..it makes the code readable.
  14. 1) does your table have field called Rank ? [check case too, i m not sure if it causes problems] 2) use back ticks to mark fields in query, to avoid problems with key words. $sql="INSERT INTO application (`IGN`, `Rank`, `Age`, `Kdr`, `Whyjoin`, `Preclan`, `Hack`, `Email`, `Mapmode`, `Reco`, `Refer`, `Agree`) VALUES ('$_POST[id]','$_POST[Rank]','$_POST[Age]','$_POST[Kdr]','$_POST[Whyjoin]','$_POST[Preclan]','$_POST[Hack]','$_POST[Email]','$_POST[Mapmode]','$_POST[Reco]','$_POST[Refer]','$_POST[Agree]')"; TIP: avoid using upper case letters in table and field names, always using lower case letters helps in avoiding mismatch problems.
  15. $dtDate = "2009-02-26 22:05:09"; $tmTime = strtotime($dtDate); $tmNextTime = $tmTime + 30; $dtNextDate = date("Y-m-d H:i:s", $tmNextTime); its the same as the little guy suggested, just instead of current time, u can put any time in the variable.
  16. ow.......than i may be completely wrong ! sorry for mis-guiding u
  17. 1) Firing 2 CURL requests back to back doesnt mean that it is hitting both pages one after another. It executes as if 2 differnet users are trying to open these pages in 2 different browsers. u need to login to open second page, so it will not work. 2) u dont need to isntall snoopy, u can just download and include it. it is a PHP class.
  18. mysql_connect("localhost", "user" ,"***"); mysql_select_db("dbname"); $strSql = "UPDATE propertylisting set propertylisting_status = 'NO' WHERE propertylisting_status = 'YES' AND propertylisting_expiry < '".time()."'"; mysql_query($strSql); //Assumptions //- u will be showing records with status = 'YES' //- u r storing unix time stamp in your third field whcih is _expiry, //- u will run this script periodically,
  19. try running the query directly in phpmyadmin or any other mysql client u have.
  20. 1) Write cron 2) Select all active records from table 3) check 3rd field if the time has already passed. if yes deactivate the listing by updating record.
  21. yes it will.
  22. as far as i know even if u do 2 curl_exec one after another they will not be as good as hitting one page after another. PHP is stateless.... you will have to try something like Snoopy class..it is a browser simulator , but i m not sure how elegantly it works !! Google for Snoopy.class.php
  23. sort your original first on counter, then do this foreach.
  24. $origArr = array("bread"=>19, "butter"=>19, "coke"=>4, "orange"=> 7); $newArr = array(); foreach($origArr as $key=>$val) { $item = array(); $item["term"] = $key; $item["counter"] = $val; $newArr[] = $item; } not tested.
×
×
  • 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.