Bounty
-
Posts
78 -
Joined
-
Last visited
Never
Posts posted by Bounty
-
-
Hello everyone,i was trying to make a register/login pages on my own and well i got stuck..and my good friend google couldn't help me :S
So well i came to ask proffesionals
Okay here is it:
First thing i don't get is about email activation that i wanted to use on my register page...
I got do_reg.php file that looks like this:
<?php include 'connection.php'; //grab data from form $name = $_POST['username']; $pass = $_POST['password']; $pass_conf = $_POST['pass_conf']; $email = $_POST['email']; $ip = $_POST['ip']; //if else if($name == false || $pass == false || $pass_conf == false || $email == false){ echo "Please fill in all the required fields."; }; if($pass != $pass_conf){ echo "Blah..Passwords do not match."; }else{ //generate random code $code = rand(11111111,99999999); //send email $subject = "Activate your account"; $headers = "From: admin@mysite.com"; $body = "Hello $name,\n\nYou registered and need to activate your account. Click the link below or paste it into the URL bar of your browser\n\n http://localhot/login/activate.php?code=$code\n\nThanks!"; if (!mail($email,$subject,$body,$headers)) echo "Error,what a shame!"; else { $sql = mysql_query("INSERT INTO users (username,password,email,code,active,ip) VALUES('$name','$pass','$email','$code',0,'$ip')") or die(mysql_error()); $result = mysql_query($sql); echo "Thank you for registering! But your account is not still active :'( Please check your email ($email) for activation code! "; } }; ?>
I went through thousands of erros and still couldn't make it work,i am using xampp localhost server for now and maybe that is the reason it wont work even if i tried to activate SMTP and that stuff in php.ini conf file (as my friend google told me)..
So this is one of the errors:
Warning: mail() [function.mail]: SMTP server response: 550 relaying denied in C:\xampp\htdocs\login\do_reg.php on line 25Error,what a shame!
Now the next thing i couldn't understand is where is the error inside this script... (do_login.php)
<?php include 'connection.php'; $session_username = $_SESSION['username']; if($_POST['login']) { //get form data $username = $_POST['username']; $password = $_POST['password']; } if(!$username||!$password) echo "Username and password missing!"; else { //login $login = mysql_query("SELECT * FROM users WHERE username='$username'"); } if (mysql_query($login)==0) echo "No souch user!"; else { while ($login_row = mysql_fetch_assoc($login)) { $password_db = $login_row['password']; $password = md5($password); if ($password!=$password_db) echo "Incorect password!"; else { //check if active $active = $login_row['active']; $email = $login_row['email']; if ($active==0) echo "You haven't activated your account, please check your email ($email) for activation!"; else { $_SESSION['username']=$username; //assign session header("Location: index.php");//refresh } } } } ?>
Thank you for your spent time and help..
-
-
I tried with 3 buttons but what every button does is just cycling through images...like its just 1 button...
-
Anyone?
-
Ok i got this javascript that changes bg image but it does not work the way i need.It changes only by 1 button like "next" button. I need more buttons where every could switch just 1bg.
Here is the link.
-
Finally solved
-
Nevermind about last post...i got it
Just tell me how to do this:
// in english pageif($_COOKIE['TestCookie'] == 'Serbian') {
header("location:serbian/index.php");
} else {
// english page here
}
Should i insert whole page html instead of comment?
-
Can't something like this be done?
<?php if($_COOKIE['TestCookie'] == 'srb') { header("location:index2.php"); } else { $Month = 2592000 + time(); $value = 'eng'; setcookie("lang", $value, $Month); } //and keep with page ?>
And can you write me a js code for image-link-cookie set?
Please?
Thanks
-
I get it...just 1 thing..
// in english pageif($_COOKIE['TestCookie'] == 'Serbian') {
header("location:serbian/index.php");
} else {
// english page here
}
Where is "//english page here" couldn't there be something like "do nothing and keep loading the page"?
Or you think to insert whole <html></html> code inside of it?
-
I only need 2 pages original eng and sidepage srp. So i wanted to add a "checker" to eng page (if cookie is "srp" redirect if not continue) and two buttons that will change the value of cookie (1 and 0)...
I don't understand this linking "?lang=english"...
-
The thing is that i got 2 pages.. one written in English and one on Serbian...so i want if person press a image-link that leads to Serbian page it should create cookie so every time after a person loads my site it gets redirected to serbian page...and if clicked back to English image-link the cookie gets deleted and it should run as every else site...
I hope you understood what i want to do ://
Thanks for helping..
-
I dont get it...how to use that with php?
-
This is my original topic. Well after wildteen88 posted that i should use JS to make cookies by clicking a link. I used google to find a tutorial on how to do that but my tries wasn't successful...
So could you help me build a image button+setting cookie+switching to page2....?
Thanks
-
What i mean by link is something like this:
<h1>Link</h1> <a href=/nextpage.html action="?setcookie=1">Set Cookie</a>
-
What about image or link instead of button? :/
-
Someone? Please?
-
Ok here are my 3 php pages:
set.php
<?php $Month = 2592000 + time(); $value = '1'; setcookie("cs_hpage", $value, $Month); ?>
get.php
<?php if (isset($_COOKIE["cs_hpage"])) { $cookie = $_COOKIE["cs_hpage"]; print("Received a cookie: ".$cookie."\n"); } else { print("Fail!.\n"); } ?>
clear.php
<?php setcookie ("cs_hpage", "", time()-60000); ?>
It all works like charm but i dont know how to set
if $cookie == 1
echo "Cookie here!"
and if other then 1
echo "Fail!"
All i managed to do is as you can see to echo the cookie :/
And question no.2:
How can i set a cookie through a button?? (Like when pressed set cookie to value "1")
Thanks..
-
I understand..so should i mark this one solved or anything?
-
I understand that,i didnt mean to be rude i just wanted some pointing...
-
Ok so i need mootols.js and menu.js got them...now where to find code that can import the menu in my page?
-
ok...can anyone just tell me your opinion..is this even posible? Is it hard? Did i explain right?
http://www.phpfreaks.com/forums/index.php/topic,303294.0.html
-
I know,thats why i didn't...i meant if i knew this i would post it in php coding not in third party...
-
I dont have in mind to be rude or anything.. But im sure that the team that solves problems in php coding forum can solve problems in third party forums...if i knew that there are 2 teams i would post same problem in php coding...
-
You guys have done excellent job with the support and everything but ive noticed that there are just few replies in "Third party forums" forums...why?
Register/Login
in PHP Coding Help
Posted
Well i'm using xampp localhost server shouldn't i be administrator?
I found a way to activate SMTP on google but it won't stop error :S
As for do_login.php i forgot to copy you the error..