i created a table in the database (mysql),and i write a code for inserting data in the datbase using php.values are inserted properly.here i set the status column value as deactive.when user created in that time ,we send a mail to the user to active the link ,means my site and then status column has to changed as active.
my db table contains the following columns
name,email,pwd,status,lastlogin,security qun,ans
when user is created in that time i set the status as deactive.in that time i want to sent a mail(in this mail,i want to send the link to their account) to the user to active their account ,then only user goes to the next process.after that when user open the mail & click that link,the status column has to changed as active in the database.how can i do this,anyone help me..
one way to solve the problem is:
make the field 'status' as varchar not int.
when you are inserting user information for the first time, make a random string and insert it in the status field.
say your random string you have created is 'lka342lkjasd8234kl2324ljklj2'. send the link with the string as a parameter.
when the link is clicked in the script check the verification string matches the value in your status table.
if it matches then show message that his account is verified and change the value of the field to 1 (as 1 indicates a active account)
if the string doesn't matches then show message the verification link is wrong.
in another way you can make another table for storing verification string. and make the status fiend an integer. set 0 initially and make it 1 when verified, and check the verification with the new table.
You can create column called activation_code, send an email to user with link, which will contain this activation_code. Link like this www.example.com/active.php?activation_code=AABBCCDDEEFF, when user click this link you can get activation_code, find a user at database and change status. Also you can create column activation_expires which will contain a date when activation code will expire.
Related
I have website login system and after logging in, users can withdraw amount that is stored in database, the problem is when someone login using multiple devices and submit withdraw form at the same time he/she will recieve the amount multiple times. How to prevent users submitting at the same time ?
Make a field in the users table LOCKED with default value of zero and when its value is 1 disallow the transaction and every time a transaction takes place toggle it to 1 and back to zero when finished.
In order to answer your questions, I'll assume that:
1. You are using mysql database.
2. A user is allowed ONLY one withdrawal.
In your database, create a table named withdrawal.
Then, add fields like:
id INT PRIMARY KEY
user_id INT UNIQUE
withdraw_amount DECIMAL(10,2)
In this case, the user can only submit ONE record to withdrawal table since the user_id field is UNIQUE.
But, if my assumptions don't match with exactly what you require, then provide more information about what you need.
i have 2 tables one name unete_info and unete_confirmation. unete info has all basic information for a registry and unete confirmation has a field name joind_id which is generated when user successfully registered.
join_id is located in both tables as well name last_name and email, email is the unique value to validate both tables. i need to check whithin the tables every hour to see if the user the register successfully if not get a notificacion i have a user pending.
meaning my query needs to check within both tables and if user has join id empty in both tables after an hour send a notfication. but so far i need first how to get the user that dont have join_id, so far i came up with this.
SELECT unete_info.name,unete_info.last_name,unete_info.age,unete_info.number,unete_info.language,unete_info.submitted,unete_confirmation.join_id
FROM unete_info
INNER JOIN unete_confirmation ON unete_info.email=unete_confirmation.email
im missing how to check every hour and how to get users that join_id is null(empty)
I am working on the CI in this project i need to implement user activity tracking for logged in user like if any user see any records i can save that to the database and if any record is updated then i need show get only that particular updated filed value and show in the log table like this user 'xyz' has updated the phone number from '123456' to '546789'. like this if any recorded is updated, added, deleted, or viewed then i want to able to track that, i hope that make sense.
Any help is appreciated....
You can maintain a column in your table which will store the activity. when your required event is triggered.e.g.Updating Employee No. 1 to 100 will Store Activity as an Update and you can add one more column to store the ID of the updated Entry. hope this helps.
ive a project in which a user can add record but that can published in the front end end only after it is verified and approved by admin. Please help me with the workflow and php code for this
here is a thought , because this is what i have implemented in my system
we have bunch of data entry guys , they add data . Then asks administrator to review once it done administrator publishes.
i have created one extra field flag and by default flag is 0 for newly entaied data.
once admin review the work he then updates the table setting flag to 1
That is not a problem. What you need to do is very simple.
First of all
You need to create a table in database which store all the data you want.
You need to create 1 more field which store any variable. Example ('0' or 'pending' as default ). Or you can store by using INSERT sql. What I mean is when you doing your form using php and then you insert the particular field as 0 or pending.
INSERT INTO table ('name', 'contact', 'field')VALUES ('$name','$contact','0/pending')
Create an admin site which use to verify and approve manually for the new user.
Do a transaction which can change the status of the field.
Update the field if admin approve to 1 or approved.
PS* if do not approve just let the field remain 0 or change the value to rejected.
Select the result by calling the specific value which according to the value you set in the field. For example you set the value is approved. Then what you should do is :
SELECT * FROM table WHERE field = approve
This should be what you want.
I can give you some raw steps.
Create a flag (column) is_published in you users table.
Set this flag default value as 0
Provide an option in the admin panel with approve or publish button.
On click of the above mentioned buttons run an ajax request update that particular column with value 1.
In the front end part list only those records where is_published = 1 or is_published != 0
Hope this can solve your problem.
I am creating a real-estate website that displays properties. On each property listing I would like a button that says 'Express Interest', when clicked, this button should send an email to me containing the user details who expressed interest (the user will be logged in and so all their details will be taken from their account).
I have the email function working fine, HOWEVER, I also want to display the number of people who have 'Expressed Interest'. Is there a way to track how many times an email has been sent using this button and display "xx people have expressed interest in this property"
Store in the database before sending the mail and just before sending the mail include the number of people or the people who are interested, a simple query would suffice, or if you have a content management system you can include it there, in both cases you would need an intermediate table (connection between user id and real-estate id)
I would add another table to your database that stores a property_id and a user_id. If a user clicks expresses interest, you add another row to that table with the current property_id and the current user_id. To get the amount of links you simply count the rows
SELECT count(user_id) FROM interest_relation WHERE property_id = 'your property id'
This way you can also find out which user is interested in which property.