Jump to content

Chud37

Members
  • Posts

    43
  • Joined

  • Last visited

    Never

Everything posted by Chud37

  1. Okay so: I've been writing an application that has a standard AJAX call. But AJAX isnt the problem. For the last 3 month my application has been working perfectly, however today (the first day that the app was launched publicly) it stops calling the ajax function all together. The code was thus: Onclick=\"register();\" Suddenly today in chrome this function stopped working, and i could not figure out why, eventually i changed te function name and all was working. But how rediculous, the register() function works fine in IE??? It literally suddenly stopped working, and so i changed the function to preBooked(); and its fine now. Can anyone explain this at all? It is really bugging me. Thanks in advance, Richard();
  2. Got it. I had referenced a function in the .JS file above my .click functions that wasnt working, at it was bombing out there. I removed that to see and it works fine.
  3. Hello, I have an external jquery.shop.js file, and there are three pages where I need a donation box to popup. I built it on the first page, and it works fine, looks beautiful, etc. But when I implement the same code on the other two pages, it refuses to popup. I know the jquery file is referenced correctly and loading, because other functions in there are performing on the other pages too. But i cannot get any response out of it. It confuses me, because the code is the same, both in the HTML and the Jquery. What is stopping the [.click] function from performing? here is the code: $('#donateButton').click(function(){ alert('hello'); if(popupStat==0) { popupStat=1; $('#donationPopup').center(); $('#donationPopup').fadeIn('slow'); $('#content').fadeTo('slow', 0.2); } }); $('#closeButton').click(function(){ if(popupStat==1) { popupStat=0; $('#donationPopup').fadeOut('slow'); $('#content').fadeTo('slow', 1); } }); I put the alert hello in there to try and debug somewhat, and again, i get the alert on the first page, but the second and third pages are not showing anything at all. I am fairly new to jQuery, but not to programming. But this seems to be a re-occuring problem for me. Does it make a difference in what order my functions are placed in the .JS file? how could i further debug this? Can anyone help? Thanks, ~Richard
  4. I need to match (Click to Enlarge) WITH the brackets. Its at the bottom of thumbnails and I want to remove it. I cannot work out what REGEX to use, Im new to it! So far i've got: {\(Click to Enlarge\)} But that is returning nothing. Could someone please tell me what the best thing to use is and why!
  5. Topic solved, after much frustration. The answer was to NOT use http://www.mydomain.com and just use index.php. So now my .htaccess file looks like: Options +FollowSymlinks RewriteEngine on RewriteOptions MaxRedirects=10 AddType "text/html; charset=UTF-8" html AddType "text/plain; charset=UTF-8" txt RewriteRule ^series/([^/]+)/([^/]+)$ "index.php?language=$1&m=$2" [NC] RewriteRule ^play/([^/]+)$ "index.php?p=$1" [NC] RewriteRule ^browse$ "browse.php" [NC] RewriteRule ^browse/$ "browse.php" [NC] RewriteRule ^help$ "help.php" [NC] RewriteRule ^help/$ "help.php" [NC] Hope this helps anyone.
  6. Topic solved, after much frustration. The answer was to NOT use http://www.mydomain.com and just use index.php. So now my .htaccess file looks like: Options +FollowSymlinks RewriteEngine on RewriteOptions MaxRedirects=10 AddType "text/html; charset=UTF-8" html AddType "text/plain; charset=UTF-8" txt RewriteRule ^series/([^/]+)/([^/]+)$ "index.php?language=$1&m=$2" [NC] RewriteRule ^play/([^/]+)$ "index.php?p=$1" [NC] RewriteRule ^browse$ "browse.php" [NC] RewriteRule ^browse/$ "browse.php" [NC] RewriteRule ^help$ "help.php" [NC] RewriteRule ^help/$ "help.php" [NC] Hope this helps anyone.
  7. hello; I have the following .htaccess file: Options +FollowSymlinks RewriteEngine on RewriteOptions MaxRedirects=10 AddType "text/html; charset=UTF-8" html AddType "text/plain; charset=UTF-8" txt RewriteRule ^series/([^/]+)/([^/]+)$ "http://www.mydomain.com/index.php?language=$1&m=$2" [NC] RewriteRule ^play/([^/]+)$ "http://www.mydomain.com/index.php?p=$1" [NC] RewriteRule ^browse$ "http://www.mydomain.com/browse.php" [NC] RewriteRule ^browse/$ "http://www.mydomain.com/browse.php" [NC] RewriteRule ^help$ "http://www.mydomain.com/help.php" [NC] RewriteRule ^help/$ "http://www.mydomain.com/help.php" [NC] We have recently moved servers, and this .htaccess file was working fine on our old server but now moving over and using the above .htaccess file it seems to be doing something different. For instance, If I goto www.mydomain.com/browse - I should be redirected to browse.php, and the user shouldn't know any better. The browser is doing the first part right, it redirects it to the correct page, but it is not hiding the browse.php from the address bar in the clients web-browser. So the redirects are working, but it is also giving away our pages aswell. If a user goes to www.mydomain.com/series/english/my-series, I DONT want them to see www.mydomain.com/index.php?language=english&m=my-series can someone help please? Its a new server I have WHM access and Cpanel obviously. What can it be? ~Chud37
  8. hello; I have the following .htaccess file: Options +FollowSymlinks RewriteEngine on RewriteOptions MaxRedirects=10 AddType "text/html; charset=UTF-8" html AddType "text/plain; charset=UTF-8" txt RewriteRule ^series/([^/]+)/([^/]+)$ "http://www.mydomain.com/index.php?language=$1&m=$2" [NC] RewriteRule ^play/([^/]+)$ "http://www.mydomain.com/index.php?p=$1" [NC] RewriteRule ^browse$ "http://www.mydomain.com/browse.php" [NC] RewriteRule ^browse/$ "http://www.mydomain.com/browse.php" [NC] RewriteRule ^help$ "http://www.mydomain.com/help.php" [NC] RewriteRule ^help/$ "http://www.mydomain.com/help.php" [NC] We have recently moved servers, and this .htaccess file was working fine on our old server but now moving over and using the above .htaccess file it seems to be doing something different. For instance, If I goto www.mydomain.com/browse - I should be redirected to browse.php, and the user shouldn't know any better. The browser is doing the first part right, it redirects it to the correct page, but it is not hiding the browse.php from the address bar in the clients web-browser. So the redirects are working, but it is also giving away our pages aswell. If a user goes to www.mydomain.com/series/english/my-series, I DONT want them to see www.mydomain.com/index.php?language=english&m=my-series can someone help please? Its a new server I have WHM access and Cpanel obviously. What can it be? ~Chud37
  9. So does that mean for client side file references (i.e. javascript includes etc) I can use a '/' and for the server side - I can use $_SERVER['DOCUMENT_ROOT']?
  10. You MUST be changing it somewhere before hand. When you echo it, are you echoing it at the very begining of the php page?
  11. I have recently discovered the mod_rewrite, and so now i've got rewrite settings on my server where by it will not map /series/english/myseries to index.php?q=english&series=myseries; Which is all very well and good and works nicely. However, When I am trying to load say a Javascript file inside Index.php now, or include a PHP file, I have huge problems, because it is trying to look at my 'relative' path of 'js/jquery.js' and cant find it from the pseudo directory 'series/english/myseries'. What is the best way to compensate for this problem? For the PHP includes i've started using $_SERVER['DOCUMENT_ROOT']; which seems to map files okay. But i can't do the same with JS. I dont know what to do
  12. Aha, After testing I realised that my work domain where I was sending test emails to is the problem, for some reason that domain and that domain only isnt recieving my emails. I will close this thread, thank you!
  13. I dont own the server, It is being hosted with a company, and they use the eXtend control panel. Whilst I prefere cPanel, I dont have a choice - and I cannot see anywhere in the eXtend control panel to view mail server logs..
  14. Hello, I have been using the mail() command for a while now, but for some reason It has just stopped functioning all together. I have added an OR DIE rule to the end of it and had no response. To all intents and purposes that mail is being sent - there are no errors whatsoever - just the mail is not getting delivered. I cannot think of anything I've done or changed that would stop it from being delivered, I haven't even been near the function that does it in a while. Here is the code: function sendMail($to,$ref) { $subject = 'Booking Confirmation'; $file = "receipts/$ref.htm"; $fh=fopen($file, "r"); $message = fread($fh, filesize($file)); fclose($fh); $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $headers .= 'From: Company <noreply@company.co.uk>' . "\r\n"; mail($to, $subject, $message, $headers); } I have taken out the public names involved, but otherwise thats the code. It has worked absolutely fine in the past, and even If I strip out all of the filehandling part of it, and just use a simple $from - $to - $message, it still seems not actually send the mail. It wouldnt be so bad If I at least had an error to go on, but I dont I am just simply not getting the mail. Please help! ~Chud37
  15. Alright, hash passwords are good and all. But what about the actual login process? Are sessions acceptable, or is there another method?
  16. no, Im just asking for the most secure way of doing it, Im not asking for help on how i'm doing it at all. But what is the general concensus out there for creating secure logins on PHP applications? how do others do it?
  17. Hello, I just wanted some tips really and what people thought on the subject. For alot of my PHP applications I create a user control panel to manage the back end SQL databases. However these have to be hosted on the server and therefore I was thinking that they probably are not that secure. As far as I secure them so far I use a password system, sometimes with usernames and passwords; that is then taken through a form via POST method and then verified that way. I am completly aware is not that secure at all, so I want to up my game. I was thinking that maybe password protected directories would help? However last time I used them I was being asked for the username/password everytime I submitted a form which wasnt convenient. And what about session variables to store the user info/data/verify login? Is that secure enough? Please help! Thanks! ~Chud37
  18. I've done it. Silkfire you helped, but i ended up kinda writing a new procedure in the end. I said i'd show my results so here tis. $familyAdults = array(); $familyChilds = array(); $familyTicket=0; foreach($adult as $key => $data) if($data['Days']=="X1234") {array_push($familyAdults,$data['Name']);} foreach($child as $key => $data) if($data['Days']=="X1234") {array_push($familyChilds,$data['Name']);} $family = array(); $subArray = array(); for($x=0;$x<count($familyAdults);$x+=2) { if(isset($familyAdults[$x])) {array_push($subArray,$familyAdults[$x]);} if(isset($familyAdults[$x+1])) {array_push($subArray,$familyAdults[$x+1]);} if(isset($familyChilds[$x])) {array_push($subArray,$familyChilds[$x]);} if(isset($familyChilds[$x+1])) {array_push($subArray,$familyChilds[$x+1]);} echo "COUNT: " . count($subArray) . "<br>"; if(count($subArray)==4) {$familyTicket++; array_push($family,$subArray); $subArray = array();} } echo "Adult - (c)" . count($familyAdults) . "<br>"; pPrint($familyAdults); echo "Child - (c)" . count($familyChilds) . "<br>"; pPrint($familyChilds); echo "FAMILY<br>"; pPrint($family); echo "FAMILY TICKET: " . $familyTicket . "<br>"; basically, I got all the qualifying Adults and Children in to $familyAdults[] and $familyChilds[]. Then, I step through them in 2's in the Adults, and form an array called $family. Then I have all the names of the Family in one array in groups of four. Hooray. If you can simplify this code, and make it better, I'd love to know how and why because Im always willing to learn. Thanks for your help guys.
  19. i showed my original array for adult[] in the first post, and the child is the same structure. But actually, thank you very much, I think i can work with this. I'll take what you wrote and modify if it so it fits, but i think you've got the answer there. Thanks!
  20. aha! i didnt think of the ===. But i cant be bothered now to go through and change it all! And that might work, Im just sick of creating new arrays all the time, just to figure out this one thing. @SilkFire - Thats not a bad idea in theory but, I cannot just find out the answer with >= 2 because Lets say i have 5 adults and 2 children, then It could potentially work out 2 families. I need unique grouping somehow of 2 individual adults to 2 individual children. If there is a booking of say 20 people, And some of them book full weekends and such, I want it to work out how many groups of pairs of adults there are with full bookings, and how many groups of pairs of children there are with full bookings, and then give me the amount of families coming. All this could be solved really by asking my boss if I can just put 1 family discount per booking on the booking page lol. But i dont want to give up that easily
  21. what do you mean? i dont get that at all. are you talking about the IF statement I mentioned?
  22. I was going to say have a number system, like 1 = sunday 2 = monday etc. Or you could use time() as a timestamp, then work out the day with date("d",$day) or something like that. Zumba is everywhere! Someone i know just became a Zumba instructor.
  23. Hello, Okay. I am writing a booking system that has the option for a family ticket. There are four days in total, and if the four people (2 adults, 2 children) book all four days, they get the discounted family ticket. Okay. So i've managed to get all the data into two handy arrays, adult[] and child[], and they go a little something like this: adult = array(array("Name" => "Bob", "Age" => "age1", "Days" => "X1234")); The child array is also very similar. The days need explaining - the X is simly to fill in the first character because i check it with strpos() and it returns 0 if the character is found in the first slot, and the 1 equels the first day and the 2 the second etc. Its a weekend event, so 1 is friday, 2 is saturday, 3 is sunday. So it could be X34 for instance and just be sunday and monday. Both arrays are quite easy to sort though, and along the way I learnt the wonderful method of callback functions which was quite exciting! Anyway, I now have all this data, and I want to determine the family tickets. So as I mentioned, the 2 adults and 2 children all need to have X1234 in the 'Days' part of the array. What I originally did was this: if((!count(adults) % 2) && (!count($child) % 2)) && (count($adults)==(count($child)))){perform stuff} But then i thought, hang on a minute, what if there are 4 adults and 2 children? I need to somehow go through the two different arrays, Pick out 2 of each that qualify, and group them, until it cant be done anymore. I cant just simply do it in a one big foreach or for loop as I dont know when it ends, the 2 different counts could be quite different. So what can i Do? I hope I have explained it well. I really cant get my head around how to achieve this! Thanks, Richard
  24. Thanks, I didnt of 2d arrays. It took a bit of fiddling but got there in the end! Cheers!
  25. Hello, I have to write a booking form and in my form I have a jQuery function that allows to add as many extra people as you like. For each person, they have to select which days they want to be there for, IE, friday, saturday, sunday or monday. The checkboxes are as such: <input type="checkbox" id="a_friday" name="adultFri[]" class="hideMe"> <input type="checkbox" id="a_friday" name="adultSat[]" class="hideMe"> <input type="checkbox" id="a_friday" name="adultSun[]" class="hideMe"> <input type="checkbox" id="a_friday" name="adultMon[]" class="hideMe"> Which is fine. However, because some of the checkboxes will not be selected, the arrays dont line up when I recieve them. For example, if adult #1 checks friday and saturday, and adult #2 checks sunday and monday, I end up with this: adultFri[0] = on adultSat[0] = on adultSun[0] = on adultMon[0] = on The adultSun and adultMon should both be at point 1. This is because If the checkbox isnt checked, it doesnt get passed through. Does anyone have a solution to this? Please help! Thanks.
×
×
  • 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.