Jump to content

[SOLVED] Can I approve someone that wants to login before they do?


energysuperstore09

Recommended Posts

  • Replies 50
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Does this script look right?

 

<?php

$email = $_POST['email'];
$password = md5($_POST['pass']);

@mysql_connect("205.178.146.75","fleco2008","xxxxxxx") or die("Error: unable to connect to database");
@mysql_select_db("test09");

$result = mysql_query("SELECT * FROM `loginreg` WHERE `email`='$email'");
if (mysql_num_rows($result) == 0) {
die("No account exists at that email");
}
if ($password != mysql_result($result,0,'password')) {
die("Incorrect password");
}
echo "";
while($row = mysql_fetch_array($result))
  {
   $active = $row['active'];

if ($active == "0") {
     $error = "1";
}}

?>

Link to comment
Share on other sites

I am trying to make sure they are active when logining in. Does this script look right?

 

<?php

$email = $_POST['email'];
$password = md5($_POST['pass']);

@mysql_connect("205.178.146.75","fleco2008","xxxxxxx") or die("Error: unable to connect to database");
@mysql_select_db("test09");

$result = mysql_query("SELECT * FROM `loginreg` WHERE `email`='$email'");
if (mysql_num_rows($result) == 0) {
die("No account exists at that email");
}
if ($password != mysql_result($result,0,'password')) {
die("Incorrect password");
}
echo "";
while($row = mysql_fetch_array($result))
  {
   $active = $row['active'];

if ($active == "0") {
     $error = "1";
}}

?>

Link to comment
Share on other sites

Yeah looks fine.

 

You may want to change if ($active == "1") {

welcome;

}else{

Account isnt active;

}

 

but eitehr way round doesnt matter.

 

Basically if active = 0 then error will =1

you then need to ONLY allow logins if error == 0 or null or anything other than 1.

Link to comment
Share on other sites

<?php

if ($active == "1") {
welcome;
}else{
Account isnt active; this where i get the syntax error
}

 

isnt real code..

 

Where welcome is, run whatever you would do for a correct login.

 

Where account isnt active, Run whatever code you would if the login fails.

LIKE:

 

<?php

if ($active == "1") {
echo "Acctount IS active";
}else{
Echo "Sorry account isnt active";
}

Link to comment
Share on other sites

I do things differently - rather than having an 'active' field I have two tables, ver_users and users. I send them a verification link and once they load the page up, it moves their user details from ver_users to the users table. Then I dont need to check an active flag when they log in and the users table only contains verified users.

Link to comment
Share on other sites

thanks.  I put the correct code in but it seems like it's not stopping someone from logining in if active is 0.

 

This is my login script

 

<!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>Distributor Area from Texas Fluorescents - Go Where the Business Is!</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta NAME="description" CONTENT="Texas Fluroescents' is a manufacturer of energy efficient linear pendant fluorescent lighting fixtures specifically T5 Industrial Fluorescent Lighting Fixtures, T8 Industrial Fluorescent Lighting Fixtures and T5HO Industrial Fluorescent Lighting Fixtures for industrial lighting, production floor lighting, warehouse lighting.">

<meta NAME="keywords" CONTENT="fluorescent lighting fixtures, T5 Industrial Fluorescent lighting fixtures, T5HO industrial fluorescent lighting fixtures, T8 industrial fluorescent lighting fixtures, T5 warehouse lighting fixtures, T5 warehouse fluorescent lighting fixtures">

<meta NAME="robots" CONTENT="index,follow">

<?php

$email = $_POST['email'];
$password = md5($_POST['pass']);

@mysql_connect("205.178.146.75","fleco2008","xxxxxxx") or die("Error: unable to connect to database");
@mysql_select_db("test09");

$result = mysql_query("SELECT * FROM `loginreg` WHERE `email`='$email'");
if (mysql_num_rows($result) == 0) {
die("No account exists at that email");
}
if ($password != mysql_result($result,0,'password')) {
die("Incorrect password");
}
echo "";
while($row = mysql_fetch_array($result))
  {
   $active = $row['active'];

if ($active == "1") {
echo "Account IS active";
}else{
echo "Sorry account isnt active";
}
}

?>
<script type="text/javascript">
<!--
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->
</script>
</head>


<div id="container">
<div id="header">
  
  <div id="logo"><a href="index.html"><img src="images/TxFluorescentslogo.jpg" border="0" /></a></div><h1>Texas Fluorescents - Fluorescent Lighting</h1><ul><li><a href="contact_us.html">Contact</a></li><li><a href="comingsoon.html">FAQ   |   </a></li><li><a href="comingsoon.html">Sitemap    |   </a></li><li><a href="comingsoon.html">Support   |   </a></li></ul></div><div id="subhead">your source for quality lighting</div><div id="phone">800-232-7407</div>

<div id="contain">
<div id="nav">
<ul>
<li><a href="index.html">HOME       |</a></li>
<li><a href="companyprofile.html">COMPANY       |</a></li>
<li><a href="products.html">PRODUCTS       |</a></li>
<li><a href="distributorlogin.html">DISTRIBUTOR       |</a></li>
<li><a href="internet_promotions.html">PROMOTIONS       |</a></li>
<li><a href="sales_representatives.html">FIND SALES REP       |</a></li>
<li><a href="contact_us.html">CONTACT US</a></li>
</ul>
</div>
<div id="main"></div>
<div class="beneath">
<div class="specification"><a href="downloadcenter.html"><img src="images/specification-download-center.jpg" border="0" /></a></div>
<div class="retrofitnew"><a href="retrofit.html"><img src="images/retrofit-center.jpg" border="0" /></a></div>
<div class="signup"><a href="internet_promotions.html"><img src="images/signup-now.jpg" border="0" /></a></div>
<div class="quote"><a href="request-quote.html"><img src="images/request-quote.jpg" border="0" /></a></div>
</div>
</div>


<div class="left_pan">

    <ul>
                <span class="style66">  PRODUCTS</span>
	<li><a href="hibay-fluorescents.html">HiBay Fluorescents</a></li>
        <li><a href="linear-pendant-fluorescents.html">Linear Pendant Fluorescents</a></li>
        <li><a href="recessed-fluorescents.html">Recessed Fluorescents</a></li>
        <li><a href="retrofit_refit_kits.html">Retrofit Kits</a></li>
        <li><a href="surfacemounts.html">Surface Fluorescents</a></li>
        <li><a href="wraparounds.html">Wraparounds</a></li>
        <li><a href="fluorescentstrips.html">Fluorescent Strips</a></li>
        <li><a href="closetoceilingCFL.html">Close-to-Ceiling - CFL</a></li>
        <li><a href="wallfixtures.html">Wall Fluorescents</a></li>
        <li><a href="wallpacks.html">HID Wall Packs</a></li>
        <li><a href="floodlights.html">HID Flood Lights</a></li>
        <li><a href="HighBays.html">HID High Bays</a></li>
        <li><a href="comingsoon.html">HID Vandaliers</a></li>
        <li><a href="Essentials.html">Essentials</a></li>
        <li><a href="RecessedDownlights.html">Recessed Downlights</a></li>
        <li><a href="exit_emergency.html">Exit & Emergency Lighting</a></li>
        <li><a href="Ballast_Transformers.html">Ballast & Transformers</a></li>
        <li><a href="NeptunDimmableCFLs.html">Fluorescent Lamps</a></li>
        <li><a href="comingsoon.html">LED Lighting</a></li>
      </ul><ul><span class="style66">  SUPPORT</span> 
            <li><a href="feedback.html">Feedback Form</a></li>
             <li><a href="comingsoon.html">Instruction Sheets</a></li>
             <li><a href="customerservice.html">Customer Service</a></li>
             <li><a href="salesdepartment.html">Sales Department</a></li>
             <li><a href="technicalsupport.html">Technical Support</a></li>
             <li><a href="productinquiry.html">Product Inquiry</a></li>
             <li><a href="comingsoon.html">Returns</a><br />
  </li>
      </ul>
</div>
            
<div class="content"><img src="images/distributor-arrow.jpg" width="571px" border="0"/>
<p>Welcome to the Texas Fluorescents' Distributor Area. You will be able to access special pricing, download catalogs, brchures, and most important keeps you up-to-date with whats going on at Texas Fluorescents. Make sure you read the lastest news to stay informed of upcoming information.</p>
<div class="catagory">
<a href="literature-download.php"><div class="small"></div></a>
<a href="pricing-download.php"><div class="medium"></div></a>
<a href="hot-sheet-download.php"><div class="large"></div></a>
<div align="left"><br class="spacer" /></div>
</div>
<div class="catagory">
  <div class="green25">
    <h3 align="center" class="style10"><a href="literature-download.php">Literature Download</a></h3>
    <DIV align="center">
      <p> </p>
    </DIV>
  </div>
  <div class="green27">
    <h3 align="center" class="style10"><a href="pricing-download.php">Pricing Download</a></h3>
    <p align="center"> </p>
  </div>
  <div class="green30">
    <h3 align="center" class="style10"><a href="hot-sheet-download.php">Hot Sheet Download</a></h3>
    <p align="center"> </p>
  </div>
  <div id="green28">
    <h3 align="center" class="style10"> </h3>
    <p align="center" class="style11"> </p>
  </div>
   <img src="images/latest-news.jpg" width="571px" border="0"/>     
        <p><span class="impor">Sales Meeting coming up 08-31-2009 through 09-02-2009</span><br />
        Texas Fluorescents will have a one hour Sales Meeting for all our sales representatives including inside sales, outside sales, customer service and quotations personnel.  Each agency is required to participate. The meeting will cover all of the exciting new things at Texas Fluorescents.
    We will offer 3 convenient times during the week of August 31. Please plan to join via an internet link to one of these 3 meetings. You will recieve an email regarding the details. Scheduled Times are:</p>
        <p>Monday August 31, 2009<br />
          at 10:00am Eastern
        </p>
         <p>Tuesday September 1, 2009<br />
          at 5:00pm Eastern
        </p>
        <p>Wednesday September 2, 2009<br />
          at 9:00am Eastern
        </p>
          <p><span class="impor">New Hot Sheets Available 08-18-2009</span><br />
      We have just finished our brand new versions of the 2009 Hot Sheets. We offer a wider variety of products with even lower pricing.</p>
</div>
</div>

</div>
<div class="footer"><img src="images/TX-Fluorescent-Footer-Image.gif" />
<p align="center">© Copyright 2009 Texas Fluorescents All Rights Reserved. Developed by <a href="http://www.wired2design.com" target="_blank">WIRED2DESIGN</a> Studios</p></div>
</body>
</html>

 

and this is what my db looks like

 

http://www.texasfluorescents.com/db-look.jpg

 

Thanks for your help

Link to comment
Share on other sites

Your not doing anything with the code itself.

 

if ($active == "1") {

echo "Account IS active";

}else{

echo "Sorry account isnt active";

}

}

 

You need to change the echos for whatever you would do to display an error page or a logged in page. If that makes sense?

Link to comment
Share on other sites

Can anybody help me?

 

Below is my code to where when I make someone active by putting a 1 in the db and try to login it still tells me that there not active

 

<?php

$email = $_POST['email'];
$password = md5($_POST['pass']);

@mysql_connect("205.178.146.75","fleco2008","xxxxxx") or die("Error: unable to connect to database");
@mysql_select_db("test09");

$result = mysql_query("SELECT * FROM `loginreg` WHERE `email`='$email'");
if (mysql_num_rows($result) == 0) {
die("No account exists at that email");
}
if ($password != mysql_result($result,0,'password')) {
die("Incorrect password");
} 
if ($active == "1") {
header("Location: /account-activated.php");
}
else{header("Location: /account-pending.php");
}

?>

 

Anybody?

Link to comment
Share on other sites

It still tells me that it isn't active.

 

<?php

$email = $_POST['email'];
$password = md5($_POST['pass']);

@mysql_connect("205.178.146.75","fleco2008","Leighan24") or die("Error: unable to connect to database");
@mysql_select_db("test09");

$result = mysql_query("SELECT * FROM `loginreg` WHERE `email`='$email'");
if (mysql_num_rows($result) == 0) {
die("No account exists at that email");
}
if ($password != mysql_result($result,0,'password')) {
die("Incorrect password");
} 
if ($row['active'] == "1") {
header("Location: /account-activated.php");
}
else{header("Location: /account-pending.php");
}

?>

Link to comment
Share on other sites

Tbh id do teh whole thing like:

 

<?php

$email = $_POST['email'];
$password = md5($_POST['pass']);

@mysql_connect("205.178.146.75","fleco2008","xxxxxx") or die("Error: unable to connect to database");
@mysql_select_db("test09");

$result = mysql_query("SELECT * FROM `loginreg` WHERE `email`='$email'");

while($row = mysql_fetch_array( $result )) {

if (mysql_num_rows($result) == 0) {
die("No account exists at that email");
}
if ($password != $row['password']) {
die("Incorrect password");
} 
if ($row['active'] == "1") {
header("Location: /account-activated.php");
}
else{header("Location: /account-pending.php");
}}
?>

 

 

 

Link to comment
Share on other sites

Now I just have to figure out how I can have it activated with that link you were talking about rather than me going to activate it manually.

 

Is there a way that i when someone registers it can email me letting me know that they have registered so that I can go and activate them?

 

Your a life saver by the way. Thanks for dealing with me.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.