Jump to content

Danny620

Members
  • Posts

    390
  • Joined

  • Last visited

Everything posted by Danny620

  1. I was thinking that but each diffrent type of users has diffrent infomation.
  2. Hi I’m trying to develop an online application that will allow ‘Candidates’ to book on courses that “Providers” have posted. The application is going to have 4 different types of users, please see attached ‘Figure 1.4 - JobSkilla User Permissions & Roles.jpg’ all of which have different information associated with them. On first signup of a provider they will complete a company profile and a user will be created as the owner associated with that “Provider” that user will then be able to invite their team members (Team associations) to share the same “Provider” data but with restricted access to areas such as billing / invoives. I’m going to be building the application using laravel 5.2, I still want to use laravels Auth but how can I allow multiple auths? I was thinking of having a table called “Auth” that could manage the logins with a forging key to the ‘candidates’, ‘providers’ table. What’s the best way of handling multiple logins that are associated with 1 “Provider”? I’ve attached a EER diagram with the current database design this may be incomplete. I wanted to ask for some guidance with the best way to program/db design the project. I would appreciate if anyone can give me a better solution or point me in the right direction. I don't mind paying for advice. JobSkilla EER Diagram.pdf
  3. Ive been thinking of creating one table to hold the login details like Auth id, email, password, user_id, provider_id, advisor_id Then link to auth to like users table where it can hold there details such as first_name, last_name What do you think? Has anyone seen this implemented before?
  4. Hi all, I’m building a search engine to find courses online; I wanted to ask for some guidance with the best way to program/structure the project. I’m going to be building the application using laravel 5.2 I have 3 different types of users as follows Users Course Providers Advisors All of which have different information associated with them such as Users Table first_name last_name date_of_birth email password Course Providers – this needs to have multiple logins associated with the course provider company_name address_line_1 address_line_2 postcode tel Advisors company_name first_name last_name email password I still want to use laravels Auth but how can I allow multiple auths or am I best in using roles if so how would this work? What’s the best way of handling multiple logins that are associated with 1 company? I would appreciate if anyone can give me a better solution or point me in the right direction.
  5. Hi, I have a few wordpress websites that I host for my clients because of the number of attacks they have been receiving lately I have implemented a .htaccess file to block any ip address that's not in the whitelist, the problem I face is everytime the client moves from location to location or there ip address changes I have to update the .htaccess file with there new ip. I'm trying to build a script where they can access a url with a key in and submit there new ip address the php script would then read the .htaccess and add the new ip, however the 'echos' in the file seem not to be echoing any information to screen and I'm faced with a blank white screen can anyone give me any ideas on how to do this or have alook at the script below I have wrote. <?php if (isset($_GET('key')) && $_GET('key') = '78J89ke93k93HJ883j003') { $htaccess = '.htaccess'; //read the entire file $str = file_get_contents($htaccess); //delete deny from all from file $str = str_replace('deny from all', '', $str); $ip = 'allow from ' . $_get('ip'); //'allow from 92.27.111.112'; $str .= $ip; //re add deny from all to end of file $str .= "\n" . 'deny from all'; if(file_put_contents($htaccess, $str)){ echo 'IP ' . $ip . ' Added to .htaccess file'; } } else { echo 'Invalid Key'; } ?>
  6. That's not really the answer I was looking for
  7. Hi, I'm building an application that keeps track of stock of cars, I have cars table that contains details about that car but I have a photos table that contains id, car_id, photo. When your on the add a car section I want to be able to upload as many photos as I want but the problem is I'm unsure on how to program it. Do I query the database for the next auto id and then have an Ajax file upload that uploads them and adds to database that next car id? What about if the user decides to cancel half way though? My photos table will be left with reference to that id because it's not yet been added. Can some give me some ideas on how I should go about this?
  8. Hi Sean, that is the bit i want to fix BTW, why are you hard-coding the field name as 'first_name' for all errors? i want it the be the field name with the error but i dont know how to access the field name in laravel errors can you help?
  9. Hi where it says 'field' => 'first_name', I want that to be the field the error occured on and also the syntax is the laravel
  10. Hi, I am building a restfull service and i would like to out put a error like the following { "error": true, "message": "Validation failed", "code": 400, "errors": [ { "field": "first_name", "error": "The first name field is required." }, { "field": "first_name", "error": "The last name field is required." }, { "field": "first_name", "error": "The gender field is required." }, { "field": "first_name", "error": "The city id field is required." }, { "field": "first_name", "error": "The postcode field is required." }, { "field": "first_name", "error": "The email field is required." }, { "field": "first_name", "error": "The password field is required." } ] } but i cant seem to read the array key as what the vailidation failed on $validator = Validator::make(Input::all(), $rules); if ($validator->fails()) { $errors = array(); $messages = $validator->messages(); //print_r($messages); foreach ($messages->all() as $value) { $errors[] = array('field' => 'first_name', 'error' => $value ); } $response = Response::json(array( 'error' => true, 'message' => 'Validation failed', 'code' => 400, 'errors' => $errors ) ); //$validator->messages() return $response; }
  11. Hi I have a string as 18:00:00 and i want to be able to formate it is 6:00pm
  12. Hi, I am using codeigniter as my framework, when someone checks the tick boxs i simply loop over the post request and bulk insert them into a table my problem is when a user wants to go back and edit the record i.e untick some of preselected value or tick new ones how can i handle this? should I delete all entries that exist and write new data to database? Please can you advise me on how to do this?
  13. I need to do it in php not as a query mysql
  14. Hi, I am developing a hotel booking type website, I need to be able to work out if its not 48 hours from the checkin date any ideas on how i do this my checkin date is in mysql format like 2014-02-15 so it needs to be able to check if its 48hours from that day 12pm
  15. Everytime i run my script i get A PHP Error was encounteredSeverity: Warning Message: Creating default object from empty value Filename: controllers/user.php Line Number: 71 <?php if (!defined('BASEPATH')) exit('No direct script access allowed'); class User extends MY_Controller { var $form_data; function __construct() { parent::__construct(); // load model $this->load->model('User_model', '', TRUE); $this->lang->load('pubs'); $this->load->helper('language'); } public function register(){ // load model $this->load->model('Pub_model', '', TRUE); $data['title'] = 'Register'; // set empty default form field values $this->_set_fields(); // set validation properties $this->_set_rules(); $data['city_options'] = $this->Pub_model->city_options(); $data['county_options'] = $this->Pub_model->county_options(); $data['facility_options'] = $this->Pub_model->facility_options(); if ($this->form_validation->run() == FALSE){ // load view $this->load->view('includes/header', $data); $this->load->view('front/register', $data); $this->load->view('includes/footer', $data); }else{ // build array for the model $form_data = array( 'pub_id' => set_value('pub_id'), 'room_title' => ucwords(strtolower(set_value('room_title'))), 'room_description' => ucwords(strtolower(set_value('room_description'))), 'adults' => set_value('adults'), 'children' => set_value('children'), 'price_per_night' => set_value('price_per_night') ); if ($this->User_model->save($form_data)) { $this->session->set_flashdata('flash_success', 'Room was successfully added'); } else { $this->session->set_flashdata('flash_success', 'Room was not added successfully'); } // redirect to room list page redirect('user/register/', 'refresh'); } } // set empty default form field values function _set_fields() { $this->form_data->title = ''; $this->form_data->first_name = ''; $this->form_data->last_name = ''; $this->form_data->dob = ''; $this->form_data->email = ''; $this->form_data->password = ''; $this->form_data->passconf = ''; $this->form_data->landline = ''; $this->form_data->mobile = ''; $this->form_data->address_1 = ''; $this->form_data->address_2 = ''; $this->form_data->city_id = ''; $this->form_data->county_id = ''; $this->form_data->postcode = ''; } public function title_check($title_input) { //allowed title items $titles = array("Mr", "Mrs", "Miss", "Ms", "Dr", "Prof"); if (in_array($title_input, $titles)){ return TRUE; }else{ $this->form_validation->set_message('title_check', 'The %s field must be a value from the dropdown list'); return FALSE; } } public function account_check($account_input) { //allowed account types $types = array("3", "4"); if (in_array($account_input, $types)){ return TRUE; }else{ $this->form_validation->set_message('account_check', 'The %s field must be a valid account type'); return FALSE; } } // validation rules function _set_rules() { $this->form_validation->set_rules('account_type', 'Account Type', 'callback_account_check'); $this->form_validation->set_rules('title', 'Title', 'callback_title_check'); $this->form_validation->set_rules('first_name', 'First Name', 'required|trim|alpha|xss_clean|max_length[50]'); $this->form_validation->set_rules('last_name', 'Last Name', 'required|trim|alpha|xss_clean|max_length[50]'); $this->form_validation->set_rules('dob', 'Date of Birth', 'xxxxxxxxxxxxxxxx'); $this->form_validation->set_rules('password', 'Password', 'required|min_length[6]|max_length[25]|matches[passconf]'); $this->form_validation->set_rules('passconf', 'Password Confirm', 'required'); $this->form_validation->set_rules('email', 'Email', 'trim|valid_email|max_length[100]'); $this->form_validation->set_rules('landline', 'Landline', 'trim|is_numeric|max_length[20]'); $this->form_validation->set_rules('mobile', 'Mobile', 'trim|is_numeric|max_length[20]'); $this->form_validation->set_rules('address_1', 'Address Line 1', 'required|trim|xss_clean|max_length[150]'); $this->form_validation->set_rules('address_2', 'Address Line 2', 'trim|xss_clean|max_length[150]'); $this->form_validation->set_rules('city_id', 'City', 'required|is_numeric|max_length[5]'); $this->form_validation->set_rules('county_id', 'County', 'required|is_numeric|max_length[5]'); $this->form_validation->set_rules('postcode', 'Postcode', 'required|trim|xss_clean|max_length[16]'); $this->form_validation->set_rules('country_id', 'Country', 'required|is_numeric|max_length[5]'); //Set global error delimiters $this->form_validation->set_error_delimiters('<span class="error">', '</span><br />'); } } /* End of file user.php */ /* Location: ./application/controllers/user.php */
  16. First I would like to thank you so much for giving me this code it works a treat expect it does'tn seem to put the start date in on the first day?
  17. This is my code $this->db->select("b.id, p.name, CONCAT_WS(' ', u.first_name, u.last_name ) AS full_name, DATE_FORMAT(b.check_in, '%d %b %Y') AS ck_in, DATE_FORMAT(b.check_out, '%d, %b %Y') AS ck_out, b.canceled, DATE_FORMAT(b.booked_on, '%d, %b %Y') AS booked_on"); $this->db->from('bookings b'); $this->db->join('pubs p', 'b.pub_id = p.id'); $this->db->join('users u', 'b.customer_id = u.id'); $this->db->where('b.user_id', $user_id); return $this->db->get()->result_array(); when i run i get Error Number: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '%d`, `%b` %Y') AS ck_out, `b`.`canceled`, DATE_FORMAT(b.booked_on, `'%d`, `%b` %' at line 1 SELECT `b`.`id`, `p`.`name`, CONCAT_WS(' ', `u`.`first_name`, `u`.`last_name` ) AS full_name, DATE_FORMAT(b.check_in, `'%d` %b %Y') AS ck_in, DATE_FORMAT(b.check_out, `'%d`, `%b` %Y') AS ck_out, `b`.`canceled`, DATE_FORMAT(b.booked_on, `'%d`, `%b` %Y') AS booked_on FROM (`bookings` b) JOIN `pubs` p ON `b`.`pub_id` = `p`.`id` JOIN `users` u ON `b`.`customer_id` = `u`.`id` WHERE `b`.`user_id` = '3'
  18. Hi I am wanting to use codeigniter to build a calendar however to populate the calendar you need to provide the day numbers how can i do this with a database design like so id - int (10) check_in - date check_out - date p.s it would need to fill in the dates to between sample data 1, 2014-02-12 , 2014-02-15 2, 2014-02-15 , 2014-02-22 $this->load->library('calendar'); $data = array( 3 => 'http://example.com/news/article/2006/03/', 7 => 'http://example.com/news/article/2006/07/', 13 => 'http://example.com/news/article/2006/13/', 26 => 'http://example.com/news/article/2006/26/' ); echo $this->calendar->generate(2014, 6, $data); http://ellislab.com/codeigniter%20/user-guide/libraries/calendar.html
×
×
  • 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.