Jump to content

OGirly

Members
  • Posts

    16
  • Joined

  • Last visited

    Never

Everything posted by OGirly

  1. haha! Machine coding? Totally failed that the first time I took it I had to retake both of my assembly language courses, haha, and I was even specializing in computer engineering (hence my requirement to retake these course lol...sorta important when dealing with device drivers and OS"s ). A CS degree is fine, but sometimes they make you learn a whole lot more than you'll ever use since it's sort of a general degree in :computing theory: for the most part; if your already in the industry why not just learn languages, and build a portfolio? Not to mention, college is ridiculously expensive now a days, but if your thinking about going have you considered a university? CSSFreakie: I know how you feel, without sounding too strange I've literally wished many times to be able to "plug" in knowledge as they do in the matrix lol Anyone can learn anything about computers, it just takes time...lol...wouldn't it be sooo nice if we could skip the 'time' part .
  2. Ha! I will avoid this for sure then. Thanks so much for the advice, it helps! Esp. the manual I may be adding that to my bookmark bar for a few weeks The top down approach makes a whole lot of sense, I know I was having problems before that I think we're caused by jumping in and out of queries and printing data... It's a new structure to get used to. I"m starting to see though, why php has such a huge following; as you learn it, it's really really intuitive to start working with (lol..not of the libary functions have "strange" names ). Thanks all for the kind welcome, I'm really looking forward to getting a better understanding of PhP with your guys help! ~alice
  3. Can I give my two cents? Learn C++ before going back and learning C; you may develop some bad habits or styles with C that may hinder you from really getting the most out of C++. The book they had me read when I was in school (like 2008ish) was "The C++ Programming Language, Third Edition by Bjarne Stroustrup". Pretty decent read, and a really in depth look at C++, it's features, the standard library etc. Although, it sort of assumes you have a basic understanding of programming concepts (OOP, Modular etc), so just be ready to do some outside research if your working through this title. Also, http://www.learncpp.com/ , is a decent web page to really just "get started" etc. with programming; but it's not going to take you all the way to finishing real projects. Learn C++, it's fun and it never hurts to know another language. Any "programming" language will help you with another, just working with the concepts in general (in any language, environment) will help build you into a better programmer. As far as knowing C++ and PhP don't count on them 100% translating lol...I was sooooo used to working in Strong Static env. that when I started PhP I get my variable's mixed up all the time b/c I'm struggling with that for some reason :\, although it probably will be easier to go into a SS environment vs coming into a PhP like one :\. Good luck with it, if you have any questions as your starting out feel free to message Best wishes, ~ alice
  4. yeppers works perfectly here as well! Don't you hate when things work on others machines but not your own, it's like Best wishes, ~ alice
  5. haha thanks! The name was a nickname I picked up in school since I was the only girl in my Comp Theory class, and I'm well sorta super girly (I think it may have annoyed some of them lol). It's stuck though, and I've sorta adopted it as a forums/net/gamertag lol Nice to meet you (btw I must have watched clueless about 100 times when I was younger!! although not sure if that's the origin of your name ).
  6. Hello I guess a little about my background? I'm new to PhP, but I do have a background in C, C++ etc. I have a few certs mostly through school :\ (linux+, microsoft vista lol b/c we all had to get it for school etc), and a BA in computer Science. I've sorta done the quick O'Reilly training as far as any studying of php (learning PhP5, and Programming PhP are the two titles I've read so far :\), as well as working through the php.net manual...so I really do mean I'm NEW to PhP. I'm extremely excited about it though (a friend of mine was like "why don't you know this already?") a few weeks ago, and she let me borrow her books. I"m hooked! I sorta know Ruby, and have a background in Pearl and just never got around to learning this; but php seems like a lot of fun to work with. For some reason I've gotten off to a rough start with it, but after playing around with it I am starting to feel really dumb for not learning this sooner I have some background with MySql as well, but my programming education wasn't really "web" intensive...so forgive me if I make some errors :\ A friend of mine and I are working on a website together as a "learning project" as we both try to get a better grasp of the language so please don't be surprised if you see a few post from me in the next few weeks. Currently a homemaker while my partner is finishing up her school simply because a computer science degree is not usable for much in Ohio compared to San Fran where we are originally from. Moving back in a year though, thank god! So I'm hoping to get a good understanding of PhP before heading back out west. I'm a rambler...if you can't tell...so I try to keep my posts mainly to code bah! or else you'd hear whole my life story lol....22yrs...hmm..that's about it? Just felt like saying hey and giving a quick introduction. Looking forward to getting to know some of you ~alice
  7. hey! I'm from Cali too (currently in Ohio for my partners school blah..but :\) nice to meet you I'm from San Fran; you?
  8. we'll it's working now; so I"m going to assume that the last post has some typeo that I've since caught. Thank you for all your help; you have no idea how helpful you've been! Looking forward to learning this language a bit more seems pretty great! ~alice
  9. Okay, so here's what I have now, pretty much just the changes you recommended; it's making progress. If I redirect to somewhere like google lets say it works just fine, but if I redirect back to the page with a ?vnsufac sent to allow an admin to just accept or reject another user it does not update any of them temporiarily it will stop them from showing, but it will not update them in the database. It will appear that all three have been done, but again...none are. If i have it redirect to somewhere like google. The one that I did does get updated, and it finally will update the last one; but never if I redirect to the ogirly_staff_homepage.php or ogirly_staff_homepage.php?vnsufac=1. Something must be going screwy here...here's the code...again thanks for helping with this. At least it's inputting the data. It's pretty similar to before; just made the clean ups you recommended etc. Still not sure why it's not working when I redirect back to the site though... :\ (Processing form is the second bit of code posted) <?php if(isset($_GET[vnsufac])){ // simply prints the back home button echo "<form action=\"http://localhost/~atharp1122/OGirly_Site/ogirly_staff_homepage.php\" method=\"post\">" ."<input type=\"submit\" value=\"Back to Staff Homepage\" style=\"margin-top:10px;\"></form>"; // perform database query, create arrays for each unverified staff request $UNVSRA = array(); ogirly_db_connect(); $UNVSRA = mysql_query("SELECT username, email, firstname, lastname FROM staffUNAP WHERE verified_email = 1 AND verified_staff = 0"); // print the form per entry while($row = mysql_fetch_assoc($UNVSRA)){ echo '<div class="newVerifyUserContain" >'; echo '<div class="newVerifyUser">'; echo '<form action="http://localhost/~atharp1122/OGirly_Site/process_staff.php" method="post">'; echo 'USERNAME: ' . $row['username']; echo '<input type="hidden" name="usrname" value="' . $row['username'] . '">'; echo '<input type="submit" name="approve" value="approve">'; echo '<input type="submit" name="reject" value="reject">'; echo '</form></div></div>'; }close_connection($ogirly_db_connection); } ?> <?php if(isset($_POST[approve])){ if(isset($_POST['usrname'])){ $usrname = isset($_POST['usrname']) ? (string) $_POST['usrname'] : FALSE; ogirly_db_connect(); $query = "UPDATE staffUNAP SET verified_staff = '1' WHERE username = '{$usrname}'"; mysql_query($query); if(mysql_error()){ echo mysql_error(); close_connection($ogirly_db_connection); } else{ close_connection($ogirly_db_connection); //echo "usrname = " .$usrname; header("location: http://localhost/~atharp1122/OGirly_Site/ogirly_staff_homepage.php?vnsufac"); } } else{ echo "usrname not set";} } else{ echo "no post data sent";} ?>
  10. I tried that and it's still not working; for some reason it will always insert the data except for the last one; even on a different file...grrrr... I have something at the end that's telling me that there are no more users that are unverified after I go through and accept everyone, but when I go to look at the database(and upon reload of the page) the last one that I clicked approve on (regardless of order in the print out it could have been the first, second third etc) will not submit; but it's also not giving me any sql errors at all...what could be happening here?? This is the new file, the processing file: <?php include("constants/ogirly_db_login_constants.php"); ?> <?php if(isset($_POST[approve])){ if(isset($_POST['usrname'])){ $usrname= $_POST['usrname']; ogirly_db_connect(); $query = "UPDATE staffUNAP SET verified_staff = '1' WHERE username = '{$usrname}'"; mysql_query($query); close_connection($ogirly_db_connection); if(mysql_error()){ echo mysql_error(); } else{ header("location: http://localhost/~atharp1122/OGirly_Site/ogirly_staff_homepage.php"); } } } else{ echo "No POST SENT"; } ?> and here is the other file: <?php if(isset($_GET[vnsufac])){ // simply prints the back home button echo "<form action=\"http://localhost/~atharp1122/OGirly_Site/ogirly_staff_homepage.php\" method=\"post\">" ."<input type=\"submit\" value=\"Back to Staff Homepage\" style=\"margin-top:10px;\"></form>"; // perform database query, create arrays for each unverified staff request $UNVSRA = array(); ogirly_db_connect(); $UNVSRA = mysql_query("SELECT username, email, firstname, lastname FROM staffUNAP WHERE verified_email = 1 AND verified_staff = 0"); $request_counter = 0; while($UNVSRA2[$request_counter] = mysql_fetch_assoc($UNVSRA)){ $data[$request_counter] = array('0' => $UNVSRA2[$request_counter][username], '1' => $UNVSRA2[$request_counter][email], '2' => $UNVSRA2[$request_counter][firstname], '3' => $UNVSRA2[$request_counter][lastname], '4' => $request_counter); // print the form per entry print "<div class=\"newVerifyUserContain\" >"; print "<div class=\"newVerifyUser\">"; print "<form action=\"http://localhost/~atharp1122/OGirly_Site/process_staff.php\" method=\"post\">"; print "<ul><li>"; echo "USERNAME: {$data[$request_counter][0]}<li>" ."<li><input type=\"hidden\" name=\"usrname\" value=\"{$data[$request_counter][0]}\"></li>" ."<li><input type=\"submit\" name=\"approve\" value=\"approve\"></li>" ."<li><input type=\"submit\" name=\"reject\" value=\"reject\"></li>"; print "</ul>"; print "</form>"; print "</div>"; print "</div>"; $request_counter++; }close_connection($ogirly_db_connection); } ?> here's the login program that is on the page the data is input into; it has a notification of new staff user requests that appears in the login div, and it keeps track of any unverified requests. It counts down, even disappearing after I click on the last user..but it's not actually updating to the database. This is really holding me back on finishing this last bit of this project..I really have no idea why it's not working I really appriciate your help on this, because I"m totally at a loss at what to do and it's been like three days (four really I tried for a day and a half before contacting the forums) and I still can't figure this out...omg soooo frustrating It seems like what I am trying to do should be SO simple :\ <?php //Staff Login // Check for Logout if(isset($_POST[logout])){ unset($_SESSION[username], $_SESSION[login], $_SESSION[staffLogin], $_SESSION[admin]); } // Check for previous Login if(isset($_SESSION[login]) && $_SESSION[staffLogin] == 1){ if($_SESSION[admin] == 1){ check_unverified_staff(); } else{ check_unverified_staff(); } echo "<form action =\"{$_SERVER[php_SELF]}\" method=\"post\" style=\"padding-top: 60px;\" >"; echo "Logged in as {$_SESSION[username]}<br/>"; echo "<input type=\"submit\" name=\"logout\" value=\"Logout\"></form>"; } // Check for new login elseif(isset($_POST[username])){ if((preg_match("/^\w{4}\w{1,11}\w$/", $_POST[password])) && (preg_match("/^\w{4}\w{1,13}\w$/", $_POST[username]))){ ogirly_db_connect(); $loginQuery = mysql_query("SELECT password, verified_staff, verified_admin FROM staffUNAP WHERE username = '$_POST[username]'"); $loginArray = mysql_fetch_array($loginQuery); close_connection($ogirly_db_connection); if($loginArray[0] == $_POST[password] && $loginArray[1] == 1){ $_SESSION[username] = $_POST[username]; $_SESSION[login] = 1; $_SESSION[staffLogin] = 1; // check to see if admin : if admin, post admin notices if($loginArray[2] == 1){ $_SESSION[admin] = 1; check_unverified_staff(); } //end admin check echo "<form action =\"{$_SERVER[php_SELF]}\" method=\"post\" style=\"padding-top: 60px;\" >"; echo "Logged in as {$_SESSION[username]}<br/>"; echo "<input type=\"submit\" name=\"logout\" value=\"Logout\"></form>"; } else {print_login_form();} } else {print_login_form();} } // First time visit/Default Action/Logout Action else {print_login_form();}
  11. Thank you, I will try that when I get home today. I'm sort of used to working with C++ so I thought PhP would be super easy, I feel like an ass now for thinking so. I seem to also be getting variables messed up etc. as I'm used to a really strict environment, this is quite a bit different. I'll try the two files and see if I can't figure out the problem by splitting it up as you recommended. <?php include("".XXX); ?> to include the new file correct?
  12. if(isset($_POST[approve])){ $usrname = isset($_POST['usrname']) ? (string) $_POST['usrname'] : FALSE; mysql_query("UPDATE staffUNAP SET verified_staff = 1 WHERE username = '$usrname'"); } ^ is what I am using to put it into the database; and yes username is spelled usrname in this case; it is intentional.
  13. hmm...no it's still not inserting the last one to be approved. All of the other ones, I set it to about four test users etc, they all get approved; just not the last one. At first it appears to go away, but it's not set in the database. :\
  14. actually, the above works, up until the last posting. It will update everyone as we go, but for the final person it will not update them...any ideas?
  15. You solved it! Here's how I did it in the end; hopefully someone else can use this too...great help! Thanks again <?php if(isset($_GET[vnsufac])){ // simply prints the back home button echo "<form action=\"http://XXXXXXXXX.php\" method=\"post\">" ."<input type=\"submit\" value=\"Back to Staff Homepage\" style=\"margin-top:10px;\">"; // perform database query, create arrays for each unverified staff request $UNVSRA = array(); XXXXX_db_connect(); $UNVSRA = mysql_query("SELECT username, email, firstname, lastname FROM staffUNAP WHERE verified_email = 1 AND verified_staff = 0"); $request_counter = 1; while($UNVSRA2[$request_counter] = mysql_fetch_assoc($UNVSRA)){ $data[$request_counter] = array('0' => $UNVSRA2[$request_counter][username], '1' => $UNVSRA2[$request_counter][email], '2' => $UNVSRA2[$request_counter][firstname], '3' => $UNVSRA2[$request_counter][lastname], '4' => $request_counter); // print the form per entry print "<div class=\"newVerifyUserContain\" >"; print "<div class=\"newVerifyUser\">"; print "<form action=\"{$_SERVER[php_SELF]}\" method=\"post\">"; print "<ul><li>"; echo "USERNAME: {$data[$request_counter][0]}<li>" ."<li><input type=\"hidden\" name=\"username\" value=\"{$data[$request_counter][0]}\"></li>" ."<li><input type=\"submit\" name=\"approve\" value=\"approve\"></li>" ."<li><input type=\"submit\" name=\"reject\" value=\"reject\"></li>"; print "</ul>"; print "</form>"; print "</div>"; print "</div>"; $request_counter++; }close_connection($XXXXXXXX_db_connection); } if(isset($_POST[approve])){ $username = isset($_POST['username']) ? (string) $_POST['username'] : FALSE; echo $username; } ?>
  16. You know for some reason I've never even encountered the ternary operator before, but it seems extremely useful is cases like this, or setting variables to user input etc! I'll post the php.net link to it as well so others can read (pretty much at the bottom of the comparison operators page (again a mystery why I've never even at least read about this (even in the O'Reilly books I"ve had to read though). Hmm...I think this should solve the problem; I'm going to work on it now, so I'll let you know! here's the php.net link if anyone would like to read about this: (again at the bottom of the page http://php.net/manual/en/language.operators.comparison.php
  17. Are you talking about when you put the data into the database, or retrieve it. If retrieve, maybe this? (php and mysql...you can adjust etc.) $Requster_Name = "Cris"; $query = mysql_query('SELECT Request_Approvers FROM table_Name WHERE Requster_Name = $Requster_Name'); $approvers = mysql_fetch_array($query); echo "$approvers[0]" ."$approvers[1]";
  18. well I thought this would be really easy..but I"m still stumped and it's honestly starting to be really frustrating. I can get the forms to print with the values displaying for each individual user. I can also get the usernames, emails, first/last names etc into an array. I"m trying to have this search my database for any unverified staff requests, then allow an admin to verify each user (and set if they are an admin) one user at a time; not submitting every user each time. Why is this so hard? I guess it doesn't make sense, the unique name fields. How do I know which field to search for? if I set each fields name individually how do I search for an isset? ie please excuse punctuation not using a text editor for this: if(isset($_GET[verifyStaff])){ $requestCounter = 1; $checkForUnverifiedStaff = mysql_query("SELECT username, email, firstname, lastname FROM staffUNAP where verified_staff = '0'"); while($unverifiedStaff = mysql_fetch_array($checkForUnverifiedStaff)){ print "<div class=\"containVerify\">; print "<div class=\"staffVerify\">; echo "<h3>Would you like to verify this user?</h3>"; echo "<form action=\"{$_SERVER[php_SELF]}\" method\"POST\">" ."<input type=\"checkbox\" name=\"isAdmin{$requestCounter}\" value = \"1\">Is Admin?" ."<input type=\"hidden\" name=\"username{$requestCounter}\" value = \"{$unverifiedStaff[0]}\"> ."<input type=\"submit\" name=\"verifyNewStaffUser{$requestCounter}\" value =\"verify\">" . "</form>"; print "</div></div>"; } } if(isset($_POST[??? What do I search for here? I don't know which user they are trying to verify :X ???)){ this is where I get stuck I don't know how to retreive a post variable I don't know the name for in a case like this I can't just do isset($_POST[$requestCounter]) } ack..I'm soooo frustrated...I hate to say this but this issue has brought me to tears I have no idea what I am not getting about this...I am feeling really confused and I"m about ready to give up...bah! Three days on this..I just don't know what to do...I thought I understood what you guys said but I guess not...do you guys understand what I'm trying to do? Am I being clear? Sometimes I"m not very good at that...please help me I"m pretty desperate to get this project finished
  19. Oh thank you so much!! I totally missed that!! I will fix it with this today when I start working, and I'll post this as solved when I get it to work, along with the solved code! Thanks so much you two!! ~ Alice
  20. I usually hate to post something like this as a first post...I'd like to at least do an into but I"m stumped and I think it's a totally stupid thing I"m not noticing. Anyway, this is the final step in a three step user verification; this is for a staff user to be verified. Anyway, by now they have already verified their email and entered a random code so I"m only worried about actually setting them to verified status in my database so they can start working on blogs etc. Anyway, this form is supposed to find all unverified staff members, and allow an admin to easily just click down the list (one at a time currently) and verify the user (ie. setting their database status to verified_staffUser). The username that is supposed to be verified (or declined and therefore their entry deleted) is supposed to be passed through as $_POST[vnsupUsername]. This is set each time it loops through and prints a new user. The problem is that it's only sending the final username when I click verify/decline on any user :\. I"m not sure why it's doing this. In firebug on firefox it's showing that the user name is set for each one to be properly in the form...but when I click on it (I am having on my machine) the username being worked with echoed..and it's always the last one that was entered into the database. I have no idea why this is happening ..any thoughts? <?php if(isset($_GET[vnsufac]) || isset($_POST[svnsu]) || isset($_POST[dvnsu])){ // simply prints the back home button echo "<form action=\"http://localhost/~atharp1122/OGirly_Site/ogirly_staff_homepage.php\" method=\"post\">" ."<input type=\"submit\" value=\"Back to Staff Homepage\" style=\"margin-top:10px;\">"; // this will print out the form to verify/deny all new staff user requests that have been email verified $programCheckUVStaff = mysql_query("SELECT username, email, firstname, lastname FROM staffUNAP where verified_staff = '0'"); while($UVStaff = mysql_fetch_assoc($programCheckUVStaff)){ print "<div class=\"newVerifyUserContain\" >"; print "<div class=\"newVerifyUser\" >"; echo "<h3 style=\"text-align: center;\">Would you like to verify this Staff request?</h3>"; echo "<table><tr><td>" ."<img src=\"images/default_icons/di_bunny_rabbit.png\" width=\"56\" height=\"59\" />" ."<ul style=\"padding-left: 100px; padding-bottom: 20px; margin-top: -42px; list-style-type: none;\"><li>" ."{$UVStaff[username]} aka {$UVStaff[firstname]} {$UVStaff[lastname]}</li><li>" ."{$UVStaff[email]}</li></ul></td></tr><tr><td>" ."<form action=\"{$_SERVER[php_SELF]}\" method=\"post\">" ."<input type=\"checkbox\" name=\"isadmin\" value=\"1\" style=\"margin-left: 10px;\">Is Admin?" ."<input type=\"hidden\" name=\"vnsupUsername\" value=\"{$UVStaff['username']}\">" ."<input type=\"submit\" name=\"svnsu\" value=\"Verify Staff\" style=\"margin-left: 200px;\">" ."<input type=\"submit\" name=\"dvnsu\" value=\"Decline Request\">"; print "</table>"; print "</div></div>"; } } // verify a staff member if(isset($_POST[svnsu])){ echo "verifying a new user"; echo $_POST[vnsupUsername]; } ?>
×
×
  • 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.