Jump to content

kn0wl3dg3

Members
  • Posts

    61
  • Joined

  • Last visited

    Never

Everything posted by kn0wl3dg3

  1. Correct. It's the mechanism that makes OOP in PHP relatively painless. Ok, got it. Unfortunately, I don't think that's what I'm after (or at least I don't recognize it as such) I'm sorry for all the confusion guys, I guess I don't know how to word what I'm looking for. I was more curious about using a single instance of a class throughout several scripts. Is this something I'm missing in autoload?
  2. Ok, I just read that link. Correct me if I'm wrong: Autoloading takes away the nuisance of including a bunch of classes, correct?
  3. Sorry. Access a class over multiple files. Just wondering how it's usually handled. Is there a way, or do you just remake the class on each page.
  4. @ajlisowski: I get that. That's what I thought the answer would be. I'll look into serializing, but only with an educational mindset This wasn't about any particular issue I'm having, but I do use dbs for that, so I appreciate the advice. Can you clarify what you mean here? @Muddy_Funster It wasn't really any particular issue, just wondering how it's done. Basically it was the login scenario that started the line of thought. Do I write in a login method, only to instantiate a user class in the login page just to call that one method, store a session and pass it over to another script that instantiates another class? Do I skip all that login stuff, do it proceduraly, and make the class once I get where the info is needed? Those kind of thoughts started flying through my mind so I asked Thanks for the replies to both of you
  5. This may sound like a very stupid question, but I can't find a clear answer anywhere. I'm making my first dive in OOP and all the tutorials only really show basic usage. They define a class, and show how to use it in a file. My question is how does it work to use an object throughout a program? Is it available everywhere or do I store things in sessions and start a new object on each page? For example: logging in a user. If I created an instance after confirming the credentials, would that same instance be available for use in say index.php, or would I just pass a session over and create a new instance on each page? Again, sorry if this seems dumb to some people.
  6. Update: Ok, got it. It was a jquery call that wasn't using https.
  7. Actually, it's only 5 files. (Of about 50). They're all in front of the login..weird Any ideas anyone? The rest work without the annoying alert.
  8. Update: I got my https working with a mod-rewrite in the .htaccess file. Now, the only problem is that it pops up that annoying warning about content being delivered securely every time I open a page.. Is there any way to get rid of that?
  9. How does that differ from this code I found online? RewriteEngine On RewriteCond %{HTTPS} !on RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} Is one better than the other? I just have a login page that sets a session variable, then checks for it on the pages I want restricted. Thanks for your help
  10. Google just pops up a hundred versions of the same script; just managed to confuse me. Thanks for the link, I'll check it out.
  11. Our admin just added ssl to our site, and now I need to make it work. Problem is, I've never used it before. I've tried to do some reading but there's a lot of conflicting info out there. I know I can just add https to all my links, but I have them as relative links and that would require alot of time and rewriting code to use absolute urls. I also read something about doing it in the .htaccess file, but I've never edited that either so I'm out of my comfort zone here. I do think this would be the best way though, since it would not require rewriting anything, and would be the most expandable. I don't need all my pages to be secure, just anything past our login. Does anyone have any advice, ideas, or resources to help me out?? Thanks for reading
  12. The live site is not up yet, so I would only be able to show you a demo. This is far as I can get anyone in: http://wpocmhra.convergencehealth.com/Default.aspx?tabid=3908&caltid=wpo163444738&nrcun=wpo163444738&nrcpw=wpo163444738 All I want to do is get rid of the hideous blue background. It doesn't match our scheme and sticks out like a sore thumb. They won't change anything so I'm trying to find a way around it. Thanks for reading
  13. Access is not something that can happen, its something that doesn't face outward, its purchased by the head and regulated. What I can do first thing in the morning is to grab a screenshot and grab some of their html if that would help. Thanks for the response
  14. That might be a good option. I'll have to find out what language their system is in (if they'll tell me ) Going to look into those suggestions. Thanks. If anyone thinks of anything else, let me know.
  15. I thought it was. Oh well. I want to alter someone's css but only for users coming from my site. It comes from a vendor who we asked all those questions and no, we can't make any changes. But as I explained, we got permission to try a hack if it doesn't mess anything up. The answer to the last question is no, we're doing a pass through single sign on right now, where we just pass them over to their site with credentials. My one idea was an iframe, but I know for a fact that they have all kinds of tracking stuff in there so I need to make sure there would be no residual harm in doing it that way. I can't see any, but they are tight-lipped as to how they do what they do, and I'm waiting on a response if they think that would be an option. They have been notoriously hard to work with in the respect of changing things, and I have no say in using the vendor or not, so I need to find a way around them. I just need other ideas Thanks
  16. Is there a way to inject css into a website? Here's the scenario: We contract with a vendor to get part of our offerings. They did a redesign, and we don't like the new background color. We asked, and they said they can't change it because it would change it for every client. So we asked if we would be ok finding a way to inject a new bg color into the css, they said sure, which leads me here. Is there a way to do this? All I want to do is change the background color for our users. Hope this makes sense. Any ideas/help is appreciated. Thanks
  17. I do believe it is! Thank you I tried it on the exact query that I noticed the error and it brought the correct results. I'll test more but mark it solved cause I think it is
  18. I hope so!! Ill try it asap
  19. Need help with a query I've got this code SELECT Name, Time, Description FROM Table WHERE ID = ANY (SELECT ID FROM LinkList WHERE Link LIKE '%term%') OR Name LIKE '%term%' OR Technique LIKE '%term%' OR Origin LIKE '%term%' OR Time LIKE '%term%' AND User_ID='1' OR Public=1 But its not returning the right results well it is but not the results i want I want to get the records that match the term ONLY when the last two are met. Is there a way to group this with () or something? I've tried group by but its not getting what I think should be the right results. So it should get any ids that have the term in them but only if it matches the userid OR if public is 1. Please help
  20. Thank you! I had to make two minor tweaks, but it was exactly what I needed. I don't know why I didn't think to try the array assignments in another order! Can't thank you enough! Here's what worked: foreach ($_POST['udata'] as $record_id => $fields) { $sql = "UPDATE test SET "; $field_data = array(); foreach($fields as $name => $value) { $value = mysql_real_escape_string($value); $field_data[] = "$name = '$value'"; } $sql .= implode(', ', $field_data); $sql .= " WHERE id=$record_id"; $result = mysql_query($sql, $conn) or trigger_error("SQL", E_USER_ERROR); }
  21. Been trying since I posted earlier...no luck. Can anyone please help?
  22. Hi I found a tutorial on dealing with databases here: http://www.phpfreaks.com/tutorial/php-basic-database-handling It's great, except that I need it to do more than just a name; I need first, last, dob and email. I have it figured out how to order, insert and delete, but can someone help me figure out how to do the updating? The tutorial creates an array called cname and loops through it to do the update, but when I add more fields, it only holds the last fileds (emails in this case) I just need to be able to update all the fields for each user instead of just the name. Sounds easy but I've gotten nowhere Everything I have tried is posted below. Any help? Thanks // INSERT: if we have a name to add... if($_POST['fname']) { // little bit of cleaning... $fname = mysql_real_escape_string($_POST['fname']); $lname = mysql_real_escape_string($_POST['lname']); $dob = mysql_real_escape_string($_POST['dob']); $email = mysql_real_escape_string($_POST['email']); // check for previous entry $sql_check = "SELECT id FROM test WHERE fname='$fname' AND lname='$lname'"; $res_check = mysql_query($sql_check, $conn) or trigger_error("SQL", E_USER_ERROR); if (mysql_num_rows($res_check) == 1) { while ($row = mysql_fetch_assoc($res_check)) { $id = $row['id']; } // update $sql = "UPDATE test SET Current=1 WHERE id='$id'"; $res = mysql_query($sql, $conn) or trigger_error("SQL", E_USER_ERROR); } else { // insert new name into table $sql = "INSERT INTO test (id, fname, lname, dob, email) VALUES ('', '$fname', '$lname', '$dob', '$email')"; $result = mysql_query($sql, $conn) or trigger_error("SQL", E_USER_ERROR); } } // end if // UPDATE: if we have name(s) to change... if($_POST['udata']) { /* // for each name to change... foreach ($_POST['udata'] as $input => $v) { echo "$input = $v<br />"; $sql = "UPDATE test SET "; foreach ($v as $id => $value) { echo "$id = $value<br />"; } $sql .= "WHERE ..."; } echo "<hr />$sql<hr />"; print_r($_POST['udata']); */ for ($i = 0; $i < count($_POST['udata']['fname']); $i++) { $fname = $_POST['udata']['fname'][$i]; echo "$i = $fname<br />"; } /* foreach($_POST['cname'] as $cid => $cname) { // little bit of cleaning... $id = mysql_real_escape_string($cid); $fname = mysql_real_escape_string($cname); $lname = mysql_real_escape_string($cname); $dob = mysql_real_escape_string($cname); $email = mysql_real_escape_string($cname); // update name in the table $sql = "UPDATE test SET fname = '$fname', lname='$lname', dob='$dob', email='$email' WHERE id = '$id'"; $result = mysql_query($sql, $conn) or trigger_error("SQL", E_USER_ERROR); } // end foreach */ } // end if // DELETE: if we have a name to delete... if($_GET['id']) { // little bit of cleaning... $id = mysql_real_escape_string($_GET['id']); // delete name from table $sql = "UPDATE test SET Current=0 WHERE id= '$id'"; $result = mysql_query($sql, $conn) or trigger_error("SQL", E_USER_ERROR); } // end if // ORDERBY: if one of the links was clicked.. if ($_GET['orderby']) { // make an aray of allowed names $allowed = array('id','fname', 'lname', 'dob', 'email'); // bit of cleaning... $order = mysql_real_escape_string($_GET['orderby']); // is it a valid column name? yes: use it. no: default to 'id' $order = (in_array($order, $allowed))? $order : "id"; // if no link clicked, default to 'id' } else { $order = "id"; } // end else // SELECT: get the list of names from database $sql = "SELECT id, fname, lname, dob, email FROM test WHERE Current=1 ORDER BY $order"; //$result = mysql_query($sql, $conn) or trigger_error("SQL", E_USER_ERROR); $result = mysql_query($sql, $conn) or die(mysql_error()); /**** end deal with the database ****/ /**** list everything out ****/ // list columns echo "<form action = '{$_SERVER['PHP_SELF']}' method = 'post'>\r\n"; echo "<table border = '1'>\r\n"; echo "<tr>\r\n"; echo "<td><a href = '{$_SERVER['PHP_SELF']}?orderby=id'>id</a></td>\r\n"; echo "<td><a href = '{$_SERVER['PHP_SELF']}?orderby=fname'>fname</a></td>\r\n"; echo "<td><a href = '{$_SERVER['PHP_SELF']}?orderby=lname'>lname</a></td>\r\n"; echo "<td><a href = '{$_SERVER['PHP_SELF']}?orderby=dob'>dob</a></td>\r\n"; echo "<td><a href = '{$_SERVER['PHP_SELF']}?orderby=email'>email</a></td>\r\n"; echo "<td>delete</td>\r\n"; echo "</tr>\r\n"; // loop through list of names while ($list = mysql_fetch_assoc($result)) { echo "<tr>\r\n"; echo "<td>{$list['id']}</td>\r\n"; echo "<td><input type = 'text' name = 'udata[fname][{$list['id']}]' value = '{$list['fname']}' />\r\n"; echo "<td><input type = 'text' name = 'udata[lname][{$list['id']}]' value = '{$list['lname']}' />\r\n"; echo "<td><input type = 'text' name = 'udata[dob][{$list['id']}]' value = '{$list['dob']}' />\r\n"; echo "<td><input type = 'text' name = 'udata[email][{$list['id']}]' value = '{$list['email']}' />\r\n"; echo "<td><a href = '{$_SERVER['PHP_SELF']}?id={$list['id']}'>delete</a></td>\r\n"; echo "</tr>\r\n"; } // end while // list input box for adding new entry echo "<tr>"; echo "<td bgcolor = 'gray'></td>\r\n"; echo "<td><input type = 'text' name = 'fname' /></td>\r\n"; echo "<td><input type = 'text' name = 'lname' /></td>\r\n"; echo "<td><input type = 'text' name = 'dob' /></td>\r\n"; echo "<td><input type = 'text' name = 'email' /></td>\r\n"; echo "<td bgcolor = 'gray'></td>\r\n"; echo "</tr><tr>\r\n"; echo "<td></td>\r\n"; echo "<td align = 'center'><input type = 'submit' value = 'submit' /></td>\r\n"; echo "<td></td>\r\n"; echo "</tr></table></form>\r\n"; /**** end list everything out ****/
×
×
  • 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.