NamePros
Welcome, Guest! Ready to make a name for yourself in the domain business? We welcome both the hobbyist and professional domainer to join the discussion as part of the NamePros community.

Click here to create your profile to start earning reputation for posting, and trader ratings for buying & selling in our free e-marketplace. Build your trader rating with each successful sale. Our system has tracked over 100,000 sales and counting!
FAQ & TOS Register Search Today's Posts Mark Forums Read

Go Back   NamePros.com > Website Development Discussion Forums > Programming
Reload this Page Reset a remote string [+rep, +NP$]

Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics.

Advanced Search


Closed Thread
 
LinkBack Thread Tools
Old 02-24-2006, 11:44 AM THREAD STARTER               #1 (permalink)
NamePros Regular
 
cvxdes's Avatar
Join Date: Oct 2005
Location: Milford MA
Posts: 692
cvxdes has much to be proud ofcvxdes has much to be proud ofcvxdes has much to be proud ofcvxdes has much to be proud ofcvxdes has much to be proud ofcvxdes has much to be proud ofcvxdes has much to be proud ofcvxdes has much to be proud ofcvxdes has much to be proud ofcvxdes has much to be proud of
 



Reset a remote string [+rep, +NP$]


Im making a SQL-Less CMS in a certant sence, and i need a function to update the password var in another file. Does anyone know a function to do this?

I'll add rep to people who try to help, and donate some NP$
cvxdes is offline  
Old 02-24-2006, 02:43 PM   #2 (permalink)
Senior Member
 
Eric's Avatar
Join Date: Mar 2005
Posts: 4,948
Eric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatness
 

Member of the Month
MOTM September 2005
Save a Life Child Abuse 9/11/01 :: Never Forget Baby Health Marrow Donor Program AIDS/HIV Breast Cancer Animal Rescue Cystic Fibrosis Ethan Allen Fund Animal Cruelty Ethan Allen Fund Ethan Allen Fund Baby Health Cancer Alzheimer's Protect Our Planet Cancer Survivorship SIDS Child Abuse Diabetes Protect Our Planet Multiple Sclerosis Autism Adoption Special Olympics
Hmm... Could have it required to enter both the old password and new password, then do something like below:

PHP Code:
<?php
????: NamePros.com http://www.namepros.com/programming/170827-reset-a-remote-string-rep-np.html

$file 
"data/blah/passwords.txt";

$fp fopen($file"w");
$data fread($fpfilesize($file));
$data2 str_replace($old_pwd$new_pwd$data);
fwrite($fp$data2);
fclose($fp);

?>
Not sure on that, but maybe you can get something from it
Eric is offline  
Old 02-24-2006, 05:40 PM THREAD STARTER               #3 (permalink)
NamePros Regular
 
cvxdes's Avatar
Join Date: Oct 2005
Location: Milford MA
Posts: 692
cvxdes has much to be proud ofcvxdes has much to be proud ofcvxdes has much to be proud ofcvxdes has much to be proud ofcvxdes has much to be proud ofcvxdes has much to be proud ofcvxdes has much to be proud ofcvxdes has much to be proud ofcvxdes has much to be proud ofcvxdes has much to be proud of
 



^Thanks. I got this idea:

PHP Code:
$pass1 file("/home2/****/passwords.txt");
$user1 file("/home2/****/usernames.txt");
$pass $pass1[count($pass1)-1];
$user $user1[count($user1)-1];
$info = array(
'pass' => $pass,
'user' => $user,
); 
And in the admin file,
PHP Code:
$filename "/home2/****/passwords.txt";
  
$fp fopen($filename,'a');
????: NamePros.com http://www.namepros.com/showthread.php?t=170827
????: NamePros.com http://www.namepros.com/showthread.php?t=170827
  
fputs($fp,$input['password']);
  
fclose($fp);
  
?> 
thanks anyways though.
cvxdes is offline  
Old 02-24-2006, 09:56 PM   #4 (permalink)
NamePros Regular
 
Jim_'s Avatar
Join Date: Aug 2005
Location: NY, USA
Posts: 610
Jim_ is a splendid one to beholdJim_ is a splendid one to beholdJim_ is a splendid one to beholdJim_ is a splendid one to beholdJim_ is a splendid one to beholdJim_ is a splendid one to behold
 


Save The Children
I would store user data in a flatfile like this:
id|level|username|passwordhash|email|otherinfo
ex:
Code:
0|admin|admin|098f6bcd4621d373cade4e832627b4f6|blah@test.com|blah
1|user|bob|098f6bcd4621d373cade4e832627b4f6|blah@test.com|blah
2|user|joe|098f6bcd4621d373cade4e832627b4f6|blah@test.com|blah
Then you could ask for the old password and new password, then do something like
PHP Code:
<?php
$userid 
1;
$oldpass "oldpass";
$newpass "newpass";
????: NamePros.com http://www.namepros.com/showthread.php?t=170827

$userdb file("./users.txt");
$editfile fopen("./users.txt""w"); 
foreach (
$userdb as $line) {
  
$userarray explode("|",$line);
  if(
$userarray[0]!=$userid) {
    
fwrite($editfile,$line); 
  } else {
    if(
$userarray[3]==md5($oldpass)){
      echo 
"Password successfully changed!";
      
fwrite($editfile,$userarray[0]."|".$userarray[1]."|".$userarray[2]."|".md5($newpass)."|".$userarray[4]."|".$userarray[5]."\n"); 
????: NamePros.com http://www.namepros.com/showthread.php?t=170827
    } else {
      echo 
"You did not supply the correct password.";
      
fwrite($editfile,$line); 
    }
  }
}
?>
__________________
ask me about the internet
Jim_ is offline  
Old 02-24-2006, 11:59 PM   #5 (permalink)
Dan
Buy my domains.
 
Dan's Avatar
Join Date: Feb 2006
Posts: 2,796
Dan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant future
 


Autism Autism Autism Autism Autism Autism Autism
Jim is good at flat file stuff >_<

He's made flatFileHost, started flatBB, and I think his tagger is flat.
Dan is offline  
Old 02-25-2006, 10:10 AM THREAD STARTER               #6 (permalink)
NamePros Regular
 
cvxdes's Avatar
Join Date: Oct 2005
Location: Milford MA
Posts: 692
cvxdes has much to be proud ofcvxdes has much to be proud ofcvxdes has much to be proud ofcvxdes has much to be proud ofcvxdes has much to be proud ofcvxdes has much to be proud ofcvxdes has much to be proud ofcvxdes has much to be proud ofcvxdes has much to be proud ofcvxdes has much to be proud of
 



Originally Posted by Jim_
I would store user data in a flatfile like this:
id|level|username|passwordhash|email|otherinfo
????: NamePros.com http://www.namepros.com/showthread.php?t=170827
ex:
Code:
0|admin|admin|098f6bcd4621d373cade4e832627b4f6|blah@test.com|blah
1|user|bob|098f6bcd4621d373cade4e832627b4f6|blah@test.com|blah
2|user|joe|098f6bcd4621d373cade4e832627b4f6|blah@test.com|blah
Then you could ask for the old password and new password, then do something like
????: NamePros.com http://www.namepros.com/showthread.php?t=170827
PHP Code:
<?php
$userid 
1;
$oldpass "oldpass";
$newpass "newpass";

$userdb file("./users.txt");
$editfile fopen("./users.txt""w"); 
foreach (
$userdb as $line) {
  
$userarray explode("|",$line);
  if(
$userarray[0]!=$userid) {
    
fwrite($editfile,$line); 
  } else {
    if(
$userarray[3]==md5($oldpass)){
      echo 
"Password successfully changed!";
      
fwrite($editfile,$userarray[0]."|".$userarray[1]."|".$userarray[2]."|".md5($newpass)."|".$userarray[4]."|".$userarray[5]."\n"); 
    } else {
      echo 
"You did not supply the correct password.";
      
fwrite($editfile,$line); 
    }
  }
}
?>

How would i make that multiple users?

like if i wanted to do $userid = $input['id']; how would i?
cvxdes is offline  
Old 02-25-2006, 10:34 AM   #7 (permalink)
NamePros Regular
 
Jim_'s Avatar
Join Date: Aug 2005
Location: NY, USA
Posts: 610
Jim_ is a splendid one to beholdJim_ is a splendid one to beholdJim_ is a splendid one to beholdJim_ is a splendid one to beholdJim_ is a splendid one to beholdJim_ is a splendid one to behold
 


Save The Children
I don't get what you're asking. :S
__________________
ask me about the internet
Jim_ is offline  
Old 02-25-2006, 10:58 AM   #8 (permalink)
A Wealth of Knowledge
 
stscac's Avatar
Join Date: Aug 2004
Posts: 3,809
stscac has much to be proud ofstscac has much to be proud ofstscac has much to be proud ofstscac has much to be proud ofstscac has much to be proud ofstscac has much to be proud ofstscac has much to be proud ofstscac has much to be proud of
 



Flat file has its pros and cons.

One example for each is below

PRO: Simpler than MySQL or other database types
CON: A limited number of simultaneous connections can be made than a true database.

-Steve
stscac is offline  
Old 02-25-2006, 11:09 AM   #9 (permalink)
NamePros Regular
 
Jim_'s Avatar
Join Date: Aug 2005
Location: NY, USA
Posts: 610
Jim_ is a splendid one to beholdJim_ is a splendid one to beholdJim_ is a splendid one to beholdJim_ is a splendid one to beholdJim_ is a splendid one to beholdJim_ is a splendid one to behold
 


Save The Children
Another option would be SQLite.
__________________
ask me about the internet
Jim_ is offline  
Old 02-25-2006, 01:31 PM THREAD STARTER               #10 (permalink)
NamePros Regular
 
cvxdes's Avatar
Join Date: Oct 2005
Location: Milford MA
Posts: 692
cvxdes has much to be proud ofcvxdes has much to be proud ofcvxdes has much to be proud ofcvxdes has much to be proud ofcvxdes has much to be proud ofcvxdes has much to be proud ofcvxdes has much to be proud ofcvxdes has much to be proud ofcvxdes has much to be proud ofcvxdes has much to be proud of
 



Nevermind, lol. I think i got it... I'll post back in an hour
cvxdes is offline  
Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools


Liquid Web Smart Servers  
All times are GMT -7. The time now is 05:13 AM.

Managed Web Hosting by Liquid Web
Domain name forum recommended by Domaining.com Powered by: vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.6.0 Ad Management plugin by RedTyger