Jump to content

trq

Staff Alumni
  • Posts

    30,999
  • Joined

  • Last visited

  • Days Won

    26

Posts posted by trq

  1. Php runs on the server so cannot mix with java[b]script[/b] (client-side) as you have descibed. You will need to have the javascript code request your php script from the server, or maybe look into using ajax.
  2. [!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]no luk is it anythig to do with md5?[/quote]
    Could be a number of things. You might need to manually view the differences and see.
    [code]
    <?php

      $pass = md5("PUTYOURPASSHERE");
      $user = "PUTUSERNAMEHERE";

      $result = mysql_query("SELECT `password` FROM band WHERE `username` = '$user'";
      if ($result) {
        $row = mysql_fetech_assoc($result);
        echo "password from db = {$row['password']}</ br>";
        echo "md5'd password given = $pass</br >";
      }

    ?>
    [/code]
  3. You probably shouldn't let a user know which of there username or password failed, this can open up security holes. Without it, we can also get this all done in one query and therefore less work on the database.
    [code]
    <?php

      session_start();
      include 'db.php';

      if (!empty($POST['username']) && !empty($_POST['userpass'])) {
        $user = trim($_POST['username']);
        $pass = md5(trim($_POST['password']));
      } else {
        $error = "Invalid Username or Password combo!";
        include 'login.html';exit();
      }

      $sql = "SELECT * FROM band WHERE username = '$user' AND `password` = '$pass'";
      $result = mysql_query($sql) or die(mysql_error());
      if ($result) {
        $user = mysql_fetch_assoc($result);
        
        $_SESSION['userid'] = $user['id'];
        $_SESSION['username'] = $user['username'];
        $_SESSION['email']= $user['email'];
        $_SESSION['prov'] = $user['prov'];
        $_SESSION['name'] = $user['name'];
        $_SESSION['style'] = $user['style'];
        $_SESSION['hist'] = $user['hist'];
        $_SESSION['infl'] = $user['infl'];
        $_SESSION['open'] = $user['open'];
        $_SESSION['photo'] = $user['photo'];
        $_SESSION['webs'] = $user['webs'];
      
      } else {
        $error = "Invalid Username or Password combo!";
        include 'login.html';exit();
      }

    ?>
    [/code]
    Also... do you really need all that stuff in a session?
  4. Well really, the only thing wrong with your code is there is no error checking. Try...
    [code]
    $sql = "SELECT * FROM band WHERE username='$user'";
    if ($result = mysql_query($sql)) {
      $user = mysql_fetch_assoc($result);
      if (md5($pass) != $user['password']) {
        $error = "Invalid password.  Try again.";
      } else {
        echo "success";
      }
    } else {
      echo mysql_error();
    }
    [/code]
  5. Most likely your query isn't stisfied. Maybe something like this would be more effective.
    [code]
    mysql_query("
      SELECT * FROM $usertable
      WHERE ($metode = '%$search%' OR '%$search2%')
      OR ($metode2 = '%$search%' OR '%$search2%')
    ");
    [/code]
  6. To be honest, I dont think you could justify the switch. If they already have time invested in there current environment, php really has nothing more to offer over .NET. (ps ASP.NET is either developed in C# or VB.NET)

    If the reason for your argument is simply to win a developement contract, then im sorry to say, but I really believe youv'e an uphill battle on your hands.

    The only real benifit I could see is the openess of php and the systems it will run on. If these guys are even remotely interested in open source technoligies, this may be your best angle. Be warned though... alot of bigger companies are still very scared of committing to open source, and this approuch may also do more harm than good.

    Just my 2 cents.
×
×
  • 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.