Jump to content

MadTechie

Staff Alumni
  • Posts

    9,409
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by MadTechie

  1. Slight bug in your code samshel (easily missed), Heres the fix.. $sql = "SELECT * FROM table WHERE MONTH(reg_date) ='".$m."' AND DAY(reg_date) IN ('".implode("','", $arrDays)."')";
  2. Okay the reason your getting this delay is due to the Nagle Algorithm and how it affects TCP/IP transmissions of small packets done separately versus large packets. Test example:~ Now you could write the data to a file and then use readfile() and that will work!.. or break it up into smaller chunks Heres a function to use in replacement of the echo construct <?php function echobig($string, $bufferSize = 8192) { $splitString = str_split($string, $bufferSize); foreach($splitString as $chunk) { echo $chunk; } } ?> <?php //replace echo $data; //with echobig($data); ?> Hope that helps MadTechie
  3. Huh! you lost me, Okay you want to select all fields (SELECT * FROM table WHERE the month is what and the day is what ? do you mean a range! you totally lost me!
  4. change <b><?php echo $row->track_no; ?>. </b> <?php echo $row->track_artist; ?>. : <?php echo $row->track_title; ?> to <b><?php echo $row['track_no']; ?>. </b> <?php echo $row['track_artist']; ?>. : <?php echo $row['track_title']; ?> What they do.. mysql_fetch_assoc — Fetch a result row as an associative array meaning uses the field name $row['track_no'] = the track_no field $row['track_title'] = the track_no field mysql_fetch_row — Get a result row as an enumerated array meaning its a array with number keys ie $row[0] = the track_no field $row[1] = the track_title mysql_fetch_array — Fetch a result row as an associative array, a numeric array, or both Both of the above $row[0] = the track_no field $row['track_no'] = the track_no field $row[1] = the track_title $row['track_title'] = the track_no field
  5. can you post a more complete script, your probably get more help!
  6. its a positive lookbehind that matchs any character that is NOT a A single digit.
  7. No need to destory it, I assume something like this is happening Use enters site (no sessions are set) user logs in, first session doesn't get set, user logs in again all is fine.. So. Use enters site (set a sessions ie $_SESSION['dummy']=true;), user logs in, second session does get set
  8. try this <?php $word="Hello: welcome / it's 19:10 12/03/2009"; $word = preg_replace('%(?<=[^\d])(:|/)(?=[^\d])%sm', '', $word); $NewWord = preg_split('/\s+/sm', $word); print_r($NewWord); ?> EDIT: oops forgot about the date! Added
  9. Okay see all that HTML at the start of the page! thats not allowed try this <?php require_once('recaptchalib.php'); // Get a key from http://recaptcha.net/api/getkey $publickey = "public code from the reCaptcha site "; $privatekey = "private code from the reCaptcha site "; # the response from reCAPTCHA $resp = null; # the error code from reCAPTCHA, if any $error = null; # was there a reCAPTCHA response? if ($_POST["recaptcha_response_field"]) { $resp = recaptcha_check_answer ($privatekey, $_SERVER["REMOTE_ADDR"], $_POST["recaptcha_challenge_field"], $_POST["recaptcha_response_field"]); if ($resp->is_valid) { $firstname = $_REQUEST['firstname'] ; $lastname = $_REQUEST['lastname'] ; $orgname = $_REQUEST['orgname'] ; $address1 = $_REQUEST['address1'] ; mail( "info@mywebsite.com", "Feedback Form Results", "Organization: $orgname \nAddress: $address1", "From: $firstname $lastname <$email>"); header ( "Location: http://www.mywebsite.com/thanks.html"); } else {# set the error code so that we can display it $error = $resp->error; } } $reCAP = recaptcha_get_html($publickey, $error); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>News Form</title> </head> <body> <form method="post" action=""> <label for="firstname">First Name:</label> <input type="text" name="firstname" id="firstname" /><br /> <label for="lastname"><strong>Last Name:</strong></label> <input type="text" name="lastname" id="lastname" /><br /> <label for="orgname"><strong>Organization Name:</strong></label> <input type="text" name="orgname" id="orgname" /><br /> <label for="address1"><strong>Address 1:</strong></label> <input type="text" name="address1" id="address1" /><br /> <!--put the following script and noscript in the spot where you want the recaptcha to appear and this puts the captcha where you want it to appear on your page --> <script type="text/javascript" src="http://api.recaptcha.net/challenge?k=<public code from the reCaptcha site >"> </script> <noscript> <iframe src="http://api.recaptcha.net/noscript?k=<private code from the reCaptcha site >" width="350" frameborder="0"></iframe><br> <textarea name="recaptcha_challenge_field" rows="3" cols="40"> </textarea> <input type="hidden" name="recaptcha_response_field" value="manual_challenge"> </noscript> <?php echo $reCAP;?> <br /> <label><input name="submit" type="submit" id="submit" value="Submit" /></label> </form> </body> </html>
  10. Clearing the cache shouldn't affect a script it will affect HTML,CSS,JS,IMAGES etc but not php! Try Clearing the cache in FF press Ctrl+Shift+Del, tick all except saved password and click clear
  11. $line = fgets( $fp, 1024 ); is only getting the last line, you need to append to the last line.. try this change $line = fgets( $fp, 1024 ); to $line .= fgets( $fp, 1024 );
  12. Theirs a ton of problems with safari cookies which relates to sessions, removing sessions being a common problem, if the problem is only related to the first time then maybe set a dummy session on the first page!
  13. OKay first the reason for the problem 0 = empty the fix <td colspan="2"><input name="deduction" type="text" id="deduction" <?php if (!empty($deduction) && !is_numeric($deduction)) echo "value=\"$deduction\""; ?> ><div class="highlight" id="inf_deduction">
  14. replace your posted code with <?php $page = $_GET['page']; $rpp = 2; if($page==""){ $page = 1; } $dirArr = scandir('comments/Birthday/'); function rem_invalid($arr) { foreach ($arr as $k => $v) { if (stristr($v,'.gif') === false) unset($arr[$k]); } } $dirArr = preg_grep("/^.*\.gif$/i",$dirArr); if ($c = count($dirArr)) { $dirArr = array_combine(range(0,count($dirArr) - 1),$dirArr); //above is your code $dirArr2 = array(); foreach($dirArr as $file) { $key = $filemtime($file); $dirArr2[$key] = $file; } krsort($dirArr2); $dirArr = array_values($dirArr2) unset(dirArr2); //below is your code $numOfPages = ceil($c / $rpp); for ($i = (($page - 1) * $rpp); $i < min($c,($page * $rpp)); $i++) { $filenames = $dirArr[$i]; //$filename = filectime($path/$filenames); <<< this is wrong...what is right way for this? echo "<img src='comments/Birthday/$filenames' width='200'><br>"; echo "<input type='text' value='$filename'><br><br>"; } } echo "<br /><br />"; for ($i = 1; $i <= $numOfPages; $i++) { echo "<a href='view_pix.php?page=$i'>"; echo " ".$i." "; echo "</a>"; } ?>
  15. If you read the whole page it tells you everything you need to know, including what JOINs to use for what! and how to use them!
  16. i would guess that the query is wrong, (field missing maybe) for a better error report try $get=mysql_query("SELECT count(*) FROM tbluser WHERE `username` = '$userName' AND `password` = '$protectedPass' AND `deleted` = '0' ") or die(mysql_error()); $result = mysql_result($get,0); echo $result;
  17. I agree, change the hours field to a float should solved the problem
  18. Try this <?php $dirArr = array_combine(range(0,count($dirArr) - 1),$dirArr); $dirArr2 = array(); foreach($dirArr as $file) { $key = $filemtime($file); $dirArr2[$key] = $file; } krsort($dirArr2); $dirArr = array_values($dirArr2) unset(dirArr2); $numOfPages = ceil($c / $rpp); //.. ?>
  19. read here SQL JOINS
  20. Yep sounds like you need eval(), or a new design.. as from your concept your going to have major security problems what are you using it for ?
  21. 0. Wrong Section!.. (this is the wrong section to post this) 1. I develop one window and have a *nix Server (at home and as my host), the reason is not only cost but thats a factor, 2. problems when moving from windows to *nix, 3. *nix is more secure, so your need to update the permissions for any folder you wish to write to. 4. Paths (this shouldn't really be a problem but remember 4.1. *nix path's windows = these/are/my/folders 4.2. windows path's = these\are\my\folders 5. *nix is case-sensive, (this is the biggest pain for me, i wish i could make windows case-sensive) 5.1 hello.jpg is not the same as Hello.jpg in *nix but is the same in windows. Hope that helps
  22. Try this (see added line) else { //And not we stick the message in the database with all the correct information mysql_query("INSERT INTO messages (reciever, sender, subject, message) VALUES('$reciever', '$user', '$subject', '$message')") or die (mysql_error()); mysql_query ("UPDATE `users` SET `pm_count` = `pm_count`+1 WHERE username='$reciever' LIMIT 1") or die (mysql_error()); //ADDED } PS The reason to make it clean is not to make it pretty at the end but to make it easier to develop
  23. okay 1. on the main page have the sliders html in a DIV (hidden) 2. on the main page include the JS but as a function 3. create a new function that makes the ajax call and set the responce to split the responce and use them to call the JS function (see 2).
  24. Yep, Split, ie result = subject.split(/|/); Why not have a AJAX call that is used only for the slider, then on the responce split the responce and use those for the parameter required (pass them to a JS function that can them all the slider parts) and unhide a div (with the slider)!
  25. Can you post the code your having problems with! Okay this is the wrong section, for this post... try here however you can't make your code unhackable.. if you don't want people stealling the code then keep in on your own server, if your selling it then yes protect it but don't expect it to be 100% protected (their is no such thing).
×
×
  • 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.