Jump to content

king

Members
  • Content Count

    60
  • Joined

  • Last visited

Community Reputation

0 Neutral

About king

  • Rank
    Newbie

Previous Fields

  • Languages
    PHP, SQL (MySQL and Oracle), HTML, CSS, Learning Java

Contact Methods

  • Website URL
    http://
  • ICQ
    0
  1. king

    Cleaning Up Code

    Heredoc is the same as a multi-lined double-quoted string. It's probably going to be slower since it has to check for variables inside the string. But the difference is so small, that no one even cares. You don't have to be picky on every little thing. PHP 5.3.0 has a nowdoc which is a multi-lined SINGLE-QUOTED string. Nowdoc syntax is like this: echo <<<'END'END; It's faster than Heredoc since it does not have to parse variables inside the String, but PHP 5.3 isn't released yet.For now, just use Heredoc. A small performance difference doesn't really matter with technology nowadays.
  2. OK, I do not understand what you're trying to do.Provide me with your table structure and how you are trying to order the data.Order by field if exists? Doesn't make any sense to me.
  3. Note that I'm no expert at this so you should probably wait for other users' input as well.When do you need more than one database? Most of the time you don't. It's better to reduce the number of databases you have on a server. But for big companies, like Sun Microsystems, of course they have more than one database. Sun, for example, probably would have a database for their community, a database for their bug tracker, a database for their main site (which includes their users, their products, etc.) and so on and so forth. That was just an example.SQL requests are made to a database server (and
  4. king

    Firefox 3

    Heh, I dumped Windows several months ago and installed Linux (Ubuntu 7.10). A few months later, I dual-booted my Ubuntu with Unix (Solaris 10) which is now my main operating system. I now enjoy programming on Unix much more than Windows.Anyway, a big improvement on Firefox 3 is "Do you want Firefox to remember this password?". That got so annoying in Firefox 2. Every time I try to login, I got that stupid prompt.
  5. king

    Line Breaks

    <?php$result .= "\n\n\n".'---------------'."\n";?> That's how I would do it. There are times when you need double quotes.Edit: Make your code look a bit neater $row['Subject'] = stripslashes($row['Subject']);$result = <<<END<form action="messages.php?mode=sendmsg" method="post"><div><p>To: <input type="text" name="to" value="{$row['Sender']}" /></p><p>Subject: <input type="text" name="subject" value="{$row['Subject']}" /></p><p>Message: <br /><textarea rows="10" cols="50" name="message">END;
  6. Go to function: DrawCharacters() in the scurity-image.inc.php function DrawCharacters() { // loop through and write out selected number of characters $_SESSION['code'] = $this->sCode; for ($i = 0; $i < strlen($this->sCode); $i++) { // select random font $iCurrentFont = rand(1, 5); $size = rand(12, 16); // select random greyscale colour $iRandColour = rand(0, 128); $iTextColour = imagecolorallocate($this->oImage, $iRandColour, $iRandColour, $iRandColour); // write text to image imagestring($this->oImage, $iCurrentFont, $this->iSpacing / 3 + $i
  7. <?php // include security image class require('includes/security-image.inc.php'); // start PHP session session_start(); // get parameters isset($_GET['width']) ? $iWidth = (int)$_GET['width'] : $iWidth = 180; isset($_GET['height']) ? $iHeight = (int)$_GET['height'] : $iHeight = 60; // create new image $oSecurityImage = new SecurityImage($iWidth, $iHeight); $oSecurityImage->Create(); // Whoops, forgot this line! // assign corresponding code to session variable // for checking against user entered value $_SESSION['code'] = $oSecurityImage->GetCode();?>
  8. What's the code for this file: 'includes/security-image.inc.php' that you require() in your security-image.phpAlso, you DO have the GD library for PHP right?In your php.ini file, you removed the semicolon in front of:;extension=php_gd2.dllRight?
  9. king

    variable=value

    You should put anythinghere.inc (or whatever file) in a separate directory (e.g. a directory called areas) so someone doesn't include bottom.inc or topnav.inc $area = basename($_GET['area']); // Make sure it's a valid fileinclude 'topnav.inc';if (file_exists('areas/'.$area.'.inc')) // Make sure the file existsinclude 'areas/'.$area.'.inc';include 'bottom.inc';
  10. Hmm... That's really weird... Does the image display properly? Also, what does your security-image.inc.php look like?
  11. Okay, we might be getting somewhere now.Change the following line: $_SESSION['code'] = $oSecurityImage->GetCode(); To: $_SESSION['code'] = $oSecurityImage->sCode; Now, see what happens...
  12. king

    Firefox 3

    Yep, and they have set a Guinness world record with more than 8 million downloads in 24 hours.I'm using Firefox 3 right now! I love the User Interface! Can't wait until the next version of FF comes out lol.
  13. Something odd is going on here.Make the following file: security-image.php look like this:<?php // include security image class require('includes/security-image.inc.php'); // start PHP session session_start(); // get parameters isset($_GET['width']) ? $iWidth = (int)$_GET['width'] : $iWidth = 180; isset($_GET['height']) ? $iHeight = (int)$_GET['height'] : $iHeight = 60; // create new image $oSecurityImage = new SecurityImage($iWidth, $iHeight); // assign corresponding code to session variable // for checking against user entered value $_SESSION['foo'] = 'foo';
  14. OK, create a new PHP file called test.php. Put the following script in that new file: <?phpsession_start();if (!isset($_SESSION['test']))$_SESSION['test'] = 'Hello World';elseecho $_SESSION['test'];?> Access the page once, then refresh it. See if it prints anything.
  15. Ok, remove the print_r($_SESSION) for now.Also, it is $_SESSION['code'] = $oSecurityImage->GetCode();You have: $_SESSION['security_code']So change that.$l['join.php']['incorrect_security_code'] = 'Incorrect security code. Please try again.'; function init() { global $g; global $l; global $gc; $name = get_param("join_handle", ""); $pass = get_param("join_password", ""); $pass2 = get_param("verify_password", ""); $mail = get_param("email", ""); $mail2 = get_param("verify_email", ""); $captcha = get_param("code", ""); $this->message = ""; if (isset($_SESSION['code'])) die('It wo
×
×
  • Create New...