Jump to content


Staff Alumni
  • Posts

  • Joined

  • Last visited

Everything posted by Daniel0

  1. I don't think you can... [quote]--enable-mbstring: Enable mbstring functions. This option is required to use mbstring functions.[/quote] I believe it has to be compiled with mbstring, which you obviously can't do if you aren't a server admin. You have to contact your host if you want it enabled.
  2. Take a look at [url=http://www.phpfreaks.com/forums/index.php/topic,95433.0.html]this topic[/url]... I believe that solves your problem.
  3. Hey, The official description is located here description of $_SERVER['PHP_SELF'] from PHP is: [quote]The filename of the currently executing script, relative to the document root. For instance, $_SERVER['PHP_SELF'] in a script at the address http://example.com/test.php/foo.bar  would be /test.php/foo.bar. The __FILE__  constant contains the full path and filename of the current (i.e. included) file. If PHP is running as a command-line processor this variable contains the script name since PHP 4.3.0. Previously it was not available.[/quote]
  4. Daniel0

    Class vs. ID

    I believe IDs have to be unique in order to have valid XHTML (possibly HTML too). So imagine a forum system, where each post row has an ID called 'postrow', that would not make the ID unique, so you'd have to use the classes instead.
  5. [quote author=godsdead link=topic=99757.msg392961#msg392961 date=1152257222] This code isnt working in my stand alone server running: Apache 2.0 PHP Version 5.1.1 [code] <?php switch($x){ case"": echo"Hello"; break; case"work": echo"WORK DAMIT!"; break; } ?> [/code] Okie one of the most simplest codes and it wont WORK when i go to [b]?x=work[/b] :@! This should work as it works on my online server, but i really need it to work on my home server! the script runs useing this: [code] <?php $x = $_GET[x]; switch($x){ case"": echo"Hello"; break; case"work": echo"WORK DAMIT!"; break; } ?> [/code] with the [b]$x = $_GET[x];[/b] variable, Also i realised i cant process any forms unless i use this! which is Sooooooooo Anoying! as all my scripts have basically ******! please help! [/quote] Your example code will only work if register globals is turned on.
  6. Sure it is, but sometimes people may not be able to code a feature/function themself. But looking at other people's code is a great way to improve your own coding skills if you are not very good in a certain language, I think.
  7. Daniel0

    Add mUsic

    If you are going to add background music on your website, make sure you can turn it off, because I believe many people, like myself, find it extremely annoying.
  8. Chances are that the MP3 file exceeds 1000000 bytes (0.95 mb). Either change the value of the hidden field MAX_FILE_VALUE or completely remove it.
  9. You might want to look at this site's [url=http://www.phpfreaks.com/tutorial_cat/25/Page-Number--Pagination.php]pagination tutorials[/url] :)
  10. You would have to use [url=http://php.net/intval]intval[/url] or [url=http://php.net/mysql_real_escape_string]mysql_real_escape_string[/url] on the variable $tutid if you choose not to enclose the value in quotes in the query to ensure that people to not exploit your code inject another query the initial query.
  11. You could [url=http://php.net/serialize]serialize[/url] the array, put it in the link and then [url=http://php.net/unserialize]unserialize[/url] at the other page. Example: [code] <?php $data = serialize($_REQUEST); echo "<a href='what-ever-page.php?data={$data}'>Back</a>"; ?> [/code] (If you'd like to use POST or GET instead of REQUEST you just replace it) Another solution would be to use [url=http://php.net/http_build_query]http_build_query[/url] to build a query string automaticly for you. You need to use PHP5 though. Example: [code] <?php $data = http_build_query($_REQUEST); echo "<a href='what-ever-page.php?{$data}'>Back</a>"; ?> [/code]
  12. You could use [url=http://httpd.apache.org/docs/2.0/mod/mod_rewrite.html]mod_rewrite[/url] to make it look in another way.
  13. It's used to display the value of a variable inside a string enclosed in double quotes.
  14. I made an example script for you here: [code]<?php /** * Check password level script * * A script made to demonstrate how password levels could be calculated * * @author Daniel Egeberg */ /** * Password level * * A function made to calculate password strength * * @param string $password The password to check * @return integer */ function password_level($password) { $level = 0; if(strlen($password) >= 6) { $level++; } if(preg_match('/[0-9]/',$password)) { $level++; } return $level; } /** * Display form * * Used to display the form with an optional message * * @param string $message An optional message * @param string $password Used to fill-out the form */ function display_form($message=null,$password=null) { $message = !empty($message) ? "<strong>{$message}</strong>\n\n" : null; echo <<<EOF {$message}<form action='{$_SERVER['REQUEST_URI']}'> <label>Password: <input type='text' name='password' value='{$password}' /></label> <button type='submit'>Calculate password level</button> </form> EOF; } if(!empty($_GET['password'])) { display_form("Your password strength is at level ".password_level($_GET['password'])); } else { display_form(); } ?> [/code] I am not sure what you mean with if it contains characters, so I did not implement that, but I'm sure you can figure out how to do so based on this example script.
  15. Hey, You might want to check out the [url=http://pear.php.net]PEAR[/url] package called [url=http://pear.php.net/package/HTML_BBCodeParser]HTML_BBCode_Parser[/url]. It's a package already written for people who would like to use it and it comes with a [url=http://pear.php.net/package/HTML_BBCodeParser/docs]documentation[/url].
  • 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.