Daniel0
Staff Alumni-
Posts
11,885 -
Joined
-
Last visited
Everything posted by Daniel0
-
Nope. Check [url=http://php.net/setcookie]the manual's examples[/url]. And my example do work on my system, and it is without session_start.
-
To set sessions session_start is required (or session.auto_start must be on in php.ini). It has nothing to do with cookies.
-
You can create the array dynamically. Imagine you have your page files called this: *page*.page.php Then you could use this code to do it: [code]<?php $dir = "files"; $modules = array(); $dh = opendir($dir); while($file = readdir($dh)) { $module_name = explode('.',$file); if($module_name[count($module_name)-2] === 'page') { unset($module_name[count($module_name)-1]); unset($module_name[count($module_name)-1]); $modules[] = join('.',$module_name); } } $_GET['page'] = strtolower($_GET['page']); if(in_array($_GET['page'],$modules)) { include "{$dir}/{$_GET['page']}.page.php"; } else { echo "The page '{$_GET['page']}' do not exist."; } ?>[/code]
-
Looks very nice, but something is wrong in the menu (perhaps a HTML comment). [attachment deleted by admin]
-
[quote author=dharm link=topic=110339.msg453473#msg453473 date=1161130931] Is it accessible? can we change the text size? [/quote] Not in IE. You will have to use percentages instead of pixels/ems/points or whatever you use.
-
Just do this: [code]<?php $pages = array( // GET var => file 'page1' => 'page1.php', 'page2' => 'page2.php', 'home' => 'home.php', ); if(in_array($_GET['page'],$modules) && file_exists("pages/{$_GET['page']}")) { // do stuff } else { echo "No such page"; } ?>[/code]
-
Well, then you haven't turned errors on. I meant to type this: [code]error_reporting(E_ALL); setcookie("test","this is a test"); print_r($_COOKIE);[/code] But what I posted should give an error like this: [code]Parse error: parse error, unexpected $end in *file* on line *line*[/code] Set [tt]display_errors[/tt] in php.ini to [tt]On[/tt] to display errors. Then try with the fixed code (you might have to refresh).
-
Is it just me or do [url=http://validator.w3.org]W3C's validator[/url] often load really slowly?
-
Looks nice. Make a footer and [url=http://validator.w3.org/check?uri=http%3A%2F%2Fwww.j4r.org%2Fprojects%2Fzirc%2F]validate your code[/url] though.
-
There is problems with the bar in Opera 9.02, Firefox 1.5.0.7 and Internet Explorer 6 on Windows as well. And another thing: [quote=your site]OPTIMIZED FOR Firefox[/quote] Do [i]not[/i] optimize it for a specific browser! You need to make it work properly in [i]all[/i] browsers.
-
I don't get it. People are talking about 3, 4, 5 etc., but I only see 1 and 2 :S
-
Odd. Try this: [code]error_reporting(E_ALL); setcookie("test","this is a test); print_r($_COOKIE);[/code] and tell me what you get.
-
Try to put [code]error_reporting(E_ALL);[/code] on the top of your page and see if it returns any errors.
-
[quote author=dc_jt link=topic=111792.msg453617#msg453617 date=1161159188] Is it possible to create a button in the error form so that when the user presses this they are returned to the input form with the fields they entered correctly still input?? Or is a session needed? [/quote] You can read my tutorial [url=http://www.phpfreaks.com/tutorials/145/0.php]Multipage forms[/url] to get an idea of how to do it.
-
[code]<?php $files = array('file1.txt','file2.txt','file3.txt'); foreach($files as $file) { $contents[] = file_get_contents($file); } $fp = fopen('new_file.txt','w+'); fwrite($fp,join("\n",$contents)); fclose($fp); ?>[/code]
-
how to echo a checkbox and radio button (if checked or not)
Daniel0 replied to Deserteye's topic in PHP Coding Help
Shorter: [code]<input type="checkbox" name="checkbox" value="checkbox" id="checkbox"<?php echo $row['checkbox'] ? ' checked="checked"' : null; ?> />[/code] -
I would store them as files.
-
Try enabling errors and putting error_reporting(E_ALL); on top of your page to see if it returns any errors.
-
Try this: [code]runkit_function_add(array($object,"method_name"));[/code]
-
Seems like a good idea skarecrow, but why not just use runkit_function_remove and then define it with the same name as the one you removed instead? You should also note that those functions are experimental and that they require a PECL extension installed, so if you are programming for a client, then you will require them to have the runkit extension, but the client may be at a shared host and therefor not having access php.ini to load the extension (or can it be done using dl()?).
-
You don't need a constructor. If it is eg just a class consisting of random functions Then it is not necessary. [quote author=knowNothing link=topic=111785.msg453182#msg453182 date=1161099622] Am I supposed to be able to pass vaiables into this constructor [/quote] I'm not sure what you mean, but this is possible (if that's what you mean): [code]$hello = new hello("hi");[/code]
-
Ok... "Opera Day". Let's see if it is as good as you claim.
-
Creating a tagging system search database?
Daniel0 replied to extrovertive's topic in Application Design
Yeah -
If you purchase Zend Platform there is some PHP code as well, but it is encrypted. That is sort of the same. I don't see any problems in encrypting your code.
-
Where are your forum?