Jump to content

Grant Holmes

Members
  • Posts

    221
  • Joined

  • Last visited

    Never

Everything posted by Grant Holmes

  1. I have a page that shows a dynamic number of records. The simple thing I'm doing here is "Activating" inactive records; changing a 0 to a 1 in my field called "Active". On my display page, the iINactive records are only shown and there is a checkbox that accurately shows the status of the field. I've figured out (with your help) how to select all the checkboxes and now want to use a button that calls a page to update the records that were selected. The code on that page is: <?php $DOCROOT = $_SERVER['DOCUMENT_ROOT'] ; // start query // This line borrowed from another page doing the same thing, but I don't have ALL these fields... // the table "birthdays" and field Active do exist among others... $qry = "UPDATE birthdays SET Active='1' WHERE COMMENTCLIENTID='$clientid' AND (COMMENTID='$id'"; // loop through each comment and add it to the query to delete it for ($i = 1; $i < count($chk_msg); $i++) { // get id $id = $chk_msg[$i]; // add this id to the query $qry .= " OR COMMENTID='$id'"; } $qry .= ")"; // run query mysql_query ( $qry, $link ) or die ( "Query to activate failed: $qry." ); // close connection mysql_close ($link); // go to Admin Panel load_page ( "requests_inactive_test.php?prod_id=$prod_id" ); ?> See commented line. I borrowed this from another site of mine that I had developed. The line that appears to me to do all the work is: $qry = "UPDATE birthdays SET ACTIVE='1' WHERE COMMENTCLIENTID='$clientid' AND (COMMENTID='$id'"; But I don't have all those fields. Can someone explain what this line even means/does in plain English, or is this enough information to help me edit the code to update my records. The ONLY field I want to change/update is the ACTIVE field.
  2. I didn't see the edit. I'd asked in there somewhere what that number does. I read the post link, but was pretty much Greek to me. What does it do? Not using cookies. I'm pretty sure we're using the variables.
  3. For any authorized user, no, its no big deal. My brother just had his laptop stolen and if this site was on his PC, anybody could've just gotten into history and jumped in (we have that part fixed), or in the case of this script, there are two levels Admin and User. If admin just logged out and someone hit "Back" they'd be into other information. Really not a HUGE deal, just trying to make it appear more professional overall. I POST to their main URL, I may try POSTing to the log in page, but with the current behavior, I can't imagine it acting differently.
  4. I guess this works, and yet it doesn't..... When I do a "go back" I get the post data warning and the page displays like it did, HOWEVER... if I use any link on that page, I DO go to the log in page- IOW, I cannot access other data without logging back in. Before (who knows when) I could'a sworn that it went directly to the Log in page and did NOT display the previous data. I guess this IS progress!
  5. This really isn't a PHP issue, but a favicon. This link should help you: http://www.html-kit.com/favicon/
  6. So, what I hear you guys saying is that without somewhat significant other changes, I'm stuck where I'm at? My PHP skills do not allow me do accomplish extending beyond what I learn in forums like this. Thanks for your help, all. When i get some development $$, maybe I can have a "pro" look at this further. Unless you guys have other intellegence for me, I'll call the original issue "solved" and let this go.
  7. I'll look at that link. Thanks. The bad news is that I'm still able to "go back" and see the secure page after hitting logout.
  8. BTW, this is what my session_start is at the moment... //***************************************************************************// $SECactive = true; session_start(); //***************************************************************************// I assume the first couple lines of your solution would replace my second actual "session_start():" line
  9. As I attempt to implement your solution, can you tell me what the CACHE limiter does? Is that a time out? Like after one minute of not being used it requires log in again?
  10. That stuff seems to defeat IE pretty easily, but FFox is still able to "go back" and reload the page. Here's what I have now: // Log out user. //***************************************************************************// // if ($_REQUEST['SEClogout']==1) { session_destroy(); unset($password); unset($username); header("Location: $SECdumpurl"); } When in FireFox, I can still use my browser to GO BACK, I okay the postdata warning and the "secure" page still loads
  11. Revraz... (Newbie here) not so much that I'm new to PHP, as I AM, but I'm always more on the "creative" side and get stuck occasionally fixing stuff I probably shouldn't be allowed to see. That's to say, How would I do that??? Can I do that within that code snippet above?
  12. In a php file where we hold some variables, I have this: // // Modify the URL to point to the logout page. This must be a complete URL. // This is the page at which you'll be dumped after logging out. $SECdumpurl = "http://www.ThePageToGoTo.com/"; then later in that page, we have this: //***************************************************************************// // Log out user. //***************************************************************************// // if ($_REQUEST['SEClogout']==1) { $_SESSION = array(); // delete all session vars header("Location: $SECdumpurl"); }
  13. I just didn't want it to be so easy (like jumping into history) to be able to log in. Using https for what we're doing is probably overkill. So, now I'm noticing that the LOG OUT thing I thought I had beat, isn't. Before, I thought just days ago (NOW what did I break!??!?!), when I hit the logout link, and went BACK (browser button) I went back to the log in page. Now I get a "this page displaying post data" warning and I'm back in my secure page. Sigh ??? This code is further down in that code for when you hit the log out link. Is this helpful to troubleshoot that? ...} function SECShowLogoutLink() { global $SEClogoutstyle; echo "<a style='$SEClogoutstyle' href='".basename($PHP_SELF)."?SEClogout=1'>logout</a>"; }...
  14. Avoiding the whole cheerleader thing.... Then how do the "Captcha" things work? They use a "non-system" font. (Seems like the one I set up, I actually uploaded the CaptchaFont.TFF file to the web folder??) I've got a site where I have a script running that shows various international times: http://www.martiniinthemorning.com/martinitime.php I've wanted to use a more "digital" font (which I have, but know you may not). So how can I use MY font on that page?
  15. Adam & Tinker. Thanks. I changed the "get" to "POST" and all appears well. The script does do authentification and uses a MySQL backend to track log-ins, etc. It's really a pretty nice piece of code...for the most part. Anyhow, Am I correct in thinking that this issue on logging in (and seeing/not seeing the stuff in the address bar) has nothing to do with logging out and being able to "go back" to a viewable page or log in page as described above?
  16. Papaface: This was written for me 2-3 years ago by a programmer... I have no idea. I was told that it was the function of the way the form was done. I'm really weak in PHP. Tinker, Sorry, I thought I'd done that. <form id='SECloginform' name='SECloginform' method='get' action='<?php echo basename($PHP_SELF); ?>'> It appears its using "get"
  17. I thought I had this beat months ago, but when I set up my stuff on a new server the problem is back and I have no clue how I beat it last time. Back then, when I logged out, I could use the back button and go right back into the "secured" pages. THAT is fixed, but the username and password are still showing in the address bar: http://www.mydomain.com/secure/data.php?SECemailpass=&SECloginusername=admin&SECloginpassword=Th3PassW0rd&SEClogin=Login I know one person that helped then told me it was the difference between "Get" and "Post", but I'm not sure I even remember that as correct. I don't remember if that solved the "back button" issue or the URL issue. At this time, if I log out, I cannot go back and view pages (I go back to log in). So, how do I fix the user/pass showing in the Address bar and being part of the history file? I THINK I'm posting the relevant portion of my log-in code: <input type='hidden' id='SECemailpass' name='SECemailpass' value=''> <center> <table style='font:10pt arial;'> <tr> <td>Username: </td> <td><input type='text' name='SECloginusername' value='<?php echo $_REQUEST['SECloginusername']; ?>'></td> </tr><tr> <td>Password: </td> <td><input type='password' name='SECloginpassword' value='<?php echo $_REQUEST['SECloginpassword']; ?>'> <span style='font-size:8pt'> <a href='javascript:SECEmailPassword();'>Forgot your password?</a> </span> </td> </tr><tr> <td></td> <td align='center'><input type='submit' name='SEClogin' value='Login'></td> </tr> </table>
  18. Looking over an old web site, I'm seeing that I need more complex help than I'm likely to expect here. Thanks all. More files are needed like an Update.php and so on. Not really solved, but need "Professional Help"
  19. I've gotten a bit of help off-forum and am VERY close. I am now able to CHECK/UnCHECK all the checkboxes for whatever rows/records are returned. My last problem is saving the changes. I have a submit button, When I click it, it appears to be updating the record and the page refreshes, but the record(s) are not changed. Any help? Here's my current code: <?php include_once("security/SECsecurity.php"); ?> <?php $DOCROOT = $_SERVER['DOCUMENT_ROOT'] ; ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <HTML> <HEAD> <TITLE>Martini In The Morning Inactive Requests</TITLE> <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1"> <META NAME="GOOGLEBOT" CONTENT="NOARCHIVE"> <META NAME="ROBOTS" CONTENT="NONE"> <LINK REL="stylesheet" TYPE="text/css" HREF="martini.css"> <script src="JS/sorttable.js"; ?></script> <script type="text/javascript"> function checkall(class, uncheck){ inputs=document.getElementsByTagName("input") //Identify every DIV for (input=0; input<inputs.length; input++){ //Go through the array if(inputs[input].className==class){ //Pick out the DIVs with the CLASS of "shadow" if(uncheck){inputs[input].checked=false}else{inputs[input].checked=true} } } } </script> </HEAD> <BODY> <a name="top"></a> <?php include("dbinfo.inc.php"); mysql_connect(mysql,$username,$password); @mysql_select_db($database) or die( "Unable to select database"); $query="SELECT * FROM birthdays WHERE Event='test' AND Active='0'"; $result=mysql_query($query); $num=mysql_numrows($result); mysql_close(); echo "<A name=\"top\"></A><b><center><H1>Martini In The Morning \"<I>Inactive Requests</I>\":</H1>"; ?> <center><div style='width:100%; background-color:silver; text-align:right'> <?php SECShowAdminLink(); ?> <?php SECShowLogoutLink(); ?> <A href="data.php">Main Data Page</A> </div> <center><div style='width:100%; background-color:#ffe4c4; text-align:center'><BR>This page is showing <I>INACTIVE</I> Requests</B><BR><A href="requests.php">view <I>ALL</I> </A> <A href="requests_active.php">view active only</A></div></center> <div style='width:100%; background-color:#deb887; text-align:right'><form method="post"><a href="#" onclick="checkall('group1'); return false;">Check All</a> | <a href="#" onclick="checkall('group1', 1); return false;">Uncheck All</a> | <input type="submit" name="submit" value="Update" onclick="return confirm('Are you sure?')"></div> <table border="1" cellspacing="2" cellpadding="3" class="sortable"> <tr> <TH valign="top">From:</TH> <TH valign="top">City</TH> <TH valign="top">State</TH> <TH valign="top">Zip</TH> <TH valign="top">Country</TH> <TH valign="top">Artist Name</TH> <TH valign="top">Song Title</TH> <TH valign="top">Submitted</TH> <TH valign="top">Status</TH> <TH valign="top"> </TH> </tr> <?php $i=0; while ($i < $num) { $Active=mysql_result($result,$i,"Active"); $firstname=mysql_result($result,$i,"Contact_Info_FirstName"); $lastname=mysql_result($result,$i,"Contact_Info_LastName"); $city=mysql_result($result,$i,"Contact_Info_City"); $state=mysql_result($result,$i,"Contact_Info_State"); $zip=mysql_result($result,$i,"Contact_Info_ZipCode"); $country=mysql_result($result,$i,"Contact_Info_Country"); $email=mysql_result($result,$i,"Contact_Info_Email"); $Bfirstname=mysql_result($result,$i,"Birthday_Info_FirstName"); $Blastname=mysql_result($result,$i,"Birthday_Info_LastName"); $Bcity=mysql_result($result,$i,"Birthday_Info_City"); $Bstate=mysql_result($result,$i,"Birthday_Info_State"); $Bzip=mysql_result($result,$i,"Birthday_Info_ZipCode"); $Bcountry=mysql_result($result,$i,"Birthday_Info_Country"); $Date=mysql_result($result,$i,"DateEntered"); $id=mysql_result($result,$i,"id"); ?> </form> <tr> <td valign="top"><input type="hidden" name="ud_id" value="<? echo $id; ?>"> <STRONG><?php echo "$firstname $lastname"; ?></STRONG><BR><a href="mailto:<?php echo "$email"; ?>"><?php echo "$email"; ?></a></TD> <TD valign="top"><?php echo "$city"; ?></TD> <TD valign="top"><?php echo "$state"; ?></TD> <TD valign="top"><?php echo "$zip"; ?></TD> <TD valign="top"><?php echo "$country"; ?></TD> <TD valign="top"> <?php echo "$Bfirstname"; ?></TD> <TD valign="top"> <?php echo "$Blastname"; ?></TD> <TD valign="top"><?php echo "$Date"; ?></TD> <TD valign="top"> <B>Active?: <?php // Set the variable $foo from the database or from form data. $checked = $Active ? "checked" : ""; echo "<input type=\"checkbox\" class=\"group1\" name=\"foo\" $checked>"; ?> </td> <TD valign="top"><CENTER> <a href='requests_edit.php?id=<? echo "$id"; ?>'>edit</a><BR><A href="#top"><IMG src="images/uparrow.gif" border="0" hspace="2" vspace="4" /></A><A href="#bottom"><IMG src="images/downarrow.gif" border="0" hspace="4" vspace="4" /></A></CENTER></TD> </TD> </tr> <?php ++$i; } echo "</table>"; ?> <div style='width:100%; background-color:#deb887; text-align:right'><form method="post"><a href="#" onclick="checkall('group1'); return false;">Check All</a> | <a href="#" onclick="checkall('group1', 1); return false;">Uncheck All</a> | <input type="submit" name="submit" value="Update" onclick="return confirm('Are you sure?')"></div> <P><A href=\"#top\">Back to top</A></P></B><BR> <BR><BR><BR> <?php include "include/footer.php"; ?> <a name="bottom"></a> </BODY> </html>
  20. hmmm... I'm not sure. My screen shot was to explain what I needed, not the current state of the code. Right now the code I've modified per above instructions gives me this (see attached). I was trying to clarify what I needed. I have the database already and the php code already. I just need the code modified to do this. [attachment deleted by admin]
  21. I've populate a table with results submitted by visitors through a form. The record is populated with a "0" in the Active field when created. Once made Active, the results will show on a public page on the site, showing others the results, in this case, requests. I want control over what is viewed publically for all the obvious reasons. On this page called "Inactive Records" I show any/all those 'new' or inactive records. (Active records are shown else where). The code you see that I posted allows me to edit each record separately (using the edit link), but it takes too long for multiple entries. For other stuff like name/address/whatever, I don't care. But for the simple act of making the records active or inactive, I want to just be able to hit the buttons already discussed. So, say I hit "Select all". Then the checkbox already in my code for all the records that are shown at that point in time (dynamic and varies) would become checked (in each row/record). In practice, It might be easier to check 50 records with the button and uncheck 3 that I don't want to view. Then once I'm satisfied with my selections, hit one button that says "Submit" and all the record/rows that were checked would be updated in the table. That help? ( dropped in a somewhat modified screen shot that may help you see what I'm heading for) [attachment deleted by admin]
  22. sorry. I put that button code in my first table row. It put your 10 boxes there with the buttons. (I've not tried my submit button yet!!!!) The select/deselect buttons work on the 10 boxes from your code, but I need them to select/deselect the boxes in the table (or the records returned. AND I don't need those 10 boxes.
  23. K, I REALLY appreciate your help. The code you gave me, I got to put 10 boxes in the top row of my table, and the Buttons DO select THOSE check boxes, but they don't check the boxes in my table beside the records. Should I take this back to PHP yet, or is there still an issue we can deal with here?
  24. THIS oughta be fun. Neither of us understands the other. I'll try a restate: ON the page, I won't know how many records will be returned, depends on how many are submitted, and or were left unchecked/inactive from before. So on a dead day, I could get three records; a busy day 32, whatever. I THINK I need three buttons; one button to check all the displayed records one button to UNcheck all the displayed records (someone changes their mind) one button to save the checkbox status(es) to the table for any/all affected records. I only need these buttons to show up once at the top of the display table, (or possibly the bottom to, but no mater) so could be in a TR above the results. That help???
  25. So I understand, what will "number" control? I just need this to happen once, say at the top of the page, where it would be most convenient. Edit; I just put the PHP code in my page and it appears that I got a checkbox for every field on my page. A WHOLE bunch of them. If my page returns 5 rows/records/results I'd need one "Select All" button, one "DeSelect All" Button, and one "Save changes button. The Select/deselect would effect the one checkbox at the end of each row. I don't see anywhere on the page where the buttons above showed up.
×
×
  • 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.