Jump to content

wildteen88

Staff Alumni
  • Posts

    10,480
  • Joined

  • Last visited

    Never

Everything posted by wildteen88

  1. What do you mean by left to right? Do you mean they go across the page? Rather than go down the page? If you want them to go down the page do: <p><input type="checkbox" name="delete" value="yes"> YES<br /> <input type="checkbox" name="delete" value="No">No</p>
  2. In that case you'll need to modify the script which performs the login/registration operation which I assume is dologin.php and doregistration.php Looking at your form all you need to do is md5 the $_POST['p'] variable in the files suggested above. The md5 hash will need to be stored in your users table of course this should be done in doregister.php. Appling md5 encryption to passwords will be no different to what you have now. All you need to do is run the md5() function on whatever variable holds the password.
  3. chnage return "<option {$selected} value=\"{$h}\"> {$h} </option>"; } to $html .= "<option {$selected} value=\"{$h}\"> {$h} </option>"; } return $html;
  4. read my post here:
  5. HTML Attribute values should always be wrapped in quotes: echo '<option value="'.$value.'">'.$value . '</option>';
  6. Maybe the tutorials/guides on this site help you. They are guides HP-Unix 11
  7. Does both your XP desktop and VISTA laptop connect to a (wireless/wired) router? If so use your Desktops Internal LAN address (eg 192.168.2.101) on your vista laptop to connect ro your XP WAMP installation (eg http://192.168.2.101 rather then http://localhost). You may need to configure the firewall you use on XP to accept connections from your LAN
  8. I assume you are checking the version of MySQL through the page generated by the phpinfo() function? If so phpinfo does not return the version of the MySQL server installed but the version of the MySQL Client API (which is libmysql.so). The Client API should match the version of MySQL you have installed. In order to get a newer client API PHP will need to be upgraded.
  9. Yes those values are fine. This seems to me that something else is installed and is using port 80. Apache uses port 80 by default to listen for http requests. I assume you are using Windows too? If so then go to Start > All Programs > Apache HTTP Server > Configure Apache Server > Edit the Apache httpd.conf Configuration File. Apaches httpd.conf file should now be open in your text editor, normally Notepad. Goto line 46, which should be like the following: Listen 80 Change the number 80 to 8080. Now save the httpd.conf (Ctrl+S or File > Save). In order for the changes to come into affect Apache will need to be restarted. Now open your browser and go to http://localhost:8080/ instead. You should get an "It Works" page.
  10. Post more code, include your query too.
  11. I agree its an overkill but I tried to keep it simple. Plus mine limits the values $_GET['guide'] can be set to.
  12. PHP can create files if they don't exists with the fopen fwrite and fclose functions. Read the docs on these functions specifically the various modes fopen accepts. You'll need to make sure the directory you are creating the file in has sufficient write permissions.
  13. $_SERVER['DOCUMENT_ROOT'] returns the full file path to your websites document root (where you upload your html/php files to etc). if you echo $_SERVER['DOCUMENT_ROOT'] it'll display your websites document root path, example path would be something like /home/yourite.com/public_html/ strtolower() converts the string defined in $_GET['guide'] to lowercase characters.
  14. I'd do this: if(isset($_GET['guide'])) { $path = $_SERVER['DOCUMENT_ROOT'] . '/guides/php/'; switch($_GET['guide']) { case 'Install': case 'Syntax': case 'Variables': case 'Date': case 'Include': case 'Cookies': case 'Sessions': case 'DB_Intro': case 'Insert': $path .= strtolower($_GET['guide']) . '.php'; break; default: $path .= 'intro.php'; break; } include $path; }
  15. Loop through your array using a foreach loop <?php $data = array(); $data[0]['id'] = 'LB8053'; $data[0]['name'] = 'test'; $data[0]['firstName'] = 'test'; $data[0]['middle'] = 'L.'; $data[1]['id'] = 'R86321'; $data[1]['name'] = 'test2'; $data[1]['firstName'] = 'test2'; $data[1]['middle'] = 'A.'; // connect to mysql first here foreach($data as $key => $qry_arr) { $keys = array_keys($qry_arr); $values = array_map('mysql_real_escape_string', array_values($qry_arr)); $qry = 'INSERT INTO tbl_name ('; $qry .= '`' . implode('`, `', $keys) . '`) VALUES ('; $qry .= "'" . implode("', '", $values) . "')"; echo '<p>Running query: <pre>' . $qry . '</pre>'; mysql_query($qry) or die(mysql_error()); echo 'Success!</p>'; } ?>
  16. The package manger will be whatever came with your linux distribution. I think running '/configure <options>, make, and make' install again would be better then running 'make uninstall'.
  17. Sorry I am not an experience unix user. But How was PHP installed initially? from the source code or some Unix package manager. If you installed from source code then just run the ./config, make, make install procedure to recompile the PHP binaries with your amendments and everything should be updated. You should be able to run 'make uninstall' to remove the compiled binaries though If you used a package manager then no need to unistall/recompile PHP everything is handled by the package manager itself. Jst select what extensions you want installed and it'll do all the work for you.
  18. With GingerRobots suggestion <?php include 'header.php'; mysql_query('UPDATE `members` SET `password`=md5(`password`)'); echo 'Passwords reset. DELETE THIS SCRIPT NOW DONOT RERUN.'; ?>
  19. I wasn't sure whether to use that query as I thought Mysql will set all passwords to the md5 hash of the string '`password`' (minus the quotes) and not the value of the password field. However after testing this my thoughts where wrong. I found out why my code wasn't working correctly though. The following line: while(list($username, $password) = mysql_fetch_row(mysql_query('SELECT username, password FROM members'))) actually causes an infinity loop
  20. Umm. That shouldn't be much of an issue with that script I provided.
  21. Do you have many passwords in your database? It shouldn't cause too much of problem.
  22. not you cannot decrpty md5 hashes. md5 is a one way encryption. In order to decrypt the hash you'll need to use brute force or a dictionary attack which will take log time to do. Why do want to decrypt a password? Is to retrieve the orginal password if the user has forgotten it? I do not recommend this method. Instead what you should do is reset the password to a random one and provide the new password to the user. There are many tutorials out there which shows how to create random passwords
  23. Missed of a closing parenthesis on line 6, corrected code <?php include 'header.php'; while(list($username, $password) = mysql_fetch_row(mysql_query('SELECT username, password FROM members'))) { mysql_query('UPDATE members SET password='.md5($password).' WHERE username="'.$username.'"'); } echo 'Passwords reset. DELETE THIS SCRIPT NOW DONOT RERUN.'; ?>
  24. Yeah sorry. Forgot to include the php tags Corrected code: <?php include 'header.php'; while(list($username, $password) = mysql_fetch_assoc(mysql_query('SELECT username, password FROM members')) { mysql_query('UPDATE members SET password='.md5($password).' WHERE username="'.$username.'"'); } echo 'Passwords reset. DELETE THIS SCRIPT NOW DONOT RERUN.'; ?>
  25. No. Just create new php file call it md5passwords.php and add the above code to it. Upload to your website where your other PHP scripts are and go to yoursirte.com/md5passwords.php Nothing will be outputted so don't refresh the page or anything. Now delete the file from your site. Existing passwords should still work.
×
×
  • 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.