wildteen88
Staff Alumni-
Posts
10,480 -
Joined
-
Last visited
Never
Everything posted by wildteen88
-
$_SERVER['PHP_SELF'] or $_SERVER['SCRIPT_NAME'] Hehe too slow :(
-
Printf is the same as sprintf so prehaps have a read of how to use [url=http://www.php.net/sprintf]sprintf[/url] function. printf will do what you want to to do from what I can tell from your thread. [code=php:0]// an unformated number: $num = '523'; // now we format it, so it is a 5 digit number with // zeros at beginning to pad the number to be five digits $num = printf("%05d", $num); // print our new formated number: echo $num; // the result should be 00523[/code]
-
Its not the foreach line, But the line above that. You have a missing semi-colon - [b];[/b] - at the end of line 87 which is this: [code]$msg .= "<ul>\n"[/code] Add a semi-colon at the end of that line.
-
I believe you are looking for [url=http://www.php.net/printf]printf()[/url] For example: [code=php:0]for($num = 1; $num <= 10; $num++) { printf("%05d", $num); echo "<br />\n"; }[/code]
-
I'd suggest you use this instead: [code]// if you are expecting id to be a number. Check that its a number before using it! if(isset($_GET['id']) && is_numeric($_GET['id'])) { $id = $_GET['id']; } // id is not a number or is not set so we kill the script. else { die('Invalid URL Parameter'); }[/code] Add that before [code]$query = "SELECT * FROM $global[pre]_results WHERE match_id='$id'";[/code]
-
Also when you changed the settings in the php.ini you did restart your server. If you dont restart your server the new PHP settings will not be loaded. Also I think 8000MB is a bit ott! But yeah please post the code so we can see
-
The :: is to do with OOP and its called the [url=http://uk.php.net/manual/en/keyword.paamayim-nekudotayim.php]Scope Resolution Operator[/url]. It allows you to call objects/methods from within a class.
-
Prehaps you can insert the PHP code into the template as ZenCart appears to be using templates. I dont think Javascript can get URL parameters so you'll have to use PHP. You might be better of getting help over at [url=http://www.zen-cart.com/forum/index.php]zen-cart.com[/url] forums. Also as ZenCart is a third party script I'll be be moving this to the Third Party PHP Scripts forum.
-
use the img bbcodes: [code][img]URL_TO_IMAGE_HERE[/img][/code] Also make sure the image isnt too big, max height n width i'd say would be 100px by 450px. Make sure the image doesnt have a large file size eithier. Ober beat me.
-
Works fine for me, make sure you have this in your htaccess file: [code]RewriteEngine On RewriteRule ^([a-zA-Z0-9-_]+)$ $1.html[/code] and Apache has the mod_rewrite module enabled. You should be able to find out why its failing by looking in Apaches error log file, called error.log Your host should allow you to access your servers error log. The error should be the last error in the log.
-
If you install a server on to your PC, your PC has a slim chance of getting hacked. As the real vunerability you'll have is the security of your PHP scripts this is how sites get hacked due to exploits in thier code. To stop people from hacking your scripts you should make sure any variables comming the client such as POST'd data, URL parameters and cookies should all be validated properly. For example say you have an id url parameter which holds an integer. You should check that the id variable is a number using this: [code=php:0]if(isset($_GET['id']) && is_numeric($GET['id'])) { // id variable has been validated and passed. We can now use $_GET['id'] variable } else { // we kill the script as id variable is either not present or is not a number die('invalid identifier'); }[/code] Also I dont like any of those packages you have listed above. It is much better to setup Apache, PHP and MySQL manaully That way if you want to upgrade PHP you can do without having to wait until your AMP package has been updated.
-
I guess user gets replaced with the actuall username of some user. And you are adding in new rules for each user for your site. I would not recommend this but a better way is to use a regular expressesion instead. So add this to your .htaccess file: [code]^([a-zA-Z0-9-_]+)$ $1.html[/code] That will now do it automatically. So if you went to your site and did this: mysite.com/my_user_name it should then serve a page called my_user_name.html That regualar expression is case insensitive and it allows numbers 0-9 and few special characters (- and _)
-
Global Variables not working as expected
wildteen88 replied to raversnet's topic in PHP Installation and Configuration
You should turn register_globals off. When this setting is off you'll have to use the $_POST superglobal array to access any POST'd data, for example to get the information from the domain field ion your form you use $_POST['domain'] rather than $domain. You change the string between [' and '] to the form field you want to access. If your form method is GET you use $_GET instead of $_POST. The same with cookies you use $_COOKIE or for sessions you use $_SESSION YOu do not need register_globals to be on if you are submitting the form to another page. Also for the form to submit to itself you use [b]action=\"" . $_SERVER['PHP_SELF'] . "\" [/b] $HTTP_*_VARS are old and have been replaced by the newer superglobals which were explained above. -
PHP 4.4.0 v 5.0.4..help please?
wildteen88 replied to marc_r's topic in PHP Installation and Configuration
PHP4 and PHP5 are the same except PHP5 has better OOP support compared to PHP4. If your project was done in OOP then this may be the problem why your project isnt working on the PHP4 box. Also make sure you are not using short tags (<? ?> or <?= ?>) and use the full tags (<?php ?> or <?php echo ?>) and that you are not using any PHP5 specific functions. -
I'm not sure on this, howver from looking at it doesnt look like the functions are robust enable, such as multiple WHERE Clause arguments etc. However there are a few errors I noticed which I'll list below. In a few places you have missing end braces - } This is due to indentation errors. Especially in the else statements. Also you are using a variable called $INFO within functions. This will not work as functions have there own variable scope and do not search for variables that where created in the global scope (outside of the function). You'll want to define $INFO as global within the function by adding the following as the first line of code (after the opening { brace) within the function [code=php:0]global $INFO;[/code]. That way the function will have access to the $INFO variable.
-
Drop Down Menus not working after upgrade
wildteen88 replied to jwashburn's topic in PHP Coding Help
[quote author=jwashburn link=topic=104648.msg417528#msg417528 date=1155833298] Turns out I missed a line in the php.ini (of course) register_long_arrays = On [/quote] You should use the newer superglobals $_POST, $_GET, etc rather than the old $HTTP_*_VARS when getting data from a form, url etc. -
You can use XAMPP for unix based OS's WAMP stands for Windows Apache MySQL and PHP
-
About Apache Server compatibility
wildteen88 replied to ilangovanbe2005's topic in Apache HTTP Server
No you can use any version of Apache on Windows, Just download the msi installer package from httpd.apache.org -
Well you'll want to use strtotime to convert 2006-05-31 into a timestamp and then use the date function convert 2006-05-31 into the date format you want.
-
You can post the code, as long as your use the code tags: [ code]YOU CODE HERE[ /code] (without the spaces before the [ characters) DO NOT post the code without the code tags. NOTE posts are limited 40,000 chars.
-
It would be good if Admins/Mods can use the PM System to warn members or to notify them thier post has been moved etc, rather than leaving a moved link in the forum when you move a thread. Only allow members to read their PMs and not reply. SMF has the admin options for this to happen.
-
You are using the wrong extension. If you are using mysql_connect you use the php_mysql.dll extension. Not the php_mysqli.dll extension. The php_mysqli.dll extensions has completly separate functions for that extension which is the mysql[b]i[/b]_*() functions #(note the i before mysql). The mysqli extension will not work with the mysql_*() functions.
-
Yes you must state session_start(); as the first line in every page (not files by pages) the user visits that has a session. Otherwise your session variables wont work. Unless you have PHP configured to start a session automatically via the [b]session.auto_start[/b] directive.
-
Dreamweaver/PHP - desgin mode WTF!!!!
wildteen88 replied to TheMilkMan's topic in Editor Help (PhpStorm, VS Code, etc)
Make sure you have the correct project selected. Also you cannot edit PHP files via Design Mode as Dreameweaver will show a little PHP symbol where the PHP code is. If you have phpBB you should only be editting the .tpl files to change the design of the forum. If you are editing the php files then you'll to use the Code view to edit the PHP code. -
Call To Undefinded Function mysql_connect
wildteen88 replied to wildteen88's topic in PHP Installation and Configuration
You cannot do [i]extension = "C:\PHP\ext\php_mysqli.dll"[/i] to enable a PHP extension. What you need to do is uncomment the extension you want to enable in the php.ini. For example if you want to enable the mysql extension you'll need to find the following in the php.ini: [code];extension=php_mysql.dll[/code] Then you remove the semi-colon from the start of that line. Or if you want use the MySQL Improved Extension you need to add [b]extension=php_mysqli.dll[/b] to end of the extension list in the php.ini Now before you save the php.ini and restart the server you need to make sure the extension_dir directive is setup correctly. To setup the extension_dir scroll up and find this: [code]; Directory in which the loadable extensions (modules) reside.[/code] Below that line should be the extension_dir directive. By defualt it will be this: [code]extension_dir = "./"[/code] Change [B]./[/B] to [B]C:\php\ext[/B] PHP will use this directive to find the extensions. Now save the php.ini and restart your server. Note: make sure a file called libmysql.dll (with is found in the root of the PHP folder (C:\php)) is either in the C:\WINDOWS folder. Note if you are on Win2k or on Windows Server xxxx you put it in the C:\WINNT folder Also it doesnt matter which version of MySQL you have as you can use the php_mysql.dll extension on either version of MySQL. You dont need to enable the php_mysqli.dll function if you are using MySQL5. The thing that sepends on which extension you use is down to the type of mysql functions you are using For example if you are using the [b]mysql_connect[/b] function to connect to MySQL or any other mysql_*() function you use the [b]php_mysql.dll[/b] extension. But if you are using the [b]mysql[color=red]i[/color]_connect[/b] (note the i after mysql) function to connect to MySQL or any other mysql[b]i[/b]_*() function then you use the [b]php_mysqli.dll[/b] extension.