Jump to content


  • Posts

  • Joined

  • Last visited


About Nicholas

  • Birthday 05/18/1989

Contact Methods

  • AIM
  • MSN
  • Website URL
  • ICQ
  • Yahoo

Profile Information

  • Gender
  • Location
    Ohio, USA

Nicholas's Achievements


Newbie (1/5)



  1. First I'll need to understand variable variables... The example on that page seems as if you could achieve the same thing with .= . Can someone explain further these lines: At this point two variables have been defined and stored in the PHP symbol tree: $a with contents "hello" and $hello with contents "world". Therefore, this statement: <?php echo "$a ${$a}"; ?> produces the exact same output as: <?php echo "$a $hello"; ?> i.e. they both produce: hello world. ------------------------------------------------------- I don't want seperate variables... Would echoing $a give "hello world"?
  2. Well it seems there are errors in the code. After enabling all errors, and the having them displayed... error_reporting(E_ALL); ini_set('display_errors','On'); $num = 1; do { if (isset($_POST["event.$num"])) { $accept.$num = $_POST["event.$num"]; $id.$num = $_POST["hidden.$num"]; $num++; $set = true; } else { $max = $num; $set = false; } } while($set); guestLogin($username,$password); for($num = 1;$num <= $max; $num++) { if ($accept.$num == 'accept') { // Line 100 $query = "UPDATE calendar07 SET accept = '1' WHERE id='" . $id.$num . "'"; $result = mysql_query($query); if ($result) { print 'Calendar updated for event id ' . $id.$num . '. The event is ' . $accept.$num . 'ed.'; } } }
  3. jesirose: If there aren't any apparent code errors, I guess there isn't a problem. I just assumed that this wouldn't work as I coded it as pseudo-code, not expecting it to actually be correct.
  4. Thanks for the quick response. And good eye on the =/== bit. Technically, what I posted was exactly the area that you need to see. But I'll trim it down for clarity... Better? case 'pendCalendar': // Get all the calendar events that haven't been accepted yet, and display them ... <form action="admin.php?action=updateCalendar" method="post"> ... // Connect to the database etc... // The fun part: looping through the results $num = 1; while($fetch = mysql_fetch_assoc($query)) { <input name="hidden_' . $num . '" type="hidden" value="' . $fetch['id'] . '> // Notice: hidden_$num will be dynamic <td style="padding: 5px;" valign="top"> <select name="event_' . $num . '"> // Again, a dynamic name <option value="accept">Accept Event</option> <option value="deny">Refuse Event</option> </select> } break; case 'updateCalendar': $num = 1; do { if (isset($_POST["event.$num"])) { $accept.$num = $_POST["event.$num"]; $id.$num = $_POST["hidden.$num"]; $num++; $set = 'true'; } else { $max = $num; $set = 'false'; } } while($set='true'); break;
  5. I it possible to have variables concatenated together? For instance, in a loop you've got something like this: $variable = "multipleSomethings"; for($num=1;$num<=10;$num++) { $variable.$num = "multipleSomethings" . $num; } echo $variable1; // "multipleSomethings1" echo $variable2; // "multipleSomethings2" See what I'm saying? Now try to understand my code. case 'pendCalendar': // Get all the calendar events that haven't been accepted yet, and display them print '<div class="para">' . '<h1>Pending Calendar Additions</h1>' . 'The following are requests from coaches which have not yet been approved.<br />' . 'Please check the information for accuracy, and then decide whether or not to accept the request.<br />' . '<strong>Be sure to check whether there are existing events that might cause a confliction.</strong><br /><br />' . '<form action="admin.php?action=updateCalendar" method="post">' . '<table cellpadding="0" cellspacing="0" style="border: 1px solid #666;" width="100%">' . '<tr>' . '<td style="background: #999; padding: 3px;" width="25%"><strong>Event Date:</strong></td>' . '<td style="background: #999; padding: 3px;" width="20%"><strong>Event Location:</strong></td>' . '<td style="background: #999; padding: 3px;" width="30%"><strong>Event Description:</strong></td>' . '<td style="background: #999; padding: 3px;" width="25%"><strong>Accept?</strong></td>' . '</tr>'; guestLogin($username,$password); $query = mysql_query( "SELECT * FROM calendar07 WHERE accept='0' " ); $num = 1; while($fetch = mysql_fetch_assoc($query)) { print '<input name="hidden_' . $num . '" type="hidden" value="' . $fetch['id'] . '>'; print '<tr>' . '<td style="padding: 5px;" valign="top">' . $fetch['month'] . ' ' . $fetch['day'] . ': ' . $fetch['time'] . '</td>' . '<td style="padding: 5px;" valign="top">Field ' . $fetch['field'] . '</td>' . '<td style="padding: 5px;" valign="top"><em>Requested by: </em>' . $fetch['leader'] . '<br />' . '<em>Brief Summary: </em>' . $fetch['desc'] . '</td>' . '<td style="padding: 5px;" valign="top"><select name="event_' . $num . '">' . '<option value="accept">Accept Event</option>' . '<option value="deny">Refuse Event</option>' . '</select>' . '</td>' . '</tr>'; } print '<tr>' . '<td colspan="4" style="text-align: right;"><input type="submit" value="Submit" /></td>' . '</tr>' . '</table>'; break; case 'updateCalendar': $num = 1; do { if (isset($_POST["event.$num"])) { $accept.$num = $_POST["event.$num"]; $id.$num = $_POST["hidden.$num"]; $num++; $set = 'true'; } else { $max = $num; $set = 'false'; } } while($set='true'); break;
  6. No problem. It was never a necessity for the site, just perhaps easier for the user.
  7. I guess I'll just stick with the drop down menus then...
  8. Mind pointing me in the direction of a few?
  9. Wondering if this is possible. I've highlighted an example below: [img]http://img152.imageshack.us/img152/179/untitled12ll.png[/img] [size=8pt](Thanks to ImageShack for [URL=http://imageshack.us]Free Image Hosting[/URL])[/size] I want to achieve this in a HTML form. I'll be using it for time as well, but not specific enough to require seconds. I'd need this setup: HH:MM AM/PM. Though AM/PM could be chosen through a drop-down... Just wondered if it's possible, or if I would be better off just allowing text to be entered. Thanks for the help.
  10. I've got close to 30 or so photos on my site, and I'd like them to be displayed in sets of 10, with a "Previous" and "Next" link allowing progress backward or forward through the pictures. You've all seen it, but can you help me to do it? Here's what I have: [quote]             # -------------------------------------------------             #  photography page content             # -------------------------------------------------             case 'photography-s':               print '<div align="left">' . "\n";               connect($error, $type); [color=red]# CONNECT TO THE DATABASE[/color]               print '<h1>my photography (<a href="http://hobbes.cjb.cc/art.php?page=photography-s">standard</a> | <a href="http://hobbes.cjb.cc/art.php?page=photography-p">panoramic</a>)</h1><br/>' . "\n";               print '<table cellpadding="0" cellspacing="0" width="100%">' . "\n" .                             $_SESSION['end'] = "10"; [color=red]# SET WHAT VALUE WE NEED TO END AT [/color]               $start = ($_SESSION['end'] - 9); [color=red]# AND WHAT WE START AT[/color]               $end = $_SESSION['end']; [color=red]# SIMPLER FORM...[/color]               $open = '<a href="#" onClick="MyWindow=window.open(\'';  [color=red]######################[/color]               $mid = "','MyWindow','scrollbars=yes,";                              [color=red]## THESE ARE "SHORTCUTS"[/color]               $close = "'); return false;\">";                                          [color=red]## IF YOU WILL[/color]               $img = '<img class="img" border="0" src="';                      [color=red]######################[/color]                             for ($id=$start;$id++;$id<=$end) { [color=red]# SET UP A FOR LOOP TO GET THE DESIRED RANGE OF ID'S[/color]                   $result = mysql_query("SELECT title, thumb, image, description, height, width FROM art_photo WHERE id ='" . ($id) . "'"); [color=red]# QUERY THE DATABASE FOR THE SPECIFIC ID'S[/color]                   $photos = mysql_fetch_assoc($result); [color=red]# AND PLACE THAT INTO THE ARRAY "PHOTOS"[/color]                   print $photos; [color=red]# A TEST...[/color]                 print '  <tr>' . "\n" .                         '      <td height="120" width="160">' . "\n"; [color=red]# THE FOLLOWING COUPLE OF LINES SET UP THE CELLS CONTAINING THE PHOTOS AND DESCRIPTIONS[/color]                 print          $open . $photos["image"] . $mid . 'width=' . $photos["width"] . ',height=' . $photos["height"] . ',left=105,top=120' . $close . $img . $photos["thumb"] . '" alt="' . $photos["title"] . '" title="' . $photos["title"] . '"/></a></td>' . "\n" .                         '      <td>' . "\n" .                                   $photos['desc'] . "\n" .                         '      </td>' . "\n" .                         '  </tr>' . "\n";                 }                 print '  <tr>' . "\n" .                         '      <td style="text-align: left;"><a href="http://hobbes.cjb.cc/art.php?page=photography-s"></td>' . "\n" . [color=red]# REWIND THE START ID[/color]                         '      <td style="text-align: right;"><a href="http://hobbes.cjb.cc/art.php?page=photography-s"></td>' . "\n" . [color=red]# ADVANCE THE START ID[/color]                         '  </tr>' . "\n" .                         '</table>' . "\n";             break; [/quote] Any help is greatly appreciated.
  11. Sorry if I came across rudely. Meant no harm. You were trying to help me!
  12. The current combination of username and password is set to "test" for both, so I don't know why it would be affected differently... But you are indeed correct, works like a charm now. Thanks so much thorpe. ;D @ Crayon: read my code. I've printed both the variables entered and from the file, and checked them against each other.
  13. When the user accesses index.php?action=login, $username and $password variables are defined through a form: [code] case 'login':                         print '<div class="para">' .                                 '<h1>Please enter your username and password.</h1><br/>' .                                 '<form action="http://www.ucjrd.com/index.php?action=redirect" method="post">' .                                 '<table cellspacing="2" cellpadding="0" width="300">' .                                 '  <tr>' .                                 '      <td><strong>Username:</strong></td>' .                                 '      <td><input type="text" size="12" maxlength="12" name="username" style="textbox">' .                                 '  </tr>' .                                 '  <tr>' .                                 '      <td><strong>Password:</strong></td>' .                                 '      <td><input type="password" size="12" maxlength="12" name="password" style="textbox">' .                                 '  </tr>' .                                 '  <tr>' .                                 '      <td colspan="2" style="text-align: right;"><input type="submit" value="submit"></td>' .                                 '  </tr>' .                                 '</table>' .                                 '</form>' .                                 '</div>';                         break;                       case 'redirect':                         $username = $_POST['username'];                         $password = $_POST['password'];                         admin($username,$password);                         break; [/code] Then the stored username and password are retrieved from a file and compared to the user's... [code] function admin($user,$pass) {         $filename = "******.txt";         $file = fopen($filename,"r");         $set_user = fgets($file);         $set_pass = fgets($file);         fclose($file);         if ($user == $set_user && $pass == $set_pass) {           $_SESSION['logged_in'] = "true";           print '<div class="para">' .                   '<h1>Login Successful</h1><br/>' .                   'Thank you for logging in. <a href="http://www.ucjrd.com/index.php?action=edit">Please click here to continue.</a>' .                   '</div>';         } else {           $_SESSION['logged_in'] = "false";           print '<div class="para">' .                        '<h1>Login Error</h1><br/>';                   print $_SESSION['logged_in'] . '<br/>';                   if ($user == $set_user) {                     print 'Usernames are the same<br/>';                   } else {                     print 'Usernames are not the same<br/>';                   }                   if ($pass == $set_pass) {                     print 'Passwords are the same<br/>';                   } else {                     print 'Passwords are not the same<br/>';                   }           print "Existing: $set_user and $set_pass<br/>" .                   "Entered: $user and $pass<br/><br/>" .                   'There was an error when checking your username and password. <a href="http://www.ucjrd.com/index.php?action=login">Please review your username and password.</a>' .                   '</div>';         } [/code] Yet this yields the error message. As you can see, I've done a bit of debugging to narrow down my problems. The password is checked properly, and rings true when it is and false when it isn't. The username on the other hand, is always considered wrong. Am I missing something? Can anyone help me fix this annoying comparison issue? Thanks so much.  ;D
  14. [quote author=akitchin link=topic=99174.msg401016#msg401016 date=1153461573] to make the nav links extend the width of their containing cell, all you have to do is change their tags to: [code]<a href="blah" style="display: block;">[/code] they will then span the width of their container.  i tried this with web developer toolbar's edit HTML function, so i know it works. i'll add some comments too, since i took the time to look at the site.  nothing stands out at me as being bad.  i like the colours, the simplicity, and the clean lines.  nicely done.  RCT is addicting, i'll add. [/quote] AWESOME, thanks so much. 448191, I'll play around with gradients in Photoshop. If I like it, I'll add it. Thanks for looking and commenting, everyone.
  15. [url=http://hobbes.cjb.cc]hobbes.cjb.cc[/url] Sorry to bump, but I've finished the design of the site. Most of the content is also finished. I've addressed two of the three points you've made, though the third (regarding extending the clickable area of the navigation bars all the way to the right) is relatively impossible. I have a transparent pixel stretching to size, and it has to be the same size for each link. because it uses the padding attribute of css, the maximum distance is decided by the link with the most characters. this happens to be the ziehen.deviantart.com link. because of this link, the rest of the links must also have the same padding on their right sides. because they're all shorter than that link, however, you get space on the far right that isn't clickable because it isn't covered by the transparent image. hopefully that made sense. my coding/design practices may be a bit unusual. i'd appreciate your comments, though. the layout was a concept i threw together in photoshop which somehow became a reality. it's my most technically advanced website, though it may not appear as such. the main file is over 400 lines, and growing constantly as i add more content. it uses PHP extensively, as a mediator between pages and to repeat tedious actions. i'm proud of the programming side of things. content wise, it has the most information i've ever given in a personal website. i have 3 pages describing some of my major hobbies, four pages within the art catagory, and then four more pages within the rct catagory. i encourage you to check out my photography, as that's the section i'm most proud of and have spent the most time updating. the rct section will hopefully grow with time, but i suppose that depends on how much i improve with each passing park/design. anyway, thanks so much for viewing. comments/criticisms welcome
  • 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.