Jump to content

wildteen88

Staff Alumni
  • Posts

    10,480
  • Joined

  • Last visited

    Never

Everything posted by wildteen88

  1. Its not broken. its because it is not following CSS compliant standards, which now IE7 is.
  2. That will only in IE7, FF and Opera and prehaps a few other CSS Compliant browsers. it wont work for IE6 and a select few browsers. As not all browsers support the :hover pseudo class on tags other than the anchor tag (a).
  3. Use mysql_fetch_assoc. mysql_fetch_array returns two lots of the same results one with associative indices and the other number indices
  4. Yes that is fine. ENUM only accepts the values you provided when you created the table. So if you did this when creating the users table: [code]CREATE TABLE users ( -- rest of fields here -- activated ENUM('0','1') DEFAULT '0' -- rest of query here --)[/code] Then the activated field will only accept 0 or 1 as the value. if the value given was not 0 or 1 it'll use the default value which was 0.
  5. Yes but you want to use: table table table table td:hover {filter:none; -moz-opacity:1.0; opacity:1.0; -khtml-opacity:1.0;}
  6. You cannot use javascript and PHP together during runtime. As the PHP code would of been parsed before the the javascript has a chance. PHP sends the output to browser, you cannot use PHP and javascript simultaniously. However you can if you use AJAX.
  7. [quote author=wildteen88 link=topic=103207.msg410850#msg410850 date=1154893010] You cannot pass url parameters when including files, they will be ignored. [/quote] I forgot to mention this earlier. Instad of parsing the url parameters in the include statement you should use them on the page that is including the file.
  8. Use the :hover pesudo selector. [code]table table table table td:hover {filter:alpha(opacity=60); -moz-opacity:0.6; opacity:0.6; -khtml-opacity:0.6;)[/code] Keep in mind though some browsers, such as IE6 and below) dont support the :hover pesudo selector. Instead you'll have to use javascript.
  9. You cannot pass url parameters when including files, they will be ignored.
  10. [b]If there is anymore swearing/slagging each other off in this thread again this thread will be closed. I have gone through and removed much of the swearing from this thread, please keep in mind there is possibly minors browsing this forum. Also ignace if you dont like people asking these types of questions then don't bother replying.[/b]
  11. Yes its possible to run your PHP scripts locally. And you have downloaded the correct pieces of software. To install have a read of [url=http://www.php-mysql-tutorial.com/install-apache-php-mysql.php]this guide[/url] If you ahve any problems please post back. Also make sure you have downloade the zipped bineries version of PHP and not the PHP Installer version.
  12. What server have you installed on your Windows box IIS or Apache? If its Apache I can help you. However I am not experience with IIS. If you have IIS installed check the manual for installing [url=http://www.php.net/manual/en/install.windows.iis.php]PHP on an IIS/PWS Server[/url]
  13. Looking at your login.php code, its a bit bloated. Try this: [code]<?php // check username and password POST vars exists first, before continuing if(isset($_POST['username']) && isset($_POST['password'])) {     session_start();     include ("dbinfo.inc.php");     $username = mysql_real_escape_string($_POST['username']);     $password = mysql_real_escape_string($_POST['password']);     $sql = "SELECT * FROM users WHERE username='$username' AND password='$password'";     $result = mysql_query($sql) or die(mysql_error());     // returns numbers of matches found.     $users = mysql_num_rows($result);     // if there was 1 result returned, user has successfully logged in     if ($users == 1)     {         $row = mysql_fetch_assoc($result);         $_SESSION['userid'] = $row['id'];         $_SESSION['username'] = $row['username'];         header("Redirect=5; URL=logged_in.php");         echo "You are logged in! You\'ll be automatically redirected in 5 secounds. ";         echo 'Or click <a href="logged_in.php">here</a> if you are impatient';     }     // user was not logged in, username/password combo incorrect     else     {         echo 'Your Password and/or Username are incorrect<br />Please try agin<br /><br /><a href="index.php">Here</a>';     } } else {     die("You have either come to this page in error or you did not fill in the login form!"); } ?>[/code]
  14. If you are getting results from a database use mysql_fetch_assoc, this returns an associative array, for example it uses the fields names for the array key rather than a number, rather than mysql_fetch_row.
  15. This what I have to get the meta tag contents: [code=php:0]<?php $text = '<meta name="keywords" content="PHP, MySQL, bulletin, board, free, open, source, smf, simple, machines, forum" />'; if(preg_match("#<meta([^>]*)>#si", $text, $matches)) {     //echo '<pre>' . htmlentities(print_r($matches, true)) . '</pre><br /><br />';     //$matches[1] is what stores the contents of the meta tag     $matches[1] = str_replace("/", '', $matches[1]);     // put each attribute and its value into an array     $attrs = preg_split("#(\"\s)#i", trim($matches[1]));     // "e now create a meta array. The format of the array will be:     // Array([attribute_name] => [attribute_value])     foreach($attrs as $attr)     {         // we now get the attribute name and attribute value in sperate variables         list($attr_name, $attr_value) = explode("=", $attr);         // we create our meta array, trimming of any double quotes remaining in the attribute value string.         $meta[$attr_name] = trim($attr_value, '"');     }     echo '<pre>' . print_r($meta, true) . '</pre>'; } ?>[/code] I use the meta tag from the forum for reference. The code outputs the following: [code]Array (     [name] => keywords     [content] => PHP, MySQL, bulletin, board, free, open, source, smf, simple, machines, forum )[/code] [b]EDIT[/b] Updated code to get each attribute into an array.
  16. Yeah, thats about right. [url=http://phpsec.org/articles/2005/password-hashing.html]this article[/url] explains/teahces how beef up password hashing
  17. I believe this: [code]$_SESSION['username'] = $num['username'];[/code] is supposed to be: [code]$_SESSION['username'] = $row['username'];[/code] $num was created from mysql_num_rows. mysql_num_rows doesnt return an array of the rows. Where as $row was created from mysql_fetch_array which returns an array. So it a case of using the wrong variable. Also whoever wrote this: [code]//this prevents and issues of capitilisation. MySQL is case insenstive whereas php is not. This will put the username from the database into the session.[/code] What do you mean?
  18. md5/sha1 uses one way encryption meaning it cannot be decrypted, however it can with brute force and cannot be done easily. Dont use md5 on its own. Use it with salt. If you add salt to your passwords it can become even harder for a hacker to brute force the password.
  19. You are not using mysql_query to perform the query. You should do this: [code]mysql_query($insertdat) or die("<p>Unable to insert data:</p>');[/code] Instead of: [code]if (!$insertdata) {   exit('<p>Unable to insert data:</p>'); }[/code] Also make sure you are connect to MySQL too.
  20. If you want to get the url parameters too (eg index.php?var=foo&var2=bar) you can use $_SERVER['QUERY_STRING']
  21. you cannot assign a variable the value of include as include doesnt return anything. If you want to get the contents of the file you'll want to use file_get_contents function which returns the contents of that file.
  22. Please read the [url=http://www.phpfreaks.com/forums/index.php/topic,95563.0.html]FAQ on this[/url]. Its all explain in that thread.
  23. You cannot run PHP code through the browser, as browsers dont uderstand PHP code and PHP is server side. So it needs a server environment in order to parse the files. If you want to run your PHP you'll have to upload your scripts to your website and run them there, or install Apache, PHP and MySQL (Apache2triad or XAMPP etc) locally on your PC. Save your php files to the htdocs folder and then goto http://localhost/filename.php to run the PHP file. There is no windows hack to run PHP files through a browser. PHP files need to be parsed by the PHP Intepretor, which then sends the output, which is probably text/html, back to the server. The server sends the output back to browser. The browser then takes the output and parses the html/css/javascript.
  24. wildteen88

    select

    Use this.value to get the value of the current selected item in the list: [code]<select name="background" onChange="document.bgColor = this.value"> <optgroup label="Background Chooser">   <option name="color" value="#5577AA">Default</option>   <option name="color" value="#7799DD">Lightblue</option>   <option name="color" value="#335588">Darkblue</option>   <option name="color" value="#5577AA">Black</option> </optgroup> </select>[/code]
  25. You'll want to use percentages
×
×
  • 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.