wildteen88
Staff Alumni-
Posts
10,480 -
Joined
-
Last visited
Never
Everything posted by wildteen88
-
PHP only has two versions - PHP4 or PHP5. There is no difference between the two except PHP5 has better OOP support and has a few functions dedicated to it. to get PHP go to http://www.php.net If you are on a non windows OS then you need to download the source and compile it yourself. If you are on Windows just download the zip package. Not the installer.
-
Microsoft (Windows) servers can still run PHP. If your host wont install PHP or has no hosting plans that support PHP. Then you will need to change hosts.
-
Go to http://www.php.net/downloads.php to get PHP(download PHP5.2 and make sure you get the zipped binaries, not the installer!). Then you will need to get a HTTP server. if you're on XP Pro then you can install IIS. However I prefer Apache. You can get Apache from [url=http://www.mirror.ac.uk/mirror/ftp.apache.org/httpd/binaries/win32/apache_2.2.3-win32-x86-no_ssl.msi]here[/url]. Installing Apache is easy as you just need to run through the onscreen instructions from the installer. However when it asks about Network Domain and Server Name type in [b]localhost[/b] for both then give it a false email address for the administrator password (admin@localhost will do). Now just plough through the remaining installation prompts until Apache is installed. Once it is, open up your web browser and go to the following address: http://localhost/ When you go there it should display a simple "It Works" message or an Apache welcome screen. If it does then you have successfully installed Apache! Now you need to install PHP! To install PHP first get the zipped binaries from php.net once you've done that extract the contents of the zip to C:\PHP. Once it has extracted PHP. PHP is installed! However we now need to configure PHP as an Apache module. To do so open up the httpd.conf for editing (Should be in C:/Program Files/Apache Group/Apache2.2/conf) Now add the following to end of the httpd.conf: [code]# PHP5 LoadModule php5_module "C:/PHP/php5apache2_2.dll" PHPIniDir "C:/WINDOWS" AddType application/x-httpd-php .php .phtml AddType application/x-httpd-phps .phps[/code] Save the httpd.conf file and restart Apache. Start > Program Files > Apache HTTP Server 2.2.x > Control Apache Server > Restart). If you get no beeps/error prompts then Apache is configured correctly. Now go to C:/Program Files/Apache Group/Apache2.2/htdocs (this is where you put your PHP files), and right click an empty space in the folder and choose New Text Document, rename this new file to test.php. Now open this file in notepad and add the following code to it: [code]<?php phpinfo(); ?>[/code] Reopen your web browser and go to http://localhost/test.php you should get a full page of information about PHP configuration and operating environment. If you do then everything is installed! Hope that helps![/code]
-
Cant access MySQL from PHP script
wildteen88 replied to jeboy's topic in PHP Installation and Configuration
Thread locked. Please do not double post. Thank you. -
In order to use Apache2.2 with PHP, eaither upgrade PHP to version 5 or downgrade Apache to Apache2.0.x Also setup PHP as an Apache Module
-
Cant access MySQL from PHP script
wildteen88 replied to jeboy's topic in PHP Installation and Configuration
When you made the changes to the php.ini and moved the files did you restart Apache? You restart Apache in order for the changes to come into effect. Also it has nothing to do with the MySQL server. It is a PHP configuration issue. Please [url=http://www.phpfreaks.com/forums/index.php/topic,95378.0.html]read this FAQ[/url]. It should help you. -
Please more info on what you are trying to do. Whats the problem with the page you provided? looks fine to me.
-
I'm logged in and playing the game, whats wrong? Also what do you mean it "doesn't show the rest". please provide more information. Do you mean the rest of the HTML?
-
Try this: [code]<?php if(isset($_POST['act']) && $_POST['act'] == 'register') { $errors = ''; foreach($_POST as $key => $value) { if($key == 'pass' || $key == 'email') { $k = $key . '2'; if(empty($_POST[$key]) || $_POST[$key] != $_POST[$k]) { $field = (($key == 'pass') ? 'passwords' : 'email addresses'); $errors[] = 'The ' . $field . ' do not match'; } } elseif(isset($_POST[$key]) && empty($_POST[$key])) { if($key != 'pass2' && $key != 'email2') { $errors[] = 'Please fill in the ' . $key . " field<br />\n"; } } } if(is_array($errors)) { echo "Unable to submit the form, due to the following errors:<br /> <ul>\n"; foreach($errors as $error) { echo ' <li>' . $error . "</li>\n"; } echo "</ul>\n"; } } echo <<<HTML <form name="reg" method="post" action="{$_SERVER['PHP_SELF']}"> <table border="0" cellspacing="3" cellpadding="2"> <tr> <td class="gbr">Username:</td> <td class="gbr"><input type="text" name="username"></td> </tr> <tr> <td class="gbr">Password:</td> <td class="gbr"><input type="password" name="pass"></td> </tr> <tr> <td class="gbr"><i>Confirm:</i></td> <td class="gbr"><input type="password" name="pass2"></td> </tr> <tr> <td class="gbr">Email:</td> <td class="gbr"><input type="text" name="email"></td> </tr> <tr> <td class="gbr"><i>Confirm:</i></td> <td class="gbr"><input type="text" name="email2"></td> </tr> <tr> <td class="gbr">Birthday:</td> <td class="gbr"> <select name="month"> <option value="January">January</option> <option value="February">February</option> <option value="March">March</option> <option value="April">April</option> <option value="May">May</option> <option value="June">June</option> <option value="July">July</option> <option value="August">August</option> <option value="September">September</option> <option value="October">October</option> <option value="November">November</option> <option value="December">December</option> </select> <select name="day"> HTML; for($i = 1; $i < 32; $i++) { echo ' <option value="' . $i . '">' . $i . "</option>\n "; } echo " </select>\n"; echo " <select name=\"year\">\n"; for($i = 1900; $i < 1994; $i++) { echo ' <option value="' . $i . '">' . $i . "</option>\n"; } echo <<<HTML </select> </td> </tr> <tr> <td colspan="2"> <input type="submit" value="Register"> <input type="reset" value="Reset"> <input type="hidden" name="act" value="register"> </td> </tr> </table> </form> HTML; ?>[/code]
-
another way is to wrap it in a div and then give it an overlfow of auto, that way if the image is larger than its container then scroll bars will appear around the image (a bit like an iframe).
-
Can you post the code relevant to that query. are yu using an or die clause after mysql_query? If you are add mysql_error() to that clause that way you will get a full error message from MySQL which will tell you why the query is failing. However I cant help you much without seeing the code.
-
[SOLVED] Replace anything within ' and ' with PCRE
wildteen88 replied to Vinze's topic in Regex Help
Like this: [code=php:0]$str = "this is a 'string' which is made up of 'characters'"; echo preg_replace("/'(.*?)'/", '_|_|_|_', $str);[/code] -
A little vague but it creates a dynamic hyperlink.
-
You will want to add an onLoad event handler to call your JavaScript when the page is fully loaded, otherwise your JavaScript will be run before the the rest of the web page is loaded and thus you get the error messages you are getting. Example: [code]<html> <head> <script type="text/javascript"> /* this function will be called when the page is loaded */ function load() { alert("Page is loaded"); } </script> </head> <!-- The event handler: --> <body onload="load()"> <h1>Page content</h1> page content here. page content here. page content here. page content here. page content here. page content here. page content here. page content here. <br /></br /> page content here. page content here. page content here. page content here. page content here. page content here. page content here. page content here. page content here. page content here. page content here. page content here. page content here. page content here. page content here. page content here. <br /><br /> page content here. page content here. page content here. page content here. page content here. page content here. </body> </html>[/code]
-
Unable to run Apache2.2 web server...
wildteen88 replied to madusudanan's topic in Apache HTTP Server
There is a service/other server running on port 80 already and thus Apache is unable to bind to that port when starting up and you get the for mentioned error message. Setup Apache to listen to another port, port 8080 should do, by changing the Listen directive to the following in the httpd.conf: Listen 8080 Now save the httpd.conf and restart Apache, open up a browser and go to the following url: http://localhost:8080/ Apache should now be working. -
When you are dealing with user input, $_GET or $_POST variables always check they exist before using them. You can do this using the isset variable: [code=php:0]$myvar = isset($_GET['myvar']) ? $_GET['myvar'] : '';[/code] That way when you run the code PHP will first check that myvar exists before using it, otherwise if you do [code=php:0]$myvar = $_GET['myvar'][/code] PHP will not check the existence of that variable and will expect that variable is already defined, when it can't find it it'll through an undefined notice message (not errors). Notices are not bad, however they should not be ignored.
-
add a comma after 0-9 in the character class, like so: [code=php:0]$str = 'hello123,world256'; echo preg_replace("/[^0-9,]/", '', $str); // returns 123,456[/code]
-
if ("$url" == "/index.php"){echo "current";}
wildteen88 replied to ted_chou12's topic in PHP Coding Help
Is the file you are running the code called index.php? -
Just enable the mcrypt extension in the php.ini, remove the # from infront of extension=php_mcrypt.dll Also make sure the extension_dir directive is set to point to the location of the extension folder.
-
If you want htm(l) files to parse PHP code then you will need to the server that. You can do that by adding .htm and/or .html to the end of the list for the following line in the httpd.conf: [code]AddType application/x-httpd-php .php[/code] Like so: [code]AddType application/x-httpd-php .php .htm .html[/code] Save the httpd.conf and restart Apache. PHP code will now be executable in .htm and .html files
-
In order to do online gaming be it on ps2, xbox, PC or what ever platform you will need to have lots of bandwidth, which broadband has. dial-up has extremely low bandwidth.The higher the bandwidth then you will get low pings to the server, the lower the ping the better game play you get. You are best of sticking with broadband if you wish to play online games.
-
I dont get no errors. It seems to be working fine.
-
If you used the installer then download the zip binaries instead and extract the contents of the zip to your PHP installation folder overwriting all existing files/folders. The installer doesnt include all files. Whereas the zip binaries do. Also do not copy the mysql library from the MySQL folder, but libmysql.dll from the php folder. Also make sure you restart the server too when you move the files/changes.
-
code folding question
wildteen88 replied to eric1235711's topic in Editor Help (PhpStorm, VS Code, etc)
Perhaps see if the developers of the editor your are using can add it in to the next version, by emailing them. What editor are you using? -
convert it to a unix timestamp (use strtotime) and then reformat it with the date function example: [code=php:0]$date = '12-01-2007'; // covert the date to a unix timestamp $ut_date = strtotime($date); // chanes the date to the following format: // dd/mm/yyyy $n_date = date("d/m/Y", $ut_date); // echo the new formatted date echo $n_date;[/code]