Jump to content

jstgermain

Members
  • Posts

    20
  • Joined

  • Last visited

    Never

Everything posted by jstgermain

  1. nvm everyone.  got it working.  got help from a friend.  here is the code in case anyone else is ever needing to do something similar [code] <?php #menu.php $sql = "SELECT * FROM `Menu`";  $result = mysql_query($sql);  while ($row = mysql_fetch_assoc($result)) {     $id = $row['id']; // get the row id     $link[$id]['name']      = $row['name']; // put in an array     $link[$id]['l_name']    = $row['l_name']; // put in an array     $link[$id]['content']  = $row['content']; // put in an array } ?> <!--// Links code //--> <a href="index.php?page=<?php echo $link['1']['l_name']; ?>"><?php echo $link['1']['name']; ?></a> <a href="index.php?page=<?php echo $link['2']['l_name']; ?>"><?php echo $link['2']['name']; ?></a> <a href="index.php?page=<?php echo $link['3']['l_name']; ?>"><?php echo $link['3']['name']; ?></a> [/code] Just add as many links as needed.
  2. sorry to bump this, but it is at the bottom of the second page now, and i still need help if possible.  please le tme know if anyone else can figure this out.
  3. no, didnt work.  just displays the first 3 letters od the first row in the link name.  :S  the link name and name of the riste row is "Home", so the first like shoed up as "H", link two showed as"o", and link 3 showed as "m".  :S  so, the wuery itself looks ok, but the way you are calling the link with the [[b]0[/b]], [[b]1[/b]], and [[b]2[/b]] isnt correct.  need another way to tell it the row.  let me know if you think of something else.  thanks
  4. that might, i will try it in a bit.  need to finish this asp / js project at work first.  i will let you know if it works or not.  i am sure it will, but for some reason i just couldnt think of it.  :p  head hurts with all these projects.  :S  thanks.
  5. ok, i will provide a few things so that someone may be able to help with what i am trying to do.  here is my MySQL setup for the table that contains the info that I am trying to retrieve. -- -- Table structure for table `Menu` -- CREATE TABLE `Menu` (   `id` int(25) NOT NULL auto_increment,   `name` varchar(100) default NULL,   `l_name` varchar(100) default NULL,   `content` text,   PRIMARY KEY  (`id`) ) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=4 ; -- -- Dumping data for table `Menu` -- INSERT INTO `Menu` VALUES (1, 'Home', 'Home', 'Home page info here.); INSERT INTO `Menu` VALUES (2, 'Hosting', 'Hosting', 'Put hosting info here'); INSERT INTO `Menu` VALUES (3, 'Contact Us', 'ContactUs', 'Put contact info here'); here is the php i am currently using. [code] <?php #menu.php //Link 1 query $query1 = "SELECT * FROM Menu WHERE id=1"; $link1 =  mysql_query ($query1); $l1 = mysql_fetch_array ($link1, MYSQL_ASSOC); //Link 2 query $query2 = "SELECT * FROM Menu WHERE id=2"; $link2 =  mysql_query ($query2); $l2 = mysql_fetch_array ($link2, MYSQL_ASSOC); //Link 3 query $query3 = "SELECT * FROM Menu WHERE id=3"; $link3 =  mysql_query ($query3); $l3 = mysql_fetch_array ($link3, MYSQL_ASSOC); ?> <!--// This is where I display the links //--> <a href="index.php?page=<?php echo $l1['l_name']; ?>"><?php echo $l1['name']; ?></a> <a href="index.php?page=<?php echo $l2['l_name']; ?>"><?php echo $l2['name']; ?></a> <a href="index.php?page=<?php echo $l3['l_name']; ?>"><?php echo $l3['name']; ?></a> [/code] as you can see, i am having to query the database 3 differnt times to make each link url and name display, and that is sort of a pain in the butt, and i am sure there is a better and easier way to do this.  hopefully someone can help me shorten this task.  keep in mind that there will be more than 3 links.  there are just 3 right now since i am still in the testing phase of everything.  any help will be greatly appreciated.  thanks in advance.
  6. ok, well, none of the code you guys tried to help with did anything.  the closest help came from magic2goodil, but left out that i still needed to query the database to get the results to echo the correct row, but i appreciat you guys and gals trying to help.  that is why i love this community.  even though i didnt get what i was looking for, i was still pointed in a good direction to figure it out myself. jesirose, as far as the sql injection, i am not sure exactly how that would happen with this site, but i will definately look into it and see if i can find some things to make it a little more secure.  thanks fo rthe advise.
  7. here is the problem, and hopefully somone will have a solution. i set my new site to have the menu be php and run on the mysql database, and obviously all the content too, but when i go to the home page, nothing displays as far as content since there is no link selected yet. how can i get it to automatically display the same info as the home link if no link has been clicked yet? here is a link to the site to see what i am talking about http://www.mct-hosting.com the content i want to display will be the same as: http://www.mct-hosting.com/index.php?page=Home here is a little code that might help. [code] <?php #This is in the index page $get =  mysql_query("SELECT * FROM `Menu` WHERE l_name='$_GET[page]'") OR DIE(mysql_error()); $page = mysql_fetch_assoc($get); //table settings are here, NOT IMPORTANT FOR THIS //code for displaying the content once a link is clicked echo $page['content']; ?> [/code] here is the code for the links that makes the content display [code] <?php $query1 = "SELECT * FROM Menu WHERE 1 AND id=1"; $link1 =  mysql_query ($query1); $l1 = mysql_fetch_array ($link1, MYSQL_ASSOC); echo '<a href="index.php?page='.$l1['l_name'];.'">'.$l1['name'];.'</a> ?> [/code] hopefully that helps with solving the problem.
  8. thanks again for the help.  i may try that in a bit, but right now, i just recoded the database to contain only one table for all the contente instead of seperate tables, and i have coded it to pull the corresponding info per the id and it works great.  so, i only had to code the check in once.  thanks for everything.  if you ever need graphics, let me know.
  9. your second example is perfect.  i put it in where the user would submit the changes, and it then checked if it was admin or not, and when i was in the demo account, it blocked me perfectly, and allowed access when i was in the admin account.  thanks so much for that.  looks like i was on the right path, but was just missing a few minor things that obviously amounted to be a big problem.  :P anyways, my last question would be, is it possible for me to make a file like i did with the process.php file and not have to type the code everytime i want to check the level?  the process.php file checks to see if i am logged in or not, and if not, it redirects me to log in, and would like to do something similar with the check for admin or demo. **EDIT** thought it might help if i provide the code [code] <?php //////////////////////////////////////////////////////////////////////////////////////////////// // Enerything in here                                                                        //                                                                                           // // Check to see if the user has access to make changes before changing, otherwise error  // $user = htmlspecialchars($_SESSION['user'], ENT_QUOTES);                                  // $check = mysql_query("SELECT `id` FROM `login` WHERE `user` = '$user' AND level = 1");    // if(mysql_num_rows($check) == 1) { // Make sure level is 1 for the user                    //                                                                                           // //////////////////////////////////////////////////////////////////////////////////////////////// // If the admin level check OK, then do the following $query="UPDATE Home SET content='$_POST[content]' WHERE id=1"; mysql_query($query); if (mysql_affected_rows() == 1) { // If it ran OK echo '<h1 id="mainhead">Thank you!</h1> <p class="main_txt">You have updated the information.</p> <p class="main_txt"><a href="admin.php">Back</a> to the Admin Home.</p>'; include('includes/admin_footer.php'); exit(); } //////////////////////////////////////////////////////////////////////////////////////////////// // and somehow this too                                                                      //                                                                                               // } else {  // Print and error is admin level is set to demo                                // Print 'Error: You do not have access.';                                              // include('includes/admin_footer.php');                                                    // exit();                                                                                  // } // End Admin level check                                                                //                                                                                               // //////////////////////////////////////////////////////////////////////////////////////////////// ?> [/code] i would like the parts that are inside of the /'s to be in the seperate file somehow.  is this possible?  if so, how can i do it?
  10. well, i didnt want to have to post the code here too, but if that is what you want me to do in order to help, no problem.  here is the current code. [code] <?php $level = "SELECT `id`, `user`, `level` FROM  `login` WHERE `user` = " . $_SESSION['user'] . " AND level = 1"; // Check if the level is equal to admin or demo $result = mysql_query ($level); // Run the query if (mysql_num_rows($result) == 0){ echp 'do the required task'; include('includes/admin_footer.php'); exit(); } } else {  // Print and error is admin level is set to demo Print 'Error: You do not have access.'; include('includes/admin_footer.php'); exit(); } // End Admin level check ?> [/code] i tried to define the user with the session user, but not sure if i did it right, or if that was the proper way to do this. do i need to maybe defin a value for something like $level such as if ($level == 1) {     echo 'do this'; }else{     echo 'error message'; } that is just a stab in the dark.  :S  also, in that little attempt above, would the session need to be included there along with the level and == 1?
  11. ok, here it goes.  i am working on a backend for my new hosting site, and i would like to have at least one admin account, possibly more in the future, and one demo account, possibly more in the future too.  i have the database set as follows: table name = login id = primary key/number value user = user name pass =  password email = email address for the user in case it is forgotten level =  number value of 0 or 1 (0 being demo account, and 1 being admin level acocunt) I have created the admin area as so.  any  user that is admin or demo can lig in to the site and look around at all the things to do, but once any change to the database is attemped, it needs to look and see what user is attempting to make the change, and check to see if that user has a level of 1 or 0.  if the level is equal to 1, then proceed with the chage, and if it is not equal to 1, then print an error message.  here is a link to the site i previously posted my problem on, but didnt get any significant help.  i dont want to go through posing all the code here again if i can avoid it.  if you read the most recent post there, you can see the code i am currently attempting to use, and tell me what is wronge hopefully and then maybe be able to help fix the code to work properly. http://freewebspace.net/forums/showthread.php?t=2178866 thanks for any help in advance.
  12. ok, i looked for someone asking about these options already, but saw nothing, so here it goes. I am currently using the php photo album from [a href=\"http://dynamicdrive.com/dynamicindex4/php-photoalbum.htm\" target=\"_blank\"]http://dynamicdrive.com/dynamicindex4/php-photoalbum.htm[/a] on [a href=\"http://www.smokingwoodies.com\" target=\"_blank\"]http://www.smokingwoodies.com[/a] and it is working great. I however would like to add a couple things into it, and i am stumped. i would like to have the images pull up in a new window like they already do, but i would like the window to resize to the size of the image. similar to the gallery here. [a href=\"http://www.methodcomptech.com/samplework.php\" target=\"_blank\"]http://www.methodcomptech.com/samplework.php[/a]. so obviously i would like it to have the option to scroll through the images from the popup instead of having to close the image, and then click a new one. i would also like to have a slideshow option that the user can change how fast the slideshow is showing. default it to like 3 seconds, and they can set it anywhere from 1 - 10 seconds while in slidshow mode. if anyone can help me with at least a couple of these thing, if not all 3, it would be greatly appreciated. thanks in advance for any help.
  13. [!--quoteo(post=379310:date=Jun 2 2006, 05:40 AM:name=redarrow)--][div class=\'quotetop\']QUOTE(redarrow @ Jun 2 2006, 05:40 AM) [snapback]379310[/snapback][/div][div class=\'quotemain\'][!--quotec--] You need help in the javascript section ok. [/quote] i will post there too then. i just posted here beacuse it is also php, but thanks.
  14. so, anyone out there that can help?
  15. ok, i looked for someone asking about these options already, but saw nothing, so here it goes. I am currently using the php photo album from [a href=\"http://dynamicdrive.com/dynamicindex4/php-photoalbum.htm\" target=\"_blank\"]http://dynamicdrive.com/dynamicindex4/php-photoalbum.htm[/a] on [a href=\"http://www.smokingwoodies.com\" target=\"_blank\"]http://www.smokingwoodies.com[/a] and it is working great. I however would like to add a couple things into it, and i am stumped. i would like to have the images pull up in a new window like they already do, but i would like the window to resize to the size of the image. similar to the gallery here. [a href=\"http://www.methodcomptech.com/samplework.php\" target=\"_blank\"]http://www.methodcomptech.com/samplework.php[/a]. so obviously i would like it to have the option to scroll through the images from the popup instead of having to close the image, and then click a new one. i would also like to have a slideshow option that the user can change how fast the slideshow is showing. default it to like 3 seconds, and they can set it anywhere from 1 - 10 seconds while in slidshow mode. if anyone can help me with at least a couple of these thing, if not all 3, it would be greatly appreciated. thanks in advance for any help.
  16. it would be a lot easier to pick one with documentation untill you learn, or get a book to help build you to that level
  17. there, header image fixed. i never noticed it doing that in FF cause i forgot to move over the images, so, thanks for the heads up on that. thanks for all the comments everyone.
  18. i thank you all for the feedback. I came here to get this type of feedback and being picked apart like this. on every other site i post on, all i get are replies of how great it is. i dont want that. i want to know what to fix. so here i will start my replies to the complaints. the header: you think it is big, great, i wanted it that way. some people may not like it, others do. i like it, and that will not be changed. as for the small links in the header, they are meant to not be that notisable, but they are there is someone wants to use them. i dont like having the header as the home link. just my preference. some people are to stupid to think of clicking the banner to return home. also, the header is only big when using a screen with low resolution. sorry if you are using 800x600 or 1024x764. but 1024x768 isnt to bad. i will consider possibly making it a touch smaller. as for breaking apart in firefox, i dont see that problem. i test the site in internet explorer and firefox whenever i change anything. maybe a screeshot would help and let me know the screen resolution you are using. the adsense: i will consider removing it. i dont care for it, but looking to make extra money. would love to know of better waus to make extra income. the upload directory. hmmmm, that should have been protected with .htaccess, and must have forgot. i will fix that. the nav: this nav is temporary, it will be changes in the final relsease of the site. just looking for feedback on the content of the site, the look, and the security. the forum: rarely do forums look like the actual site they are on, but I will be changing the colors in the final release to look more like the actual site, but that is not my focus right now. thanks for noticing that i am going for the w3c css compliant pagerank button. well, i had the pr displayed in the header on the top left corner, but since the pr is 0 right now, i dont want it to display will i actually get some pr. so, i still dont see why others may not want it displayed on their site. it is a cool little image that anyone can use. so, thanks for all the comments, positive and constructive. any other suggestions will be greatly appreciated. also, i would love to add any scripts, that any of you may have, to my site. only the php and the asp parts are able to have scripts added right now. i am working on coding the rest right now. thanks again, and please let me know of anything else. :D p.s. not sure where you got the idea that Method Computer Technologies has internet security info, but ok?
  19. [!--quoteo(post=358390:date=Mar 25 2006, 03:49 PM:name=neewah)--][div class=\'quotetop\']QUOTE(neewah @ Mar 25 2006, 03:49 PM) [snapback]358390[/snapback][/div][div class=\'quotemain\'][!--quotec--] This post should really be in website critique... [/quote] ok, thanks. i guess just review it when you get a chance then. thanks in advance. :D
  20. I started a new site to help webmastes and designers alike. looking at incorporating more tools in to the site. open to suggestions. the scripts section was just started, and only the php section is ready to start adding scripts to right now. if you have any scripts, please post them there. [a href=\"http://www.ezadmintools.com\" target=\"_blank\"]http://www.ezadmintools.com[/a]
×
×
  • 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.