Sorry, that should have said should NOT be in brackets as in the example code I posted.
BenzZz commented: Well explained! +3
Graphix commented: Don't give away answers, let them find the solution themselves. -1
Sorry, that should have said should NOT be in brackets as in the example code I posted.
The variable declaration should be in brackets:
$intro = 'yes';
Get the date they login as you run your login script:
$logindate = date('Y-m-d');
Then insert/update this date into your database table that is recording your logins.
Simply this:
<input type="checkbox" name="variablename" value="yourrequiredvalue" <?php if (!empty($variablename) && $variablename == 'yourrequiredvalue') { echo 'selected'; } ?> >
Obviously you need to replace the name and value in the checkbox to match your variables and values and then compare the value of the variable that matches what is stored in your database for this checkbox with the value you have stipulated for the checkbox and if they match echo selected.
You obviously aren't reading my replies and to be honest I now give up. I have given you the exact script to activate the user at your activate.php with a link to your login page to resolve your problem (what I have done is not including your login form which you apparently are still trying to do).
Sorry I don't know what you mean
You need to look at the code more closely (and get into the habit) as I have just seen an error in my code in checking for $_GET when it should be $_GET.
Regardless of that, try the other way I suggested in just linking to the login page instead (not sure what your login page is called):
<?php
if (isset($_GET['id']) && isset($_GET['code'])) {
$userid = $_GET['id'];
$code = $_GET['code'];
$sql = mysql_query("UPDATE users SET activated='1' WHERE userid='$userid' AND password='$code'");
$sql_doublecheck = mysql_query("SELECT * FROM users WHERE userid='$userid' AND password='$code' AND activated='1'") or die (mysql_error());
$doublecheck = mysql_num_rows($sql_doublecheck);
if($doublecheck == 0){
echo "<strong><font color=red>Your account could not be activated!</font></strong>";
} else {
echo "<strong>Your account has been activated!</strong> <a href \"login.php\">Please login</a>";
}
}
?>
I haven't included the session_start(); as you aren't setting or using any session variables in the page as far as I can tell so it isn't required.
In your code lines 16 onwards are incorrect, please look at my code example from line 12 and you will see what I mean and change your code to match.
OK, as it stands you load in the login.php page. When people reach the activate page from the email, all is fine and works as expected. However when they login the whole page will be reloaded again and as there is no information being sent through to activate the user as in the first instance to populate the data in your query then no results are returned and you get your message about not being activated.
You either need to forward them to a separate login page after activation (as I have said before) or contain your activation code in an if statement so that the code only runs if the data has been sent through to the page from the email. Something like :
if (isset($_GET['userid']) && isset($_GET['code'])) {
$userid = $_GET['id'];
$code = $_GET['code'];
$sql = mysql_query("UPDATE users SET activated='1' WHERE userid='$userid' AND password='$code'");
$sql_doublecheck = mysql_query("SELECT * FROM users WHERE userid='$userid' AND password='$code' AND activated='1'") or die (mysql_error());
$doublecheck = mysql_num_rows($sql_doublecheck);
echo $doublecheck;
if($doublecheck == 0){
echo "<strong><font color=red>Your account could not be activated!</font></strong>";
} elseif ($doublecheck > 0) {
echo "<strong>Your account has been activated!</strong> You may login below!<br />";
}
if ($doublecheck > 0 || (!isset($_GET['id']) && !isset($_GET['code'])) {
include 'logIn.php';
}
}
This is not tested but hopefully you now understand what is causing your problem and a way to work around it.
Just all the php and html from the activate.php page
In which case I can only think that there is something else going on in the page, can you post all the code for the page.
Rather than sending the user to activate.php from the email and displaying a login form there, just have a link to your normal login page.
What you say would possibly make sense so why not change your set up to have the activate.php as it is with a link underneath the message to a login page and start afresh (clearing out all submitted data from the email) and see if that works.
Are you absolutely sure that the database is being updated to activated=1 when the link in the email is clicked? It may be echoing pout but doesn't mean that the database is being updated as it should.
Firstly (not related to your problem) but you shouldn't use $_REQUEST, use $_POST or $_GET (in you case $_GET) - read why.
I cannot see a reason why your code isn't working as it should but I see you are echoing $doublecheck - what value does that return.
In you if/else statement you don't need to use elseif, just if (and remove the ($doublecheck > 0).
SELECT t1.name, t1.number, t2.message from table1 t1 inner join table2 t2 ON t1.number=t2.number
I didn't think it would have a problem running but how you format your query and join obviously affects what results you get which is what I am trying to help you with.
I actually for got something in the query, but before I change it I need to know exactly what ecords you want from each table.
Tray changing your select query to indicate which table to reference for the user id
SELECT * FROM usergroups u INNER JOIN links l ON u.group_id = l.group_id WHERE u.user_id=1
If you have a business Paypal account then they can pay you and you forward the money to the client.
You could try Google Checkout but either way, if you are confused now, I am afraid it will only get worse when you try to integrate a payment system.
In answer to your questions about Paypal, your client will need a Paypal business account which is free to set up and no monthly fee unless you go fro the Pro account. They will charge a percentage plus 20p per transaction (at the moment the highest is 3.4%). Customers can pay by logging into or setting up a Paypal account or just by entering their card details when they are sent to make payment at the Paypal website.
You need to set the ul to the same width as your image otherwise it will only be as wide as the content it contains.
This is an HTML question as far as I am concerned:
<select name="name">
<option value=''></option>
<!-- All other option fields here using your asp as required-->
</select>
Great :) Can you mark the thread as solved please?
Not quite - you have some strange things going on with your echo and can I also suggest that you always ope your PHP tags with <?php, not short tags. I have re-jigged things for you to sort it out and make it cleaner and easier for you to understand (I hope ;) )
<?php
if (isset($_SESSION['lastname']) && !empty($_SESSION['lastname'])) {
?>
<div class="login"><a href="login-register-page.php" >Logout</a></div>
<div class="createbar"></div>
<img class="create_s" src="styles/Images/create_s.png" alt="creates"/>
<div class="create"><a href="login-register-page.php" >Welcome</a><span class="style2">
<?php echo $_SESSION["lastname"]; ?>
</span></div>
<?php } else { ?>
<div class="login"><a href="login.php" >Login</a></div>
<div class="createbar"></div>
<img class="create_s" src="styles/Images/create_s.png" alt="creates"/>
<div class="create"><a href="login-register-page.php" >Create an account</a></div>
<?php } ?>
if (isset($_SESSION['lastname']) && !empty($_SESSION['lastname'])) {
// Welcome lastname
} else {
// display login
}
If you read my tutorial as in the link in my last post it explains how to do it.
Have you got session_start(); at the top of every page? And then have you checked that you have a value in the lastname session? You may want to read my tutorial on how to format and check these things here
Exactly and then change
<div class="create"><a href="login-register-page.php" >Welcome</a><span class="style2"><?php echo $_SESSION["email"]; ?> </span></div>
</div>
To
<div class="create"><a href="login-register-page.php" >Welcome</a><span class="style2"><?php echo $_SESSION["lastname"]; ?> </span></div>
</div>
You need to change the session to set to the firstname instead of email or add it as an additional session variable.
Not quite
$query= "UPDATE rpms SET quantity=quantity+'$quantity' WHERE product_name='product_name'"
What exactly is the problem? For example do any of your errors display or does it appear to go trhough but doesn't actually update?
There are actually 2 errors in your code that I can see
else
if($password != mysql_result($result, 0)){
echo "Entered an incorrect password";
}
You are missing the surrounding parenthesis for your else statement
else {
if($password != mysql_result($result, 0)){
echo "Entered an incorrect password";
} }
Then you are saying if not $sql the success, should be the other way around
if($sql){
echo "Congratulations, password successfully changed!";
}
It needs to be at the very top of the page and you need to ensure you are not calling it more than once (i.e. from an included file). So you would have something like
<?php
session_start();
//followed by your include/require files and any other PHP
?>
<!-- Your HTML page starts here -->
You need session_start() at the top of every page where you use sessions and no you don't need session_regenerate_id() (that question was in case you were using it in error).
You could put it into a div or class instead of the table (I can't answer your question as it is years since I put a background image set to a table cell).
A pritaeas says - lines 14 and 19, however I will expand and let you know that the errors are due to missing closing parenthesis on both lines.
Use $_POST to get the values submitted in the form (use for each field name and replace the word fieldname with your actual field names).
As veedeoo said, or try putting the if statement outside your img tags
<?php if $row_rs_dresses['prod_status'] == "Sold") { ?>
<img src="images/outofstock.gif" width="40" height="40" />
<?php } else { ?>
<img src="images/dot.gif" width="40" height="40" />
<?php } ?>
I see what you are doing now and there is no reason or need to have a whole html page echoed in php so change (plus you are correct you can't use <?php ?> within other php tags but the way you are doing things you also need to end and restart <<< HTML each time you want to echo php.
Change both your registration and registration failed pages.
Registration:
<?php
require_once('InitDB.php');
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Member Login</title>
<link rel="stylesheet" type="text/css" media="screen" href="registration.css" />
</head>
<body>
.
.
.
.
.
.
</body>
</html>
Fail page:
<?php
require_once('InitDB.php');
session_start();
$errmsg1 = $_SESSION['ERR_MSG1'];
$errmsg2 = $_SESSION['ERR_MSG2'];
$errmsg3 = $_SESSION['ERR_MSG3'];
$errmsg4 = $_SESSION['ERR_MSG4'];
$errmsg5 = $_SESSION['ERR_MSG5'];
$ovrerrmsg = $_SESSION['OVR_ERR_MSG'];
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Member Login</title>
<link rel="stylesheet" type="text/css" media="screen" href="registration.css" />
</head>
<body>
.
.
.
.
.
</body>
</html>
Sorry posted my first reply at the same time as you posted again so may not be relevant now.
This won't work though
<p class = "instructions">
$_SESSION['OVR_ERR_MSG']
</p>
You have no PHP tags, should be
<p class = "instructions">
<?php echo $_SESSION['OVR_ERR_MSG']; ?>
</p>
You shouldn't just be echoing out the errors without checking if they have any data first. For example, change this
<?php echo $errmsg1; ?>
To this:
<?php if (isset($_SESSION['ERR_MSG1']) && !empty($_SESSION['ERR_MSG1'])) {
echo $_SESSION['ERR_MSG1'];
}
And see what happens (you will obviously need to change them all or the one that you know will have data to test.
Sorry, I can see them now. Have you tried using var_dump($_SESSION) at the top of the page (after session_start()) to ensure that your session data is there?
Firstly, there is no need to re-assign your session variables to normal variables, just use them as they are. Secondly, and more importantly, I cannot see anywhere on the page that actually echos the error messages which is why you won't see them.
You need to give your sub-ul a class and then right the formatting for that class in your style sheet to position it correctly.
As ardav says it is a Unix timestamp and if you want to change it into a date format:
$date = date('Y-m-d', time());
I give up - we have already told the poster all of this - put the session_start() at the top of the page, format the page properly etc and none of it is being done by the looks of it.
Please show the full and exact code in one page so we can look again at what you have now based on my suggestion.
Have you tried what I suggested (all in one page) - I am unsure from your reply?
Well your header.php is wrong - you are opening and closing the body tags in the header file and then again in your main page. Your header file should only be the code that is within the header of your page. Plus you are not declaring <html> in the header. I suggest creating your page as a whole first, testing it and then once working take out everything that you want to be in your header.php file and move it into that file.
Sorry, floated div's need to come first so in the html you need:
<div id="left">Content Here</div>
<div id="right">Content Here</div>
<div id="center">Content Here</div>