Jump to content

the shig

Members
  • Posts

    14
  • Joined

  • Last visited

    Never

Everything posted by the shig

  1. didn't know this. Also, imagine link from website A to website B login form using the referer method. login... then get redirected back to website A. wtf catastrophe
  2. could use <?php // login.php $page_just_on = $_SERVER['HTTP_REFERER']; $query_string = $_SERVER['QUERY_STRING'] != '' ? '?' . $_SERVER['QUERY_STRING'] : ''; $redirect_page = $page_just_on . $query_string; ?> store $redirect_page as a hidden input field in the login form. then after processing the login and checking their details, just redirect to the page.
  3. i've got some code if you still need it.
  4. hi there, turn on error_reporting(E_ALL); how does the start data ($strCart ) get into the script. is it from a text file, database, $_SESSION etc. Also, what does the data look like with more items in the basket that are all different in price etc. Can you provide an example of more data. then it will be possible to help you with a solution. you may want to look at <?php list($var, $var, ...) = explode(':', $strCart); ?> this would make the data much easier to put together, but would only work if the $strCart input is always identical. Hence, seeing more data would be helpful.
  5. hi, you've got the check email the wrong way round <?php if( ! check_email($email)) // should be if(check_email($email)) ?>
  6. hi here you go. <?php function check_email($email) { return (substr(trim($email), -14) == '.pnn.police.uk'); } //example use if(!check_email($email)) { echo "email not ok"; } else{ // ok. } ?> At the moment, your script is really, REALLY insecure. Your database could be dropped in a jiffy. The bare minimum you should do to this input is pass it all through mysql_real_escape_string() and strip_tags(). The actionscript validation is not validation. it just checks to see if they've input something. thats $14,211,199.64 for services rendered. I shall PM you the invoice. be careful what you wish for
  7. Howdy, agreed...recursion is the way forward. what do you actually want to do with the original array? just output each value, flatten it, split into mini arrays, map to two arrays with keys and values sharing keys, validate each value? is it multi-deminsional on numerical keys, or is it associative? etc. etc. if you could post your original foreach( foreach( foreach code, or an example array and expected output it would really helpful. Also, be warned when trying recursive functions. if you set up infinite recursion (i.e. the function never returns and constantly calls itself) then things will crash.
  8. hi, you're incrementing an array value when the index is not set. change <?php $nbrdays[$week-1]++; ?> to <?php if(!isset($nbrdays[$week-1])) { $nbrdays[$week - 1] = 0; } $nbrdays[$week-1]++; ?> should fix it. make sure you put curly brackets { } after your conditional statements.
  9. here it is <?php //takes a mysql date format yyyy-mm-dd function to_days($date) { $bits = explode('-', $date, 2); $year = $bits[0]; if(is_leap_year($year)) { $bits[0] = '2000'; } else{ $bits[0] = '1999'; } $date = implode('-',$bits); $leaps = 387; //leap years up to 1600 for($i = 1600; $i < $year; $i++) { if(is_leap_year($i)) { ++$leaps; } } $days = date('z', strtotime($date)); return $leaps + ($year * 365) + $days + 1; } function is_leap_year($year) { if($year % 100 == 0 && $year % 400 == 0) { return true; } if($year % 100 == 0) { return false; } if($year % 4 == 0) { return true; } return false; } ?> this works for dates after 1600-01-01. for earlier dates change:- <?php $leaps = 387; //leap years up to 1600 for($i = 1600; $i < $year; $i++) { if(is_leap_year($i)) { ++$leaps; } } ?> to <?php $leaps = 0; for($i = 1; $i < $year; $i++) { if(is_leap_year($i)) { ++$leaps; } } ?> hope this helps
  10. hi, this'll do it. edit : keeps messing up format with &#160; when editing see next post
  11. howdy, try adding... <?php echo $pagination; ?> somewhere
  12. you missed a dash (-) echo "<form action=\"".$PHP_SELF."\" method=\"post\" enctype=\"multipart/formdata\">\n"; change to echo "<form action=\"".$PHP_SELF."\" method=\"post\" enctype=\"multipart/form-data\">\n";
  13. hi, I've used two ajax calls for the progress bar. Modified the names of scripts for your example Number 1) this calls the php emailer script and then calls the second ajax function Number 2) this calls the php counter script, and if the percentage done isn't yet 100, recursively calls itself using setTimeout(). basically, the emailer script whirrs away sending emails. Each time an email is sent, the script updates a database table. the database table is something like id total done .... When updating, it sets the done column to whatever stage the emails are at. the counter script connects to and uses the data from this table to compute the total sent and the percentage. it then outputs these totals e.g. echo $done.'|'.$percentage; the output from the counter script is what triggers the readyState = 4 in the second javascript function. then the output can be assigned to two variables var output = ajax.responseText; var bits = output.split('|'); var done = bits[0]; var percentage = bits[1] Some html that looks like this is needed. <span id="done">0</span> / 5000 (<span id="percentage">0</span>%) Then change the HTML document.getElementById("done").innerHTML = done; document.getElementById("perentage").innerHTML = percentage; because this second ajax function is recursive, with the next ajax call and response the new values of done and percentage will be used. If you need prototype code for this I'm happy to post it. Hope this helps.
  14. Howdy, Firstly hello. Saw this thread and thought it would be a good mini project (not created a progress bar yet). If you want a progress bar, then consider making a table with two columns (ids = "done" and "to_do" (use the id to access using javascript)). "done" starts with width of 0px and background color of blue (or green or whatever). "to_do" starts with width of 500px and background color of white. as you receive the ajax.responseText from the counter, just modify the widths of the two columns. e.g. at 25% , width of "done" will be 125px and "to_do" will be 375px. at 47% width of "done" will be 235px and "to_do" will be 265px etc. etc. all the way to 100% when all you can see is "done" at 500px and "to_do" is now 0px; Looks pretty groovy and almost exactly like a moving progress bar. If you want some working code then get in touch. Hope this helps.
×
×
  • 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.