Jump to content
Old threads will finally start getting archived ×

LisaDee

Members
  • Posts

    12
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

LisaDee's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Is this somehow easy to add later on into my script. because at the moment i have no clue how to do it. I'll crack on things what i know first i think.
  2. yes i was thinking to leave it simple on those job numbers. As in this demo shows exactly what u where saying. I think this is the right syntax for mysql >>> ID int NOT NULL AUTO_INCREMENT, PRIMARY KEY (ID) ??? Yes and that makes sense too to change a status to deleted and just need to hide from rest of them, valid ones. ok finally getting somewhere now @ Psycho Do u have any suggestions on 2. question about multi user thing?
  3. i think this is basically similar to invoicing. when numbers should be in order. and further i planing when row is deleted it will be moved to secondary DB where admin can revive and delete it completely. Just thinking what will happen with primary DB job_number if i'll move it out. It will be duplicate isn't it? Don't know if i'll be able pull all this off i'm not very good with php. ok i can add text part separate as label or so and then. don't know which would be the best way to approach all this
  4. No it's not a homework it's kinda my side project for job registration system. I understand it is not a Primary ID. It will be something e.g JobNR00001, JobNR00002 etc. or JobNR1, JobNR2 etc. don't know which way is better presume 2nd as i don't know how many records i will have.
  5. Hi all, May be could someone guide me what i should look into for to accomplish my goal for new DB, I've not event started search on google as I don't know what to look for. For example I'll use DB with user records and information. 1) I need to add specific ID e.g 1,2,3...10 etc to DB but if last ID is 10 and i deleted it then next new ID should be 10 again but if I delete ID 3 or any ID before last ID 10 then next new ID should be 11. If that makes sense! 2) How to control / prevent if more then 1 user try to edit same record? Thanks
  6. I don't use ircmaxell's lib. I use http://www.php-login.net and he uses ircmaxell lib . License says: "Licensed under MIT. You can use this script for free for any private or commercial projects.". Any ways I it use for non commercial, for training purpose only. And like I said I'm new to PHP it's easier for me to get bits of code and modify them to see how they work then learn from them.
  7. ty all for ur help. looks like all is working.
  8. ye figured out, i had to change these lines as well to get it work. $user_password = $_POST['newpassword']; $newpassword = $_POST['newpassword']; $repeatnewpassword = $_POST['repeatnewpassword']; $user_password = password_hash($newpassword, PASSWORD_DEFAULT); mysql_query("UPDATE users SET user_password_hash='$user_password', ... Just 1 more thing please how do i add checking for a empty password - e.g. if empty echo "please insert password"
  9. P.S. as per doddsey_65 suggestion I added line on top require_once('../libraries/password_compatibility_library.php'); and now it is inserted password into DB w/o error but it is not hashed - plain password e.g. 123456
  10. it doesn't use any tag 'include' for the function but i thought the function is in 'session'. The full login scrip is here . There u can see that /libraries/password_compatibility_library.php holds a function password_hash and in /classes/Registration.php uses same password_hash function without any 'includes'.
  11. wow that was fast response i was about to go sleep. Cheers!!! kk added error check to code and ive got an error: Call to undefined function password_hash() in edit_pwd.php on line 40 hmm ive got password_compatibility_library.php in ../library/ for that function, why it didn't recognised it? And does the actual code looks ok? @off i'll change it 2morrow
  12. Hi I'm quite newbie with php. Im trying to add password change to existing login script and stuck on a problem with password change code. May be someone could help me out here please. Can't figure out where is the problem, why it doesn't insert the hashed password - getting some error after submit ( blank page). i noticed problem is between lines 32 and 47 I've tried with md5 and it worked (inserted md5 pwd into DB) but my login don't recognise md5 as it reads password_hash passwords. <?php session_start(); include('menu.php'); require_once('../config/db.php'); //strip and trim slashes function clear($message) { if(!get_magic_quotes_gpc()) $message = addslashes($message); $message = strip_tags($message); $message = htmlentities($message); return trim($message); } // include the configs / constants for the database connection $con = mysql_connect(DB_HOST, DB_USER, DB_PASS) or die("Could not connect: " . mysql_error()); mysql_select_db(DB_NAME); if(!$_GET['user_id']) { $query = mysql_query("SELECT * FROM users ORDER BY user_id DESC") or die(mysql_error()); } else { if ($_POST['submit']) { $user_name = clear($_POST['user_name']); $user_fname = clear($_POST['user_fname']); $user_lname = clear($_POST['user_lname']); $user_id = $_GET['user_id']; $user_password = $_POST['newpassword']; $newpassword = $_POST['newpassword']; $repeatnewpassword = $_POST['repeatnewpassword']; // crypt the user's password with PHP 5.5's password_hash() function, results in a 60 character // hash string. the PASSWORD_DEFAULT constant is defined by the PHP 5.5, or if you are using // PHP 5.3/5.4, by the password hashing compatibility library $user_password_hash = password_hash($newpassword, PASSWORD_DEFAULT); //check two new passwords if ($newpassword==$repeatnewpassword) { //successs //change password in db mysql_query("UPDATE users SET user_password_hash='$newpassword', user_name='$user_name', user_fname='$user_fname', user_lname='$user_lname' WHERE user_id='$user_id'"); mysql_close(); die("Your password has been changed. <a href='index.php'> Return</a>"); } else die("New password doesn't match!"); } else { $user_id = $_GET['user_id']; $query = mysql_query("SELECT * FROM users WHERE user_id='$user_id'"); $row = mysql_fetch_assoc($query); ?> <form action="?user_id=<?php echo $row['user_id']; ?>" method="post"> <input type="hidden" name="ID" value="<?php echo $row['user_id']; ?>"> user ID: <input type="text" name="user_name" value="<?php echo $row['user_name']; ?>"><br> First Name: <input type="text" name="user_fname" value="<?php echo $row['user_fname']; ?>"><br> Last Name: <input type="text" name="user_lname" value="<?php echo $row['user_lname']; ?>"><br> New Password: <input type='password' name='newpassword'><p> Repeat New Password: <input type='password' name='repeatnewpassword'><p> <input type="Submit" name="submit" value="Enter information"> </form> <?php }} ?> thanks!
×
×
  • 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.