Jump to content

elite_prodigy

Members
  • Posts

    158
  • Joined

  • Last visited

    Never

Everything posted by elite_prodigy

  1. Anyone? Please, I'm desperate to solve this error.
  2. Unknown column 'test' in 'where clause' Same error being generated. I have no idea what you're talking about there, could you explain it or write an example? Does anyone know how to solve the error I'm getting? And why the proper page isn't being displayed?
  3. I'm not getting expected results. I'm using the following code to determine if a site even exists in the database: <?php $sql = "SELECT * FROM `sites` WHERE `site`='$site';"; if ($result = mysql_query($sql,$conn)) { if (mysql_num_rows($result)) { if ($_SESSION['count'] < 1){ $page = "home"; $_SESSION['count'] = $_SESSION['count']++; } } } else { $page = "sign"; } ?> The above tests to see if a query can be executed on a particular table, then if the record in the table exists, then decides if this is their first visit of the day and if it is sets the $page variable to "home" which will be used later in my switch structure. If a query cannot be executed on the database, then the record isn't there which setes the $page variable to "sign" which tells the switch structure to display a page telling the user that the site does not exist and that it may be registered for free. The only page that keeps appearing is the "Sign Up" page, even when records exist in the database: http://www.exposemyschool.com/images/scrnShot_phpMyAdmin.jpg Try visiting one of the following sites: http://www.exposemyschool.com/fun http://www.exposemyschool.com/test Both return the Sign Up Page. Does anyone know why this is happening? Here is the full functions.php file. It may help to understand my problem and where I'm going with the whole thing: <?php session_start(); include('config.php'); $site = $_SESSION['site']; $page = $_SESSION['page']; $sql = "SELECT * FROM `sites` WHERE `site`='$site';"; if ($result = mysql_query($sql,$conn)) { if (mysql_num_rows($result)) { if ($_SESSION['count'] < 1){ $page = "home"; $_SESSION['count'] = $_SESSION['count']++; } } } else { $page = "sign"; } switch($page){ case "home":{ $sql = "SELECT `content` FROM `home` WHERE `site`=".$site.";"; $query = mysql_query($sql,$conn); $area2 = $query; $sql = "SELECT * FROM `home_alerts` WHERE `site`=".$site.";"; $query = mysql_query($sql,$conn) or die(mysql_error()); while($notice = mysql_fetch_array($query)){ $title = $notice['title']; $content = $notice['content']; $author = $notice['added_by']; $time = $notice['added_on']; $area1 .= '<div class="alert"><h1 class="alert_title">{$title}</h1><div class="alert_content">{$content}</div><div class="author">Placed By: {$author}</div> <div class="date">On: {$time}</div></div>'; } break; } case "secret":{ $sql = "SELECT * FROM `posts` WHERE `site`=".site.";"; $query = $mysql_querry($sql,$conn); while($secret = mysql_fetch_array($query)){ $title = $secret['title']; $alias = $secret['alias']; $content = $secret['content']; $area2 .= '<div class="secret"><h1 class="title">{$title}</h1>{$content}<div class="author">Author: {$author}</div></div>'; } break; } case "digger":{ $area2 = ' <div class="form"> <form method="post" action="contribute.php"> <div class="prompt_no_break">Alias:</div><div class="input"><input type="text" name="alias" /></div> <div class="prompt_no_break">Title:</div><div class="input"><input type="text" name="title" width="100" /></div> <div class="prompt_break">Contribution:</div><div class="input"><textarea rows="25" cols="50" wrap="virtual"></textarea></div> </div> '; break; } case "archive":{ $sql = "SELECT * FROM `dirt_approve` WHERE `site`=".site.";"; $query = $mysql_querry($sql,$conn); while($secret = mysql_fetch_array($query)){ $title = $secret['title']; $alias = $secret['alias']; $content = $secret['content']; $area2 .= '<div class="secret"><h1 class="title">{$title}</h1>{$content}<div class="author">Author: {$author}</div></div>'; break; } } case "staff":{ $sql = "SELECT `alias` FROM `staff` WHERE `site`=".site.";"; $query = $mysql_querry($sql,$conn); while($staff = mysql_fetch_array($query)){ $alias = $staff['alias']; $alias_list .= '<li>{$alias}</li>'; } $area2 = '<div class="staff"><ul>{$alias_list}</ul></div>'; break; } case "sign":{ $area2 = '<div class="available"><h1>Congratulations!</h1>This domain is available for free registration.<a href="http://www.exposemyschool.com/sign_up.php">Sign Up Now!</a></div>'; break; } default:{ $area2 = '<div class="nav_error"><h1 class="title">Oops!</h1>The following error(s) occured while attempting to process your request: <ul> <li>The page you are looking for does not exist</li> <li>The page was moved</li> <li>The site you are searching for no longer exists</li> <li>The site you are attempting to access has been deleted due to a terms of service violation.</li> </ul> Possible Solutions: Contact technical-support [at] exposemyschool [dot] com . There may be a fatal systems error that needs attention. Try refreshing the page. Make sure you typed the address correctly. If you are the owner of this site and are unable to access it contact User Services at: user-service [at] exposemyschool [dot] com . If you recently registered this site then try waiting. It may take several minutes to register in our systems.</div>'; break; } } ?> (please be patient with all above links, scripts are being run on the server which cause Apache to restart every few minutes)
  4. Thank you! Why didn't I think of that? So simple! I really need to think more logically.
  5. I'm using the following code to test if a "site" exists in the database. <?php //... $sql = "SELECT * FROM `sites` WHERE `site`=$site;"; $result = mysql_query($sql,$conn); $rows = mysql_num_rows($result); if($rows > 0){ if($_SESSION['count'] < 1){ $page = "home"; $_SESSION['count'] = $_SESSION['count']++; } } else{ $page = "sign"; } //... ?> The above code does a couple things. It queries the data I need from the database and uses mysql_num_rows() to see if at least one row exists (I'll add a clause later for when more than one row exists) because if there is a row then the site is there. I'm getting the desired result, but a warning is generated when no site exists because mysql_num_rows() returns an error when there is nothing to query. I need to catch the warning so that it is not displayed to the screen. I thinking a try/catch statement but cannot for the life of me think of how to write it. Can anyone help?
  6. What the hell does this mean? I have no idea, the line the error references is the final line of my code, the ?> line. The last 20 or so lines of the file: <?php //... //... //... case "sign":{ $area2 = '<div class="available"><h1>Congratulations!</h1>This domain is available for free registration.<a href="http://www.exposemyschool.com/sign_up.php">Sign Up Now!</a></div>'; break; } default:{ $area2 = '<div class="nav_error"><h1 class="title">Oops!</h1>The following error(s) occured while attempting to process your request: <ul> <li>The page you are looking for does not exist</li> <li>The page was moved</li> <li>The site you are searching for no longer exists</li> <li>The site you are attempting to access has been deleted due to a terms of service violation.</li> </ul> Possible Solutions: Contact technical-support [at] exposemyschool [dot] com . There may be a fatal systems error that needs attention. Try refreshing the page. Make sure you typed the address correctly. If you are the owner of this site and are unable to access it contact User Services at: user-service [at] exposemyschool [dot] com . If you recently registered this site then try waiting. It may take several minutes to register in our systems.</div>'; break; } } ?> //line 154
  7. Oh, thanks! Right now I'm laughing my ass off at myself because that is EXACTLY what I programmed the page to do. I just havn't added in the clause that tells the user that the site doesn't exist which would prevent that error from ever even occuring! Thanks. I have a bad habit of assuming my queries are perfect (they are not, mostly) and forgetting to put in the die() which, even when the queries are "perfect" might reveal information which could help fix the problem. (Which it almost always does) Thanks! --elite
  8. Can someone explain why the below code is NOT a valid result resource? I use the variable $notice to store the array: <?php //... case "home":{ $sql = "SELECT `content` FROM `home` WHERE `site`=".$site.";"; $query = mysql_query($sql,$conn); $area2 = $query; $sql = "SELECT * FROM `home_alerts` WHERE `site`=".$site.";"; $query = mysql_query($sql,$conn); while($notice = mysql_fetch_array($query)){ //Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/expose/public_html/site/functions.php on line 30 $title = $notice['title']; $content = $notice['content']; $author = $notice['added_by']; $time = $notice['added_on']; $area1 .= '<div class="alert"><h1 class="alert_title">{$title}</h1><div class="alert_content">{$content}</div><div class="author">Placed By: {$author}</div> <div class="date">On: {$time}</div></div>'; } break; }
  9. If you are a programmer, you are involved with the design whether you like it or not. Your scripts output the (x)html that then has CSS layered over top. Granted as a back end programmer you can ignore what the designer does with the CSS, but if you don't output (x)html that the designer can use, then you aren't doing a very good job of programming. I am given formats and I use said formats for use with output. I do my best to keep my output as clean of (x)HTML as possible. Sorry, fixed this on friday. I just built a bunch of divs. You can look at it here : http://exposemyschool.co.cc/phpfreaks
  10. The title of the post was "Optimization....". I want help optimizing my page. I'm a programmer first, a designer seccond. I work mainly with backend operations. I don't do design. So, if you want to explain how to do this with boxes or divs, go ahead. I still can't get the float: center;.
  11. I've tried that and the table remains on the left of the page.
  12. Windows is written in: C - > "kernel" C++ - > "kernel", registry, parts of the GUI, shell, MFC, API(?) Assembly - > actually helps to change the way windows reads its own C/C++, structural uses; low level task switching routines; device drivers, all of DOS Visual Basic - > puts the windows in Windows Java - > Vista Only - graphical effects (unconfirmed) As full rewrites are a "no-no" Windows have been rehashing, hacking, breaking, fixing, screwing around with, bashing, smashing, killing, resurecting, and more explicit things with the old DOS all the way up to XP. I'm almost positive Vista was has an all new Kernel and API
  13. Okay the page is http://exposemyschool.co.cc/something <--write whatever you want for your own musings The source is: <html> <head> <title> <?php echo $site; ?> .::. Dirty Little Secrets .::. <?php echo $page ?> </title> <link rel="stylesheet" type="text/css" href="http://exposemyschool.co.cc/site/main.css"> </head> <body> <table border="1" class="container"> <tr> <td colspan="5" class="top_bar"> </td> </tr> <tr> <td class="nav">Home</td> <td class="nav">Secrets</td> <td class="nav">Dirt Digger</td> <td class="nav">Archives</td> <td class="nav">Staff</td> </tr> <tr> <td colspan="5"> <table border="1" class="content"> <tr> <td class="display"> <?php echo $var_name; ?> </td> </tr> </table> </td> </tr> </table> </body> </html> The CSS is: body{ background-color : #333366; } .top_bar{ background: #333366 url("http://exposemyschool.co.cc/site/images/top_bar.jpg") top left repeat-x; height: 143px; width: 100%; } .nav{ background: #333366 url("http://exposemyschool.co.cc/site/images/nav_bar.jpg") top left repeat-x; height: 40px; align: center; } .container{ width: 75%; align: center; position: absolute left: 12.5% } .content{ align: center; width: 100%; } I can't get the table to move to the center. And when I take away the border there are lines through the backgrounds of the NavBar. Can someone help me with this? My strength is not in design. *ingnore the PHP, this page will be displaying dynamically from SQL. there is only one page that will, if I can manage, seem like several.
  14. The mod_rewrite should be able to handle several pages at once. Like I said, I want it to appear that they are in a separate directory. So users should be able to navigate through links and stuff without them ever seeing anything but their subdirectory.
  15. Okay, when I click "Create New Directory" I enter .htaccess then I added <IfModule mod_rewrite.c> RewriteEngine On </IfModule> RewriteRule ^([a-zA-Z0-9_]+)$ site?siteName=$1 RewriteRule ^([a-zA-Z0-9_]+)/$ site?siteName=$1 Then I click "Save File" and the file never appears. But when I name it something like htaccess.htaccess the file appears. But I keep getting a page not found error. The .htaccess file is in my root directory in public HTML. So when I type an address like this: http://www.somesite.com/fun the Super Global $_get[] should recieve the siteName variable and recieve the value "fun" but I have a index.php file set up in the /site/ directory with <?php echo $_GET['site']; ?> But I never get to the index.php, just a cheap error page.
  16. Could you add underscores so it could do a url such as : http://www.somesite.come/happy_fields and turn it into: http://www.somesite.com/site?siteName=happy_fields
  17. I need to take a URL such as: http://www.somesite.come/RANDOM_TEXT and turn it into: http://www.somesite.com/site?siteName=RANDOM_TEXT Could someone show me how to do that? I want to give the appearance of individual directories without all the hassle as one "Super Mod" pointed out to me. (Thanks by the way) Thanks! --Elite
  18. Can someone show me how to use mod_rewrite or link to a great tutorial? Thanks! --Elite
  19. Okay, below I create all the directories and open all the files needed to run the SiteBuilder. <?php //set up the directories and build files mkdir($site); mkdir($site."/admin"); mkdir($site."/admin/style"); $adm_style_overall = fopen($site."/admin/style/overall.css", "w+"); //written $adm_dirt = fopen($site."/admin/dirt.php", "w+"); //written $adm_index = fopen($site."/admin/index.php", "w+"); //written $adm_login = fopen($site."/admin/login.php", "w+"); //written $adm_pass = fopen($site."/admin/change_pass.php", "w+"); //written $adm_dish_it = fopen($site."/admin/dish_it.php", "w+"); //written $adm_old_posts = fopen($site."/admin/old_posts.php", "w+"); //written $adm_profile = fopen($site."/admin/profile.php", "w+"); //written $adm_user_admin = fopen($site."/admin/user_admin.php", "w+"); //written $adm_temp_request = fopen($site."/admin/temp_request.php", "w+"); //written $adm_appearance = fopen($site."/admin/appearance.php", "w+");//written mkdir($site."/images"); mkdir($site."/staff"); mkdir($site."/style"); $site_style_overall = fopen($site."/style/overall.css", "w+"); //written $site_dirt_digger = fopen($site."/dirt_digger.php", "w+"); //written $site_dirt_digger_archive = fopen($site."/dirt_digger_archive.php", "w+"); //written $site_do_dirt = fopen($site."/do_dirt.php", "w+"); //written $site_index = fopen($site."/index.php", "w+"); //written $site_secrets = fopen($site."/secrets.php", "w+"); //written $site_staff = fopen($site."/staff.php", "w+"); //written ?> Now, here I write staff.php, and get this error: <?php /*** Begin staff.php ***/ $page_staff = " <?php $"."conn = mysql_connect(\"localhost\", \"********\", \"**********\") or die(mysql_error()); mysql_select_db(\"********\",$conn) or die(mysql_error()); $"."get_pages = \"SELECT * FROM `".$site."_staff`;\"; $"."page_data = mysql_query($"."get_pages,$"."conn); while($"."pages = mysql_fetch_array($"."page_data)){ $"."name = $"."pages[username]; $"."list .= \"<a href=\\\"$"."namehttp://www.exposeyourschool.co.cc/\".$"."site.\"/staff/\".$\".\"name.\".php\\\">$\".\"name</a><br /><br /><br />\"; } ?> <html> <head> <title>".$district."\'s Dirty Little Secrets</title> <style type=\"text/css\"> @import url(\"http://www.exposeyourschool.co.cc/{$site}/style/overall.css\"); </style> </head> <body> <table class=\"main\" border=\"0\"> <tr> <td colspan=\"2\"> <table class=\"logo\" border=\"0\"> <tr valign=\"top\"> <td> <center><img src=\"http://www.exposeyourschool.co.cc/".$site."/images/header.jpg\" /></center> <br /> </td> </tr> </table> </td> </tr> <tr class=\"mid\" valign=\"top\"> <td class=\"nav\"> <a href=\"http://www.exposeyourschool.co.cc/".$site."/index.php\">Home</a> <br /> <br /> <a href=\"http://www.exposeyourschool.co.cc/".$site."/secrets.php\">Dirty Little Secrets</a> <br /> <br /> <a href=\"http://www.exposeyourschool.co.cc/".$site."/staff.php\">Staff</a> <br /> <br /> <a href=\"http://www.exposeyourschool.co.cc/".$site."/dirt_digger.php\">Dirt Digger</a> <br /> <br /> <a href=\"http://www.exposeyourschool.co.cc/".$site."/dirt_digger_archive.php\">Dirt Digger Archive</a> <br /> </td> <td class=\"body\"> <?php echo $"."list; ?> </td> </tr> <tr class=\"bot\" valign=\"top\"> <td class=\"footer\" colspan=\"2\"> <center> <script type=\"text/javascript\" src=\"http://x10hosting.com/adserve.js?corporate\"></script><br /> Copyright © 2008 ".$site." Secrets and Their Volunteers<br /> All Outside Links and Articles are © Their Respective Owners<br /> </center> </td> </tr> </table> </body> </html> "; //write file fwrite($site_index, $page_index); //this is the line with the errors fclose($site_index); //This is the line with the errors. /*** End staff.php ***/ ?> Can anyone tell me why this particular error keeps popping up?
  20. Thanks to everyone who answered! I so can't wait to finish the registration system!
  21. Fixed! For now! <?php $local = "overall.css"; $css_file = fopen($local, "r"); //changed mode to "r" $CSS = fread($css_file, 400000); fclose($css_file); ?>
  22. That didn't work. It's the right file, I just recreates the file when opened. Maybe changing the mode will help?
×
×
  • 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.