Jump to content

Jahren

Members
  • Posts

    66
  • Joined

  • Last visited

    Never

Everything posted by Jahren

  1. $SomeVar = $fin is missing a semi-column $SomeVar = $fin;
  2. I knew I explained this all wrong lol For some reason, when I change the source of the image, it wont show up the first time. the src is a php script that generates an image on the fly. It uses values from the session to draw a pie chart. The problem is that when it's called the first time, the session has not been written yet. Basically, I do this: <select id='annee' name='annee' onchange='xajax_updateFormValeurs(this.value); toggleMain(this);'><option value='-1'>Choose one</option><option value='2009'>2009-2010</option><option value='2010'>2010-2011</option><option value='2011'>2011-2012</option><option value='2012'>2012-2013</option><option value='2013'>2013-2014</option></select> updateFormValeurs fetch data from the DB and assign the html controls with them. I also fire the onchange() event of an other control which formats the date values and change the image src (which triggers the image draw) For some reason, the first time we select a year from the select box, the SESSION variable hasn't been written yet. I'm not sure where I fail to synchronize Could it be that I can't be sure which xajax assignments will be called first? (since I assign values to html controls and script an onchange event firing) edit: here's the php/ajax $xAjax_objResponse->assign("id_plan", "value", $arrData['id_plan']); $xAjax_objResponse->assign("date1", "value", $arrData['date_debut']); $xAjax_objResponse->assign("date2", "value", $arrData['date_fin']); $xAjax_objResponse->assign("nbJoursFeries", "value", $arrData['nb_jours_feries']); $xAjax_objResponse->assign("nbJoursConges", "value", $arrData['nb_jours_conges']); $xAjax_objResponse->assign("nbJoursTravail", "value", $arrData['nb_jours_travail']); $xAjax_objResponse->assign("commentaires", "value", $arrData['commentaire']); $xAjax_objResponse->assign("btnSubmit", "innerHTML", "Modifier le plan d&#39;action"); $JoursEntre = $arrData['nb_jours_travail'] + $arrData['nb_jours_conges'] + $arrData['nb_jours_feries']; $xAjax_objResponse->assign("nbJoursEntre", "value", $JoursEntre); //on part le script du graphique $xAjax_objResponse->script("document.getElementById('date1').onchange();");
  3. Hi guys, I'm generating a pie chart on the fly using ajax/php it works very well except for a racing condition bug. I have an image which src changes everytime I want to reload the picture. function updatePieImg(){ document.getElementById('pie_chart').src = "./lib/php/pie_generator/pie_draw.php?c=" + randomString(); } function randomString() { return new Date().valueOf(); } I call the update with a select box event : onchange I know my code works well because before calling the draw function, I populate the page with values from the database. Everytime I had an element to my pie chart, it generates a new map area. (makes my slices clickable with a custom event for them). Now, the draw function. I know it works well too because if I select an other item in the select box, it will update correctly. The problem is for the first time you select an item, it wont show. (But the map area will) I know it's confusing, if you need clarification, I'll try and answer my best. Too much code is involved to show everything.
  4. I use htmlencode also for portability. I encode html chars into the database for later use on windows or linux machines without problems ^^
  5. Hi guys quick question : is there a way to test an array has ALL different values inside like $a = array('1', '2', '3') = true $a = array('1', '1', '3') = false ?
  6. indeed. It was flawed. I changed the initial value from false to $valide = $nb_dispos > 0; so if I have no element to check, it returns false. and there is no date0, this is why I start at 1. now it works like a charm Edit : This function is used to verify that there are no double inputs in all the form. I do not know how many entries I have to check before it is sent which is why I have to use that weird setup. (PHP generating Javascript Generating HTML)
  7. ahaha, yep that's right. edit : its been 14 hours straigtht every day of coding including weekends for a full month. I have a week to go only as a deadline to have everything working top notch. i'm tired as hell. thanks everyone for your support.
  8. flyhoney's guess was right. However something is still wrong as it returns false when it shouldn't. i'll check it out. thanks for your inputs i'll give feedback in a sec
  9. there's a chance that $nb_dispos is < 1 so it could return crap and I really don't understand why it gives me this error. It's why i'm seeking knowledge here ehe ^^
  10. I personaly use function remove_html_tags($chaine) { return htmlentities($chaine, ENT_QUOTES); } and then I use function put_back_html_tags($chaine) { return html_entity_decode($chaine); } to read it back
  11. I have this little glimpse of code that wont work function valider_journees($nb_dispos) { $valide = false; $date = array(); //I have to start at 1. its been tested already for($i = 1; $i <= $nb_dispos; ++$i) { $valide = $valide && !in_array($_POST['date' . $i], $date); $date .= $_POST['date' . $i]; } return $valide; } when I echo the values : echo $_POST['date' . $i] . ' ' . !in_array($_POST['date' . $i], $date); I get this error : I've tested types with gettype() and they all give me strings A little help ? Thanks!
  12. I don't have a clue on how I can do this tho. When would that be triggered? Is there some sort of Event() when a session dies? I guess you're right DarkWater Edit : I think i'll go with a counter system i'll try to auth from the table every five pages you load or something
  13. yeah, checking an ID seems a good alternative. so I'd have a table of connected users. a simple check of online users is far better than checking the whole auth table! thanks! edit : Tho it leads me to an other question I put a userID in that table upon login and remove it from the table on logout. How can I remove users that have timed out? edit2 : ahaha edit and reply at the same time
  14. <?php $ipaddress = getenv('REMOTE_ADDR'); query = "INSERT INTO invalid VALUES ('','$ipaddress',NOW())"; mysql_query($query); ?> <html> etc...
  15. Hi guys! here goes question #3! I am an admin and play around my account manager. I've found out a user that needs to be shutdown for various reasons. I've deleted the user in question but I would like him to get disconnected right away. How can I nullify his $_SESSION['uname'] from the server? In other words, Is there a way to manipulate someone else's SESSION vars. I do have auth protection at login. But I won't reconnect to the database everytime a user loads a single page. I just check if the $_SESSION['uname'] exists. Again : Is there a way to play with the array of session vars?
  16. so mktime(0, 0, 0, $startMonth , ($startDay+$i), $startYear)) is able to switch month on his own if we get to day 32 for exemple?
  17. Ahhh, that makes more sense now thanks for the reply btw i'm still implementing the solution to my project. Hold on for feedback
  18. Can I ask something about the code so I understand it all ? what does '86400 + 1;' do?
  19. oh wow, Nice way of doing it i'll find an easy way to convert it to mysql dates im pretty sure. thanks a bundle it works fine in test. I'll try and fit this function in my design and give you feedback about it. thanks again
  20. yeah don't forget about session_start(); XD thanks DarkWater
  21. deprecated means It's still possible to use it but that you can run into problems since it wont get updated anymore. use that instead ^^ session_start(); $_SESSION["variable_something"] = 'Yay! i'm into a session var!!'; edit : thanks DarkWater for session_start() I forgot
  22. I use regular mySQL date format ie : 2009-02-04 thanks
  23. first an error in your echo sentence echo "$i; $cartId[i];$productId[$i]"; should be with $ sign echo "$i; $cartId[$i];$productId[$i]"; i'm not sure I understand what you are doing $_POST['txtQty']; contains a single string therefore using $newQty = (int)$itemQty[$i]; mean you will only get 1 character at a time. is it really what you want?
×
×
  • 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.