Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7963091
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T05:31:42+00:00 2026-06-04T05:31:42+00:00

I have created a register form, that puts users in the database and auto

  • 0

I have created a register form, that puts users in the database and auto loging in them directly after registration ( or it suppose to )

The problem is that when they register an account the autologin is redirecting the previous user that registerd.

I think its because the previous user is already loged id.. But if no one is logd in I get one of my own error message that says ” The user dont exist”

Cant really figure out whats the problem.

Any ideas ?

This is some of my code.

if(empty($errors)){
                add_user($_POST['username'], $_POST['password']);
                $_SESSION['uid'] = fetch_user_id($_SESSION['username']);
                $_SESSION['username'] = htmlentities($_POST['username']);

                header("Location: profile.php?uid=" . $_SESSION['uid']);

                die(); 

And my function

//fetches profile information for the given user
function fetch_user_info($uid){
    $uid = (int)$uid;

        $sql = "SELECT
        `user_name` AS `username`,
        `user_email` AS `email`
    FROM `users`
    WHERE `user_id` = {$uid} ";

    $result = mysql_query($sql);

    return mysql_fetch_assoc($result);

}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T05:31:43+00:00Added an answer on June 4, 2026 at 5:31 am

    You probably meant:

    $_SESSION['uid'] = fetch_user_id($_POST['username']);
    

    instead of:

    $_SESSION['uid'] = fetch_user_id($_SESSION['username']);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created custom registration form in drupal 6. i have used changed the
I have a registration form that when the user enters in valid registration data
We have created a registration form in drupal 6 and used cck address field
I'm have a form set up which allows users to register with our mobile
I need to create registration form for an event. Each person that register can
I have users registration procedure on my app. But my users have to register
I have a register form created by mvc3 scaffolding. e.g. <div class=editor-label> @Html.LabelFor(model =>
I have a User model. It has register view containing a form that looks
I have a Django form that will add an entry to a database with
I have a Create new account page. The form is in page named Register.php

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.