Welcome to Geeklog, Anonymous Saturday, December 21 2024 @ 09:54 am EST
Geeklog Forums
custom first time login script to update and insert
Status: offline
lbpp
Forum User
Chatty
Registered: 06/10/05
Posts: 57
Hey all, i have a custome script here that redirects people to a welcome page the first time the log in to give them an overview of my site. The problem is that i made got this script after i already had 1000 members so the table that is being "UPDATED" is only updated for people who already have an entry, but not INSERTED into the table if there is no entry for that persons UID. I need the script below to check to see if the UID exists in the table and if not to INSERT them as logged in as well as update it when a new user logs in the first time. I know its just a simple bit of code, but for some reason i cant get it to work.
function plugin_user_login_staticpages($uid) {
global $_CONF,$_TABLES;
if (DB_getItem($_TABLES['custom_member'],'has_logged_in',"member_uid=$uid") == 0) {
DB_query("UPDATE {$_TABLES['custom_member']} set has_logged_in=1 WHERE member_uid=$uid");
echo COM_refresh($_CONF['site_url'] . '/staticpages/index.php?page=newuser');
exit;
}
}
thanks for the help in advance
Text Formatted Code
function plugin_user_login_staticpages($uid) {
global $_CONF,$_TABLES;
if (DB_getItem($_TABLES['custom_member'],'has_logged_in',"member_uid=$uid") == 0) {
DB_query("UPDATE {$_TABLES['custom_member']} set has_logged_in=1 WHERE member_uid=$uid");
echo COM_refresh($_CONF['site_url'] . '/staticpages/index.php?page=newuser');
exit;
}
}
thanks for the help in advance
15
18
Quote
Status: offline
jmucchiello
Forum User
Full Member
Registered: 08/29/05
Posts: 985
Examine DB_save in lib-database.php
16
16
Quote
All times are EST. The time is now 09:54 am.
- Normal Topic
- Sticky Topic
- Locked Topic
- New Post
- Sticky Topic W/ New Post
- Locked Topic W/ New Post
- View Anonymous Posts
- Able to post
- Filtered HTML Allowed
- Censored Content