Jump to content

wildteen88

Staff Alumni
  • Posts

    10,480
  • Joined

  • Last visited

    Never

Everything posted by wildteen88

  1. buttons dont submit forms. You'll want to use submit button and not a normal button.
  2. [quote]EDIT: I think register_globals is off, how do I fix this?[/quote] Why do you want to turn it on? Also trunning it on wont change anythink. CTM pointed it out its do with your reqular expressions.
  3. You cant without submitting the form. You cannot use PHP like you can with javascript. However you can if you use AJAX.
  4. Yes we know about this. It is planned to be added. Topic closed.
  5. I'm not sure with that one then, however I remember reading something about mail and headers in an online article.
  6. [quote author=Ifa link=topic=102866.msg409045#msg409045 date=1154626925] [quote author=wildteen88 link=topic=102866.msg409040#msg409040 date=1154626491] You can place header, sessiojn_start, mail, setcookie or any other function that changes the headers anywhere within your script, aslong as there is no output before the use of these functions. [/quote] mail? :) [/quote] Yes believe it or not mail does send headers. [quote author=onlyican link=topic=102866.msg409056#msg409056 date=1154627214] if you have header somewhere other than the top you need ob_start(); at the top of the page [/quote] You'll want to add ob_start(); at the top of each PHP page and ob_end_flush(); at the end of each PHP page.
  7. YOu server will need to be configured to to parse .phps files with the PHP Highlighter. With Apache you can add this to the httd.conf or .htaccess (i think): [code]AddType application/x-httpd-phps .phps[/code]
  8. You can place header, sessiojn_start, mail, setcookie or any other function that changes the headers anywhere within your script, aslong as there is no output before the use of these functions.
  9. int can hold upto a maximun of just over 2.1 billion entries - 2,147,483,647 to be exact. If you want to go bigger you can use bigint.
  10. Try: [code=php:0]<?php $text = "[flag]usa[/flag]"; $flagSize = "18-12"; $flagArray['usa'] = 'United States'; function getFlag($flag) {     global $flagSize, $flagArray;     $flag = '<img src="images/flags/' . $flagSize . '/' . $flag . '.gif" class="flag" alt="' . $flagArray[$flag] . '">';     return $flag; } $outputText = preg_replace("/\[flag\]([a-z]{3})\[\/flag\]/e", "getFlag(\"$1\")", $text); echo $outputText; ?>[/code]
  11. Could you post the full error message here, along with your PHP code.
  12. If you ahve string like so: $var_string = "2;5;14;18"; you can use a function called explode which will get each number into an array like so: $userGroup = explode(";", $var_string); Now when you want to acces the usergroup numbers you use: $userGroup[0]  to get the first on which will be 2 $userGroup[1] to get the secound etc. Rember arrays start from zero, so if you want to get the 6th usergroup use $userGroup[5]
  13. Do you have PHP5? When you installed PHP5 did you enable the mysql extension and if you are on a unix based server did you compile PHP with the --with-mysql command? This the only reason I can see why this isnt working.
  14. You'll want to define the function first before you use it. So you'll  want to this: [code=php:0]<?php function getName() {     $a = "test";     return $a; } ?> <table> <?php echo getName(); ?> <table> [/code]
  15. sha-1 is one way encryption too. There are encryption/decrption functions in PHP. However you can encode/decode strings with base64_encode/base64_decode however these are not secure. The only way to reset the users password is to create a random password generator which will generate a random password for them, or get them to reset the password.
  16. A Simple example of this would be when using forms, the incorrect way: [code]<?php // get the users name: $name = $_POST['name']; // get the user age: $age = $_POST['age']; // display thier name and age: if($name != "" && $age != "") {     echo "Hello {$name}, you are {$age}";     echo "<br /><br />"; } ?> <form action="" method="post">   Name: <input type="text" name="name" /><br />   Age:&nbsp; <input type="text" name="age" size="3" />   <input type="submit" value="Display Message" /> </form>[/code] When you first run that code you'll get to undefined index messages: [quote]Notice: Undefined index: name in C:\server\www\test.php on line 4 Notice: Undefined index: age in C:\server\www\test.php on line 7[/quote] Now the proper way: [code]<?php // check that form has been submitted: if(isset($_POST['submit'])) {     // now that form has been submitted we can work with form variables     $errors = '';         // check that form fields has been filled in:     if(isset($_POST['name']) && !empty($_POST['name']))     {         $name = $_POST['name'];     }     else     {         $errors[] = 'You have not filled in the name field';     }     // check the age variable is numeric     if(isset($_POST['age']) && is_numeric($_POST['age']))     {         $age = $_POST['age'];     }     else     {         $errors[] = 'You have not filled in the age field correctly';     }     // check there are no errors:     if(is_array($errors))     {         echo "Please correct the following errors:\n<ul>";         foreach($errors as $error)         {             echo "<li>{$error}</li>\n";         }         echo "</ul>\n";     }     else     {         echo "Hello {$name}, you are {$age}";         echo "<br /><br />";     } } ?> <form action="" method="post">   Name: <input type="text" name="name" /><br />   Age:&nbsp; <input type="text" name="age" size="3" />   <input type="submit" name="submit" value="Display Message" /> </form>[/code]
  17. [quote author=tomfmason link=topic=102770.msg408460#msg408460 date=1154557077] Is there a gd extension that you can use in the php.ini or no? I just looked in the php.ini on my local windows machine and saw [code]extension=php_gd2.dll[/code]. I am not a 100% sure but I thought that would refer to gd. Good Luck, TOm [/quote]That would work if Mateobus is hosted on a Windows server but Mateobus will need to have root access to get to the php.ini file. However if its unix based server then as akitchin mentioned above PHP will need to be recompile with the --gd-enabled option.
  18. Do you have paragraph tags (<p></p>) or line break tags (< br>) inside the list tags (<li></li>)? If you do take them out. Also could you post your html code for your list here too.
  19. [b]Umm, took too long. heheh, ohwell[/b] This is possible with javascript: [code]<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Javascript Test</title> <script type="text/javascript"> // this function is called evertime the checkbox is changed function disableBox(box) {     // get checkBox status     var checkBox = document.form1.chkbox.checked;     // get form to disable:     var box2Disable = document.getElementById(box);     // if checkbox is checked     if( checkBox == true) {         // disable the input field         box2Disable.disabled = true;     } else {         // enable the box         box2Disable.disabled = false;     } } </script> </head> <body> <form name="form1"> Checkbox: <input type="checkbox" name="chkbox" onclick="disableBox('box1')" /><br /> Box: <input type="text" id="box1" /> </form> </body> </html>[/code]
  20. Try creating anew .htaccess file in the root of your site. and add the following init: [code]php_flag session.use_only_cookies 1 php_flag session.use_trans_sid 0[/code]
  21. They can go anywhere. However this line: [code]LoadModule php5_module php/sapi/php5apache2.dll[/code] Should be: [code]LoadModule php5_module C:/php/php5apache2.dll[/code] Change C to the letter of your drive. Just add them to the bottom of the httpd.conf. Now save the httpd.conf and restart Apache. To restart Apache look at the bottom right of the screen next to the clock. Look for the Apache taskbar icon, whcih has a green triange pointing to the right, which is inside a white circle and a purple feater pointing to top left. If you left click that icon and select Apache2 then restart from the menu that appears. Wait 30 secounds. Now goto http://localhost/ and Apache should be configured to parse PHP files wth the PHP Intepreter.
  22. WAMP is a web server. It installs Apache (this is the actuall web server), PHP (PHP Intepreter - this is what parses the PHP code) and MySQL (which is a database). What do you mean FTP, what do want use FTP for? If you mean FTP the files to WAMP then you dont need to. If WAMP is installed your computer and you want to test run a PHP script, before it gets uploaded to your live site, then you can move the PHP file to the htdocs folder (I think you have to goto C:\wamp\htdocs\ to get to the htdocs folder, i'm not sure) Then you open up any web browser and type in http://locahost/ - this will access WAMP aslong as Apache is running which it should be. Now just click the PHP file you want to run. Thats it. If you are satisified with how the PHP script runs you can the upload the file to your live site, by using FTP.
  23. You can do by setting up a cron job if you are on a unix based server, or Schedule if you are on a wndows bases server.
  24. Use str_replace to convert £ into & #163 (without the space): [code]$sign = '& #163;'; // remove the space betweeen & and # $salary = '£100'; $pos = strpos($salary, '£'); if ($pos === false){   $newsalary = $sign.$salary; // add £ to the $salary var }else{       $newsalary = str_replace('£', $sign, $salary); // remove the £ and add £ instead } echo $newsalary;[/code]
  25. Theres not much difference as they are the same except servers can come in many forms and can slot into a rack and connect up to other servers in the same rack to form on huge server. All what a server consists of is basically a mother board and a hard drive which all connects up to one main computer which the data center uses to monitor each server etc. Also data centers tend do be on Gbps (Gigabit per secound) internet speeds.
×
×
  • 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.