Jump to content

mike12255

Members
  • Posts

    439
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by mike12255

  1. they example i posted didnt, but my real code does have proper indexes
  2. dang, i have a bunch of queries like this running so it really slows down my page, thanks.
  3. So i currenlty have a really slow page and i think its beacuse all the diffrent querys i run on the db. So i was wondering if it was possible to combine a COUNT(*) so i still get the total number of entires with a limit on another thing. Basically im just trying to combine the code below. <?php $count = mysql_result(mysql_query("SELECT COUNT(*) FROM skillsoverall"),0) or die(mysql_error()); $query = mysql_query ("SELECT playerName FROM skillsoverall ORDER BY lvl DESC limit $from, $ppls_page") or die(mysql_error()); ?>
  4. is it possible to check for a swear word, then got a character length to check if the character length matches the length of the swear word?
  5. ok thanks cags ill try it when i get home, off to school now.
  6. i tried using in array problem is when i use the string "hey fuck" it does not see the word "fuck" i tried expermenting with this would strstr() be good for this in a for each statment?
  7. this is how i've layed out my funtion so far: function check_words($str){ $bad = array('fuck','shit','ass','cunt','dick','penis','whore','douche','clit','boob','nipple','sex','http://'); if (!preg_match($str,$bad)){ return true; }else{ return false; } } i just need a simply way to see if the string contains atleast one of those words, which method do you think is best. I also need to to search for things like "motherfucker" and see "fuck" cause this is a community site.
  8. is there an away to use preg_match with an array? i want to check a string with an array to see if it contains badwords however i get an error saying string expect it got an array, which i know.
  9. crap normally i call it row i was really gapping it yesterday...yeah i know about the messy code i just wanted to try somthing so wasnted worried about OOP thanks
  10. So my code below does want i want, grabs info from a db and displays it according to last name, however there is an issue it says this error after showing the names: does anyone know why? <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>DriveProtest.ca</title> <meta name="keywords" content="ontario canada protest drive strike instructor liscense G1 G2 G" /> <meta name="description" content="" /> <link rel="stylesheet" type="text/css" href="style.css" /> </head> <body> <div id="container"> <div id="navcont"> <ul id="nav" > <li ><a href="index.php">Home</a></li> <li><a href="about.php">About</a></li> <li><a href="petition.php">Petition</a></li> <li><a href="contact.php">Contact</a></li> <li><a href="donate.php">Donate</a></li> <li></li> </ul> </div> <div id="content_main"> <h3><br /> </h3> <h3>News: Welcome To DriveProtest.ca</h3> <?php $con = mysql_connect('localhost','mike1992_driver','raven1'); $db = mysql_select_db('mike1992_petition',$con); $ip = GetHostByName($REMOTE_ADDR); $sql = "SELECT * FROM petition WHERE ip = '$ip'"; $res = mysql_query($sql) or die (mysql_error()); if (mysql_num_rows($res) == 0){ // has not signed it yet echo "<p><strong>You have not signed the petition yet!</strong> to do so <a href=\"petition2.php\">click here</a>!"; }else{ // their ip is in our db so dont display forum. echo "</p>You have already signed this peition so you cannot sign it, however you may view all the signatures it holds"; } $sql = "SELECT COUNT(*) AS CNT FROM petition"; $res = mysql_query($sql); echo "<br /> There are currently $CNT signatures!</p>"; $sql = "SELECT fname,lname,comment FROM petition ORDER BY lname DESC"; $res = mysql_query($sql) or die (mysql_error()); while ($res = mysql_fetch_array($res)){ //create the table echo $res['lname'] . " " .$res['fname'] . " " . $res['comment'] ; } ?> </p> <hr /><br /> <br /> <br /> </div> <div id="nav_main"><br /> <h4><strong>Advertisements</strong></h4> <ul> <li> <script type="text/javascript"><!-- google_ad_client = "pub-8552204471372682"; /* 160x600, created 8/26/09 */ google_ad_slot = "4663547552"; google_ad_width = 160; google_ad_height = 600; //--> </script> <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script> </li> </ul> </div> </div> <div id="footer"> <div id="copyright">Copyright © 2009 DriveProtest.ca</div> <ul id="nav_footer"> <li><a href="index.php">Home</a> |</li> <li> <a href="contact.php">Contact</a> |</li> <li> <a href="#">Sitemap</a></li> </ul> </div> </body> </html>
  11. no didnt help, thanks for trying though mate
  12. so you want to get the admins email from a database and send an email to it?
  13. so on the this page you can see a list of 25 names with the word "test" under them. I want to make the words test appear to the right of the names i tried echoing divs after after the names but that didnt work, here is my code and css: php code: <?php include "global.php"; //top 25 scores function top(){ $sql = "SELECT * FROM skillsoverall ORDER BY xp DESC LIMIT 0,25"; $i =1; $mods = array("samm", "claws", "danny", "josh", "tehbyte", "saints skill", "mike"); $res = mysql_query($sql) or die (mysql_error()); while ($row=mysql_fetch_array($res)){ echo "<div id=\"center\">"; if (in_array($row['playerName'],$mods)){ echo $i.". " ; //echo "<div style=\"color:#008B8B\">"; echo "<img src=\"modcrown.gif\">"; echo $row['playerName'] . "<br />"; //echo "</div>"; $i++; }else{ echo $i.". " . $row['playerName'] . "<br />"; $i++; } echo "</div>"; echo "<div id=\"right\">"; echo "test"; echo "</div>"; } } top(); ?> and here is my css: @charset "utf-8"; @import url(nav.css); /* CSS Document */ /* Blanket Styles*/ body { background:url(images/BG.gif); margin: 0; padding: 0; font-size: small; color: #383838; font-family: Verdana, Arial, Helvetica, sans-serif; } * html body { font-size: x-small; /* for IE5/Win */ f\ont-size: small; /* for other IE versions */ } img { border-style: none; } * { margin: 0; padding: 0; } a:link, a:visited { color: #383838; text-decoration: underline; } #left { width: 140px; float: left; padding: 15px 10px; /* side padding is added to total width above for a 160px "real total" */ } #center { margin: 0px; padding: 15px 8px 8px 8px; float: right; width: 144px; } #right { margin: 0 165px; padding: 15px; } #header{ width:750px; height:300px; margin-left:auto; margin-right:auto; margin-top:5px; background-image:url(images/header.png) } a:hover, a:active { color: #585858; } /* Conatiner */ #container { background-color: #fff; width: 1100px; margin: 0 auto; overflow: hidden; } /* Header */ #container h1 { width: 600px; height: 42px; margin: 28px 0 0 18px; float: left; font-family :Ligurino, Verdana, "Arial Rounded MT Bold", Arial, Georgia, "Times New Roman", Times, serif; font-size:36px;` } #staff{ background-color: #EBEBEB; margin-left:auto; margin-left:auto; text-align:left; } #skills{ float:right; width:auto; } #level{ float:left; width:auto; } #buttons { margin: 42px 27px 0; float: right; } #buttons img { padding-left: 7px; } /* Info */ #info { height: 315px; margin: 0 auto; clear: both; } #info h2 { font: 100 140% Arial, Helvetica, sans-serif; letter-spacing: 1.5px; color: #464646; padding: 22px 0 0 25px; } #info p { width: 220px; color: #898888; padding: 5px 0 0 25px; } #whatisthis { float: left; width: 300px; } #templatetypes { float:left; width: 200px; padding: 21px 0 0 66px; } #supportlinks { float: right; width: 155px; padding: 21px 50px 0; } #info ul { list-style-image: url(images/bullet.gif); } #info li { line-height: 22px; } #info a:link, #info a:visited { color: #585858; text-decoration: none; } #info a:hover, #info a:active { color: #585858; background-color: #FFFFFF; } /* Main Content Area */ #content_main { width: 620px; padding: 0 0 0 15px; margin: 20px 0; float: left; text-align: justify; margin-left: 15px; } #content_main p { line-height: 23px; display: block; text-align: left; padding-bottom: 10px; } #nav_main { float: right; width: 200px; background: url(images/r_bg.gif) repeat-y; height: 650px; padding: 0 0px 0 25px; margin: 32px 0; } #nav_main ul { list-style: none; } #nav_main ul li { line-height: 23px; } #nav_main a:link, #nav_main a:visited { color: #383838; text-decoration: none; } #nav_main a:hover, #info a:active { color: #585858; } #card { float: left; } h3 { font-family: "Times New Roman", Times, serif; font-size: 180%; font-weight: 100; } h4 { color: #bbbbbb; font-family: "Times New Roman", Times, serif; font-weight: 100; padding-bottom: 8px; } hr { border: 0; color: #d7d5cb; background: #d7d5cb; height: 1px; margin: 15px 0 20px 0; } /* Footer */ #footer { width: 822px; color: #fff; font-size: 85%; margin: 20px auto; padding-bottom: 20px; } #footer a:link, #footer a:hover, #footer a:active, #footer a:visited { color: #fff; text-decoration: none; } #copyright { float: left; } #nav_footer { float: right; list-style: none; } #nav_footer li { float: left; } /* Special Formatting */ code { margin: 5px 0; padding: 10px; text-align: left; display: block; overflow: auto; font: 500 1em/1.5em 'Lucida Console', 'courier new', monospace; /* white-space: pre; */ background: #FAFAFA; border: 1px solid #f2f2f2; border-left: 3px solid #666666; } blockquote { margin: 15px; padding: 0 0 0 20px; background-color: #FAFAFA; background-position: 8px 10px; border: 1px solid #f2f2f2; border-left: 3px solid #666666; font: bold 1.2em/1.5em "Trebuchet MS", Tahoma, sans-serif; color: #666666; } blockquote p, blockquote ul, blockquote ol { line-height: normal; font-style: italic; } .float-left { float: left; padding-right: 5px; } .float-right { float: right; padding-left: 5px; } .align-left { text-align: left; } .align-right { text-align: right; } /* Table Styling */ table { border-collapse: collapse; margin: 10px 15px; } th strong { color: #fff; } th { background: #717170; background-image:url(images/nav/nav_bg.png); background-repeat:repeat-x; height: 35px; padding-left: 11px; padding-right: 11px; color: #fff; text-align: left; border-left: 1px solid #999999; border-bottom: solid 2px #FFF; } tr { height: 30px; } td { padding-left: 11px; padding-right: 11px; /* border-left: 1px solid #FFE1C3; */ border-left: 1px solid #FFF; border-bottom: solid 1px #ffffff; } td.first,th.first { border-left: 0px; } tr.row-a { background: #F8F8F8; } tr.row-b { background: #EFEFEF; } /* form styling */ form { margin:10px 15px; padding: 5px; border: 1px solid #EEEEEE; background-color: #FAFAFA; } label { display:block; font-weight:bold; margin:5px 0; } input { width: 275px; padding: 2px; border:1px solid #eee; font: normal 1em "Trebuchet MS", Tahoma, sans-serif; color:#777; } textarea { width:375px; padding:2px; font: normal 1em "Trebuchet MS", Tahoma, sans-serif; border:1px solid #eee; height:100px; display:block; color:#777; } input.button { margin: 0; font: bold 1em Arial, Sans-serif; background: #FFF url(gradientbg.jpg) repeat-x; padding: 2px 3px; color: #333; border: 1px solid #DADADA; }
  14. here is my website layout the italic admin folder does not exsist from withing the install folder i am trying to create the directory admin sub folders rootfolder admininstall
  15. i understand folders i need to go up a directory and create my new folder and files
  16. so i want to have to places on my site an admin folder and the main site so im creating the admin folder with mkdir however it keeps creating the folder in the install folder i have tried ../ and ././ methods. Also i dont know were this is going but i have it creating a config.php file that is suposed to go in the main site and admin folder however its not appearing at all. The install folder is a folder of the main site. so its not a folder inside a folder or anything. here is my code: <?php $config = "<?php // database connection config \$dbHost = '$db'; \$dbUser = '$dbuser'; \$dbPass = '$dbpass'; \$dbName = '$dbname'; \$bid = '$bid'; \$dbConn = mysql_connect (\$dbHost, \$dbUser, \$dbPass) or die ('MySQL connect failed. ' . mysql_error()); mysql_select_db(\$dbName) or die('Cannot select database. ' . mysql_error()); ?>"; //create and open and create the config file $fn = "././config.php"; $fn2 = "././admin/config.php"; $fh = fopen($fn ,'w') or die("can't open file"); //write in into the config file $fh = fwrite($fh,$config); //close it to open the admin config file //fclose($fh); //open the admin config file $fh2 = fopen($fn2 ,'w') or die("can't open file"); //write into the admin config file fwrite($fh2, $config); //close the admin config file //fclose($fn); ?> can anyone help me with this issue?
  17. i was more less looking for the function name rather then having it typed for me...
  18. i think i do that, on the one page i query the basic_info table, and then on the next page after that i query info into the other two tables
  19. i do have id set to auto increment for each table, is there a function to find the highest one?
  20. so i've setup my database layout below. As you can see pages and users both have the field bid this refers to the id in basic_info. I thought this would be a great idea so i could use one database for all my clients however i ran into a problem. im not sure how to tell php which id it should query into bid. I use an automated script to insert all the info into my database and before i had a seperate db for every client. So say i have 323 clients in my db and i got to add a new one so there will be 324 how can i tell php to find out that bid should equal 324 and query it in with the new entery? table feilds basic_info id cleint cleint_email website website_info Pages id bid name info usersidbidusernamepassword
  21. sadly i always make small little mistakes like that but cant catch them other then that my script does as i wish, thanks for catching the error mate
  22. so im trying to get the text the user selects and add bold tags around them problem is my button dosnt seem to work, can anyone figure out why? <html> <head> <script language="javascript" type="text/javascript"> function ShowSelection() { var textComponent = document.getElementById('outputtext'); var selectedText; // IE version if (document.selection != undefined) { textComponent.focus(); var sel = document.selection.createRange(); selectedText = sel.text; document.myform.outputtext.value += "[b]" + selectedText + "[/b]"; } // Mozilla version else if (textComponent.selectionStart != undefined) { var startPos = textComponent.selectionStart; var endPos = textComponent.selectionEnd; selectedText = textComponent.value.substring(startPos, endPos) document.myform.outputtext.value += "[b]" + selectedText + "[/b]"; } // alert("You selected: " + selectedText); } </script> <form name="myform"> <input type="button" value="Option One" onClick="addtext1();"> <input type="button" value="Bold" onClick="ShowSelection();"> <textarea name="outputtext" cols="30" rows="25">Dear </textarea> </form> <!--next--> </body> </html>
  23. I designed that header based of a tutorial i saw that included the robots, if i can find the website link again ill post the credits
×
×
  • 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.