Jump to content

SFB

Members
  • Posts

    282
  • Joined

  • Last visited

Posts posted by SFB

  1. It all depends on you php abilities. if you are a good programer like lets say justsomeguy for example, it would probably take you lessthan a week days spending 2-3 hours on it a day. if you were me it would take about a week and a half at 2-3 hours a night. it also depends on how good you are at debuging scripts. EDIT: I would start by looking at getting familiar with the php mail function or whatever you are going to use to send the newsletter. then i would make a form and have php process and send it . then you can work on making things fancy!

  2. ok thanks, I got it working for the most part. I still have to do some more scripting like mabey at least encoding the passwords so i dont read them. and on the profile/changeprofile page i have to do the scrip for changing the password. I am going to have them type in the old one then type in their new one then confirm the new one. my site is sometimes on and sometimes not. it will probably be online for a larger chunk of time (like forever) by the end of this week. anyways if you look between 5 hours ago and now it should be online. well anyways take a look at the login script http://snowforts.ath.cx/loginEdit: WELL ANYWAYS! ha ha :):blink::):) I just noticed that i "like" said that alot lately.

  3. what would i change in php.ini that would make sessions always start so i wouldnt have to use session_start(). I have heard of people doing this but i havnt seen where to do it.another thing can i reset things in an array like i can with variables?if so how would i do this in my case. I would rather not mess up my files event though i have a backup.

  4. hey dan, how are you trying to create this file? i would just open it even though it isnt ther and then write a message like mitch does. I am using the same type of server and i dont have all the problems you do. mabye it is because i have my server installed as a service on windows and you are using fedora core 5 but that shouldnt make much difference.

  5. ok everything seems like it should work but it doesnt. what would this error meanParse error: syntax error, unexpected T_STRING, expecting ']' in C:\Program Files\xampp\htdocs\login\register.php on line 11what should i be looking at on line 11Edit: here is my script

    <?php$username = $_POST['username'];$password = $_POST['password'];$conpassword = $_POST['conpassword'];$name = $_POST['name'];$lname = $_POST['lname'];$email = $_POST['email];if(($username != "") && ($password !="") && ($email !="") && ($password == $conpassword)){include_once('C:/Program Files/xampp/htdocs/userdata.php');$newuser = array();$newuser['username'] = "$username";$newuser['password'] = "$password";$newuser['first'] = "$name";$newuser['last'] = "$lname";$newuser['email'] = "$email";$users[] = $newuser;function write_users(){ global $users; $str = "<" . "?php\n"; $str .= "\$users = array();\n\n"; for ($i = 0; $i < count($users); $i++) {   $str .= "\$newuser = array();\n";   $str .= "\$newuser['username'] = \"" . $users[$i]['username'] . "\";\n";   $str .= "\$newuser['password'] = \"" . $users[$i]['password'] . "\";\n";   $str .= "\$newuser['first'] = \"" . $users[$i]['first'] . "\";\n";   $str .= "\$newuser['last'] = \"" . $users[$i]['last'] . "\";\n";   $str .= "\$newuser['email'] = \"" . $users[$i]['email'] . "\";\n";   $str .= "\$users[] = \$newuser;\n\n"; } $str .= "?" . ">"; if (!$handle = fopen("users.php", "w")) {   echo "We are sorry please go back and try Registering again.  If this problem occurs again please contact the administrator<!--fopen-->";   exit; } if (fwrite($handle, $str) === FALSE) {   echo "We are sorry please go back and try Registering again.  If this problem occurs again please contact the administrator<!--fwrite-->";   exit; }  fclose($handle);}write_users();}else{Print"Please check to make sure that all fields were filled in Corectly!";}?>

  6. That's all you need to do.  When you include the file, it creates an array called $users that contains all the users, right?  So you can use the code I gave you last time to create a function that writes the file.  You don't need to read what's in the file, you are overwriting it each time with the current $users array.
    function write_users(){  global $users;  $str = "<" . "?php\n";  $str .= "\$users = array();\n\n";  for ($i = 0; $i < count($users); $i++)  {    $str .= "\$newuser = array();\n";    $str .= "\$newuser['username'] = \"" . $users[$i]['username'] . "\";\n";    $str .= "\$newuser['password'] = \"" . $users[$i]['password'] . "\";\n";    $str .= "\$newuser['first'] = \"" . $users[$i]['first'] . "\";\n";    $str .= "\$newuser['last'] = \"" . $users[$i]['last'] . "\";\n";    $str .= "\$newuser['email'] = \"" . $users[$i]['email'] . "\";\n";    $str .= "\$users[] = \$newuser;\n\n";  }  $str .= "?" . ">";  if (!$handle = fopen("users.php", "w"))   {    echo "Cannot open the users file for writing";    exit;  }  if (fwrite($handle, $str) === FALSE)   {    echo "Cannot write to the users file";    exit;  }   fclose($handle);}

    Then you can just make a call to write_users() whenever you want to save.

    so all i would have to do is add include('userdata.php'); somwhere in the file and then when i want to save a new user i could call the function. I got another question too. i never really understood how something like
      $str = "<" . "?php\n"; $str .= "\$users = array();\n\n"; for ($i = 0; $i < count($users); $i++) {   $str .= "\$newuser = array();\n";   $str .= "\$newuser['username'] = \"" . $users[$i]['username'] . "\";\n";

    works. what is the purpose of the str .="stuff" I understand the purpose in the first line so php doesnt think you are starting another php thing inside of itself. well i guess what i want is a link to something that explains the .= and "stuff" . "otherstuff" and how to properly use them

  7. o well i will clarify myself by telling you what i do in my scriptfirst i open the file then i read itthen i remove the end of php (?>)then i add the new arraythen i place the end php symbol (?>) at the endthe i write the data over the exzisting file. i dont want to do it this way. somehow i want to take the data i have and just write a file. mabey somehow i could include my userdata.php file and then rewrite the exzistign arays and then add the new one.

  8. Well, if you are saving your data in a file, then ultimately you do have to write the file.  The variables thing is to save you the headache of reading everything back in.  You can also create your own little data management class to help you write the file automatically, but yeah, you will have to write the data to the file, you just write PHP code instead of the raw data.  So, using my example from post 7, the code would be something like this:
    $str = "<" . "?php\n";$str .= "\$users = array();\n\n";for_each_user{  $str .= "\$newuser = array();\n";  $str .= "\$newuser['username'] = \"" . $username . "\";\n";  $str .= "\$newuser['password'] = \"" . $password . "\";\n";  $str .= "\$newuser['first'] = \"" . $first . "\";\n";  $str .= "\$newuser['last'] = \"" . $last . "\";\n";  $str .= "\$newuser['email'] = \"" . $email . "\";\n";  $str .= "\$users[] = \$newuser;\n\n";}$str .= "?" . ">";//write $str to the file

    So, yeah, if you are storing your data in a file there's really no way to get around actually writing the file, you have to do that regardless.  But if you do it this way, you don't have to do any extra work to read all the data in.

    I am confused on how this works. do i just use this for the new user or do i include the userdata.php file and it will re write it for me. i realize i will have to add a fwrite and the things that go with that function. I want a way to write data to this file without opening it taking the data and then removing parts and placing them back after i add the new data. This sounds confusing but i hope you will understand.
  9. i guessed that people wouldnt undersand. well rember when i was working on a login script. I should have just posted it in that one. I will go back to that topic and things be more clear again.

  10. I was wondering if there was a way to write data in a file just before ?>. It would be helpfull. I could just remove ?> and putt it back in when i write over the file again but I dont feel like doing it that way.

  11. I think you could use css and set the margin left to auto and the margin right to auto and it should center it if the margins are the same. It works for tables i havent tested it on a frame though.

  12. Oh no! not an image!....His site was image free. lol dan you will have to show this to me sometime it sounds like it would look very funny. you could also try getting those charictors using php. i think there was something like char(); or chr(); but i could be wrong.

  13. I have been making the necessary changes to make my pages into xhtml. one thing i have found is that the browsers change how they read a page by the doctype. anyways now the <div> tag has a line break after it like the <p> did in html. this is happening for me in IE, Opera, and firefox it may be more browsers but those are all the ones i have. I was wondering if there was a way to remove the line break that is automatically added. or i could settle with another tag that does the same thing without the line break. i am using css to change the style of some words and now when switching to xhtml i have line breaks in places they are not needed.

  14. how do i store the data in variables in file? you make it seem like i dont even have to write to that file. if there is a better way to add the variables to the file that the variables are sored in please tell me now!

×
×
  • Create New...