Jump to content

Kemik

Members
  • Posts

    83
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

Kemik's Achievements

Member

Member (2/5)

0

Reputation

  1. Hello, I'm coding a budget application. Basically, the section of code I'm working on will check if today is the start of a new week and if so it will add the weeks budget to the current balance. If today is > next week date fetch budgeted amounts per week from each category and current balance update category balance with current balance + budgeted amount update next week date for next coming sunday This piece of code will run every time the user visits the homepage. (Would this be easier to just use cron jobs?) I'm stuck on what happens if the user doesn't visit the site for two weeks. It will only add one weeks budget to the balance. Also, how would I calculate the date for the next coming sunday? I cannot use date + 7 as the user could visit on a tuesday, wednesday, etc. Thanks.
  2. Oh thanks! Never heard of that function. Should be easy enough to make the fixtures from there. 5. Use shuffle function. 6. $nofixtures = $maxusers / 2 7. Loop for $nofixtures create a new fixture with incremental $fixture_id, $userone = incremental user, $usertwo = next user in the array. I'm going to do a bit more searching for the loops so I don't have much experience with loops and getting incremental information so feel free to post suggestions.
  3. Hello all, I’m building a tournament system and I’m going through the planning stages, specifically making the psuedo code. I’m trying to think how I would take a list of players, add a number of passes if there are spaces left (total spaces - number of users signed up) and then randomise who each user plays against. The system is using user_ids to identify users. So, on click of “Make fixtures” the following occurs: 1. Get $maxusers and $nosignedup. 2. $passes = $nosignedup - $maxusers. 3. Get array of users ($users [user_id]) 4. A loop to add a user with the user_id of -1 for each pass to $users array. Here’s where I’m stuck. I need to randomise the user_id in the array and then some how make fixtures for the tournament. E.g. if the tournament has max users of 8 it will make 4 fixtures. Any ideas would be appreciated.
  4. I'm using CodeIgnitor. I don't think it's affected though. I just used the $this->input->post('date') to get the textfield called date. When I echo $this->input->post('date') it comes out with the input as it should. It's just like $_POST['date']. My data is being stored as DATE in a MySQL database. Feel free to test it here. I've stopped it inserting to the database. It will just return the values. Here's the insert code: $insert = array( 'date' => $this->input->post('datetime') , 'details' => $this->input->post('event') ); $this->db->insert('one_events', $insert); The event text gets inserted but the date doesn't.
  5. Hello, The user types a date (dd-mm-YYYY) in to a text field, the date is checked against a regex and if it passes, is then inserted to a database. For some reason inserting the date ($this->input->post('date')) directly in to the database gives the default for the field (0000-00-00). I've tried doing date("d-m-Y", $this->input->post('date')) but get 1970-01-01 or something like that. Do you have any advise for converting the text field input in to a format that can be inserted in to the database?
  6. Kemik

    Date regex

    Hello all, I'm trying to create a regex which only allows dates in the following format: dd-mm-yyyy So I can insert it in to my database (DATETIME). if(!eregi("(0[1-9]|[12][0-9]|3[01])[- /.](0[1-9]|1[012])[- /.](19|20)\d\d", $str)) { $this->validation->set_message('datetime', 'The %s field must be in this format: dd-mm-yyyy'); return FALSE; } else { return TRUE; } If I try it, I get the error The datetime field must be in this format: dd-mm-yyyy. Can anyone see where I'm going wrong? Thanks.
  7. Hello, I'm creating a calendar and want to display one form if the user selects One-time-event from a drop down menu or display a different one if they select Daily. The only thing that really changes is that for one-time-event text field called date is displayed and if it's daily a drop down menu with the days of the week is displayed. I've had a look around google but cannot really find anything that could help me. Thanks for the help.
  8. Hello, I'm thinking about the structure of the database/code for a calendar application I want to make. How would be best to store events that occur once a week/month/year? I couldn't really create a separate entry for each time it occurs as there could be 52 events (once a week) / insert queries. Thanks for the help.
  9. Solved <?php if (date("Y-m-d", strtotime($row->datetime)) == date("Y-m-d")) { $datetime = date("H:i", strtotime($row->datetime)); } else { $datetime = date("d/m/Y H:i", strtotime($row->datetime)); } ?>
  10. Hello all, Can you check this code and tell me where I'm going wrong please? <?php if ($row->datetime == date("Y-m-d")) { $datetime = date("H:i", strtotime($row->datetime)); } else { $datetime = date("d/m H:i", strtotime($row->datetime)); }?> I'm unsure how I would do the if part of the statement as the datetime is in SQL Datetime format. I know I need to say its strtotime but I'm not sure where to put it.
  11. I need them to stay with me. It's a CMS that I coded and I don't want them taking it to another host. They wouldn't have file access anyway.
  12. Thanks dbo. For querying the permissions would I just Select all group_ids from User_Group where user_id is $user_id. Then Select permission from permissions where group_id = group_id from previous query? If permission = allow then continue, if not show error. How would you handle clashes? E.g. a user is in two groups, one allows access to edit news the other is denied. Really the user should be allowed as they are allowed in at least one group. Not sure how I'd code that though. Finally, how would you store the users permissions in the session, so you dont have to constantly query the database?
  13. Hello, I'm creating a CMS where users sign up and they're given a subdomain with my CMS installed. They can then edit at will, users sign up, etc. I'm looking in to two options for managing the files for the CMS. 1. Store each CMS copy in it's own folder, database, etc. (Basically a whole cPanel account per CMS). 2. Store the files centrally. Possibly create seperate databases or do something else using one. Option one will be harder to maintain and update. As if I make one update with the files I have to manually do each CMS. Option two is easier to maintain, however managing how the CMS gets it's site title, content, etc is harder as each user may have their own theme, logo, etc. How would you advise I could do this? I'm not thinking about thousands of CMS installs, but possibly hundreds (100 - 300) if it takes off.
  14. Yes, that's what I'm working off, but I'm not sure how to lay this one out. The user can only be in one admin group, but can also be a member of a clan and then have certain permissions for a clan. How would I layout a database for this? At the moment I have users, clans and clan_members tables.
  15. Hello, I'm creating a fairly complicated user system. A user can be one of the following, with each group given different permissions. Admin Groups Site Admin (root) General Admin News Admin Competition Admin Referee Site User Users and admins can also be a member of a clan (aka team) Clan Permissions Clan Leader (all clan permissions) Clan Member Manage Applications Manage Fixtures User awaiting member approval E.g. Bill is clan leader and has access to all clan actions. Bob is a clan member with the ability to manage applications. Fred is a clan member with both manage applications and manage fixtures. As you can see, it's sort of a two tier permission system. A user can only be one of the "Admin Groups" but can also (optionally) be one of the "Clan Permissions". How would I organise all of this? Database side and the pseudo design for the coding. Thanks for your help.
×
×
  • 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.