Jump to content

aebstract

Members
  • Posts

    1,105
  • Joined

  • Last visited

Posts posted by aebstract

  1. That password part has to be there, without it anyone can select any plant and instantly have access.

     

     

     

    edit: I think from my original code that I posted here, it isn't putting the passwords in the correct rows because of the way I'm trying to order it or something?

  2. <?php 
    			$query = "SELECT `header` , `content` , `publication` , `month_of_article` , `year_of_article` FROM press_coverage ORDER BY year_of_article DESC" ;
    			If ($r = mysql_query ($query)) { 
    			//sending the query to the mySQL server
    			While ($row = mysql_fetch_array($r)) { 
    			//inputs the data into the table
    
    
    			$header = $row['header'];
    			$content = $row['content'];
    			$publication = $row['publication'];
    			$month_of_article = $row['month_of_article'];
    			$year_of_article = $row['year_of_article'];
    
    
    echo "<p>$header, $content, $publication, $blablabla whatever wahtever</p>";
    			?>
    

     

    So basically, what I am saying is: however you are outputting your content, wrap it in a paragraph tag, or a div or something and style it however you need.

  3. I added

                  while($r=mysql_fetch_array($result))
    		  {
    
    $password=$r["password"];
    
    $passpass = md5($_POST['password']);
    

     

    and the closing bracket after the error echo. I added this so that I could display the password from db, might be a better/easier way I am not aware of.

  4. wow, this must just not be my day. I tried adding a little bit so I can display both the password they are inputting, md5'd and the password from the db, now when I try to login, it just returns me to the same page.. no errors.. nothing. (password still filled in)

     

    <?php
    
    if(isset($_SESSION["id"]))
    {
    header("Location: index.php?page=acchome");
    exit();
    }
    
    
    if(!isset($_SESSION["id"]))
    {
    
    if (isset ($_POST['submit']))
    {
    
    $problem = FALSE;
    
    
          if (empty ($_POST['password'])) {
    $problem = TRUE;
    $error .= 'You must fill in a password <br />';
          }
    
    
    
    
    if (!$problem) {
    
    
    
    $result = mysql_query("SELECT id, plantloc, password, city, state, zip, street FROM plants WHERE id='".$_POST['dropdown']."' AND password='".md5($_POST['password'])."'") or die (mysql_error());
    if (mysql_num_rows($result) == 0)
                  {
    
                  while($r=mysql_fetch_array($result))
    		  {
    
    $password=$r["password"];
    
    $passpass = md5($_POST['password']);
    echo 'The pasword you entered did not match the plant location you chose.<br />
    your password: $passpass<br />
    db password: $password';
    
    			}
    
    } else {
    
                          $worked = mysql_fetch_array($result);
        			   	  $_SESSION["id"] = $worked[id];
    
    
    				if ($history == eqfps348){
    
                          header("Location: index.php?page=$history");
    
    				} else {
    
                          header("Location: index.php?page=accounthome");
    
    				}
    
    }
    
    
    }
    }
    }
    
    
    
    
    
    
    
    $content .= '<center><table><tr><td>
    
    <form action="index.php?page=login" method="post">
       Location:
       </td><td>
    
    <select name="dropdown">';
    
    	mysql_connect("localhost","berryequipment","gU8Kso8Y") or die(mysql_error());
    	mysql_select_db("berryequipment_net_db");
    
    $result = mysql_query("SELECT * FROM plants ORDER BY plantloc ASC") or DIE(mysql_error());
    while ($r=mysql_fetch_array($result)) {
    
    $id=$r["id"];
    $plantloc=$r["plantloc"];
    
    $content .= "<option value=\"$id\">$plantloc</option>\n";
    
    }
    
    
    $content .= '</select>
    
    
                 </td></tr><tr><td>
       Password:
       </td><td>
       <input type="password" maxlength="6" name="password" value="' . $_POST[password] . '" size="6" />
       </td></tr><tr><td></td><td>
       <input type="submit" name="submit" value="login" />
    </td></tr></table></center>
    
    </form>';
    
    
    ?>
    

  5. Got the same password did not match issue. You're just trying to fix the format of the way I did my query, but like I said (please read this part) this was working fine before I used the code in the first post on this topic. Here is what I used to put plants in to the database:

     

    <?php
    session_start();
    header("Cache-control: private");
    
    if (isset ($_POST['submit'])) {
    $problem = FALSE;
    
    
    
    if (empty ($_POST['plantloc'])) {
    $problem = TRUE;
    $error .= 'Must enter a plant location<br />';
    }
    
    
    
    mysql_connect("localhost","berryequipment","gU8Kso8Y") or die(mysql_error());
    mysql_select_db("berryequipment_net_db");
    
    
    if (!$problem) {
    
    $plantloc  = $_POST['plantloc'];
    $city  = $_POST['city'];
    $state  = $_POST['state'];
    $zip  = $_POST['zip'];
    $street  = $_POST['street'];
    $email  = $_POST['email'];
    $pt  = $_POST['pt'];
    
    $length = "6";
    $password = "";
    $possible = "0123456789bcdfghjkmnpqrstvwxyz";
    $i = "0";
    
    while ($i < $length) {
        $char = substr($possible, mt_rand(0, strlen($possible)-1), 1);
        if (!strstr($password, $char)) {
          $password .= $char;
          $i++;
        }
    
      }
    
    $password2 = md5($password);
    
    
    $result = MYSQL_QUERY("INSERT INTO plants (plantloc,password,city,state,zip,street,PT,email)".
    "VALUES ('$plantloc', '$password2', '$city', '$state', '$zip', '$street', '$pt', '$email')") or die (mysql_error());
    
    
                          header("Location: account2.php");
    
    } else {
    $content .= "$error";
    }
    }
    ?>
    
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <title>setup account</title>
    
    </head>
    
    <body>
    
    
    
    
    
    
    
    
    <?php
    $content .= '<form action="account2.php" method="post">
    <br />
    Plant Location: <br /><input type="text" maxlength="100" class="textfield" name="plantloc" size="40" value="' . $_POST[plantloc] . '" /><br /><br />
    Plant City: <br /><input type="text" maxlength="100" class="textfield" name="city" size="40" value="' . $_POST[city] . '" /><br /><br />
    Plant State: <br /><input type="text" maxlength="100" class="textfield" name="state" size="40" value="' . $_POST[state] . '" /><br /><br />
    Plant Zip: <br /><input type="text" maxlength="100" class="textfield" name="zip" size="40" value="' . $_POST[zip] . '" /><br /><br />
    Plant Street: <br /><input type="text" maxlength="100" class="textfield" name="street" size="40" value="' . $_POST[street] . '" /><br /><br />
    Plant Email: <br /><input type="text" maxlength="100" class="textfield" name="email" size="40" value="' . $_POST[email] . '" /><br /><br />
    Plant Type: <br /><input type="text" maxlength="100" class="textfield" name="pt" size="1" value="' . $_POST[pt] . '" /><br /><br />
    
    
    
    <input type="submit" name="submit" value="submit" class="textfield" /></form>';
    
    
    
    echo "$content";
    ?>
    
    
    
    
    </body>
    </html>
    
    

     

    from this I am going to the top post and resetting all passwords.

  6. Okay I'm having a bit of trouble with this. I echoed all these results to a blank page so I could print it out and have record of the passwords that the database saved. I know my login form works, cause I have tested it out before, but with a more manual way of inserting passwords, vs setting them all at once. Well now I have tried many of these passwords that this generated for me but nothing is matching up. Here is my login:

     

    <?php
    
    if(isset($_SESSION["id"]))
    {
    header("Location: index.php?page=acchome");
    exit();
    }
    
    
    if(!isset($_SESSION["id"]))
    {
    
    if (isset ($_POST['submit']))
    {
    
    $problem = FALSE;
    
    
          if (empty ($_POST['password'])) {
    $problem = TRUE;
    $error .= 'You must fill in a password <br />';
          }
    
    
    
    
    if (!$problem) {
    
    
    
    $result = mysql_query("SELECT id, plantloc, password, city, state, zip, street FROM plants WHERE id=('$_POST[dropdown]') AND password=('".md5($_POST['password'])."')") or die ("error");
                if (mysql_num_rows($result) == 0)
                  {
    echo 'The pasword you entered did not match the plant location you chose.';
    } else {
    
                          $worked = mysql_fetch_array($result);
        			   	  $_SESSION["id"] = $worked[id];
    
    
    				if ($history == eqfps348){
    
                          header("Location: index.php?page=$history");
    
    				} else {
    
                          header("Location: index.php?page=accounthome");
    
    				}
    
    }
    
    
    }
    }
    }
    
    
    
    
    
    
    
    $content .= '<center><table><tr><td>
    
    <form action="index.php?page=login" method="post">
       Location:
       </td><td>
    
    <select name="dropdown">';
    
    	mysql_connect("localhost","berryequipment","gU8Kso8Y") or die(mysql_error());
    	mysql_select_db("berryequipment_net_db");
    
    $result = mysql_query("SELECT * FROM plants ORDER BY plantloc ASC") or DIE(mysql_error());
    while ($r=mysql_fetch_array($result)) {
    
    $id=$r["id"];
    $plantloc=$r["plantloc"];
    
    $content .= "<option value=\"$id\">$plantloc</option>\n";
    
    }
    
    
    $content .= '</select>
    
    
                 </td></tr><tr><td>
       Password:
       </td><td>
       <input type="password" maxlength="6" name="password" value="' . $_POST[password] . '" size="6" />
       </td></tr><tr><td></td><td>
       <input type="submit" name="submit" value="login" />
    </td></tr></table></center>
    
    </form>';
    
    
    ?>

     

     

    Keeps returning my error of "The pasword you entered did not match the plant location you chose."

    This topic could have its own post but I decided to just keep it here.

  7. <?php
    
    mysql_connect("localhost","berryequipment","gU8Kso8Y") or die(mysql_error());
    mysql_select_db("berryequipment_net_db");
    
    
    
    echo "<table>";
    
    
    
    	$result = mysql_query("SELECT * FROM plants") or DIE(mysql_error());
    
    	$nmbrows = mysql_num_rows($result);
    
    	while($r=mysql_fetch_array($result))
    
    	{
    
    	$id=$r["id"];
    	$plantloc=$r["plantloc"];
    	$city=$r["city"];
    	$state=$r["state"];
    	$zip=$r["zip"];
    	$street=$r["street"];
    	$pt=$r["PT"];
    	$email=$r["email"];
    
    
    
    
    
    for ($newid = 1; $newid <= $nmbrows; $newid++) {
    
    $length = "6";
    $password = "";
    $possible = "0123456789bcdfghjkmnpqrstvwxyz";
    $i = "0";
    
    while ($i < $length) {
        $char = substr($possible, mt_rand(0, strlen($possible)-1), 1);
        if (!strstr($password, $char)) {
          $password .= $char;
          $i++;
        }
    
      }
    
    $password2 = md5($password);
    
    mysql_query("UPDATE plants SET password=$password2 WHERE id=$newid") or DIE(mysql_error());
    
    }
    
    
    echo "<tr><td>$plantloc</td><td width=10></td><td>$city, $state $zip</td><td width=10></td><td>$street</td><td width=10></td></tr>
    <br />$password
    <br />$email
    <br /><br />";
    
    
    
    
    }
    
    
    
    echo "</table>";
    
    
    
    ?>
    

     

    Suppose to simply update the password for every row in my table. Generating a new one for each account. Then I want it to all echo out in the page, this will be printed out one time and kept for reference to each account's password.

     

     

    I'm getting a white page with this:

     

    Unknown column 'c519880022deeb6d18a3aab3bbc27a6e' in 'field list'

     

  8. RewriteEngine On
    
    RewriteBase /
    
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^([A-Z]+)/$ /index.php?page=$1 [NC,L]
    RewriteRule ^([A-Z]+)/([0-9]+)/$ /index.php?page=$1&var1=$2 [NC,L]
    

     

    www.berryequipment.net

     

    If you click, for example, "featured product" you'll see this url and it works:

    http://www.berryequipment.net/index.php?page=featured

    though if you go to

    http://www.berryequipment.net/featured/

    you get a forbidden 403 error.. does anyone have any reasoning for why I'm coming up with this error?

  9. eh, I'm sorry for not being detailed enough.. wasn't intended, thought I was being so.

     

    Basically there is a link on a page, it goes to the login page. If the user logs in after clicking that link, it will take them back to that page. If they get to the login page any other way then it will just log them in normally. So far there are two pages that will have this special link, so two locations possible to go to from login rather than the normal home page. More could be added, so it needs to be something that is low maintenance and easy to add more pages to. I don't want it to always return to previous page on login though.

  10. Is there a way I can check and see if someone came from a specific page? Not to see what page they came from but just do like an if:

     

    if(user came from page 1) {

    do something

    } else {

    do something else

    }

     

    Really only need to check it from one page, might add 2-3 more but I can just run an elseif or something if I need to. Can anyone point me in the direct of checking if they came from a specific page or not? Let me know if my question isn't clear enough.

  11. Can you show the code that creates the email? I'm thinking when you set your email address for the from, you're using single quotations outside of your data, which is why it is giving you

    "joe@bloggs.com <P ALIGN=\"LEFT\"FONT FACE=\"Times New Roman\" SIZE=\"14\" COLOR=\"#000000\" LETTERSPACING=\"0\" KERNING=\"0\"/FONT/P>"
    

     

    In the last part, it seems you missed a < in front of your </p> so you're left with just the /p> If what I said about you putting this in single quotations is true, then you don't need the \ in front of the ". Seeing some code would help though!

  12. As for the last part of your question, the security measure so it isn't just joe@gmail.com in the url, run a md5 on their email and use that as the activation url. When someone goes to confirm.php and mail isset then you will change the row in the db that to activated.

     

     

    Quick example:

    if (isset($_GET['mail'])) {
    
    $result = mysql_query("UPDATE users SET confirmation='true' WHERE email=('".md5($_POST['mail'])."')") or DIE(mysql_error());
    
    echo "thanks for confirming your account";
    }
    

     

    Something like that..

     

     

    edit: after seeing above post, you won't need the registration_key as long as you're doing the md5. It's basically doing the same thing, they just don't really know what you're checking against.

  13. Well, with what he said being that sometimes the number may go backwards, meaning you would have to add a negative number to the starting number to reach your goal. Does it have to be formatted 1-2-3-4-5-6 or could it be (1)-(2)-(3)-(-4)-(5)-(6). I wasn't worried about the formatting of the numbers, just how to achieve the goal.  If it has to be formatted a certain way, then yes that needs to be mentioned and made apparent as, if like you stated, it has to be 1-2-3-4-5-6, then you couldn't have a negative unless you had --4.

×
×
  • 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.