wildteen88
Staff Alumni-
Posts
10,480 -
Joined
-
Last visited
Never
Everything posted by wildteen88
-
Its not broken. its because it is not following CSS compliant standards, which now IE7 is.
-
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).
-
Use mysql_fetch_assoc. mysql_fetch_array returns two lots of the same results one with associative indices and the other number indices
-
Inserting into table with ENUM value? the right way?
wildteen88 replied to bilis_money's topic in PHP Coding Help
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. -
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;}
-
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.
-
[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.
-
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.
-
You cannot pass url parameters when including files, they will be ignored.
-
[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]
-
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.
-
What about as a local host??
wildteen88 replied to dsartain's topic in PHP Installation and Configuration
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] -
Noobie Stuff: Very Basics Explained Easily
wildteen88 replied to Pudgemeister's topic in PHP Coding Help
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] -
Name for array element instead of number...
wildteen88 replied to AncientSage's topic in PHP Coding Help
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. -
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.
-
Yeah, thats about right. [url=http://phpsec.org/articles/2005/password-hashing.html]this article[/url] explains/teahces how beef up password hashing
-
Noobie Stuff: Very Basics Explained Easily
wildteen88 replied to Pudgemeister's topic in PHP Coding Help
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? -
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.
-
PHP & MySQL 'INSERT INTO' function not working.
wildteen88 replied to nickholt1972's topic in PHP Coding Help
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. -
how to get the current URL of the current page?
wildteen88 replied to bilis_money's topic in PHP Coding Help
If you want to get the url parameters too (eg index.php?var=foo&var2=bar) you can use $_SERVER['QUERY_STRING'] -
eregi_replace problem when string is a file
wildteen88 replied to silentwf's topic in PHP Coding Help
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. -
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.
-
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.
-
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]
-
You'll want to use percentages