Jump to content

wildteen88

Staff Alumni
  • Posts

    10,480
  • Joined

  • Last visited

    Never

Everything posted by wildteen88

  1. If I'm not overlooking anything, by id number you mean page number?. Then prehaps you want to use this: [code=php:0]echo ('<a href="1.php?page=' . $page . ' ">' . $row['name'] . ' </a><br />');[/code] Rather than [code=php:0]echo ('<a href="1.php?page=' . $row['id'] . ' ">' . $row['name'] . ' </a><br />');[/code]
  2. yeah that warning is due to this: [code] margin: 0px; margin-right: 3%;[/code] In the #information and #content .col selectors. It should be just [b]margin-right: 3%;[/b] or [b]margin: 0 3% 0 0;[/b] If you go here: http://jigsaw.w3.org/css-validator/validator?uri=http%3A%2F%2Fhomepage.ntlworld.com%2Fcshepwood%2Fbusinessman%2Fcampussource.v2.css&usermedium=all You'll see the CSS now validates. I corrected the warnings for you.
  3. Yes you'll want to use explode, like effigy has shown, however if you are dealling with user input from a form field not all OSs use the same whitespace character for newlines. \r\n - Windows \r - Mac \n - Linux So if you are dealing with user input from a textarea in a form, you'll wnat to do something like this: [code=php:0]// Convert other OS newlines into the linux newline char $words = str_replace(array("\r\n", "\r"), "\n", $_POST['words_txtbox']); $word = explode("\n", $words);[/code]
  4. Huh! With the following code: [code=php:0]define('TEST', 'test is' . ($test? ' ': ' not ') . 'ok'); echo TEST;[/code] PHP will define TEST as "test is ok" if the variable $test exists or holds a boolean that is true, is a string or a number etc. If $test was set to a boolean that is false, null or not a string/number etc it'll define TEST as "test is not ok". When ever you initiate define('VAR_NAME', blah blah) PHP will define the constant VAR_NAME with whats in the secound parameter. If you have ten files that has 100 defines it will only define 100 constants at a time as you can only run one file at a time, unless you include the other 9 files.
  5. The client wont matter whether the site has valid HTML or CSS, they probably wont even know what valid HTML/CSS is. When I use CSS and go to validate it I get warnings, sometimes I dont. I dont really understand the warnings at times. As long as the site looks good in the majority of browsers (such as IE, FF, Opera etc) then dont fix whats doesnt need fixing.
  6. Why dont you try it out for yourself then you'll know. It works for me I get "[i]test is not ok[/i]" message.
  7. If you have a ton of mods installed on your phpBB forum than thats your problem. Or it could your server is low spec. However using phpBB isnt such a good idea either. We use SMF here which is free and is light weight compared to phpBB.
  8. For question1 supergalobals are already global, as by thier name superglobals, you dont need to define them as global withina  function/class. For questioin 2. Yes that should be fine. However you'll want to escape the value I'm unsure abolut 3 and 4 thought
  9. This seems to a coniguration problem with your server. What server have you got installed (APache, IIS) alsow what version of PHP do you have installed and how is PHP configured with your server?
  10. No need to change anything as it states it validates as valid CSS. I wouldnt worry trying to fix those warnings.
  11. Not sure but try the code out first and see if it works. However It should do. All I've done is taken your code and put it into a big echo statement.
  12. The code you posted above is still incomplete. As this block of code is incomplet: [code]{ //BEGIN CHECKING USERNAME...   if(!$_POST['username']) die('Alert: username field was blank.'); //array of invalid characters $junk = array('.', ',', '/', '`', ';', '[', ']', '-', '_', '*', '&', '^', '%', '$', '#', '@', '!', '~', '+', '(', ')', '|', '{', '}', '<', '>', '?', ':', '"', '=');              //starting lenght of username   $len = strlen($_POST['username']);   //replace invalid characters   $_POST['username'] = str_replace($junk, '', $_POST['username']);   $test = $_POST['username'];   //if lenghts are different ($len smaller), invalid characters found, so prompt error.   if(strlen($test) != $len) {     die('Username Error: Username contained invalid characters. You can only use A-Z, 0-9 and the underscore (_).');   } //Check if username already exists... $q2 = mysql_query("SELECT * FROM `members` WHERE `username` = '".$_POST['username']."'");   $q3 = mysql_fetch_object($q2);       if($q3->username == $_POST['username']) {   die('<BR><BR>Sorry, but the username "'.$q3->username.'" is taken, please choose another.'); }[/code] Post the full code here. DO not miss out any code blocks. Also when you post code make sure you use the code tags ([nobbc][code]YOUR CODE HERE[/code][/nobbc]).
  13. Rather than going in and out of PHP mode. Use HEREDOC to echo out the HTML for the scroller: [code=php:0]echo <<<SCROLLER <div id="scroller" style="position:absolute; width:63px; height:23px; z-index:12; left: 774px; top: 275px; visibility: visible;">   <img src="images/del.jpg" width="31" height="31" onMouseOver="P7AniMagic('initial',0,0,5,30,0,0)" onMouseOut="P7AniMagic('initial',0,0,1,1,2,0)">   <img src="images/del.jpg" width="31" height="31" onMouseOver="P7AniMagic('{$Layer2Scroll}',0,{$ScrollVal},5,30,0,0)" onMouseOut="P7AniMagic('initial',0,0,1,1,2,0)"> </div> SCROLLER; // DO NOT INDENT OR PUT ANYTHING ON THE LINE ABOVE![/code]
  14. Rather using seperate if statements use and if/eseif/else statement. [code]<?php if($page == 'SubmitNew') {     include 'submit.php'; } elseif($page=='Contact') {     include 'contact.php'; } elseif($page == 'faq') {     include 'faq.php'; } elseif($page == 'cat') {     if($category == '1')     {         $cat = "shopping";     $m = "14";         include 'outer.php';     }     else     {         include 'inner.php';     } } ?>[/code] Or better option would be a switch/case statement: [code]<?php switch($page) {     case 'SubmitNew':         include 'submit.php';     break;     case 'Contact':         include 'contact.php';     break;     case 'faq':         include 'faq.php';     break;     case 'cat':         if($category == '1')         {             $cat = "shopping";         $m = "14";             include 'outer.php';         }         else         {             include 'inner.php';         }     break; } ?>[/code]
  15. When I deal with dates I prefer to use a unix timestamp (number secounds since Jan 1st 1970), I grab the timestamp using the time() function, then use an INT value and give it a max length of 20 or so. When I retrieve the date I use the date function to convert the timestamp into a readable date, using the secound parameter of the date functions. [code=php:0]date("D-m-y", $row['timestamp']);[/code] If you wnat to use the date function, then you'll wenat to use a VARCHAR field set to 255 chars.
  16. Do you have script tags within your post? If you do add a space before script in the script tag eg: [code]< script >YOU CODE</ script >[/code]
  17. I do not see the problem. The highlighted PHP code looks fine to me, and is more readable compared to the site you have linked to. Could you define what you mean by massive spaces between lines.
  18. Could you post the actuall error message here and the code you are using here too. Also @Daniel0 you do not need to put quotes around variables, floats, booleans etc.
  19. Try this: [code]<?php // initialize a session session_start(); ?> <html> <head></head> <body> <?php // if no data, print the form if (!isset($_SESSION['login']) && !isset($_POST['user'])) { ?> <form action="<?php echo $_SERVER['PHP_SELF']?>" method="post">   Username:<input type="text" name='user'><br />   Password:<input type="text" name='pass'><br />   <input type="submit" name="submit"> </form> <?php } else if (!isset($_SESSION['login'])) {     // if a session does not exist but the form has been submitted     // check to see if the form has all required values     // create a new session     if (empty($_POST['user']) && empty($_POST['pass']))     {     echo "Please insert your username<br />";         echo "Please insert your password<br />";     }     elseif (empty($_POST['user']))     {         echo "Please insert your username<br />";     } elseif (empty($_POST['pass']))     {   echo "Please insert your username<br />"; } } ?> </body> </html>[/code]
  20. You dont need to disable your firewall when going to localhost (or 127.0.0.1). Not sure why localhost doesnt work what version of Windows are you using and what browser are you using. If you create a hello world script, all what wil bel displayed in the browser will be is hello world, and when you got View > Source code they'll just be hello world. No PHP code will be seen. If PHP code is shown then your server isnt configured correctly.
  21. In the Network Domain and Server Name boxes type in localhost For the administrators email you can put your email addy in or a duff email addy, eg admin@localhost The email address wont be used for anythink.
  22. Because you are using exit on the if/else statement. When you use exit is stops the script from running. So if < was not found in the string the script would exit and print word ok. However if > was found it'll exit and show word bad. If you remove the exit; it'll print word okword bad. You dont to use exit in the if/else statement otherwise it wont complete the loop. It'll only run once. Prehaps you want to do something like this: [code=php:0]$mess = "hi there > hows you"; $not_allowed = array("<", ">"); foreach($not_allowed as $val) {     if(eregi($val, $mess))     {         echo "We have detected a word/symbol(s) that we do not accept. Please do not use any of the words/symbols below:<br />\n";         echo 'Words/Sybols not allowed: ' . implode(", ", $not_allowed);     } }[/code]
  23. There is [url=http://tinymce.moxiecode.com/]TinyMCE[/url]. Its a javascript based WYSIWYG editor like FCKEditor.
  24. For your first code snipped you'll wnat to use $val rather than $key in your if statement so the code should be this: [code=php:0]<?php $mess = "hi there < hows you"; $not_allowed = array("<", ">"); foreach($not_allowed as $val) {     if(eregi($val, $mess))     {         echo "word bad";         exit;     }     else     {         echo "word ok";         exit;     } } ?>[/code] However havn't we goine over this subject many times before? I can recall you posting something similar to this before
  25. Thast why we are requesting to see your code. So we can see what chnages you ahve made to your code. So can you please repost the modified code here please so we can review it for any errors or problems we can see.
×
×
  • 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.