Quantcast
Channel: WordPress › Support » Forum: Hacks - Recent Topics
Viewing all articles
Browse latest Browse all 8245

fallenpeace on "Use wordpress's login for outside standalone application?"

$
0
0

Okay basically, I have a music project I picked up from a friend that ive been working on for the the past couple of weeks. Its divided into three parts, A main website (powered by wordpress) - a custom user panel (powered by codeigniter) - and a radio/music player (Powered by codeigniter).

Oddly enough, all three parts have their own login system. So users need to register on each separate area which is horrible. I am not worried about the custom user panel because that is being removed and we will just be themeing the original wordpress dashboard to our liking.

Basically I want to combine the radio/music player with the wordpress login/register system so the usernames and passwords are the same throughout the main wordpress site and the musicplayer.

The radio uses a basic login/register system and here's the corresponding functions:

public function uregister() {
    $this->load->helper( array('form') );
    if( $_POST['submit'] ) {
        $data = array("ra_fullname"=>$_POST['fname'],
                      "ra_email"=>$_POST['uemail'],
                      "ra_password"=>$_POST['upassword']);
        $this->db->insert('ws_radio_user', $data);
        redirect( site_url() );
    }

    $data = array();
    $this->load->view('user_register', $data );
} 

public function ulogin() {
    $this->load->helper( array('form') );
    if( isset( $_POST['submit']) ) {
        $data = $this->db->query("select * from ws_radio_user where ra_email = '".$_REQUEST['lemail']."' and ra_password = '".$_REQUEST['lupassword']."'")->row();
        if( $data ) {
            $sess_array = array(
                            'id' => $data->uid,
                            'username' => $data->ra_email
                          );
            $this->session->set_userdata('logged_in', $sess_array);
            redirect('http://radio.#.com');
        } else {
           $data = array();
           $data['error'] = "username password does not match";
           redirect('http://radio.#.com');
        }
    }

    $data = array();
    $this->load->view('login_view', $data );
}
public function logout() {
    $this->load->helper( array('form') );
    $this->session->unset_userdata('logged_in');
    $this->session->sess_destroy();
    redirect('http://radio.#.com', 'refresh');
}

I am nowhere near a professional when it comes to php, so any insight would be extremely helpful, in replacing this login (which obviously only reads and writes plaintext) with the wordpress login system.

Also both the wordpress tables and the radio tables are in the same database ^.^


Viewing all articles
Browse latest Browse all 8245

Trending Articles