ignace
Moderators-
Posts
6,457 -
Joined
-
Last visited
-
Days Won
26
Everything posted by ignace
-
login error with Internet Explorer but not Firefox
ignace replied to jakatu's topic in PHP Coding Help
i would use a strcmp() to check wether a HTTP POST header was sent <?php if (strcmp(strtolower($_SERVER['REQUEST_METHOD']), 'post') === 0) { // form has been submitted ?> -
why don't you just use overloading to set your properties? (http://be2.php.net/manual/en/language.oop5.overloading.php) so that you are able to do: <?php class Inbox { private $_properties = array(); public function __set($key, $value) { $this->_properties[$key] = $value; } public function __get($key) { if (array_key_exists($key, $this->_properties)) { return $this->_properties[$key]; } } } $inbox = new Inbox(1); $inbox->foo = bar; ?> if you want to use only one instance of the class, but don't want to be bothered with scopes, then use the Factory Pattern (http://en.wikipedia.org/wiki/Factory_method_pattern) implementation is something like: <?php class Inbox { private static $_instance; public function getInstance() { if (self::$_instance === null) { self::$_instance = new self(); } return self::$_instance; } } $inbox = Inbox::getInstance(); $inbox->set('foo', $bar); unset($inbox); function newScope() { $inbox = Inbox::getInstance(); echo $inbox->get('foo'); // returns $bar } ?> if you combine both techniques you can do: <?php class Inbox { private static $_instance; private $_properties = array(); public function getInstance() { if (self::$_instance === null) { self::$_instance = new self(); } return self::$_instance; } public function __set($key, $value) { $this->_properties[$key] = $value; } public function __get($key) { if (array_key_exists($key, $this->_properties)) { return $this->_properties[$key]; } return null; } } $inbox = Inbox::getInstance(); $inbox->foo = 'bar'; $inbox->hello = 'world'; unset($inbox); // $inbox does not longer exist function newScope() { $box = Inbox::getInstance(); echo $box->foo . $box->hello; } newScope(); // barworld ?>
-
how do I display current number of registered users on login page
ignace replied to djsting_com's topic in PHP Coding Help
SELECT COUNT(*) num_reg_mem FROM users -
sha1 returning binary value with a length greater than 20 chars...
ignace replied to scarhand's topic in PHP Coding Help
<?php $hash = sha1(time(), true); echo $hash . ' = ' . strlen($hash); // –ƒ$²¡öS„Ïô`Ï‚k]b = 20 ?> -
the technology you are looking for is called sockets (http://be2.php.net/manual/en/ref.sockets.php) you need to encrypt passwords with the 1024 bit RSA method (http://en.wikipedia.org/wiki/RSA)
-
sure, thats what we are here for, but you may want to post some code..
-
login error with Internet Explorer but not Firefox
ignace replied to jakatu's topic in PHP Coding Help
where do you print the $message to the screen, or do you print it at all? and same question as rhodesa, whats the code for redirect_to()? -
yeah i already thought i would get answers like that, but what i wanna do is program my own mktime() function or datesub(), dateadd() functions, i already looked for the algorithm to perform the calculation however nothing came up even scholar.google.com came up blank, however for what i have read so far you need an epoche date to start from, if possible i want to change the date from 1/1/1970 to the gregorian date and start from their, and then convert it to julian dates. I know this is all been done before and functions have been made however i want to write my own, well not entirely my own but i hate using functions of which i know that i am not able to program them myself, therefore the whole "re-write" once again all help is greetly appreciated, greetz, ignace
-
i mean i then subtract one from the other
-
if i have a date 15/5/2003 and 30/11/2008 how can i then calculate the number of days between them? my first thought went to using an epoche date (i used 1 jan 1970 00:00:00 which is on a monday) and then calculate from 1 jan 1970 to 15/5/2003 and do the same for 30/11/2008 so i just have to extract them from eachother, however apparently i don't have the programming skills to solve the problem, all help is appreciated! greetz, ignace
-
shouldn't the file already exist before you can execute such queries? or maybe the file is created but instead in the sql folder
-
if it is a function i would suggest using: function <yourfunction> { if ($weapondmg<=10) { $victimnewhealth=$killquery+1000; }elseif ($weapondmg<=20) { $victimnewhealth=$killquery*0.20; }elseif ($weapondmg<=30) { $victimnewhealth=$killquery*0.50; }elseif ($weapondmg<=40) { $victimnewhealth=$killquery*0.50; }elseif ($weapondmg>=40) { $victimnewhealth=$killquery*0.50; } return $victimnewhealth; } or do return $killquery * <multiplier> or try if (statement) { .. } else if (statement) { }
-
$box = imap_open ("{gmail.com:993/imap/ssl}INBOX", "myemail", "mypassword"); should connect automatically to the imap server see the options for additional information http://en.php.net/imap_open
-
if(is_array($results['resultElements'])) $enable=1; else $enable=2; // should be if(is_array($results['resultElements'])) { $enable=1; } else { $enable=2; } // or if you want to keep short form if(is_array($results['resultElements'])): $enable=1; else: $enable=2; // but it can be that it is interpreted the wrong way
-
need help:- Integration of header, menu and footer in php.
ignace replied to lovelyjitu's topic in PHP Coding Help
<!-- start header.php --> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <link rel="stylesheet" type="text/css" href="style.css" /> <title>My First Web Site</title> </head> <body> <!-- end header.php (should include your menu to) --> <!-- start footer.php --> </body> </html> <!-- end footer.php --> <!-- start index.php echo file_get_contents is faster then include_once() --> <?php echo file_get_contents("header.php");?> <!-- start content --> <table height="80" border="5" width="100%" cellspacing="0" cellpadding="2"> <tr> <td valign="center" align="center" width="100%"> <a href="data.html">Home</a><!-- file:// won't work --> <a href="contact.php">Contact Us</a> <a href="aboutus.php">About Us</a> <a href="links.php">links</a> </td> </tr> </table> <!-- end content --> <?php echo file_get_contents("footer.php");?> i was so friendly to correct your html code, i also suggest you read PHP 5 Advanced which will give you an introduction into modules: http://www.amazon.com/PHP-Advanced-Visual-QuickPro-Guide/dp/0321376013 -
their are quiet some ways to accomplish that you could do: basename?message=blablabla <?php if ($_GET["message"] && $_GET["message"] != "") { echo $_GET["message"]; } // or set a message $message = "blablabla"; if ($message && $message != "") { echo $message; } ?>
-
don't know if this is going to help you, but did you already tried (players.player_name IS NOT NULL)?
-
have you tried the & sign? printf("<a href='embed.php?mp3=%s&name=%s' onClick='return popup(this, \"notes\")'><img src='stream.gif' alt='Stream this song' width='14' height='14' border='0'>", $filename, $file);
-
yep, like rajiv said you need sql + you would like to use accounts, so that the colors are unique to every account, so you won't be fighting over the internet about what color the webpage should have
-
1. post the table structure, so that we may be of further assistance 2. have you performed a database normalization? if not => http://en.wikipedia.org/wiki/Database_normalization
-
<div style="background:#0c0 url(image1.jpg); border:1px solid #00c; width:500px; height:500px; text-align:center; padding:10px;"> <div style="background:#c00 url(image2.jpg); border:1px solid #0c0; width:480px; height:480px; text-align:center; padding:10px;"> <div style="background:#00c url(image3.jpg); border:1px solid #c00; width:460px; height:460px; text-align:center; padding:10px;"> </div> </div> </div> you do this by placing a div inside another where the parent is the image beneath the child image
-
Which are those basic rules you stick to?
-
so you wan't to execute that code when someone presses a button? <?php if (isset($_POST["mybutton"])) { require('inc_rate.php'); getComments("1"); submitComments("1",$PHP_SELF); } ?> <form action="" method="post" enctype="application/x-www-urlencoded"> <input type="submit" name="mybutton" value="press" /> </form>
-
you wrote sfoto instead of $foto uitgeweken vlaming, waar woon je dan nu? moved away from the flanders, where do you live then now?