Jump to content

deved

Members
  • Posts

    50
  • Joined

  • Last visited

Everything posted by deved

  1. If you're talking about retrieving the data from a MySQL database you could use the 'ORDER BY' command.To redirect a user try placing <meta http-equiv="Refresh" content="5;url=http://www.newsite.com"> in the head section of your page.
  2. Managed to test your scripts and they worked for retrieving data (thanks), however couldn't enter PASSWORD() into the mysql.`user` table, without first entering as either md5 or sha1, then could use the UPDATE/SET commands to change to PASSWORD() encryption (also found the mysql server had to be restarted before the new password would work).
  3. I've called the function in MySQL Query Browser and it will return the result, however is there a way to make it work within PHP like the md5 & sha1 encryption methods? All I found on the php.net site was the latter two.
  4. I'm using the mysql.user table to authenticate users, and apparently it uses PASSWORD() as the encryption method.I can use PHP to insert users and passwords using either md5 or SHA1, but not the PASSWORD() method. Where it falls down is when authenticating a user it doesn't recognize the non-PASSWORD method, and therefore doesn't allow access.Does anyone know how to enable PHP to use the PASSWORD() encryption method, or can this encryption method be changed in MySQL to say md5 or sha1.Cheers
  5. deved

    Blank screen

    I couldn't get mysqli to work either until adding this line 'extension=php_mysqli.dll' below the 'extension=php_mysql.dll' line in the Dynamic Extensions section of the php.ini file, also making sure the semicolon was removed from the beginning.
  6. deved

    PHP5 on IIS6

    If you haven't given up entirely, there is another change you may need to make in your php.ini file under 'Dynamic Extensions', and that is to remove the semicolon; from the begining of the ;extension=php_mysql.dll line which apparently loads the extension automatically.The php_mysql.dll file goes into your c:\php5\ext folder and the libmysql.dll file goes into the c:\php5 folder.Well at least they've worked for me on the few occasions I've had to install both PHP & MySQL.
  7. deved

    Selecting Tables

    How do you set the value to hidden if value has already been used ie. <input type="text" name="name" value="$var">I'm also having trouble finding info on sessions. Could you tell me how far off the mark this is?Insert the <?php session_start(); ?> before the <html> tag (is this required on each page)?Insert$_SESSION['user'] = $user;$_SESSION['pass'] = $encrypted_pass;on the following page somewhere after the $_POST, $user & $encrypted_passSorry for all the questions, but I've tried a number of tutorials and they're a bit vague in this department.
  8. deved

    Selecting Tables

    Would it then be possible to send the result of echo $row['job'] to another page using $_POST without using fields in a form? If that makes any sense.
  9. deved

    Selecting Tables

    Problem sorted. Ended up running a more specific query that matched information from both tables.It would be useful however, if information retrieved and echoed, such as the "echo $row['job']; line, could then be used in another query, as in the line $result = mysql_query("SELECT * FROM {$tbl} WHERE Job='job'");. I'm sure there's a way and with more experience will probably be able to work it out.Thanks for all your help to now tho. while($row = mysql_fetch_array($result)){echo "<h3>Job Number</h3>";echo $row['job'];}$result = mysql_query("SELECT * FROM {$tbl} WHERE Job='job'");while($row = mysql_fetch_array($result)){echo $row['data'];
  10. deved

    Selecting Tables

    I checked and there is data in the field.I also entered a lineecho "DATA";aboveecho $row['data'];which didn't show upIn the 2nd $result line I've tried linking Job='job' to the line echo $row['job']; could this be the cause?Could the result at line echo $row['job']; be turned into a variable, which can then be used in the 2nd query?Have just tested and its definately the link between Job='job' and echo $row['job']; by removing the WHERE function, and all the data including heading DATA showed.
  11. deved

    Selecting Tables

    if($radioresult == "something"){ $table = "table1a"; $tbl = "table1b";} Can u tell me why this doesn't work (I only get the result from the first query). <?php$con = mysql_connect("localhost","name","password");if (!$con) {die('Could not connect: ' . mysql_error());}mysql_select_db("dBase", $con);$acc = $_POST['acc'];$radio = $_POST['area'];if ($radio == "input1"){$table = "table1a"; $tbl = "table1b";}else if ($radio == "input2"){$table = "table2a"; $tbl = "table2b";}$result = mysql_query("SELECT * FROM {$table} WHERE account='$acc'");while($row = mysql_fetch_array($result)) { echo "<h3>Job Number</h3>"; echo $row['job']; } $result = mysql_query("SELECT * FROM {$tbl} WHERE Job='job'");while($row = mysql_fetch_array($result)) { echo $row['data']; }?>
  12. Have entered a close friend (helgetta), who would love to date you (not sure if she fits your criteria tho).
  13. deved

    Selecting Tables

    Can 2 tables be specified from the 1 result such as: if($radioresult == "something"){ $table = "table1a" && $tbl = "table1b";}else if($radioresult == "something else"){ $table = "table2a" && $tbl = "table2b";} I'm trying to retrieve data from a row of one table by using data in a row from the second table. The link is a column in both tables that has identical data.
  14. You mention validating a form using PHP. Could you advise on how this is done, or point me in the right direction?
  15. deved

    Selecting Tables

    Thanks for that. Sorry aspnetguy, still a bit new to PHP and sometimes can't work out the code unless it hits me in the face. Cheers.
  16. deved

    Selecting Tables

    Sort of, but instead of using the 2 radio buttons to perform a query within the table... actually using the 2 radio buttons to select one of 2 tables, then executing other queries.
  17. deved

    Selecting Tables

    Is it possible to select different tables within a database in MySQL based on the input from a form?If so, could anyone advise on what commands are required to make it work with radio buttons.Any help would be much appreciated.
  18. If the password is encrypted on the database, is there a way of decrypting it, to forward on to a forgetful user?Disregard that question (you would obviously create a form to extract the data) I can find any reference to 'mysql_fetch_assoc' , what's the advantage over 'mysql_fetch_array'?
  19. Thanks for your suggestions so far (am currently inserting the code into the pages). I have another question regarding validating the forms with PHP. Is it possible?
  20. What, if I set up the connection to the database with a user account that has limited functionality and encrypt the password, as well as encrypting the passwords in the database, it would help with security?I'm still fairly new to MySql, so will read up on meta tables, and also where you mention the standard installation that has users & passwords already set up.Thanks
  21. Apologies for rehashing an old post, but after much searching on sites such as php.net, webmonkey etc, I was able to create a login page based on a single table containing the username & password fields.It all seems to work ok, but could anyone in the know, advise if there is a security loophole with this script, as I'm unable to send sessions or cookies to the server.<?php// Define variables$user = $_POST['user_name'];$pass = $_POST['password'];// Connect to database $dbh=mysql_connect ("localhost", "user_name", "password") or die ('I cannot connect to the database because: ' . mysql_error());mysql_select_db ("my_database");// Encrypt the password.$encrypted_pass = md5($pass);$result = mysql_query("SELECT * FROM table WHERE user_name='$user' AND password='$pass'");// If successful returnif($row = mysql_fetch_array($result)) { echo "<center>"; echo "Hello"; echo "<br />"; echo $row['user_name']; echo "<br />"; echo $row['comments']; echo "</center>"; }// Or else displayelse { echo "You are not authorized to view this page"; echo "<br />"; echo "Please hit the back button and enter your login details again"; }?>Many thanks
  22. I have 2 MySql database - 1 is the username & password table, the 2nd is information which will be extracted using PHP to an htm page once the user has logged in once their information matches db1
  23. deved

    PHP Tutorial

    I'm a newbie PHP student and see a lot of sites that require logins to access information companies have about individuals such as, ISP's, banks, hosting providors, etc.On your 'web building' page for developers under the Server Side Scripting section, you mention 'Provide security and access control to different Web pages'Could a tutorial be done on this?
  24. I'm also trying to create a login.php that requires users to login for access to htm pages that contain data from tables.I've created a htm page where users can submit comments, and am pretty sure I can retrieve this data from the same table and display in a htm page, however can't write the login.php that gives access to this page. I assume this process would stop just anyone from accessing this page?Any help would be appreciated.
×
×
  • Create New...