473,396 Members | 1,758 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

need help in activation-registration-login solution...

Hello, I have made my cms... and is working, but have some, let me say
"bugs"... And I don't know all reasons, please allow me slightly longer
and most probably confusing post (that "confusing" is mainly becaose of
my bad english, and that bad english is also reason why am I learning
php that slow...).
As first, what is problem:
some users after succsesfull registration and login can not see
"memeber_menu" and can not activly participate if forums, galleries
(they are not able to post or upload images)... cookie problem? but just
some of them? why not all of them? if I delete one "cookie" from my
dbase for them, problem is solved...
now,

-"introduction"-
I have old site (7 years will be now) with some old members. not
"registered" members because in past I have worked on all content
manualy. now, after many younger sites have been created with nuke,
mambo, phpbb and many other CMS scripts and after year of my search for
the best of them (CMSs), I have decided to learn and write my own. And I
did, and my cnms is working with allready mentioned problem which I will
try to explain now...
-I need sort of "activation" code for my old members which I have added
to my database manualy
-I need registration with aprooval for new members (as I don't want
members with wrong e-mail addres in my dbase)

-"short explanation of my solution"-
-activation of old members:
//just some basic lines of code!
in mail:
http://mysite.tld/?page=activate&activkey=9876qwerty
//in script
mysql_query("UPDATE user_basic SET active='yes' WHERE id='$activkey'");
<form method="post" action="index.php">
<input type="hidden" name="uname" value="$uname">
<!--uname will be used for cookie-->
<input type="submit" name="OK" value="log in">
<!--"OK" will activate cookie process on index-->
//index will be desribed at the end!

-registration of new mwmbers
//just some basic lines of code!
/*long registrtion form with checking of email,
duplicate email, duplicate uname...*/
$datum=time();
$body="password=$pwd\r\n".
"activation number=$datum\r\n".
"activation link:\r\n".
"http://mysite.tld/?page=registration&regin=$datum\r\n";
mail($to, $subject, $body, $headers);
mysql_query("INSERT INTO user_temp
(uname,email,pwd,regin,checked)
VALUES ('$uname','$email','$pwd','$datum','not')");
/*aprooval part: (user can enter activation number or
click on activation link in e-mail)*/

if ($_POST['regin']) {
$regin = $_POST['regin'];
} else {
$regin = $_GET['regin'];
}

mysql_query("UPDATE user_temp SET
checked='yes'
WHERE regin='$regin'");
mysql_query("INSERT INTO user_basic
VALUES (" . stuff from user_temp table . ");
mysql_query("DELETE FROM user_temp
WHERE (regin='$regin' AND checked='yes') LIMIT 1");

<form method="post" action="index.php">
<input type="hidden" name="uname" value="$uname">
<!--uname will be used for cookie-->
<input type="submit" name="OK" value="log in">
<!--"OK" will activate cookie process on index-->
//index will be desribed at the end!

-and now index.page with that ^%#$% Cookies. maybe PHP session would be
much better, but as for now I have no idea how to use them...

$uname = $_POST['uname'];
$pwd = $_POST['pwd'];
$OK = $_POST['OK'];
$enter = $_POST['enter'];
if ($_POST['page']) {
$page = $_POST['page'];
} else {
$page = $_GET['page'];
}

if($page == exit){
unset($_COOKIE['member']);
setcookie('member','',time()-31536000,"/",".mysite.tld");
unset($_COOKIE['kuki']);
setcookie('kuki','',time()-31536000,"/",".mysite.tld");
header('Location: index.php');
}

if(isset($_COOKIE['member']) && isset($_COOKIE['kuki'])) {
$logiran=test_is_user();
if($logiran) {
member_menu();
} else {
login_form();
}
}

elseif (isset($okej)) {
$check=random_cookie();
mysql_query("UPDATE user_basic SET kuki='$kuki'
WHERE uname='$_POST[uname]'");
setcookie("member","$uname",time()+31536000,"/",".mysite.tld");
setcookie("kuki","$kuki",time()+31536000,"/",".mysite.tld");
member_menu();
}

else {
if($enter) {
$who("SELECT * FROM user_basic
WHERE(uname='$uname' AND pwd='".md5($pwd)."')";
mysql_query($who);
if(mysql_num_rows($who) != 1) {
error_user();
} else {
$user_data=mysql_fetch_array($reza_who);
if($user_data[kuki]) {
$aproov=$user_data[kuki];
} else {
$aproov=random_cookie();
mysql_query("UPDATE user_basic SET kuki='$aproov'
WHERE uname='$_POST[uname]'");
}
setcookie("member","$uname",time()+31536000,"/",".mysite.tld");
setcookie("kuki","$kuki",time()+31536000,"/",".mysite.tld");
member_menu();
}
} else { // why do I have this line? some leftover?
login_form();
}
}
I hope that my "cuting" of my scripts didn't made my solution unridable,
and I hope that someone will find what I made wrong...
tnx in advance.

--
Jan ko?
http://fotozine.org/?omen=janimir
--
Jul 17 '05 #1
1 2655
i forgot to tell what function test_is_user() does:

function test_is_user() {
if(isset($_COOKIE['member']) && isset($_COOKIE['kuki'])) {
$query="SELECT kuki FROM user_basic
WHERE uname='$_COOKIE[fotograf]'";
$result=mysql_query($query) or die ("$query");
list($procitan_kuki) = mysql_fetch_array($reza_kuki);
if ("$procitan_kuki" == $_COOKIE['provjera']) {
$logiran = "1";
} else {
$logiran = "0";
$errormsg="text about some discrepancy";
}
} else {
$errormsg="login or register";
}
return $logiran;
return $errormsg;
}

Jul 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Dave Smithz | last post by:
Hello There, I obtained a visual studio .net which I installed a few months ago but then never had time to use. I obtained a new copy of the trial which is slightly newer. However, because I...
1
by: Matt Dinovo | last post by:
I have a remoting server that is on the same local box as a COM+ managed object with Library Activation. When I try to activate the object from the remoted assembly, I get the following error: "The...
3
by: zz | last post by:
Hello everyone, We have an hybrid plain C++/COM/VB.NET commercial application in which we've included a mandatory activation mechanism. This activation system is programed in the VB.NET part and...
6
by: Mary | last post by:
We are developing a DB2 V7 z/OS application which uses a "trigger" table containing numerous triggers - each of which is activated by an UPDATE to a different column of this "trigger" table. When...
30
by: (Pete Cresswell) | last post by:
Just fired it up to see what it looked like. They wanted me to "Activate" the product before the 50th use. Geeze, I paid my money....now they want me to jump through their hoops? Brings back...
3
by: Sunny | last post by:
Hi all, I'm creating client/server app in C# (VS. 2003). So, I need the client to call the server with some auth info (user and pass). If the auth is OK, server will do some work and will prepare...
11
by: ML | last post by:
Does anyone have any info on sample code for handling activation/licensing for a vb.net app? Just looking for something fairly basic to implement the ability to have an application registered and...
1
by: Andy B | last post by:
I am making a web application that would randomly create an activation code and put it in a database. The web application would then send it in an email to the user with a link to go to and enter...
5
by: Andy B | last post by:
I am making a web application that would randomly create an activation code and put it in a database. The web application would then send it in an email to the user with a link to go to and enter...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.