Jump to content

headstress

Members
  • Posts

    13
  • Joined

  • Last visited

Posts posted by headstress

  1. You need to change this 

     <form method="post" action="contact.php" id="contactform">
    
                        <div>
                        <p>Please complete as many fields as possible. Thank you!</p>
                        </div>
    
                        <div>
                        <label>Name <span class="required">*</span></label>
                        <input name="name" type="text" id="name" value="" />
                        </div>
    
                        <div>
                        <label>Email <span class="required">*</span></label>
                        <input name="email" type="text" id="email" value="" />
                        </div>
    
                <div>
                        <label>Cell phone</label>
                        <input name="cell" type="text" id="cell" value="" />
                        </div>
    
                    <div>
                        <label>Home phone</label>
                        <input name="home" type="text" id="home" value="" />
                        </div>
    
                        <div>
                        <label>How can we help you? <span class="required">*</span></label>
                        <textarea name="message" rows="20" cols="50"  id="message" ></textarea><br /><br />
                        </div>
    
                        <div>
                        <input type="submit"  value="Submit" class="button">
                         <input type="reset" value="Reset" class="button">
                        </div>
    
    
                    </form>
    

    to this

     <form method="post" action="contact.php" id="contactform">
    
                        <div>
                        <p>Please complete as many fields as possible. Thank you!</p>
                        </div>
    
                        <div>
                        <label>Name <span class="required">*</span></label>
                        <input name="name" type="text" value="" />
                        </div>
    
                        <div>
                        <label>Email <span class="required">*</span></label>
                        <input name="email" type="text" value="" />
                        </div>
    
                <div>
                        <label>Cell phone</label>
                        <input name="cell" type="text" value="" />
                        </div>
    
                    <div>
                        <label>Home phone</label>
                        <input name="home" type="text" value="" />
                        </div>
    
                        <div>
                        <label>How can we help you? <span class="required">*</span></label>
                        <textarea name="message" rows="20" cols="50"  id="message" ></textarea><br /><br />
                        </div>
    
                        <div>
                        <input type="submit"  value="Submit" class="button">
                         <input type="reset" value="Reset" class="button">
                        </div>
    
    
                    </form>
    
  2. It looks like the user_data() function expects a user ID. You're currently passing a string:

    user_data('user_type')

    Thank  you but I am still trying to grasp this php language

     

    This php code is in a file called init.php

     

     

    if (logged_in() === true) {
    $session_user_id = $_SESSION['user_id'];
    $user_data = user_data ($session_user_id, 'email', 'user_type', 'name', 'company', 'telephone', 'password');
    
  3. These are the functions

     

     

    function user_data($user_id) {
    $data = array();
    $user_id = (int)$user_id;
     
    $func_num_args = func_num_args();
    $func_get_args = func_get_args();
     
    if ($func_num_args > 1) {
    unset ($func_get_args[0]);
     
    $fields = '`' . implode(' `, ` ', $func_get_args) . '`';
    $data = mysql_fetch_assoc(mysql_query("SELECT * FROM `users` WHERE `user_id` = $user_id"));
    return $data;
    }
    }
    function logged_in(){
    return (isset($_SESSION['user_id'])) ? true : false;
    }
     
     
    
  4. HI,  I carried out a tutorial on the net for a login form/registration page

     

    I have the form fully working but need it to direct to a certain page depending on users login details

     

    This is where I am at and cannot get it to direct to right page

    <?php
    include 'core/init.php';
     
    if (empty($_POST) === false) {
    $email = $_POST['email'];
    $password = $_POST['password'];
     
    if(empty($email) === true || empty($password) === true) {
    $errors[] = 'You need to enter a username and password';
    } elseif (user_exists($email) === false){
    $errors[] = 'This email address does not excist';
    } elseif (user_active($email) === false){
    $errors[] = 'You have not acivated your account';
    } else {
    $login = login($email, $password);
    if($login === false) {
    $errors[] = 'Username or Password Incorrect';
    } 
     
     
    if (logged_in() === true && user_data('user_type')=== 1){
     
    header ("Location: member1.php");
     
    }
     
    else if (logged_in() === true && user_data('user_type')=== 2){ 
     
    header ("Location: member2.php"); 
     
     }
     
    else if (logged_in() === true && user_data('user_type')=== 3){
     
    header ("Location: member3.php");
     
     
    }
     
    
  5. Hi

     

    I am just wondering if this is possible or would work

     

    I have 3 different user types

     

    Jobseeker, Agency, Employer

     

    All need to goto different members pages

     

    Am I going down theright lines

    
    
    function select_user_type($user_type){
    $user_type = cleandata ($user_type);
    $email = cleandata ($email);
    $password = md5($password); 
    return (mysql_result(mysql_query("Select count(`user_id`) From `users` where `email`= '$email' AND `password` = '$password' AND `user_type` = '$user_type")));
    }

     

     

    And then do an if statement to re-direct to correct page

     

    Any help appreciated

  6. Well, at its simplest, you would have a groups table with all user ids and their groups.  Upon login when querying for the username you would join the groups table and lookup the group.  Then just use an if or switch to decide where to redirect.

     

    Right ok just to understand this

     

    In my registration form I have a selection for

     

    Are you:- Recruiter, Agency, Jobseeker

     

    then have a table in the database called groups where EVERYONES data goes, then do the queries on my login script to direct them to the right member page upon successful login

  7. Hi

     

    I am trying to set up a Recruitment site and on the home page I have a login form that I have got working fine, my question to see if this is possible:-

     

    Can the one login form direct me to he right area

     

    So if an employer logs in then they will to to their page

    if the agency logs in from  the same login form it goes to  their page

    and finally job seeker goes to there own members area

     

    I have been trying to think how to do it but getting lost with it all as I am not a fully functioning guru in php

     

     

    Thanks for any pointers

×
×
  • 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.