Find user logged php with select from DB [closed] - php

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I'm doing a website with joomla.
I'm doing a page to insert some data to identify the home of the user logged, and I'd like do another page to modify these data if user need, when he want
Now if I don't want touch joomla login module and I think about a solution but I don't know how do.
Here is what I think to do:
User login into my site
He modifies the data
When the data must update in the DB I'd like to do a think like "update data
Set="$blabla" where id is logged"
How can I do this id=user logged?

You can get the user ID by running the following code:
$user = JFactory::getUser();
$id = $user->get('id');
Source: http://docs.joomla.org/Accessing_the_current_user_object

Related

how to create a temporary session for visitors without them logging into my website [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 months ago.
Improve this question
Php Am building a e-commerce website so I want to create a temporary session for each and every user who visits my website and then store the information in database? (Note: without him creating an account)
You can use session_start function to create session in PHP, then you can store information about visitor, this is sample PHP code using session
<?php
session_start();
// set user name
$_SESSION['user_name] = $_POST['user_name']

Update external table when word press user changes profile info [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 months ago.
Improve this question
We have an external table of our website users that we would like to update when the user changes something in their profile. Currently, we sync the databases, but now we need faster transfer.
I've searched stack and google, and can't find anything?
Any help or links is appreciated.
You can do that with a hook:
https://developer.wordpress.org/reference/hooks/profile_update/
add_action('profile_update', 'force_sync_profile');
function force_sync_profile($userId, $oldUserData) {
$newData = get_userdata($userId);
// Call an API or something to sync new/old data
}

How can you make a personal page about every user?PHP [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
Yes, i looked for this question online, but I can not understand.
For example i know that when you log in you go to a link like :
site.com/Username
I know that you have to have a page for users in general like : user.php
but how exactly you put the name of the person at the account page when log in or the discription(do you read the name from the url and take other data from the database?).
I am new to php.
Please explain me
-Sorry for my english
The Best Way to do it is make a user.php page and when user login in
saves it's all data in session and when user open his profile/or
something else you can retrive data from session like user id and then
use your query to get the specific data against that user
You can store the username/id in $_SESSION['username'] or $_SESSION['id] like this. And can access the data of the user from the username/id. Hope this might help you.

How can i create a page that tailors personal info to the user [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
After hours of trial and error, using WAMP i made a login system that mails me locally ( password recovery etc). I want to make pages that only the user has information tailored to the user, think of it as a profile page Facebook or Twitter, the news updates.
You can use sessions. In php you can type session_start(), then you can store some information about the user. So if the user don't have a session he can't access the page. Search about session_start(). You will find many examples about it.

How to generate a new PHP file with PHP [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
Can anyone tell me how to Dynamically generate a new php file? Like generate it and then set it's code. Say that there was a user who created an account. When he created that account I would like it to generate his profile page.
Thanks!
You can do this using file_put_contents, but it's bad practice. It's much easier/better to just have one PHP file, profile.php for example, which takes a GET parameter for the user ID, then dynamically displays the correct information based on the user ID.

Categories