![]() |
![]() |
![]() |
|||||
![]() |
![]() |
![]() |
![]() |
![]() |
|||
| Welcome
to Tech Support Forum home to more then 136,000 problems solved. Issues
have included: Spyware, Malware, Virus Issues, Windows, Microsoft,
Linux, Networking, Security, Hardware, and Gaming Getting your
problem solved is as easy as: 1. Registering for a free account 2. Asking your question 3. Receiving an answer Registered members: * See fewer ads. * And much more..
|
| Want to know how to post a question? click here | Having problems with spyware and pop-ups? First Steps |
|
|||||||
| Web Design & Programming Discussion of web design, and server-side & client-side scripting |
![]() |
|
|
LinkBack | Thread Tools |
|
|
#1 (permalink) |
|
Registered User
Join Date: May 2009
Posts: 30
OS: xp sp3
|
Mysql database and php
Hey guys, i'm trying to set up a mysql database where an account status automatically default to inactive or '0'. When a user registers, it sends them an email for them to verify, after verification, the account become active or '1'.
nb. 1. I don't how to create it is inactive 2. Make active by user's when click 'link' in their email.... HELP PLEASEEEEEEEEE!!!!! thanks alot guys!!! |
|
|
|
| Important Information |
|
Join the #1 Tech Support Forum Today - It's Totally Free!
TechSupportForum.com is a leading support website for your computer needs. We offer free, friendly and personalized computer support. Why pay to have your computer fixed when you can do it for free. Join TechSupportforum.com Today - Click Here |
|
|
#2 (permalink) |
|
Design Team Member
|
Re: Mysql database and php
Do you have an account/login system already in place?
__________________
Free Resources PC Protection - Comodo Firewall | AVG Anti-Virus | WinPatrol | Ad-Aware | Spybot S&D | SpywareBlaster |Web Design/Programming - KompoZer (Editor) | Paint.NET (Graphic) | GIMP+GIMPShop (Graphic) | FileZilla (FTP Client) | Free Hosting | |
|
|
|
|
|
#4 (permalink) |
|
Design Team Member
|
Re: Mysql database and php
Add a column to the database (user table) called "Active" or whatever you want as well as a column called "ActiveKey". When they first register, set the Active column to 0 and generate a random number to put in ActiveKey. Then send an email to them with a page to your site (verify.php or whatever) that has a form with an email box and a activation key box. Have that verify that the key matches the one in the database for that user. Alternatively you can include the key in the link in the email (ie: verify.php?key=023980823b093bjlkasdj388&email=joe@schmoe.com). Pretty simple system ;)
__________________
Free Resources PC Protection - Comodo Firewall | AVG Anti-Virus | WinPatrol | Ad-Aware | Spybot S&D | SpywareBlaster |Web Design/Programming - KompoZer (Editor) | Paint.NET (Graphic) | GIMP+GIMPShop (Graphic) | FileZilla (FTP Client) | Free Hosting | |
|
|
|
|
|
#5 (permalink) |
|
Registered User
Join Date: May 2009
Posts: 30
OS: xp sp3
|
thank you RedCore, cool, i understand the database part (moreless), but i'm not so good with the scripting part....what's the script to generate the random number and how do u out it in the "activationKey" column?
This is my php code that registers a user to the database, but how and where do i incorporate the code to generate the random key so they can verify? Hey btw, that a million for even looking at this!! PHP Code:
Last edited by dm01; 11-21-2009 at 02:02 PM. Reason: Please do not double-post. Ask a member of staff (red or purple user titles) via Private Message to edit or merge your posts. Thank you for helping us keep TSF a nice place to visit. |
|
|
|
|
|
#6 (permalink) |
|
Registered User
Join Date: Nov 2007
Posts: 388
OS: Mac OS X 10.5.7 and XP SP2
|
Re: Mysql database and php
First, I don't think you need the ! on this line:
PHP Code:
PHP Code:
PHP Code:
Last edited by FredT; 08-23-2009 at 09:34 PM. |
|
|
|
|
|
#7 (permalink) |
|
Registered User
Join Date: May 2009
Posts: 30
OS: xp sp3
|
It Works!!!! Thank you FredT!
i'm have to now use Argosoft Mail server together with MS Outlook for the purpose of this school project. I, however, need to send an email to the subscriber's address in so they could activate their's accounts. I know it's beyond this thread, but do you know how to do that perhaps? Thanks again buddy!!! [[--merged from double-posting--]] i have some sample php code i.e PHP Code:
[[Moderator's Note: please do not double-post. You may ask a member of staff to either edit your original post or merge consecutive posts. Thank you. —dm01]]
Last edited by dm01; 11-21-2009 at 02:02 PM. Reason: merging dbl-post and adding [php] |
|
|
|
|
|
#8 (permalink) |
|
Design Team Member
|
Re: Mysql database and php
The server needs mail enabled and Internet access in order to send out emails. It seems a little odd that they want you do it without Internet access but want authentication. Or maybe that's just your own feature. What you could do in that case is just make it look like it just sent an email but instead of doing that, it writes the verify URL to a text file (with the activation code, obviously) and you just copy that into your browser. You can explain that it's the same thing the email would have had, but you're doing this as a localized example.
PS: please use the PHP tags for your PHP code :)
__________________
Free Resources PC Protection - Comodo Firewall | AVG Anti-Virus | WinPatrol | Ad-Aware | Spybot S&D | SpywareBlaster |Web Design/Programming - KompoZer (Editor) | Paint.NET (Graphic) | GIMP+GIMPShop (Graphic) | FileZilla (FTP Client) | Free Hosting | |
|
|
|
|
|
#10 (permalink) |
|
Design Team Member
|
Re: Mysql database and php
Hmm...I've never done that sort of thing. Probably a question for the server guys in the Windows Server section...
__________________
Free Resources PC Protection - Comodo Firewall | AVG Anti-Virus | WinPatrol | Ad-Aware | Spybot S&D | SpywareBlaster |Web Design/Programming - KompoZer (Editor) | Paint.NET (Graphic) | GIMP+GIMPShop (Graphic) | FileZilla (FTP Client) | Free Hosting | |
|
|
|
|
|
#12 (permalink) |
|
Registered User
Join Date: May 2009
Posts: 30
OS: xp sp3
|
Re: Mysql database and php
hey, i wanna set up php sessions on a few pages, at the top of each page, i have
<?php session_start(); if (!(isset($_SESSION['login']) && $_SESSION['login'] != '')) { header ("Location: login.php"); } ?> After a while i started getting a message saying, "This page has a redirect loop". Now, i can logically assume that the sessions are not scripted properly, PLZ HELP!!! Let's say i have 6 pages (index.php being the home page) 1. Index.php 2. Courses.php 3. Personalize.php 4. Search.php 5. Upload.php 6. Welcome.php I want to redirect anyone who is not logged in, back to the login.php page, So what i did was put that piece of code at the top of each page... Please correct me.... Randy |
|
|
|
|
|
#13 (permalink) |
|
Registered User
Join Date: Nov 2008
Posts: 13
OS: Vista Ultimate / Suse10 / debian sarge
|
a few hints:
|
|
|
|
|
|
#14 (permalink) |
|
Design Team Member
|
Re: Mysql database and php
I've asked a few times - PLEASE use the PHP tags to make it easier to read.
As far as your code: PHP Code:
Should just be simple: PHP Code:
__________________
Free Resources PC Protection - Comodo Firewall | AVG Anti-Virus | WinPatrol | Ad-Aware | Spybot S&D | SpywareBlaster |Web Design/Programming - KompoZer (Editor) | Paint.NET (Graphic) | GIMP+GIMPShop (Graphic) | FileZilla (FTP Client) | Free Hosting | Last edited by Redcore; 08-27-2009 at 05:32 PM. |
|
|
|
|
|
#16 (permalink) |
|
Design Team Member
|
Re: Mysql database and php
Around your code you just put: [ PHP ] code [ / PHP ]
(without the spaces) :)
__________________
Free Resources PC Protection - Comodo Firewall | AVG Anti-Virus | WinPatrol | Ad-Aware | Spybot S&D | SpywareBlaster |Web Design/Programming - KompoZer (Editor) | Paint.NET (Graphic) | GIMP+GIMPShop (Graphic) | FileZilla (FTP Client) | Free Hosting | |
|
|
|
|
|
#18 (permalink) |
|
Design Team Member
|
Re: Mysql database and php
Yeah. It should provide basic authentication. It depends how important the data you're trying to protect is. You could do implement a session token system, authenticating that token on each page call. There are quite a few articles out there on this sort of stuff when you Google it.
__________________
Free Resources PC Protection - Comodo Firewall | AVG Anti-Virus | WinPatrol | Ad-Aware | Spybot S&D | SpywareBlaster |Web Design/Programming - KompoZer (Editor) | Paint.NET (Graphic) | GIMP+GIMPShop (Graphic) | FileZilla (FTP Client) | Free Hosting | |
|
|
|
|
|
#19 (permalink) |
|
Registered User
Join Date: May 2009
Posts: 30
OS: xp sp3
|
Re: Mysql database and php
Hey Redcore,
Here's what happening now, whenever i log in and go to welcome page, if i click on a page with the session code on it, it's going back to the login.php (somehow....Therefore, i still cannot access protected pages.... :( Can you advise me what can this problem? PHP Code:
|
|
|
|
|
|
#20 (permalink) |
|
Design Team Member
|
Re: Mysql database and php
I didn't see where you set this session variable in your login code. Could you post that?
__________________
Free Resources PC Protection - Comodo Firewall | AVG Anti-Virus | WinPatrol | Ad-Aware | Spybot S&D | SpywareBlaster |Web Design/Programming - KompoZer (Editor) | Paint.NET (Graphic) | GIMP+GIMPShop (Graphic) | FileZilla (FTP Client) | Free Hosting | |
|
|
|
![]() |
| Thread Tools | |
|
|