[PHP] question regarding subclasses, is this possible to do

2003-12-01 Thread Luke
Hi, i was wondering if the last line of the following code is possible
somehow (the second last works perfect) but say i wanted to automatically
get the id (or anything else for that particular window) would it be
possible? or would i have to include a new function in windows called setID
or something like that?

php code-
windows = new windows();
 }
 function getSize(){
  return "Big House";
 }


}

class windows{
 var $id;
 function windows($id = "all"){
  $this->id = $id;
 }
 function showID(){
   echo "ID: " . $this->id;
 }
}

$test = new house();

echo $test->getSize() . "\n\n";

$test->windows->showID();
$test->windows("Window3")->showID();
?>
---end php code--

I could always have $test->windows->setID($id) then display the properties
for that current window, but it would be sumpler if i could use
$test->windows($id)->showID() and if no var is there, show all...any ideas
on how to do this?

Thanks heaps

Luke

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: replace %rand[x]-[y]% macro in string with random string

2003-12-02 Thread Luke
result on my laptop for default script settings
(P4 2.66, 512mb ram)

20
loaded in: 1.3158s


please tell me what you think of this? if you like it i can email it to you
(as a php file)

--begin php code---
umin = $usermin;
  $this->umax = $usermax;
  $this->addresses = $addresses;
  $this->userfordomain = $userfordomain;
  $this->dmin = $domainmin;
  $this->dmax = $domainmax;
  $this->countrys = array("","au","cz","andsoforth");
  $this->types =
array("com","co","org","gov","mil","id","tv","cc","andsoforth");
 }

 function createAddressArray(){
  $i=0;
  $addressarray = array();
  while($i<$this->addresses){
   $addressarray[] = $this->makeAddress();
   $i++;
  }
  return $addressarray;
 }
 function displayAddresses(){
  $i=0;
  $addressstring = "";
  while($i<$this->addresses){
   $addressstring .= $this->makeAddress() . "";
   $i++;
  }
  echo $addressstring;
  return $addressstring;
 }
 function makeAddress(){
  $user = $this->createRandString();
  if($this->userfordomain == false){
   $domain = $this->createRandString("domain");
  }else{
   $domain = $user;
  }

  $address = $user . "@" . $domain . "." . $this->createType();
  $country = $this->createCountry();
  if($country != ""){
   $address .= "." . $country;
  }

  return $address;
 }

 function createRandString($type = "user"){
  srand((double) microtime() * 948625);
  if($type=="user"){
   $length = rand($this->umin, $this->umax);
  }else{
   $length = rand($this->dmin, $this->dmax);
  }
  $string = "";
  $numbersmin = 48;
  $numbersmax = 57;
  $lowercaselettersmin = 97;
  $lowercaselettersmax = 122;
  $whichset = 0;
  while($length >= 0){
   $set = rand(0,100);
   if($set < 5){
$string .= "_";
   }elseif($set < 32){
$string .= chr(rand($numbersmin, $numbersmax));
   }else{
$string .= chr(rand($lowercaselettersmin, $lowercaselettersmax));
   }

   $length--;
  }

  return $string;
 }
 function createType(){
  srand ((double) microtime() * 845676);
  $tid = rand(0, count($this->types)-1);
  return $this->types[$tid];
 }
 function createCountry(){
  srand ((double) microtime() * 375797);
  $cid = rand(0, count($this->countrys)-1);
  return $this->countrys[$cid];
 }
}


$test = new honeyPot();
print_r($test->createAddressArray());
echo "\n\n";
$test->displayAddresses()
?>
end php code--

-- 
Luke


"Daniel Hahler" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hello PHP-list,
>
> I'm building a script, that provides a honeypot of invalid email
> addresses for spambots.. for this I want to provide a macro for the
> templates that looks like %rand[x]-[y]%, where [x] and [y] are
> integers, that specify the length of the random script.
> My first thoughts were about the best parsing of the %rand..%-part,
> but now I came to a point, where I could also need suggestions on the
> random string generation..
> It considers very basic word generations and the only meaningful word
> I discovered was 'Java'.. *g
>
> For generation of a random string with length 1.000.000 it takes about
> 13 seconds on my xp 1600+.. that's quite a lot, imho, so suggestions
> are very welcome..
>
> the script goes here, ready to copy'n'paste:
>
> --
> list($low, $high) = explode(" ", microtime());
> $this->timerstart = $high + $low;
>
> function parserandstr($toparse){
>  $debug = 0;
>
>  $new = '';
>  $ch = array(
> 'punct' => array('.', '.', '.', '..', '!', '!!', '?!'),
> 'sep' => array(', ', ' - '),
> 'vocal' => array('a', 'e', 'i', 'o', 'u'),
> 'cons_low' => array('x', 'y', 'z'),
> 'cons_norm' => array('b', 'c', 'd', 'f', 'g', 'h', 'j', 'k',
>  'l', 'm', 'n', 'p', 'q', 'r', 's', 't', 'v', 'w')
>  );
>  while ( ($pos = strpos($toparse, '%rand')) !== FALSE){
>   if ($debug) echo '$pos: ' . $pos;
>   $new .= substr($toparse, 0, $pos);
>   if ($debug) echo '$new: "' . $new . '"';
>
>   $toparse = substr($toparse, $pos + 5);
&

[PHP] Re: replace %rand[x]-[y]% macro in string with random string

2003-12-02 Thread Luke
i forgot to mention, that being a class, you should be able to set any of
the variable you want (either on class creation: new honeyPot($value1,
$value2, etc); or with the class variables, $spambot = new honeyPot;
$spambot->addresses = 50; //amount to create)

Luke

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: replace %rand[x]-[y]% macro in string with random string

2003-12-02 Thread Luke
final note, for anyone who finds this interesting

in the class, if you update the following 2 variables, this is the proper
list

$this->countrys =
array("",".ac",".ad",".ae",".af",".ag",".ai",".al",".am",".an",".ao",".aq","
.ar",".as",".at",".au",".aw",".az",".ba",".bb",".bd",".be",".bf",".bg",".bh"
,".bi",".bj",".bm",".bn",".bo",".br",".bs",".bt",".bv",".bw",".by",".bz",".c
a",".cc",".cd",".cf",".cg",".ch",".ci",".ck",".cl",".cm",".cn",".co",".cr","
.cu",".cv",".cx",".cy",".cz",".de",".dj",".dk",".dm",".do",".dz",".ec",".ee"
,".eg",".eh",".er",".es",".et",".fi",".fj",".fk",".fm",".fo",".fr",".ga",".g
d",".ge",".gf",".gg",".gh",".gi",".gl",".gm",".gn",".gp",".gq",".gr",".gs","
.gt",".gu",".gw",".gy",".hk",".hm",".hn",".hr",".ht",".hu",".id",".ie",".il"
,".im",".in",".io",".iq",".ir",".is",".it",".je",".jm",".jo",".jp",".ke",".k
g",".kh",".ki",".km",".kn",".kp",".kr",".kw",".ky",".kz",".la",".lb",".lc","
.li",".lk",".lr",".ls",".lt",".lu",".lv",".ly",".ma",".mc",".md",".mg",".mh"
,".mk",".ml",".mm",".mn",".mo",".mp",".mq",".mr",".ms",".mt",".mu",".mv",".m
w",".mx",".my",".mz",".na",".nc",".ne",".nf",".ng",".ni",".nl",".no",".np","
.nr",".nu",".nz",".om",".pa",".pe",".pf",".pg",".ph",".pk",".pl",".pm",".pn"
,".pr",".ps",".pt",".pw",".py",".qa",".re",".ro",".ru",".rw",".sa",".sb",".s
c",".sd",".se",".sg",".sh",".si",".sj",".sk",".sl",".sm",".sn",".so",".sr","
.st",".sv",".sy",".sz",".tc",".td",".tf",".tg",".th",".tj",".tk",".tm",".tn"
,".to",".tp",".tr",".tt",".tv",".tw",".tz",".ua",".ug",".uk",".um",".us",".u
y",".uz",".va",".vc",".ve",".vg",".vi",".vn",".vu",".wf",".ws",".ye",".yt","
.yu",".za",".zm",".zw");
  $this->types = array("com","org","gov","mil","net");


luke

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: news service

2003-12-02 Thread Luke
news.php.net

and subscribe to the group php.general

make sure you have all your email addresses and stuff setup in the account
because it may ask you to send a confirmation

no user/pass required

-- 
Luke

"Bigmark" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
Hi i had your php news account setup on my outlook express buti lost it what
do i put as the address

Mark

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: Unicode translation

2003-12-02 Thread Luke
Yeah, i had a similar problem, i dont know if its the same, but i found that
adding

in the head of the html output fixed it


Luke
- Original Message - 
From: "Louie Miranda" <[EMAIL PROTECTED]>
Newsgroups: php.general
To: <[EMAIL PROTECTED]>
Sent: Wednesday, December 03, 2003 2:09 PM
Subject: Unicode translation


> Guys,
>
> A problem arised on my application when a user enters a Unicode format
code
> on the site. Well, we really catch every information and i really need to
> get some explanation about it.
>
> ex:
>
> C = U+0108: Latin Capital Letter C With Circumflex
>
> Now this unicode character does not have any keystroke on my computer, i
> only have "Character Map (Windows)" to generate this.
>
> On my php form i can type this clearly, but once preview it changes the
> character to Í or something similar (I guess).
>
> But when i used a Unicode character that has a keystroke value ë for
example
> once preview it generates the correct character.
>
> Any bright ideas on this?
>
>
> -- -
> Louie Miranda
> http://www.axishift.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: reload farmes

2003-12-02 Thread Luke
i use

  echo "\n";
  echo "javascript:top.location.href='{$placetogo}';\n";
  echo "";

and if you want to refresh a specific frame, replace top in the script for
the frame name
-- 
Luke

"Christian Jancso" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi there
>
> I have some problems with PHP.
>
> I have a website with different frames where different actions take
> place.
> One frame needs a button (here: "Delete") which:
> 1. reloads another frame
> 2. reloads itself
>
> The code looks like:
>
> if (isset($_POST['action']))
> {
> if ($_POST['action'] == "Delete")
> {
> $id = $_POST['absolute'];
>
> $activity   = mysql_query("SELECT id FROM
> activity WHERE station = '$station'");
> $activity_fetch = mysql_fetch_array($activity);
>
> $delete_activity   = mysql_query("DELETE FROM
> activity where id = '$id'");
>
> $update_stations   = mysql_query("UPDATE
> stations set status = 1, timestatus = 0 where station = '$station'");
>
> header("Location: http://127.0.0.1/empty.php";);
>
> }
> }
>
> With HTML it is . But this doesn`t work here
> because I have sent the header already.
> Can anyone help me?
>
>
> TIA
> Christian
> -- 
> 
> NextNet IT Services
> Christian Jancso
> phone +41.1.210.33.44
> facsimile +41.1.210.33.13
> 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: Generate automatic list of dates

2003-12-02 Thread Luke
that should do it :)
uend: " . $uend;
while($ufirst <= $uend){
 //do other stuff here, insert into database etc
 $ufirst = strtotime("+1 day", $ufirst);
 $formatted = date("d/m/Y", $ufirst);
 echo "ufirst: " . $ufirst . " : " . $formatted;
}


?>

---
Luke

"Tommi Virtanen" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi!
>
> $first_date = 2003-12-01
> $end_date = 2004-01-15
>
>
> while ( $first_date <= $end_date) {
>
> $sql = "INSERT INTO time_table (id, date, person_id) VALUES
> (35,$first_date,0)";
> $result = mysql_query($sql, $conn);
>
> [next date] WHAT CODE TO HERE
>
> }
>
> eg.
>
> first insert row is 35, 2003-12-01,0
> next should be 35,2003-12-02,0 etc
> ...
> and last 35,2004-01-15,0

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: Unicode translation

2003-12-02 Thread Luke
no, but on windows, you should be able to access most of them (depending on
the font) by using ALT+(number pad code)
eg ALT+(num pad)0169 gives you -> ©

Luke

-- 
Luke
"Louie Miranda" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Does all unicode characters have an equivalent key-stroke? and in even
> different fonts?
>
>
> -- -
> Louie Miranda
> http://www.axishift.com
>
>
> - Original Message -
> From: "Leif K-Brooks" <[EMAIL PROTECTED]>
> To: "Luke" <[EMAIL PROTECTED]>
> Cc: <[EMAIL PROTECTED]>
> Sent: Wednesday, December 03, 2003 11:52 AM
> Subject: Re: [PHP] Re: Unicode translation
>
>
> > Luke wrote:
> >
> > >Yeah, i had a similar problem, i dont know if its the same, but i found
> that
> > >adding
> > >
> > >in the head of the html output fixed it
> > >
> > >
> > Even better, use header('Content-Type: text/html; charset=UTF-8') at the
> > beginning of your PHP page.
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: search/replace functions

2003-12-03 Thread Luke
Id suggest using str_replace instead, its easy, and it will replace every
ocurence of the items in the first array, with their corresponding items in
the second array, the manual suggests using this instead or ereg_replace on
a simple subject like this.

http://www.php.net/str_replace

old code-

for($i = 0; $i <= 31; $i++)
{
eregi_replace($search[$i], $replace[$i], $content);
}

return $content;
}
--
becomes
---new code-

$content = str_replace($search, $replace, $content);

return $content;
}
--

Luke


"Scott Ware" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> I'm new to the list, and I don't want this to sound like a stupid ?, but
> I am having an issue with a function that I created.
>
> I have some code stored in a database, similar to XML-style tags, but I
> just created them myself to be more "user-friendly" to people.
> Like for instance , and  (would make the text
> red).
>
> I created a function, to search on the tags that I made, and replace
> them with the appropriate HTML ones, here is my function:
>
> function mytags($content)
> {
> $search[0] = "";
> $search[1] = "";
> $search[2] = "";
> $search[3] = "";
> $search[4] = "";
> $search[5] = "";
> $search[6] = "";
> $search[7] = "";
> $search[8] = "";
> $search[9] = "";
> $search[10] = "";
> $search[11] = "";
> $search[12] = "";
> $search[13] = "";
> $search[14] = "";
> $search[15] = "";
> $search[16] = "";
> $search[17] = "";
> $search[18] = "";
> $search[19] = "";
> $search[20] = "";
> $search[21] = "";
> $search[22] = "";
> $search[23] = "";
> $search[24] = "";
> $search[25] = "";
> $search[26] = "";
> $search[27] = "";
> $search[28] = "";
> $search[29] = "";
> $search[30] = "";
> $search[31] = "";
>
> $replace[0] = "";
> $replace[1] = "";
> $replace[2] = "";
> $replace[3] = "";
> $replace[4] = "";
> $replace[5] = "";
> $replace[6] = "";
> $replace[7] = "";
> $replace[8] = "";
> $replace[9] = "";
> $replace[10] = "";
> $replace[11] = "";
> $replace[12] = "";
> $replace[13] = "";
> $replace[14] = "";
> $replace[15] = "";
> $replace[16] = "";
> $replace[17] = "";
> $replace[18] = "";
> $replace[19] = "";
> $replace[20] = "";
> $replace[21] = "";
> $replace[22] = "";
> $replace[23] = "";
> $replace[24] = "";
> $replace[25] = "";
> $replace[26] = "";
> $replace[27] = "";
> $replace[28] = "";
> $replace[29] = "";
> $replace[30] = "";
> $replace[31] = "";
>
> for($i = 0; $i <= 31; $i++)
> {
> eregi_replace($search[$i], $replace[$i], $content);
> }
>
> return $content;
> }
>
> my problem is, I want to be able to replace all of the "search[]" tags
> with the "replace[]" ones. With the code that I have so-far I am not
> able to, where the "$content" variable is the
> "$row_mysql_table['content']" output. Am I on the right track? And if
> not, can anyone tell me how to accomplish this?
>
> Thanks!

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: PHP and Intranets

2003-12-03 Thread Luke
im from australia too :)

more information on server variables is available from
http://www.php.net/manual/en/reserved.variables.php#reserved.variables.server

heres and example of usage, and it only allows those 3 computer to view the
page (this authentication isnt very good, as all someone would have to do is
change their computers name to view the page)

(the getIP function was taken from a users comment in the PHP manual, very
handy, thanks! (to fund it search the manual for getIP)

\n";
echo "Your host name is: " . $_SERVER['HTTP_HOST'];
echo "Your browser is:" . $_SERVER['HTTP_USER_AGENT'];
echo "Your IP(s) Are: " . getIP();

function GetIP()
{
if (getenv("HTTP_CLIENT_IP") && strcasecmp(getenv("HTTP_CLIENT_IP"),
"unknown"))
$ip = getenv("HTTP_CLIENT_IP");
else if (getenv("HTTP_X_FORWARDED_FOR") &&
strcasecmp(getenv("HTTP_X_FORWARDED_FOR"), "unknown"))
$ip = getenv("HTTP_X_FORWARDED_FOR");
else if (getenv("REMOTE_ADDR") && strcasecmp(getenv("REMOTE_ADDR"),
"unknown"))
$ip = getenv("REMOTE_ADDR");
else if (isset($_SERVER['REMOTE_ADDR']) && $_SERVER['REMOTE_ADDR']
&& strcasecmp($_SERVER['REMOTE_ADDR'], "unknown"))
$ip = $_SERVER['REMOTE_ADDR'];
else
$ip = "unknown";
return($ip);
}//---GetIP()---//
?>

-- 
Luke

"Seung Hwan Kang" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
>
>
> Colin Eldridge wrote:
>
> > Hi, my name is Colin Eldridge, teacher from Australia.
>
> Hello Colin,
>
> Australia! I'm here in Wollongong Uni.
>
> > I am relatively new to PHP.
> > I have set up a small intranet for my students to build and use
interactive webpages.
> > The intranet:  A server(P4, XP) running Apache, MYSQL and PHP (from
Janet Valade's text with CD-ROM)
> > and 3 hosts running P2, Win98 and using IE or
Mozilla as intranet browsers.
> >
> > Students use a browser on the 3 hosts to access PHP scripts from the
server, which then deliver HTML forms back to the originating host.
> > Hosts 'post' completed forms to server, and PHP scripts connect to the
MYSQL server to update a database.
> >
> > Question:  Is there a simple way for PHP to identify which host a form
has come from?  The network names of the 3 hosts are stu1, stu2 & stu3.
Some type of unique host Id is needed  by the PHP scripts to contruct
database records. For this exercise, we are not using PHP sessions, and the
students do not have usernames and passwords for access to the database.
Access is automatic after each host is logged onto the intranet.
>
> Yes, there is .!
> use env. variables.
>
> $_SERVER["SERVER_NAME"]
> $_SERVER["REMOTE_ADDRESS"] // i think this is what u r looking for
>
> if u would lke to find out more...
>
> // test.php
> 
> echo phpinfo();
>
> ?>
>
> :)
>
> >
> > Thanks very much for your time.
> > Regards
> > Colin Eldridge
> >
> >
> >

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: Losing Sessions.

2003-12-04 Thread Luke
Hi

Well, what i can think of (and its happened to me) is session timeouts, how
long does your session last?

Just a note, in newer php versions, session_register is not required, all
you need is session_start, and then use $_SESSION['variablename'] to set the
variable.

session register used to be there to set the variable as a global, so
instead of using $HTTP_SESSION_VARS['xebitsession'] you could use
$xebitsession

i noticed something else too, (maybe its how you want it) but in first
section you have if (isset($_SESSION[$xebitsession])), unless $xebitsession
is set somewhere, that code should be

if (isset($_SESSION['xebitsession']))

same with everywhere else, unless $xebitsession is set, anwhere that there
is $_SESSION[$xebitsession] should become $_SESSION['xebitsession']

Maybe you could try it with a cookie instead and see if the same thing
happens?

HTH

Luke


"Tony Crockford" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> I hope someone can help.
>
> I have a simple login process that someone wrote for me.
>
> It uses two stored variables which it checks on each new page, if it can't
> get them it assumes you should login first and sends you to a login page.
>
> Everything was okay.
>
> I used the same script on a different server (with almost identical PHP
> setup) and now I'm getting randomly logged out. (it works fine locally and
> remotely on a different server)
>
> Can some-one suggest some useful things I could check to try and track
> down the problem?
>
> Many thanks
>
> Tony
>
> This is the check that gets called from each page:
>
>  session_start();
>
> //check to see if the session is set. (the session is set when the user
> logs in)
> //if the session is set, then it must have some data in it... in this case
> we have the user_ref and the group_ref, so that we can see who is logged
> in and what group they belong to.
> //if the session isnt set, then we redirect the user to the login.php page
> so that they can log in or if they cant log in they get an error message.
>
> if (isset($_SESSION[$xebitsession])) {
>
> $user_ref=$_SESSION[$xebitsession]['user']["user_ref"];
> $group_ref=$_SESSION[$xebitsession]['user']["group_ref"];
>
> } else {
>
> header("location:logged.php");
> }
> ?>
>
> this is the login:
>  include("db.php");
>
> mysql_connect($db_Hostname, $db_UserName, $db_Password);
> mysql_select_db($db_Database);
>
> session_start();
> session_register("xebitsession");
>
> function displaylogin() {
>
> include("includes/header.html");
> // open content body table
> include("includes/contentheader.html");
> include("includes/title.html");
> include("includes/contentheader2.html");
> include("includes/contextheader.html");
> include("includes/contentbody.html");
>
> ?>
>
> User Login
>
> 
> 
> 
> 
> 
>
> 
> Login
> Please enter your username and password below.
> 
>
> 
> Username:
> 
>  echo '' .
"\n";
> echo '' . "\n";
> ?>
> 
>
> 
> Password:
> 
> 
>
> 
>  
> 
> 
> 
>
> 
>  
> 
> 
> 
> 
> 
>
> 
> //close content table section
> include("includes/contentfooter.html");
> //close page section
> include("includes/footer.html");
>
> }
> $username=$_POST[user];
> $pass=$_POST[pass];
> $username = addslashes($username);
>
> if (!$username) {
> displaylogin();
> } else {
>
> $sql="SELECT * FROM duser WHERE upass='$pass' AND username='$username'";
> $result = mysql_query($sql);
>
> // Start the login session
> if (! isset ($_SESSION[$xebitsession])) {
>while ( $row = mysql_fetch_array($result) )
>{
>  $_SESSION[$xebitsession]['user']["user_ref"] =$row['user_ref'];
> $_SESSION[$xebitsession]['user']["group_ref"]=$row['group_ref'];
> }
>  header("location:index.php");
> }
> else {
> header("location:index.php");
> }
>
> }
> ?>

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: Sort Array by date

2003-12-04 Thread Luke
an easy way, but might not work in your case is to use sort()
if instead of storing the dates like 12-04-2003, could you prehaps store
them as
2003-04-03
year-month-day

and then you could use

$datearray = sort($datearray, SORT_STRING);

would this work for you?

-- 
Luke


"Matt Palermo" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> I have a bunch of dates in the form: MM-DD- in an array and I want to
> sort them and display them in descending order.  I have tried the usort()
> function below and it's not working.  Can anyone help me out here?
>
> $menu_item = array();
> $menu_item[] = "12-04-2003";
> $menu_item[] = "11-19-2003";
> $menu_item[] = "01-04-2004";
> $menu_item[] = "12-24-2003";
> $menu_item[] = "08-13-1982";
>
> // sorting function
> function date_file_sort($a, $b)
> {
> $a = strtotime($a);
> $b = strtotime($b);
> return strcmp($a, $b);
> }
>
> usort($menu_item, 'date_file_sort');
>
> // output results
> for($x = 0; $x < count($menu_item); $x++)
> {
> echo $menu_item[$x]."";
> }
>
>
> Here are the the results I get:
> 01-04-2004
> 08-13-1982
> 12-04-2003
> 11-19-2003
> 12-24-2003
> Anyone know why these results seem totally random?  Please help.
>
> Thanks,
>
> Matt

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: Search logic question

2003-12-04 Thread Luke
Chris' suggestion sounds allright.

Depending on how you do the search depends on what you will want to do (to a
certain degree)

you might be able to store the search criteria in the url

search.php?start=10&search=php%20general&subsearch1=search&subsearch2=logic

$results = "query results from {$_GET['search']}";

//then you could loop thru it
$i=1;
$subsearch == true;
while($subsearch == true){
if(isset($_GET['subsearch' . $i])){
$results = "subquery results";
}else{
$subsearch = false;
    }
    $i++;
}


just a concept, but it can work :)

-- 
Luke


"Hardik Doshi" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi Group,
>
> I need to implement the search engine for retrieving
> the image observations data from the MySQL database.
> The critical part in the search is the ability to add
> search criteria (Multipage search) from page to page.
> Anywhere during the process, user can click on the
> search button to search the results. Now my question
> is which data-structure is best to store all the
> search criteria so later on i can retrieve results
> from the DB using the selected search criteria.
>
> Is it advisable to store all the search criteria in
> the Object and then i can pass an object to other
> forms by either URL or hidden variables? any other
> suggessions?
>
> Please let me know. If you have any doubt in
> understanding the entire process please let me know so
> i can try to explain more.
>
> Thanks
>
> Hardik
>
> __
> Do you Yahoo!?
> Free Pop-Up Blocker - Get it now
> http://companion.yahoo.com/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: PHP to read and write on a MUSH/MUX

2003-12-04 Thread Luke
I havent done anything like that, but do you have to send a CR or LF after
the connect command (the same as pressing enter?) as i said, not sure how
you do it, but that could be a prob? try changing to

fputs($thresh, "connect USERNAME PASSWORD\n\r");
or
fputs($thresh, "connect USERNAME PASSWORD\n");

or something similar

like to know how it go's
-- 
Luke
"Angel Of Death" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
>
> I'm fairly new to PHP and am trying to make a script that connects to a
> MUSH, logs in, sends some commands, reads some data back, and then exits.
>
> I have the following code:
> ## start code 
>
> $thresh = fsockopen($hostname, $port, &$errno, &$errstr, $timeout);
>
> if(!$thresh)
> {
>  echo "Connection Failed\n";
>  echo "$errstr ($errno)\n";
>  exit();
> }
> else
> {
>  echo "Connected\n";
>  $last = 0;
>  fputs($thresh, "connect USERNAME PASSWORD");
>  while($tmp = fgets($thresh, 1024))
>  {
>  echo $tmp . "";
>  }
>  echo "Closing..";
>
>
> }
> fclose($thresh);
> ### end code ##
>
> It is connecting to the game, I can see that form inside the game.
> However it is not logging in (connect USERENAME PASSWORD).
> Also, I am not sure how to change the while loop, because I game never
> breaks contact, I believe there is always something coming in.
> I had tried feof($thresh) first of all, but that gave the same result -
> i.e. hanging as if waiting for more input without moving on.
>
> Does anyone have any suggestions for me. Has anyone done this sort of
> script before, can they show me theirs, point me to some specific help?
>
> many thanks
>
>
>
>
>
> -- 
>  Azrael
>
> ("\''/").___..--'''"-._
> `0_ O  )   `-.  ( ).`-.__.`)
> (_Y_.)'  ._   )  `._ `. ``-..-'
>   _..`--'_..-_/  /--'_.' .'
>  ((i).-''  ((i).'  (((.-'
>
> Of all God's creatures there is only one that cannot be made the slave
> of the lash. That one is the cat. If man could be crossed with a cat it
> would improve man, but it would deteriorate the cat.
>
> ICQ#52944566
> Registered Linux User: 269002

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: Random Numbers..

2003-12-07 Thread Luke
select all and
use
mysql_data_seek($result, rand(mysql_num_rows($result) - 1));
$row = mysql_fetch_assoc($result);

and there, your random row is returnd, that should be easy enough :) and it
should work

-- 
Luke

"Theheadsage" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hey,
>
> I've got a script which used to generate a random quote. It worked fine
> untill this problem occurred..
>
> Say we have 4 quotes with QuoteID's of 1 through to 4
> The script would grab a number of rows, and generate a random number
> between 1 and this value (being 4 in this case) This worked fine untill,
> one of the quotes was removed and another added, leaving 4 quotes once
> again, but the last one had an ID of 5. The problem is the Random number
> generated is between 1 and 4, so the final quote is never shown..
>
> I tried using the RAND() function in the MySQL statement it's self, but
> it's not random enough...
>
> Then I thought of doing this:
>
> Select all the Quote ID's from the DB.
> Store them in an Array.
> Generate a random number between 1 and the last ID.
> If the Random Number matches a Quote ID, then display the quote,
> otherwise Generate another
>
> But I couldn't get the code to work. Any suggestions on either how to
> write the above, or made the MySQL RAND() function, more random?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: Help with php output to file

2003-12-18 Thread Luke
what about output buffering and saving the output to a file instead of
flushing to the screen, that would work easy :)


Luke

-- 
Luke
"Paul Godard" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi
>
> I have develop an online catalog in php/mysql.  Now the client needs
> the web site on a cd.  Of course without php or mysql...
>
> What is the fastes and easiest way to convert the only 2-3 dynamic
> php pages into static html files?
>
> Of course I could copy the html code generated by the php pages for
> each product and save it as different product1.html product2.html ...
> but that will take ages ... 2000 products in 2 languages.
>
> Is there a way to redirect the output of php pages to a file instead
> of to the screen?  So I could create a simple php script that loop
> for each product & languages to generate all the pages.
> -- 
>
> Kind regards, Paul.
>
> Gondwana
> [EMAIL PROTECTED]
> http://www.gondwanastudio.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: copy function

2003-12-18 Thread Luke
Try this:

if (copy($file_att,'servername\\folder\\'.$file_name))

and make sure you have write access on the winNT server

did that work?

Luke
om
"Omar" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Is there a way to copy a file from 1 server to a different one?
> I have this code in a win 2k server, and i try to copy the file to a win
NT
> server:
>
> if (is_file($file_att))
>   if (copy($file_att,'\servername\folder\'.$file_name))
> echo "succesful";
>   else
> echo "failure";
>
> It gives me this warning:
>
> Warning: Unable to create '\servername\folder\image.jpg': Invalid argument
> in D:\Intranet\sitio\Documentos\copyf.php on line 161
> failure
>
> I need this to work on any computer of the network. What kind of
permission
> do I need so any computer can use this script?
>
> Thanks for the help.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: Newbie question

2004-01-13 Thread Luke
it sounds like maybe you dont have the mysql php extension turned on in the
php ini file, or your php doesnt have mysql support?

Luke

"James Marcinek" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hello Everyone,
>
> I'm new to this so forgive my ignorance. I'm trying to use php with MySQL
> as a database. I'm using apache 2.0 in addition to Mysql 4.1.
>
> I created a simple page (using book to learn) and when I try to go to a
> simple  php script I recieve the following error:
>
> Call to undefined function:  mysql_connect()
>
> I've followed the instructions and the mysql_connect() function has the
> correct arguments supplied ("host", "user", "passwd");
>
> Can anyone shed any light on this? I've looked at the php.ini file and it
> looks ok. the apache has the php.conf file in the conf.d directory.
>
> The book I'm learning from had some simple examples pages that I created
> early on and they work; however this is the first attempt at trying to use
> php to connect.
>
> Any help would be appreciated.
>
> Thanks,
>
> James

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: alternative to protecting files through http auth.

2004-01-14 Thread Luke
there has been a discussion in this group recently about URL re-writing (see
URL rewriting...anybody done this? and replies)

That is a possibility, using a combination of

URL Re-Writing
PHP Sessions/Cookies
And the Location: header

So all requests go back to the index, then you decide from the index.php
page if they have to be redirected, or if they are already logged in, or if
they dont have permission

That might work

-- 
Luke
"Scott Taylor" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
>
>
> Is there no other way to protect your (non PHP) files than through
> authentication?  I've been trying to set up a system that will protect
> files.  Those trying to access the files would only be able to do so
> after entering their email address.  So I set up a form that submits the
> email to my database.  But then the problem is: how to access the
> files?  I could just use http://username:password/test.com/test.jpg
> method, but then what would be the point of trying to protect the files
> in the first place?  It would simply be the same as with holding the
> link to begin with.   So is there an alternative to using http basic
> authentication to protect files?  Or is there a simple way to
> authenticate the pages themselves without using something like Manuel
> Lemos' "PHP HTTP class"?
>
> Best Regards,
>
> Scott Taylor

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Where is the mistace? Warning: ftp_put(): 'STOR ' not understood.

2004-01-15 Thread Luke
That shouldnt matter, because FTP_BINARY is a constant, and therfore has a
numeric, or string value. The only way FTP_BINARY would become a physical
string is if there was quotes around it.

As for the problem, are you sure you have the right connection open, because
the error (STOR not understood) sounds like you mat not have connected to a
valid FTP server? possibly or permissions?

-- 
Luke
"Jay Blanchard" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
[snip]
$mode = FTP_BINARY;
$picuploadname = $picupload[$i];
$piclocalname = "../pictures/".$piclocal[$i];
ftp_put($conn_ftp,$picuploadname ,$piclocalname ,$mode);
[/snip]

You cannot put FTP_BINARY into a variable, it then becomes a string
instead of a function directive.
Cahnge to this and see if it works;

ftp_put($conn_ftp,$picuploadname ,$piclocalname , FTP_BINARY);

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: Multiple drop downs

2004-01-15 Thread Luke
Well could you do something like this:

Connect to the database

retreive the entire table into an array,

run through the array for each product category (while $i < $category count)
and put a nested loop inside to create each dropdown list (or select (in
htm))

this then removes the need to connect to the database several times,
allthought you will have to loop through a multidimensional array, but that
would work

-- 
Luke
"Alex Hogan" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi All,
>
>
>
> I am converting a page from asp that is using several drop down lists.
Each
> list contains part of the product list based on the product type.  At the
> moment it is making a connection to the db and populating a list using the
> product type, closing the connection, then re-opening for another list.
>
>
>
> I can see that populating those drop downs like this is going to cause me
> tremendous problems in the future.
>
>
>
> I know there is an easier way to do this.  I wish I could think of it
right
> now. any assistance would be appreciated.
>
>
>
>
>
>
>
> alex hogan
>
>
>
>
>
> **
> The contents of this e-mail and any files transmitted with it are
> confidential and intended solely for the use of the individual or
> entity to whom it is addressed.  The views stated herein do not
> necessarily represent the view of the company.  If you are not the
> intended recipient of this e-mail you may not copy, forward,
> disclose, or otherwise use it or any part of it in any form
> whatsoever.  If you have received this e-mail in error please
> e-mail the sender.
> **
>
>
>

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: PHP Includes and Echoes in Head Sections and Search Engines

2004-01-15 Thread Luke
hi

Very simple problems, good to see ur getting the hang of it :)
the first is, you have defined your variables after you include the page, so
that the echo is outputting a blank variable...

so instead of:







make it

';
include ("../../../../includes/javascript.php");
include ("../../../../includes/stylesheets.php");
\?>

i just changed the opening and closing tags a little (you didnt need so
many) but the main change is, now the variables come before the included
file, so that the include file can access those variables too.

echo's will work anywhere inside a  wrote in message
news:[EMAIL PROTECTED]
> I'm having a blast with PHP includes and echo functions; I never dreamed
> they could be so simple and effective. But I have a couple questions
> relating to head sections and search engines.
>
> Consider the following html code:
>
>  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
> http://www.w3.org/1999/xhtml"; xml:lang="en" lang="en">
> 
> 
> 
> 
> 
>  $statename = 'Alaska';
> $postcode = 'ak';
> $linkcode = 'world/na/us/ak';
> ?>
> 
> 
>
> Welcome to !
>
> * * * * * * * * * *
>
> And here's the html code from the include named head.php:
>
>  $todayDate = date("m-d-Y");
> ?>
> Freedomware > 
>  versus
> Microsoft" />
> 
>
> * * * * * * * * * *
>
> I discovered that includes will apparently work just about anywhere, but
> echo functions apparently don't work with the  tag and meta tags;
> at least, I can't see the word "Alaska" in those locations when I click
> View Source in my browser.
>
> So I wondered if there IS a way to make echo functions work in meta tags.
>
> Also, do you know if text derived from includes causes any problems with
> search engines? My guess is no, because I can see the included words
> just fine when I click View Source.
>
> Along similar lines, I wondered if there might be potential pitfalls if
> you import links to style sheets and javascripts as includes. Everything
> seems to work just fine so far.
>
> Thanks.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Where is the mistace? Warning: ftp_put(): 'STOR ' not understood.

2004-01-15 Thread Luke
hmm, well that sure is strange. cuz here http://au3.php.net/ftp_put someone
got it working...ahh i see, they used FTP_ASCII, so its the default
anyways...hmmm might be a bug, because FTP_BINARY is just a constant, so it
has a numerical value, (eg 2003 (i dont think thats it)) but in theory

ftp_put($conn_ftp,$picuploadname ,$piclocalname , FTP_BINARY);

should be the same as

ftp_put($conn_ftp,$picuploadname ,$piclocalname , 2003);

so i duno :/

-- 
Luke
"Jay Blanchard" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
[snip]
That shouldnt matter, because FTP_BINARY is a constant, and therfore has
a
numeric, or string value. The only way FTP_BINARY would become a
physical
string is if there was quotes around it.

As for the problem, are you sure you have the right connection open,
because
the error (STOR not understood) sounds like you mat not have connected
to a
valid FTP server? possibly or permissions?
[/snip]

If you put quotes around "FTP_BINARY" in the function like this 

ftp_put($conn_ftp,$picuploadname ,$piclocalname , "FTP_BINARY");

...it will fail. The expected behaviour is that ftp_put will silently
default to ASCII mode. The same happens if you put FTP_BINARY in a
variable. I have confirmed this in 4.3.n

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] best paractice example page creation php / mysql

2004-01-15 Thread Luke
Yeah, its fine, as long as your while loop ends

just after a quick glance, it looks like an infinite loop,

you might try
instead of
while (count($aListItems)){
try
while (isset($aListItems[$i])){
or
while ($i < count($aListItems)){

-- 
Luke
"Jon Bennett" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Ahh, i was originally thinking of having a examples table, but when
> writing the post I decided it might not be nessecary :-)
>
> ok, that bit I understand fine, it's getting the data into the DB first
> that's bugging me, would something like this be ok ?
>
> function addNews($aArgs, $aListItems, $aTableItems) {
>
>  // create example record
>  $sql = "INSERT INTO _training_examples (
>  training_id,
>  status,
>  created_dt,
>  modified_dt
>  ) values (
>  ".$this->$_iTrainingId.",
>  1,
>  NOW(),
>  NOW()
>  )";
>
>  if (DB::isError($rsTmp = $this->_oConn->query($sql))) {
>
>  catchExc($rsTmp->getMessage());
>  return false;
>
>  } else {
>
>  / Use MySQL's LAST_INSERT_ID() method to query for the
> insert id
>  $sql = "SELECT LAST_INSERT_ID()";
>
>  // Check for DB class exceptions
>  if (DB::isError($iExampleId = $this->_oConn->getOne($sql)))
> {
>
>  // Report exceptions if present
>  catchExc($iExampleId->getMessage());
>
>  // Unset the product id
>  unset($iExampleId);
>  }
>
>  $i = 0;
>
>  while (count($aListItems)){
>  // add multiple records to db for list_items
>  $sql = "INSERT INTO _training_list_items (
>  training_id,
>  example_id,
>  listitem,
>  status,
>  created_dt,
>  modified_dt
>  ) values (
>  ".$this->$_iTrainingId.",
>  ".$iExampleId.",
>  ".$aListItems[$i]['List Item Text'].",
>  1,
>  NOW(),
>  NOW()
>  )";
>  $i++
>
>  }
>
> And then repeat the 2 while loop for the table_items table.
>
> Is it ok to have INSERT statements enclosed in a while loop ???
>
> Cheers,
>
> Jon
>
>
> jon bennett  |  [EMAIL PROTECTED]
> new media creative
> _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
>
> J   b   e   n   .   n   e   t
>
> 91 Gloucester Rd,  Trowbridge,  Wilts,  BA14 0AD
> t: +44 (0) 1225 341039 w: http://www.jben.net/
>
>
> On 15 Jan 2004, at 18:45, Richard Davey wrote:
>
> > Hello Jon,
> >
> > Thursday, January 15, 2004, 6:23:51 PM, you wrote:
> >
> > JB> The way I was thinking of doing this was to have 3 tables:
> >
> > JB> training_subsections
> > JB> training_list_items
> > JB> training_table_items
> >
> > JB> My problem is, is it a 'reccomended' way of doing things to query
> > the
> > JB> db multiple times for each new list_item and table_item in one go
> > ??? I
> >
> > There is no reason why you can't, but I'm quite convinced that with a
> > little more fore-thought you could come up with a table structure that
> > meant you didn't have to do this.
> >
> > For example (if I've understood your post correctly) why not have a
> > training_examples table and then use an ExampleID for the subsections,
> > list items and table items.
> >
> > That way you know which example you're dealing with and can bring back
> > all of the sub sections accordingly, linking in the list and table
> > items.
> >
> > If this isn't possible, post a few more details about what you want to
> > achieve and perhaps your table schema.
> >
> > -- 
> > Best regards,
> >  Richardmailto:[EMAIL PROTECTED]
> >
> > -- 
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: PHP Includes and Echoes in Head Sections and Search Engines

2004-01-15 Thread Luke

? Holy cow, this gets simpler all the time. Pretty soon, there'll be
? nothing left on my page but PHP includes and echo functions!
?
? Does this cut down on a website's file size? In other words, are the php
? includes effectively inactive when no one's viewing your main pages,
? leaving them empty of the included pages?

Well in a way yes, it wont cut down the transfer bandwitdth, but because you
are reusing the same files over again, this will take up less disk space on
your
server. But the same amount of data is transferred when a user views the
page (as you can see from view->source)

? But suppose there's a certain page where I don't want the style sheet in
? the middle - the one I named MIDDLE. Is there a way to mark it in the
? include page, then instruct the main page to either not import it or
? replace it with nothing ("")?

youd have to use a variable, so in the main page do the following

if($pagetoshow == 'withoutmiddle'){
$includemiddle = FALSE;
}else{
$includemiddle = TRUE; //(or false depending)
}

and in the include do this:

if($includemiddle == TRUE){
echo '';
}


just a side point, you may be better of doing your html code with echos, as
you have a few variables in there.. eg
';

if($includemiddle == TRUE){
echo '';
}
echo '';
?>

and if you are echoing a variable, quotes around it arent needed

you can just use
echo $variable;
instead of
echo "$variable";

Luke

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: Using lists over newsgroup, Problem

2004-01-18 Thread Luke
I'm successfully using Outlook Express news client to view messages and post
messages, but i do get postmaster reply emails sometimes saying message
sending expired, even though they show up and obviously worked as i can get
replys

-- 
Luke

"Siamak" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hello,
>
> I have done whatever I could to send messages to
> newsgroups but messages do not appear in the list (I
> think server ignores them).
>
> I have set a valid email and I am using XanaNews
> client.
>
> I really hate to receive huge amounts of emails in my
> box from listserver (as I am forced now).
>
> Any solution?
>
> Mac
>
> __
> Do you Yahoo!?
> Yahoo! Hotjobs: Enter the "Signing Bonus" Sweepstakes
> http://hotjobs.sweepstakes.yahoo.com/signingbonus

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: Error Reporting help

2004-01-18 Thread Luke
Are you using output buffering? that will stop it from being displayed (it
does on mine, if thre is an error and output buffering, nothing at all shows
up)

So try turning output buffering off, or at the beggining somewhere put
while(@ob_end_flush);

-- 
Luke
"Chris Edwards" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> My hosting company recently upgraded to PHP 4.3.0. Since doing this I no
> longer get syntax type errors, from my typo's inside my PHP scripts. These
> use to come up in my browser when that page was requested and the script
> run.
>
> I have spent hours going through the online help, trying to set a number
of
> the error reporting levels and parameters  but cannot get to where it will
> report on a syntax error.
>
> For example if I code
>
> echo "This is a syntax error because of the double quote start and the
> single quote end ';
>
> I just get a blank screen.
>
> I have 14 pages of PHP settings printed out, so for any kind person that
can
> help, I can respond with their values quickly.
>
> Thanks
> Chris Edwards

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: Can this head section, which loads many style sheets, be improved or simplified?

2004-01-19 Thread Luke
Well you could use elseif statements so you only have to set one true
instead of X amount false

eg

if($includenorth){
//Do North Include
}elseif($includesw){
//Do Southwest Here
}

the only thing is with that way, only one well get done, not all, but it
depends on what you want, that may be suitable.

-- 
Luke
"Freedomware" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> I now that have a system that works beautifully. I just wondered if it
> could be simplififed or improved even more.
>
> The head section on every page consists of an included page, which I
> appended below. But the most important part is the style sheet section,
> which begins with two or three default style sheets (World, North
> America), followed by several conditional "regional" style sheets (e.g.
> the North, Southwest, Great Plains, etc.) and a few alternate style
sheets:
>
> echo ' type="text/css" />';
> if($includenorth == TRUE){
>  echo '';
> }
> if($includesw == TRUE){
>  echo '';
> }
> echo '';
> echo '';
>
>
> Here's the matching head section from the main page (Alaska, in this
case):
>
>  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
> http://www.w3.org/1999/xhtml"; xml:lang="en" lang="en">
> 
>  $myname = 'Alaska';
> $mycode = 'ak';
> $mylink = '/ak';
> $mynickname = 'Land of the Midnight Sun';
> $mycontinent = 'North America';
> $mycountry = 'United States';
> $mystate = 'Alaska';
> $countrycode = 'us';
> $linkcontinent = '/na';
> $linkcountry = '/us';
> $linkstate = '/ak';
> $periods = '../../../../';
> $linkwebring = '/world/na/us/ak/';
> $includenorth = TRUE;
> $includesouth = FALSE;
> $includesouthwest = FALSE;
> [Plus about a dozen more]
> include ("../../../../includes/state/head.php");
> ?>
> 
>
> This same head section appears on pages for the Northwest Territories
> and Yukon Territory, and the style sheet all three are linked to -
> north.css - features styles that modifies page elements (e.g. div#title)
> that have been modified by PHP (e.g. div#titleak, div#titlenwt,
> div#titleyt).
>
> The head section for the Southwest states accepts the southwest style
> sheet and bars the northern style sheet.
>
> As I said, it works great. I just wondered if anyone had any suggestions
> for improving it further. It would be kind of nice if I didn't have to
> paste a string of FALSE statements into the head section of every page...
>
> $includenorth = FALSE;
> $includesouth = FALSE;
> $includesouthwwest = FALSE;
>
> Below is the entire code. Thanks!
>
>
>
>  $todayDate = date("m-d-Y");
> echo 'Freedomware > ' . $myname . '';
> echo '';
> echo '';
> echo '';
> echo '';
> echo '';
> echo ' type="text/javascript">';
> echo ' type="text/javascript">';
> echo '
> <!--
> function MM_openBrWindow(theURL,winName,features) { //v2.0
>window.open(theURL,winName,features);
> }
> //-->
> ';
> echo ' type="text/css" />';
> if($includea1 == TRUE){
>  echo ' rel="stylesheet" type="text/css" />';
> }
> if($includenorth == TRUE){
>  echo '';
> }
> if($includesw == TRUE){
>  echo ' rel="stylesheet" type="text/css" />';
> }
> echo '';
> echo '';
> ?>
>
>
>
>
>  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
> http://www.w3.org/1999/xhtml"; xml:lang="en" lang="en">
> 
>  $myname = 'Alaska';
> $mycode = 'ak';
> $mylink = '/ak';
> $mynickname = 'Land of the Midnight Sun';
> $mycontinent = 'North America';
> $mycountry = 'United States';
> $mystate = 'Alaska';
> $countrycode = 'us';
> $linkcontinent = '/na';
> $linkcountry = '/us';
> $linkstate = '/ak';
> $periods = '../../../../';
> $linkwebring = '/world/na/us/ak/';
> $includea1 = TRUE;
> $includenorth = TRUE;
> $includequon = FALSE;
> $includemar = FALSE;
> $includene = FALSE;
> $includemat = FALSE;
> $includeapp = FALSE;
> $includesouth = FALSE;
> $includemw = FALSE;
> $includegp = FALSE;
> $includetx = FALSE;
> $includerm = FALSE;
> $includesw = FALSE;
> $includeca = FALSE;
> $includehi = FALSE;
> $includemex = FALSE;
> include ("../../../../includes/state/head.php");
> ?>
> 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] [Article] Writing Efficient PHP...

2004-01-20 Thread Luke
Well if you do want to read it, i logged in and uploaded the PDF versions of
the tutorial to my webserver, so take a look

PDF (A4) http://www.zeyus.com/phptutorial/wa-effphp-a4.pdf
PDF (Letter) http://www.zeyus.com/phptutorial/wa-effphp-ltr.pdf

Hope you find it useful!

Luke

"Chris W. Parker" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
Chris Shiflett <mailto:[EMAIL PROTECTED]>
on Tuesday, January 20, 2004 12:54 PM said:

> That was great. My favorite quotes from the article:
>
> "Register for this tutorial"

Bummer. I was looking forward to reading it.



Chris.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: Specifying file paths in Windows

2004-01-20 Thread Luke
try removing the dot and /

so

if (is_file("filedir/test.txt")) echo "Found it!";
else echo "Not found";

that should work on windows and unix platforms, i dont think windows likes
the single dot, but you can use relative referencing, by just using the
directory name.

-- 
Luke
"Todd Cary" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> The \filedir is under the phpcode directory
>
> c:\webroot
>|
>|--\application
>   |
>   |--\php_code
>  |
>  |--\filedir
>
>
> Eric Bolikowski wrote:
>
> > "Todd Cary" <[EMAIL PROTECTED]> wrote in message
> > news:[EMAIL PROTECTED]
> >
> >>I moved an application from Linux to my Client's NT system and is_file
> >>cannot file the file on the NT system.  My directory structure is as
> >>follows:
> >>
> >>c:\webroot
> >>   \application
> >> \php_code
> >>   \filedir
> >>
> >>The code is
> >>
> >
> > //two dots!
> >
> >>if (is_file("../filedir/test.txt")) echo "Found it!";
> >>else echo "Not found";
> >>
> >>This is working with Linux, but it does not work with NT.  Can someone
> >>tell me why it does not work?
> >>
> >>Todd

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] authentication problems!

2004-01-20 Thread Luke
Yeah, i think i mentioned the same thing(or was going to :/ )

you should be able to use the local filesystem, and reffer to it relatively!
and then you can stream it and you wont need any authentication, and noone
will be able to directly link to the file

-- 
Luke

"Jason Wong" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> On Wednesday 21 January 2004 05:49, Scott Taylor wrote:
>
> Please trim your posts!
>
> > Of course there is not problem if the user is entering the information
> > him or her self.  But just using this code:
> >
> > $file = 'http://miningstocks.com/protected/Dec03PostPress.pdf';
> >
> > //now view the PDF file
> > header("Content-Type: application/pdf");
> > header("Accept-Ranges: bytes");
> > header("Content-Length: ".filesize($file));
> > readfile($file);
> >
> > from a PHP page where no authentication has occured does not work at
all.
>
> Did you not read my reply to your previous thread about this? Use a local
> filesystem path to read the file.
>
> -- 
> Jason Wong -> Gremlins Associates -> www.gremlins.biz
> Open Source Software Systems Integrators
> * Web Design & Hosting * Internet & Intranet Applications Development *
> --
> Search the list archives before you post
> http://marc.theaimsgroup.com/?l=php-general
> --
> /*
> "A dirty mind is a joy forever."
> -- Randy Kunkee
> */

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Odd Code Error.

2004-01-20 Thread Luke
yeah its strange,

$test is equal to $test2,
$test is equal to $test3
but $test2 is not equal to $test3,

$test = "string";
$test2 = true;
$test3 = 0;
if($test == $test2){
 echo "hi";
}

somone tell me im wrong please? else thats seriously weird

-- 
Luke
<[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> i've never had a problem doing if ($var=="test") ??
>
> > I've come across this recently too. I think what's happening is that
> > PHP is converting "NFH" to an integer, which would be zero in this
> > case. Thus zero == zero is true...
> >
> > Try doing type checking too:
> > if ($EA === "NFH")
> >
> > Martin
> >

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Odd Code Error.

2004-01-20 Thread Luke
ok, i read the section, but even so

if $a == $b
and $a == $c
then $b should be equal to $c

but php is saying otherwise?

this sounds confusing i want to try n get my head round it

a string equals a integer of zero, and a string equals true, but the reason
the bool doesnt equal the int is because when the string and int are
compared, the string is zero (because it has no numerical value)?

did that make sense? am i right?

-- 
Luke

"Robert Cummings" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> On Tue, 2004-01-20 at 22:39, Luke wrote:
> > yeah its strange,
> >
> > $test is equal to $test2,
> > $test is equal to $test3
> > but $test2 is not equal to $test3,
> >
> > $test = "string";
> > $test2 = true;
> > $test3 = 0;
> > if($test == $test2){
> >  echo "hi";
> > }
> >
>
> Looks fine to me...
>
> $test == $test2: $test is not an empty string and thus evaluates to
>  true.
>
> $test == $test3: $test is converted to an integer to compare against
>  $test3. Conversion of $test to integer results in 0,
>  which happens to be equal to $test3
>
> You should read the section on type juggling.
>
> http://ca2.php.net/language.types.type-juggling
>
> Cheers,
> Rob.
> -- 
> ..
> | InterJinn Application Framework - http://www.interjinn.com |
> ::
> | An application and templating framework for PHP. Boasting  |
> | a powerful, scalable system for accessing system services  |
> | such as forms, properties, sessions, and caches. InterJinn |
> | also provides an extremely flexible architecture for   |
> | creating re-usable components quickly and easily.  |
> `'

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Odd Code Error.

2004-01-20 Thread Luke
i think i got it now :)
i wont bother trying to explain my understanding, i think that will confuse
the matter hehe

but i think mainly the usual rule, that if an apple and a banana are fruit,
and a pear is the same as a banana, then a pear must be fruit too (AND I
think im fruit loops)

bah im goin bananas, its time to go to band practise anyways,

-- 
Luke

"Robert Cummings" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> On Tue, 2004-01-20 at 23:00, Luke wrote:
> > ok, i read the section, but even so
> >
> > if $a == $b
> > and $a == $c
> > then $b should be equal to $c
>
> No this is not true, since types conversions can be different between a
> and b, a and c or between b and c. If you want the above logic to be
> true then you must use === for equality based on type also.
>
> > but php is saying otherwise?
>
> PHPis following the rules of type conversion which are not necessarily
> commutative (hope that's the right term).
>
> > this sounds confusing i want to try n get my head round it
> >
> > a string equals a integer of zero,
>
> A non-numeric string equals 0 by the rules of string to integer type
> conversion (that's not entirely true since I think the first numerical
> portion is the part converted as per atoi()).
>
> > and a string equals true, but the reason
>
> A non empty string equals true according to the rules of string to
> boolean type conversion, unless (I think) the string is '0'.
>
> > the bool doesnt equal the int is because when the string and int are
> > compared, the string is zero (because it has no numerical value)?
>
> You are talking about bool, string and int with respect to a bool-int
> equality check. This is confusing, only two values can be compared. From
> what hat did you pull the string?
>
> > did that make sense? am i right?
>
> You didn't make sense :)
>
> Cheers,
> Rob.
> -- 
> ..
> | InterJinn Application Framework - http://www.interjinn.com |
> ::
> | An application and templating framework for PHP. Boasting  |
> | a powerful, scalable system for accessing system services  |
> | such as forms, properties, sessions, and caches. InterJinn |
> | also provides an extremely flexible architecture for   |
> | creating re-usable components quickly and easily.  |
> `'

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: Specifying file paths in Windows

2004-01-21 Thread Luke
Well, the thing is, it sounds like PDFlib isnt programmed well? or perhaps
there is a limitation in something they used...

because, sure, windows uses C:\windows\system\blah\folder\ but you can do
any of the following (this is the output from the command prompt: windoze
cmd.exe

C:\>cd windows/system32

C:\WINDOWS\system32>cd\

C:\>c:/windows/system32/ftp.exe
ftp> quit

C:\>cd /windows/system32

C:\WINDOWS\system32>cd ../system/

C:\WINDOWS\system>

so there shouldnt be a problem using relative referencing and forward
slashes? as far as i can see :/



-- 
Luke

"Todd Cary" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> I found the problem: PDFlib is expecting the file name to be in the
> proper format for the system (Linux or NT).  This is my patch:
>
> $workdir   = getcwd();
>
> if ($use_unix)
>   $cl_absolute_image = $workdir . "/tiff/" . $cl_image;
> else
>   $cl_absolute_image = $workdir . "\\tiff\\" . $cl_image;
>
>
> Do you have a suggestion on a better way to do it?
>
> Todd
>
> Luke wrote:
> > try removing the dot and /
> >
> > so
> >
> > if (is_file("filedir/test.txt")) echo "Found it!";
> > else echo "Not found";
> >
> > that should work on windows and unix platforms, i dont think windows
likes
> > the single dot, but you can use relative referencing, by just using the
> > directory name.
> >



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] 2 x DB connections at once

2004-01-22 Thread Luke
It depends, how are you creating the connections, and where are you keeping
the connection ID
and when you query, or select database, or anything to do with the
databases, do you make sure you specify that connection id?

//Notice the TRUE, that creates a new conenction, and doesnt use the
existing connection (hence returning a different id)

$sqlconnection1 = mysql_connect('test.com', 'username', 'password');
$sqlconnection2 = mysql_connect('test.com', 'username', 'password', TRUE);

then when you select databases and query youll have to specify that
connection!

//choose DB 1 on connection 1
mysql_select_db('mydata1', $sqlconnection1);
//choose db2 on connetion 2
mysql_select_db('mydata1', $sqlconnection2);

//and querying
//this will select the table named table from the mydata1 database
mysql_query("SELECT * FROM table WHERE name='me'", $sqlconnection1);
//this will select the table named table from the mydata2 database
mysql_query("SELECT * FROM table WHERE name='me'", $sqlconnection2);


hope thats what you were after
-- 
Luke

_
"Donald Tyler" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
OK, now I have done some work and it gets even stranger.

Two Objects

Validator
Importer

Both objects have private variables called $this->Connection

However, when I change the DB for one objects connection pointer, the other
objects connection pointer ALSO changes DB.

Is it not possible to have two completely separate DB connections active at
the same time?


-Original Message-
From: Donald Tyler [mailto:[EMAIL PROTECTED]
Sent: Thursday, January 22, 2004 3:08 PM
To: [EMAIL PROTECTED]
Subject: [PHP] 2 x DB connections at once

I thought this was possible, but it doesn't seem to be working:

I have a class, that has a private variable called $this->Connection, which
is a Database Connection pointer to a MySQL database. During the lifetime of

the Class, it uses the connection multiple times without a problem.

The class also uses a function from an include file that has its OWN
Database Connection pointer. And it seems that for some reason, as soon as
that external function is called, the Private Database Pointer within my
Class suddenly points to the Database name that the external functions
Database Pointer was using.

I ALWAYS specify which connection pointer I want to use when selecting the
DB and doing a mysql_query, so I have no earthly idea how the external
Connection pointer is affecting my Private Connection Pointer.

I hope I explained that well enough; it's real difficult to put into words.

Does anyone have any idea what might be happening?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: page order

2004-01-22 Thread Luke
Hey, Mita Kuuluu?

I'm not exactly sure what you mean, but basically you want to edit and move
around the values?

the 'no' field is basically an order?

to do the edit page you can use a combination of HTML forms and the mysql
results...

and to move them up or down, you can have a link  that has the id in the url

so itd be like ?id=2&action=up
if(!isset($_GET['action'])){
//display item list
}elseif($_GET['action'] == 'up'){
//move item up
$result = mysql_query("SELECT no FROM admin WHERE id={$_GET['id']}") or
die('Invalid Query: ' . mysql_error());
$previousnum = mysql_fetch_assoc[$result];
$newnum = $previousnum - 1;
$result = mysql_query("SELECT id FROM admin WHERE no={$previousnum}") or
die('Invalid Query: ' . mysql_error());
$moveid = mysql_fetch_assoc[$result];
$result = mysql_query("UPDATE admin SET no={$previousnum} WHERE
id={$moveid}") or die('Invalid Query: ' . mysql_error());
$result = mysql_query("UPDATE admin SET no={$newnum} WHERE
id={$_GET['id']}") or die('Invalid Query: ' . mysql_error());
}elseif($_GET['action'] == 'down'){
//move item down
}elseif($_GET['action'] == 'edit'){
//edit item
if(!isset($_GET['step'] || $_GET['step'] == 1){
//display HTML form with data pulled from the database based on
$_GET['id'], submit it to itself, and add &step=2
}elsif($_GET['step'] == 2 || $_GET['step'] == 'save'){
//save data back to database based on $_POST information from
form and $_GET['id']
}
}

and you should be able to adapt that to the down one for yourself (just
change the -, to a +)

there might be a better way (and more secure) to do it, but i jus made that
then, so give it a go anyways...

hey hey,

-- 
Luke


"Tommi Virtanen" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
| Hi!
|
| How I can do following:
|
| 1.
|
| i have page which list (admin)
|
| id menuname pagename no
| 1 First First page 1 edit (link to edit-page)
| 2 Second Second page 2 edit
| 3 Third Third page 3 edit
|
| I can edit all field in edit-page, also no -field.
| How I can edit only no -field, and so that when I want to
| move id 2 to first page (and then id 1 move to second page.
|
| Eg.
|
| id menuname pagename no
| 1 First First page 1 up down edit (link to edit-page)
| 2 Second Second page 2 up down edit
| 3 Third Third page 3 up down edit

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] unexpected $ error

2004-09-21 Thread luke
hi,

i get the following error when trying to run this code (see below):

Parse error: parse error, unexpected $ in /full path form.php on line 59

i have checked for unclosed braces - none - and tried uploading the files in
ascii format just in case but get the same same error.

i have searched many forums but still haven't solved it.

the include file just looks like this:



this is driving me nuts so if anyone can help, i'd be really grateful.

thanks,

lukemack.

code follows..

Form Data Successfully inserted!";
else echo " There was a problem inserting the form Data!";

mysql_close();


?>

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] php parses but no data inserted

2004-09-21 Thread luke
hi there,

the following code runs but no message is displayed from the if then else
statement at the end of the script. also, nothing is written to the database.
i have checked the insert statement and the login credentials are correct.does
anyone know what might be causing this?

thanks,

lukemack.


Form Data Successfully inserted!";
else echo " There was a problem inserting the form Data!";

mysql_close();
}

?>

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] inserting timestamp into mysql field

2004-09-21 Thread luke
Subject: inserting timestamp into mysql field

hi there,

i need to insert a current timestamp into a mysql field when a form is posted.
can anyone suggest a simple way of doing this? i would like to set a variable
in my php script to add into the insert statement. it needs to be in the
format 00-00-00 00:00:00.

Many thanks,

Luke Mackenzie.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] alternative to mysql_field_name()

2004-09-21 Thread Luke
hi there,

i am currently using the following code to loop through the results of a
sql query and extract the field names ($export contains the query
results from the database). the script goes on to place the results in
an excel file.

for ($i = 0; $i < $fields; $i++) {
$header .= mysql_field_name($export, $i) . "\t";
} 

however, i'd like to add more meaningful names as the field name
headings in the excel file. can anyone suggest how i can write a list of
tab separated headings into $header?

the rest of the script can be found here:
http://www.phpfreaks.com/tutorials/114/3.php

many thanks,

luke.


---
need a new website? get over to 
http://www.lukem-sites.co.uk 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] how to concatenate php variables in mysql query

2004-09-22 Thread luke
hi,

i'm trying to concatenate two php variables (containing form data) in a mysql
query. i'm currenty using the dot operator:

telphone number =$telcode.$telnumber' 

but only the telcode gets written to the database.

any ideas?

many thanks,

luke m.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] implode errors if array empty

2004-09-22 Thread luke
hi there,

i am using implode to get the contents of an array into a single variable:

$enterprises = implode(",", $enterprise) //enterprise contains the array.

however, if the array is empty (the user didnt select anything in the form),
the implode function errors out.

can anyone think of a way round this?

many thanks,

luke m.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] implode errors if array empty

2004-09-22 Thread luke
resolved with if(empty()) - apologies.


[EMAIL PROTECTED] wrote:

> hi there,
> 
> i am using implode to get the contents of an array into a single variable:
> 
> $enterprises = implode(",", $enterprise) //enterprise contains the array.
> 
> however, if the array is empty (the user didnt select anything in the form),
> the implode function errors out.
> 
> can anyone think of a way round this?
> 
> many thanks,
> 
> luke m.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] how to concatenate php variables in mysql query

2004-09-22 Thread luke
here is the whole query:

$query = "INSERT INTO inmarsat_comp SET date_added=NOW(), prefix='$prefix',
firstname='$firstname', lastname='$lastname', job_title='$jobtitle',
company_name='$company',
no_of_employees='$employees',address_1='$address1',address_2='$address2',
address_3='$address3', town='$town', county ='$county', postcode='$postcode',
country ='$country', telephone_number='$telcode.$telnumber',
fax_number='$faxcode.$faxnumber', email='$email', enterprise='$enterprises',
optin_thirdparty='$distribute', optin_news='$market'";

only the telcode gets inserted.

many thanks,

luke m




"Jay Blanchard" <[EMAIL PROTECTED]> wrote:

> [snip]
> telphone number =$telcode.$telnumber' 
> 
> but only the telcode gets written to the database.
> [/snip]
> 
> There is not enough here to know for sure (I am betting this is part of
> a query), but if your code looks like the above you are missing a single
> quote after the =. Now, if you enclose the variables in the single
> quotes without other manipulation it will probably not work as expected.
> Can we see the whole query?
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] header("Location: ") problem

2004-09-22 Thread luke
hi,

is there a way of setting a target property for header("Location:
thanks.htm")?

my form is in an iframe so when i hit submit, my php page redirects the user
to thanks.htm but this is rendered within the iframe not in a fresh page.

any ideas?

thanks,

luke.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] PHP telnet server

2009-01-01 Thread Luke
The current system also uses some kind of strange text based database, I was
wondering if using MySQL for the database would slow it down too much?



> > Well the current system runs of a 20MB internet connection in London,
> > seeing as that's the UK that about 2MB.
> >
> > It runs fine, responses are snappy even dealing with loads of users.
> >
> > This, however, is written in C: does PHP have that much of an overhead
> > so that bandwidth is actually that much of an issue?
> >
>
> The implementation language does not affect your bandwidth requirements
> at all.
>
>
> /Per Jessen, Zürich
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
Luke Slater
:O)

PGP Fingerprint: 643B B93E D979 15C9 5BBD 7AF9 A18B 9831 6600 C396

-BEGIN PGP PUBLIC KEY BLOCK-
Version: GnuPG v1.4.9 (GNU/Linux)

mQGiBEjrxM0RBADm6CySSIf+t4TqTwXyleiS1dwUJiMiwoesJcerVzGAkl5kJjhv
ZQp2uVEeMsX5Wo7/1AxDN8yV9cNRcX0wl8QXAFqn+7XG7GWRQlVMdmftHEFokK+/
FfU5md2c87juGPsJkZcBIu1E2UAbppAzLydRAHMBZUi2+x8X/+Bh1v1j3wCg69EM
2EM6giPRQ9H+GDvSNBfiq+sD/3ZkOeynNx9v4hFegQtRPUe7CxQbjkxzPARO4bBd
A4Cx5EHlgKAE3hdZRMl38pl9kBD7s548s2wzKLSCsQeWMJp+bdoxj5mopPWH95hG
ITDRUl/i12xC669rYQhGDY+rZW5ltmlhtNBpVHBVbr8/JogJR1/XgW1WFLWlYMTC
znnfBADJz6d+CR6SEb1iqAHVGB1sMz5mmTQ/qbtbirkDKC+4DWB0MrmRkllK8PgC
Rs+MEhwoVL1zSQPYCChZTFZS7Ja6t7duqbqWOp90gWY4gbFrcihBC+WzkwpRELil
T2wVcEtqcU25EVAGmtcAqDxRvQ/2WVReaKBZQ4brCcAGZUSAQLQ7THVrZSBTbGF0
ZXIgKE51LVZvbyBzb2Z0d2FyZSBkZXNpZ24pIDx0aW5tYWNoaW4zQGdtYWlsLmNv
bT6IYAQTEQIAIAUCSOvEzQIbIwYLCQgHAwIEFQIIAwQWAgMBAh4BAheAAAoJEKGL
mDFmAMOWtnwAoJFKtRxa6/kHkuq52rI5d+3MrC2BAJ0S0yXE7uKyzuRgFI2Uv4Fw
cWWQ5IhgBBMRAgAgBQJI687PAhsjBgsJCAcDAgQVAggDBBYCAwECHgECF4AACgkQ
oYuYMWYAw5aSogCfZTDDPlCnq9dXxax3TQ71f55d1w8AoNlMKmUQdNa4MZMaKyCx
bjYKtHz4uQENBEjrxM0QBADSsxd0x6Ioa+b/4OTIp7z2oFm72dS5CuxJl9fuhfPG
ee1yfaBHDDTHvh2k9IpWhFC+ZhCJkp560BbOpdGItZ2yhH2cCdrOeYCqiVWQBN5v
dwQaJ0o8Z/bSo5xHgLe4iED596rs6lnv8HGBnzoEQNGbexI/p9vbRTvuCLWzPZfu
7wAECwP/cXlVBrfY8E2vt6T9WUGJcWPjx9MM1wY/xLvqyJjmFLc6UAWnbR17Vb0n
c/7Af+wD1yFzUlt54bW3hqyn4sKkf6sejupY7sWbBTDCjNCJ5fAGfDzmxha/KYN7
XL7Gjp4pVfmXaPucj9WbQj8uEQi/mQ265GlCNHFofnsBAeOcxZ+ISQQYEQIACQUC
SOvEzQIbDAAKCRChi5gxZgDDlugxAJ4+eNpkqv6RELyjw3Bsx6L80maHiwCdFL6I
HlaeNZYrTyhaCMt46Gz8kN0=
=z+JR
-END PGP PUBLIC KEY BLOCK-


Re: [PHP] PHP blogs?

2009-03-20 Thread Luke
Yeah the CSS doesn't seem to be restricting the width of the boxes properly

2009/3/20 Michael A. Peters 

> Stuart wrote:
>
>> 2009/3/20 George Larson :
>>
>>> I'm reorganizing my reader.  Anybody suggest any good PHP feeds?
>>>
>>
>> http://www.planet-php.net/ is an aggregator of some of the good stuff
>> that's out there.
>>
>
> It displays horribly in Firefox.
> They need to fix it.
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
Luke Slater
:O)

PGP Fingerprint: 643B B93E D979 15C9 5BBD 7AF9 A18B 9831 6600 C396

-BEGIN PGP PUBLIC KEY BLOCK-
Version: GnuPG v1.4.9 (GNU/Linux)

mQGiBEjrxM0RBADm6CySSIf+t4TqTwXyleiS1dwUJiMiwoesJcerVzGAkl5kJjhv
ZQp2uVEeMsX5Wo7/1AxDN8yV9cNRcX0wl8QXAFqn+7XG7GWRQlVMdmftHEFokK+/
FfU5md2c87juGPsJkZcBIu1E2UAbppAzLydRAHMBZUi2+x8X/+Bh1v1j3wCg69EM
2EM6giPRQ9H+GDvSNBfiq+sD/3ZkOeynNx9v4hFegQtRPUe7CxQbjkxzPARO4bBd
A4Cx5EHlgKAE3hdZRMl38pl9kBD7s548s2wzKLSCsQeWMJp+bdoxj5mopPWH95hG
ITDRUl/i12xC669rYQhGDY+rZW5ltmlhtNBpVHBVbr8/JogJR1/XgW1WFLWlYMTC
znnfBADJz6d+CR6SEb1iqAHVGB1sMz5mmTQ/qbtbirkDKC+4DWB0MrmRkllK8PgC
Rs+MEhwoVL1zSQPYCChZTFZS7Ja6t7duqbqWOp90gWY4gbFrcihBC+WzkwpRELil
T2wVcEtqcU25EVAGmtcAqDxRvQ/2WVReaKBZQ4brCcAGZUSAQLQ7THVrZSBTbGF0
ZXIgKE51LVZvbyBzb2Z0d2FyZSBkZXNpZ24pIDx0aW5tYWNoaW4zQGdtYWlsLmNv
bT6IYAQTEQIAIAUCSOvEzQIbIwYLCQgHAwIEFQIIAwQWAgMBAh4BAheAAAoJEKGL
mDFmAMOWtnwAoJFKtRxa6/kHkuq52rI5d+3MrC2BAJ0S0yXE7uKyzuRgFI2Uv4Fw
cWWQ5IhgBBMRAgAgBQJI687PAhsjBgsJCAcDAgQVAggDBBYCAwECHgECF4AACgkQ
oYuYMWYAw5aSogCfZTDDPlCnq9dXxax3TQ71f55d1w8AoNlMKmUQdNa4MZMaKyCx
bjYKtHz4uQENBEjrxM0QBADSsxd0x6Ioa+b/4OTIp7z2oFm72dS5CuxJl9fuhfPG
ee1yfaBHDDTHvh2k9IpWhFC+ZhCJkp560BbOpdGItZ2yhH2cCdrOeYCqiVWQBN5v
dwQaJ0o8Z/bSo5xHgLe4iED596rs6lnv8HGBnzoEQNGbexI/p9vbRTvuCLWzPZfu
7wAECwP/cXlVBrfY8E2vt6T9WUGJcWPjx9MM1wY/xLvqyJjmFLc6UAWnbR17Vb0n
c/7Af+wD1yFzUlt54bW3hqyn4sKkf6sejupY7sWbBTDCjNCJ5fAGfDzmxha/KYN7
XL7Gjp4pVfmXaPucj9WbQj8uEQi/mQ265GlCNHFofnsBAeOcxZ+ISQQYEQIACQUC
SOvEzQIbDAAKCRChi5gxZgDDlugxAJ4+eNpkqv6RELyjw3Bsx6L80maHiwCdFL6I
HlaeNZYrTyhaCMt46Gz8kN0=
=z+JR
-END PGP PUBLIC KEY BLOCK-


Re: [PHP] Namespce operator

2009-03-25 Thread Luke
Backslash doesn't sound like it will look very pretty

2009/3/25 Richard Heyes 

> Backslash? Seriously? I'm hurt that my suggestion of "¬" (ASCII170 ?)
> wasn't used. :-(
>
> --
> Richard Heyes
>
> HTML5 Canvas graphing for Firefox, Chrome, Opera and Safari:
> http://www.rgraph.net (Updated March 14th)
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
Luke Slater
http://dinosaur-os.com/
:O)


Re: [PHP] Logical next step in learning?

2009-04-14 Thread Luke
2009/4/14 phphelp -- kbk 

>
> On Apr 14, 2009, at 10:58 AM, Gary wrote:
>
>  I think most books have you writing code, and Head First did as well, so I
>> think that is covered..
>>
>
> No, it isn't. There is a big difference between writing it the way a book
> tells you to do it, hand-holding all the way and doing it. When you actually
> have to do it, you take what you have read and apply it, using the book as a
> reference.
>
>
>  I actually have a real project to do that is a little beyond my abilities
>> at
>> this point (its my own), so I want to keep the learning process flowing.
>>
>
> Bastien's suggestion is spot on. Catalog your family members & friends,
> shoes, girlfriends, any information that is important to you. Really the
> only way.
>
> Ken
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
That or create a website that has already been created, but on a smaller
scale.
That way you will run into the common issues that you will have to deal with
in most of the projects you do.

-- 
Luke Slater
:O)


[PHP] problem with my class

2009-04-16 Thread Luke
Hi guys,

I've been learning about object oriented programming and I wrote this test
class but it doesn't seem to be working, it throws no errors but doesn't
insert anything to the database either. I have made sure that the data being
sent when the class is instantiated is valid.

I'm probably missing something simple here...

I have already

class RecipeCreator
{
private $rtitle;
private $problem;
private $solution;

function __construct ($t, $p, $s)
{
if(!isset($t, $p, $s))
{
throw new Exception ('Missing parameters for
__construct, need $title $problem and $solution');
}

$this->rtitle   = mysql_real_escape_string($t);
$this->problem  = mysql_real_escape_string($p);
$this->solution = mysql_real_escape_string($s);
}

public function saveRecipe()
{
$query = "INSERT INTO recipe (title, problem, solution)
VALUES ('".$this->rtitle."',

   '".$this->problem."',

   '".$this->solution."')";
mysql_query($query);
}
}

Many thanks,
Luke Slater


Re: [PHP] problem with my class

2009-04-16 Thread Luke
2009/4/16 Jan G.B. 

> 2009/4/16 Luke :
> > Hi guys,
> >
> > I've been learning about object oriented programming and I wrote this
> test
> > class but it doesn't seem to be working, it throws no errors but doesn't
> > insert anything to the database either. I have made sure that the data
> being
> > sent when the class is instantiated is valid.
> >
> > I'm probably missing something simple here...
> >
>
> Are you actually calling your public function?
>
> $x = new RecipeCreator('a', 'b', 'c');
> $x->saveRecipe();
>
> You might want to insert some error reporting...
>
> echo mysql_error(); and alike
>
>
> Byebye
>
>
>
>
> > I have already
> >
> > class RecipeCreator
> > {
> >private $rtitle;
> >private $problem;
> >private $solution;
> >
> >function __construct ($t, $p, $s)
> >{
> >if(!isset($t, $p, $s))
> >{
> >throw new Exception ('Missing parameters for
> > __construct, need $title $problem and $solution');
> >}
> >
> >$this->rtitle   = mysql_real_escape_string($t);
> >$this->problem  = mysql_real_escape_string($p);
> >$this->solution = mysql_real_escape_string($s);
> >}
> >
> >public function saveRecipe()
> >{
> >$query = "INSERT INTO recipe (title, problem, solution)
> > VALUES ('".$this->rtitle."',
> >
> >   '".$this->problem."',
> >
> >   '".$this->solution."')";
> >mysql_query($query);
> >}
> > }
> >
> > Many thanks,
> > Luke Slater
> >
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

Yes I am doing that. The query seems to be going through all right too I
tested the syntax in mysql query browser and tried mysql_error() but there
was nothing.
I think there's an issue with the __construct because when I wrote a method
in there to return one of the properties of the function, it turned up
blank! As I said before the variables I'm passing in are definitely valid...


Re: [PHP] @$_POST[...]

2009-04-22 Thread Luke
2009/4/22 PJ 

> Could somebody explain to me the meaning of @ in $var = @$_POST['title'] ;
> where could I find a cheat sheet for those kinds of symbols or what are
> they called?
> Sorry for my ignorance, but maybe this will take the fog filter our of
> my neurons. :-\
>
> --
> unheralded genius: "A clean desk is the sign of a dull mind. "
> -
> Phil Jourdan --- p...@ptahhotep.com
>   http://www.ptahhotep.com
>   http://www.chiccantine.com/andypantry.php
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
I believe placing an @ in front of a statement suppresses any error messages
it generates.

-- 
Luke Slater
:O)


Re: [PHP] E-Mail Verification - Yes, I know....

2009-04-28 Thread Luke
2009/4/28 Jan G.B. 

> 2009/4/28 Jay Blanchard :
> > Our company wants to do e-mail verification and does not want to use the
> > requests / response method (clicking a link in the e-mail to verify the
> > address), which as we all know is the only way you can be truly sure. I
> > found this;
> >
> > http://verify-email.org/
> >
> > Which seems to be the next best deal and it is written in PHP. Has
> > anyone used this? Is anyone doing something similar? How do you handle
> > errors? I know that some domains will not accept these requests.
> >
>
> They don't even detect greylisting!
>
>
>
> > I think that this method would really work for us and cut down on the
> > bogus e-mail addresses we're receiving though. Thoughts?
> >
>
> There's just one way: let the users confirm with an activation link.
> People often insert their addresses wrong without noticing it..
> example: www.myal...@mydomain.org instead of myal...@mydomain.org,
> aol. instead of aol.com and so on.
>
> So ... nothing like "insert your mail twice" or "re-check your address
> please" actually works. ;)
>
> On the other hand: Douple-opt-In is quite like an industry standard -
> why wouldn't your firm use it? It makes customers happy as well as
> "not-customers" because people can't use their addressess to sign-up.
> I hate getting other peoples email.
>
>
> byebye
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
/**
Validate an email address.
Provide email address (raw input)
Returns true if the email address has the email
address format and the domain exists.

Modified: 06/06/2003
**/
function validEmail($email)
{
   $isValid = true;
   $atIndex = strrpos($email, "@");
   if (is_bool($atIndex) && !$atIndex)
   {
  $isValid = false;
   }
   else
   {
  $domain = substr($email, $atIndex+1);
  $local = substr($email, 0, $atIndex);
  $localLen = strlen($local);
  $domainLen = strlen($domain);
  if ($localLen < 1 || $localLen > 64)
  {
 // local part length exceeded
 $isValid = false;
  }
  else if ($domainLen < 1 || $domainLen > 255)
  {
// domain part length exceeded
$isValid = false;
  }
  else if ($local[0] == '.' || $local[$localLen-1] == '.')
  {
// local part starts or ends with '.'
 $isValid = false;
  }
  else if (preg_match('/\\.\\./', $local))
  {
// local part has two consecutive dots
 $isValid = false;
  }
  else if (!preg_match('/^[A-Za-z0-9\\-\\.]+$/', $domain))
  {
// character not valid in domain part
 $isValid = false;
  }
  else if (preg_match('/\\.\\./', $domain))
  {
// domain part has two consecutive dots
 $isValid = false;
  }
  else if
(!preg_match('/^(.|[A-Za-z0-9!#%&`_=\\/$\'*+?^{}|~.-])+$/',
str_replace("","",$local)))
  {
// character not valid in local part unless
// local part is quoted
 if (!preg_match('/^"("|[^"])+"$/',
str_replace("","",$local)))
 {
$isValid = false;
 }
  }

if ($isValid && !(checkdnsrr($domain,"MX") ||
checkdnsrr($domain,"A")))
  {
// domain not found in DNS
 $isValid = false;
  }
   }

   return $isValid;
}


-- 
Luke Slater
http://dinosaur-os.com/
:O)


Re: [PHP] E-Mail Verification - Yes, I know....

2009-04-28 Thread Luke
2009/4/28 Jan G.B. 

> 2009/4/28 Luke :
> >
> >
> > 2009/4/28 Jan G.B. 
> >>
> >> 2009/4/28 Jay Blanchard :
> >> > Our company wants to do e-mail verification and does not want to use
> the
> >> > requests / response method (clicking a link in the e-mail to verify
> the
> >> > address), which as we all know is the only way you can be truly sure.
> I
> >> > found this;
> >> >
> >> > http://verify-email.org/
> >> >
> >> > Which seems to be the next best deal and it is written in PHP. Has
> >> > anyone used this? Is anyone doing something similar? How do you handle
> >> > errors? I know that some domains will not accept these requests.
> >> >
> >>
> >> They don't even detect greylisting!
> >>
> >>
> >>
> >> > I think that this method would really work for us and cut down on the
> >> > bogus e-mail addresses we're receiving though. Thoughts?
> >> >
> >>
> >> There's just one way: let the users confirm with an activation link.
> >> People often insert their addresses wrong without noticing it..
> >> example: www.myal...@mydomain.org instead of myal...@mydomain.org,
> >> aol. instead of aol.com and so on.
> >>
> >> So ... nothing like "insert your mail twice" or "re-check your address
> >> please" actually works. ;)
> >>
> >> On the other hand: Douple-opt-In is quite like an industry standard -
> >> why wouldn't your firm use it? It makes customers happy as well as
> >> "not-customers" because people can't use their addressess to sign-up.
> >> I hate getting other peoples email.
> >>
> >>
> >> byebye
> >>
> >> --
> >> PHP General Mailing List (http://www.php.net/)
> >> To unsubscribe, visit: http://www.php.net/unsub.php
> >>
> >
> > /**
> > Validate an email address.
> > Provide email address (raw input)
> > Returns true if the email address has the email
> > address format and the domain exists.
> >
> > Modified: 06/06/2003
> > **/
> > function validEmail($email)
> > {
> >$isValid = true;
> >$atIndex = strrpos($email, "@");
> >if (is_bool($atIndex) && !$atIndex)
> >{
> >   $isValid = false;
> >}
> >else
> >{
> >   $domain = substr($email, $atIndex+1);
> >   $local = substr($email, 0, $atIndex);
> >   $localLen = strlen($local);
> >   $domainLen = strlen($domain);
> >   if ($localLen < 1 || $localLen > 64)
> >   {
> >  // local part length exceeded
> >  $isValid = false;
> >   }
> >   else if ($domainLen < 1 || $domainLen > 255)
> >   {
> > // domain part length exceeded
> > $isValid = false;
> >   }
> >   else if ($local[0] == '.' || $local[$localLen-1] ==
> '.')
> >   {
> > // local part starts or ends with '.'
> >  $isValid = false;
> >   }
> >   else if (preg_match('/\\.\\./', $local))
> >   {
> > // local part has two consecutive dots
> >  $isValid = false;
> >   }
> >   else if (!preg_match('/^[A-Za-z0-9\\-\\.]+$/',
> $domain))
> >   {
> > // character not valid in domain part
> >  $isValid = false;
> >   }
> >   else if (preg_match('/\\.\\./', $domain))
> >   {
> > // domain part has two consecutive dots
> >  $isValid = false;
> >   }
> >   else if
> > (!preg_match('/^(.|[A-Za-z0-9!#%&`_=\\/$\'*+?^{}|~.-])+$/',
> > str_replace("","",$local)))
> >   {
> > // character not valid in local part unless
> > // local part is quoted
> > 

Re: [PHP] -less layouts; Ideas welcome

2009-05-21 Thread Luke
2009/5/21 Jim Lucas 

> Jim Lucas wrote:
>
>> Since this has been a topic of dicussion, I figured I would add my
>> thoughts.
>>
>> I have been toying with the idea of doing a -less layouts involving
>> tabular data, calendars, etc...
>>
>> Recent threads have finally made me do it.  Let me know what you think.
>>
>> http://www.cmsws.com/examples/templates/div_tables.php
>> http://www.cmsws.com/examples/templates/div_tables.phps (source for
>> above)
>> http://www.cmsws.com/examples/templates/div_cal.php
>>
>> When you turn off the styles, the calendar becomes pretty rough on the
>> eyes, but still "accessible".
>>
>> Same thing with the tabular data structure.
>>
>> But, not knowing how the various types of accessibility applications work,
>> I am guessing that the layout to an application trying to read it should
>> work fairly well.  Let me know if I am way off the mark with my thoughts.
>>
>> If you want to respond off list, that if fine by me.
>>
>> TIA
>>
>>
> I forgot to mention that I have checked this in the following browsers all
> on Windows XP SP3
>IE6
>Mozilla Firefox 2.0.0.20
>Mozilla Firefox 3.0.10
>Safari 4 Public Beta
>Opera 9.64
>
> the layout looked exactly the same between all the various browsers.
>
> If you have a different browser then mentioned above and you have a
> different layout let me know. If you could get me a screen shot, that would
> be great.
>
> Thank again.
>
>
> --
> Jim Lucas
>
>   "Some men are born to greatness, some achieve greatness,
>   and some have greatness thrust upon them."
>
> Twelfth Night, Act II, Scene V
>by William Shakespeare
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
But you're just using the same design semantic, but coding it in CSS instead
of using ; it even has the same name!

There appears to be nothing wrong with tables when used for the right
reasons - they _are_ there for a reason.

-- 
Luke Slater
http://dinosaur-os.com/
:O)


Re: [PHP] Re: PHP, OOP and AJAX

2009-05-28 Thread Luke
2009/5/28 Olexandr Heneralov 

> Hi!
> Do not use low-level AJAX.
> There are many frameworks for ajax (JQUERY).
> Try to use PHP frameworks like symfony, zend framework. They simplify your
> work.
>
>
> 2009/5/28 Lenin 
>
> > 2009/5/28 kranthi 
> >
> > >
> > >
> > > i recommend you firebug firefox adddon (just go to the net tab and you
> > > can see all the details of the communication between client and
> > > server)
> > > and i find it helpful to use a standard javascript(jQuery in my case)
> > > library instead of highly limited plain javascript  language
> > >
> > I also recommend using FirePHP with FireBug here's a nicely written
> > tutorial
> > on how to use them both together for Ajax'ed pages. http://tr.im/iyvl
> > Thanks
> > Lenin
> > www.twitter.com/nine_L
> >
>


Moo, I would say learn to do PHP by itself before you go using frameworks.

AJAX is a bit different though because there will be few reasons that you
will ever need to write low level code when you're using a library like
Prototype =)

-- 
Luke Slater
:O)


[PHP] class problem :(

2009-05-28 Thread Luke
Right I've read the manual on this and all that so hopefully you find people
can help.
I have an abstract class with three children. The abstract is ForumObject
and the three children are Thread, Category and Post and each have their own
table so I wrote the following:
abstract class ForumObject
{
  static private $table;

  static function getObjectIds ($field, $value)
  {
  $query = "SELECT id FROM {self::$table} WHERE $field = '$value'";
  $object_ids = mysql_fetch_array();
  return $object_ids;
  }
}

class Category extends ForumObject
{
  static private $table = "categories";
}
That's just got the important bits for the sake of your eyes but basically
the problem I'm having is calling
Category::getObjectIds ($whatever, $whatever2);
Seems to think that it's referring to ForumObject::$table rather than
Category::$table?
I looked into it and there seems to be something you can do with
get_called_class() but unfortunately I'm stuck with 5.2.9 at the moment and
that is new to 5.3.
Any ideas? Perhaps there is a different way I could implement the classes -
I would rather not have getObjectIds repeated three times!
Thanks in advance,
-- 
Luke Slater
:O)


[PHP] class problem

2009-05-28 Thread Luke
Right I've read the manual on this and all that so hopefully you fine people
can help.
I have an abstract class with three children. The abstract is ForumObject
and the three children are Thread, Category and Post and each have their own
table so I wrote the following:
abstract class ForumObject
{
  static private $table;

  static function getObjectIds ($field, $value)
  {
  $query = "SELECT id FROM {self::$table} WHERE $field = '$value'";
  $object_ids = mysql_fetch_array();
  return $object_ids;
  }
}

class Category extends ForumObject
{
  static private $table = "categories";
}
That's just got the important bits for the sake of your eyes but basically
the problem I'm having is calling
Category::getObjectIds ($whatever, $whatever2);
Seems to think that it's referring to ForumObject::$table rather than
Category::$table?
I looked into it and there seems to be something you can do with
get_called_class() but unfortunately I'm stuck with 5.2.9 at the moment and
that is new to 5.3.
Any ideas? Perhaps there is a different way I could implement the classes -
I would rather not have getObjectIds repeated three times!
Thanks in advance,

-- 
Luke Slater
http://dinosaur-os.com/
:O)


Re: [PHP] Re: class problem :(

2009-05-28 Thread Luke
2009/5/29 Shawn McKenzie 

> Luke wrote:
> > Right I've read the manual on this and all that so hopefully you find
> people
> > can help.
> > I have an abstract class with three children. The abstract is ForumObject
> > and the three children are Thread, Category and Post and each have their
> own
> > table so I wrote the following:
> > abstract class ForumObject
> > {
> >   static private $table;
> >
> >   static function getObjectIds ($field, $value)
> >   {
> >   $query = "SELECT id FROM {self::$table} WHERE $field = '$value'";
> >   $object_ids = mysql_fetch_array();
> >   return $object_ids;
> >   }
> > }
> >
> > class Category extends ForumObject
> > {
> >   static private $table = "categories";
> > }
> > That's just got the important bits for the sake of your eyes but
> basically
> > the problem I'm having is calling
> > Category::getObjectIds ($whatever, $whatever2);
> > Seems to think that it's referring to ForumObject::$table rather than
> > Category::$table?
> > I looked into it and there seems to be something you can do with
> > get_called_class() but unfortunately I'm stuck with 5.2.9 at the moment
> and
> > that is new to 5.3.
> > Any ideas? Perhaps there is a different way I could implement the classes
> -
> > I would rather not have getObjectIds repeated three times!
> > Thanks in advance,
>
> I didn't test this, just a thought.  You'd still have to implement
> getObjectIds(), but it would be slim:
>
> abstract class ForumObject
> {
>  static private $table;
>
>   static function getObjectIds ($field, $value, $class)
>  {
>$query = "SELECT id FROM {$class::$table} WHERE $field = '$value'";
> $object_ids = mysql_fetch_array();
>return $object_ids;
>  }
> }
>
> class Category extends ForumObject
> {
>   static private $table = 'categories';
>
>  static function getObjectIds ($field, $value)
>  {
> parent::getObjectIds ($field, $value, __CLASS__)
>  }
> }
>
> Or probably the same because you're defining $table anyway in the child
> class:
>
> abstract class ForumObject
> {
>  static private $table;
>
>   static function getObjectIds ($field, $value, $table)
>  {
>$query = "SELECT id FROM $table WHERE $field = '$value'";
> $object_ids = mysql_fetch_array();
>return $object_ids;
>  }
> }
>
> class Category extends ForumObject
> {
>   static private $table = 'categories';
>
>  static function getObjectIds ($field, $value)
>  {
> parent::getObjectIds($field, $value, self::$table)
>  }
> }
>
> --
> Thanks!
> -Shawn
> http://www.spidean.com
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
Ah that looks like the perfect solution! Trying now!
Many thanks!

-- 
Luke Slater
http://dinosaur-os.com/
:O)


Re: [PHP] Best Encryption Algorithm

2009-06-03 Thread Luke
2009/6/3 Andrew Ballard 

> On Wed, Jun 3, 2009 at 4:17 PM, Paul M Foster 
> wrote:
> > On Wed, Jun 03, 2009 at 07:57:32PM +0100, Ashley Sheridan wrote:
> >
> > 
> >
> >> A single-phase Caesar cypher is by far the best. It worked for Julias
> >> Caesar, and damn it, it will work for us!
> >
> > ROT13 FTW!
> >
> > Paul
> >
> > --
> > Paul M. Foster
> >
>
> ROT26  - because it's twice as strong!  :-P
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

I was once working with a very problematic partner that kept changing data
in our database, so I rot13d all the data and told him it was some advanced
encryption and he never worked it out :)

-- 
Luke Slater
:O)


[PHP] Socket error

2009-06-28 Thread Luke
Hey guys, getting an odd error here... The code involved:

$master_socket = socket_create_listen($this->port);

socket_bind($master_socket, '127.0.0.1', $this->port);
socket_listen($master_socket);
socket_set_option($master_socket, SOL_SOCKET, SO_REUSEADDR, 1);
socket_set_nonblock($master_socket);

And I'm getting:

'PHP Warning:  socket_bind(): unable to bind address [22]: Invalid argument
in /home/luke/talkserver/new/classes/server.php online 30'

$this->port is valid, I've checked both this and that socket_create_listen
seems to be executing correctly.

I'm a bit lost on the error too it seems to be what the php.net manual says
are the parameters?

I'm trying to create a listening socket server that binds to a port on the
local machine.

Thanks in advance for any help!

-- 
Luke Slater
:O)


[PHP] Socket error

2009-06-28 Thread Luke
Hey guys, getting an odd error here... The code involved:

$master_socket = socket_create_listen($this->port);

socket_bind($master_socket, '127.0.0.1', $this->port);
socket_listen($master_socket);
socket_set_option($master_socket, SOL_SOCKET, SO_REUSEADDR, 1);
socket_set_nonblock($master_socket);

And I'm getting:

'PHP Warning:  socket_bind(): unable to bind address [22]: Invalid argument
in /home/luke/talkserver/new/classes/server.php online 30'

$this->port is valid, I've checked both this and that socket_create_listen
seems to be executing correctly.

I'm a bit lost on the error too it seems to be what the php.net manual says
are the parameters?

I'm trying to create a listening socket server that binds to a port on the
local machine.

Thanks in advance for any help!


-- 
Luke Slater
:O)


Re: [PHP] Socket error

2009-06-28 Thread Luke
2009/6/29 Stuart 

> 2009/6/29 Luke :
> > Hey guys, getting an odd error here... The code involved:
> >
> >$master_socket = socket_create_listen($this->port);
> >
> >socket_bind($master_socket, '127.0.0.1', $this->port);
> >socket_listen($master_socket);
> >socket_set_option($master_socket, SOL_SOCKET, SO_REUSEADDR,
> 1);
> >socket_set_nonblock($master_socket);
> >
> > And I'm getting:
> >
> > 'PHP Warning:  socket_bind(): unable to bind address [22]: Invalid
> argument
> > in /home/luke/talkserver/new/classes/server.php online 30'
> >
> > $this->port is valid, I've checked both this and that
> socket_create_listen
> > seems to be executing correctly.
> >
> > I'm a bit lost on the error too it seems to be what the php.net manual
> says
> > are the parameters?
> >
> > I'm trying to create a listening socket server that binds to a port on
> the
> > local machine.
> >
> > Thanks in advance for any help!
>
> What port are you trying to bind to? If it's <= 1024 then you need to
> run it as a privileged user.
>
> -Stuart
>
> --
> http://stut.net/
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
Unfortunately that doesn't make a difference :(

-- 
Luke Slater
:O)


Re: [PHP] Socket error

2009-06-29 Thread Luke
2009/6/29 Daniel Brown 

> On Mon, Jun 29, 2009 at 02:42, Luke wrote:
> > Hey guys, getting an odd error here... The code involved:
> [snip!]
>
>Luke,
>
>Just a friendly reminder: for future reference, please don't start
> a second thread on the list until the first is closed out ---
> particularly if it's the same subject.  Sometimes responses to
> questions - particularly in the middle of a Sunday night - will take
> some time, but someone will eventually reply.
>
> --
> 
> daniel.br...@parasane.net || danbr...@php.net
> http://www.parasane.net/ || http://www.pilotpig.net/
> Ask me about our fully-managed servers and proactive management
> clusters starting at just $200/mo.!
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
Ah, that wasn't impatience, I have two email addresses and was unsure which
were allowed to post to the list but apparently it's both! Sorry about that.

In relation to the question, the answer was indeed to change to
socket_create, the following code works fine:

$master_socket = socket_create(AF_INET, SOCK_STREAM,
0);
socket_bind($master_socket, '127.0.0.1',
$this->port);
socket_listen($master_socket);
socket_set_option($master_socket, SOL_SOCKET,
SO_REUSEADDR, 1);
socket_set_nonblock($master_socket);

Thanks for the help =)

-- 
Luke Slater
:O)


[PHP] Scope woe

2009-06-30 Thread Luke
Hello again guys,

I was wondering the best way to tackle the following problem:

I've got a class, containing a property which is another object. So from
outside I should be able to do
$firstobject->propertycontainingobject->methodinsidethatobject();

The $firstobject variable is in the global namespace (having been made with
$firstobject = new FirstObject;), and I'm having a problem that I'm sure
many people have when accessing it inside another class, so:

class otherObject
{
static function messwithotherthings ()
{
$firstobject->propertycontainingobject->methodinsidethatobject();
}
}

But $firstobject is blank, which makes sense because in there it is pointing
to the local variable within the method.

To solve this, I could add 'global $firstobject' inside every method, but
this is very redundant and boring. I've tried a couple of things like
adding:

private $firstobject = $GLOBALS['firstobject'];

But apparently that's bad syntax. I was just wondering the best way to get
around this?

Thanks a lot for your help,

-- 
Luke Slater
:O)


Re: [PHP] Re: Scope woe

2009-06-30 Thread Luke
2009/6/30 Eddie Drapkin 

> It should be passed into the constructor as a parameter.  If you're
> using OOP properly, there's no reason to use $GLOBALS, ever.  Any
> variable in the $GLOBALS array exists twice in memory, so just keep
> that in mind, if you plan to use it.
>
> On Tue, Jun 30, 2009 at 8:43 AM, Peter Ford wrote:
> > Luke wrote:
> >> Hello again guys,
> >>
> >> I was wondering the best way to tackle the following problem:
> >>
> >> I've got a class, containing a property which is another object. So from
> >> outside I should be able to do
> >> $firstobject->propertycontainingobject->methodinsidethatobject();
> >>
> >> The $firstobject variable is in the global namespace (having been made
> with
> >> $firstobject = new FirstObject;), and I'm having a problem that I'm sure
> >> many people have when accessing it inside another class, so:
> >>
> >> class otherObject
> >> {
> >> static function messwithotherthings ()
> >> {
> >> $firstobject->propertycontainingobject->methodinsidethatobject();
> >> }
> >> }
> >>
> >> But $firstobject is blank, which makes sense because in there it is
> pointing
> >> to the local variable within the method.
> >>
> >> To solve this, I could add 'global $firstobject' inside every method,
> but
> >> this is very redundant and boring. I've tried a couple of things like
> >> adding:
> >>
> >> private $firstobject = $GLOBALS['firstobject'];
> >>
> >> But apparently that's bad syntax. I was just wondering the best way to
> get
> >> around this?
> >>
> >> Thanks a lot for your help,
> >>
> >
> >
> > Set the value of $firstobject in the constructor of otherObject (that's
> what
> > constructors are for!):
> >
> > eg.
> >
> > class otherObject
> > {
> >private $firstobject;
> >
> >function __construct()
> >{
> >$this->firstobject = $GLOBALS['firstobject'];
> >}
> >
> >static function messwithotherthings ()
> >{
> >
>  $this->firstobject->propertycontainingobject->methodinsidethatobject();
> >}
> > }
> >
> >
> > --
> > Peter Ford  phone: 01580 89
> > Developer   fax:   01580 893399
> > Justcroft International Ltd., Staplehurst, Kent
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
Thanks for the replies :)

Surely if I pass it as a parameter to the __construct then I would have to
make an instance of the otherObject, notice that messwithotherthings is
static?

Also, if I'm not using OOP properly, Eddie, how would I use it properly to
prevent this situation?

Thanks,

-- 
Luke Slater
:O)


Re: [PHP] Re: PHP 5.3.0 Released!

2009-06-30 Thread Luke
2009/6/30 pan 

> Lukas Kahwe Smith wrote:
> >> Hello!
> >>
> >> The PHP Development Team would like to announce the immediate release
> >> of PHP 5.3.0. This release is a major improvement in the 5.X series,
> >> which includes a large number of new features and bug fixes.
> >>
> >> Release Announcement: http://www.php.net/release/5_3_0.php
> >> Downloads:http://php.net/downloads.php#v5.3.0
> >> Changelog:http://www.php.net/ChangeLog-5.php#5.3.0
> >>
> >> regards,
> >> Johannes and Lukas
>
> Great !
>
> The downloads page is devoid of any note in re pRCL binaries
> for Windows.
> windows.php.net doesn't say anything either of which pre-existing
> PECL binaries will work with 5_3.
>
> Is the 5_2_6 set of PECL binaries compatible with 5_3 ?
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
Did anyone notice it has been released on the same day as firefox 3.5? See
any similarity in the version numbers?

-- 
Luke Slater
:O)


Re: [PHP] Sessions

2009-07-03 Thread Luke
2009/7/3 Daniel Brown 

> On Thu, Jul 2, 2009 at 23:27, Jason Carson wrote:
> > Hello all,
> >
> > Do I have to add session_start() at the beginning of every page so that
> > the $_SESSION variables work on all pages or do I use session_start() on
> > the first page and something else on other pages?
>
> Yes, unless you're using session autoloading.  Also, in most
> cases, you will only need to call session_start() once (before
> referencing $_SESSION), even if $_SESSION is accessed in an included
> file.
>
> --
> 
> daniel.br...@parasane.net || danbr...@php.net
> http://www.parasane.net/ || http://www.pilotpig.net/
> Check out our hosting and dedicated server deals at
> http://twitter.com/pilotpig
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

Some people have a file called init.php, which would contain
session_start(); as well as other things that need to be done every page
load (connect to the database perhaps?) and they just 'require' that at the
top of every page.

-- 
Luke Slater
http://dinosaur-os.com/
:O)


Re: [PHP] How to build an FF extension

2009-07-23 Thread Luke
2009/7/23 Ashley Sheridan 

> On Wed, 2009-07-22 at 23:49 -0400, Paul M Foster wrote:
> > On Wed, Jul 22, 2009 at 08:31:10PM -0700, Javed Khan wrote:
> >
> > > How to build an FF extension and how to install it. I'm using Fedora 10
> > > operating system.
> > > Can someone please provide me with the steps
> > > Thanks
> > > J.K
> >
> > Let me substitute for Dan here. You're asking this on a PHP list, which
> > isn't the appropriate venue for such a question. Firefox/Mozilla lists
> > would be a better place to ask.
> >
> > Paul
> >
> > --
> > Paul M. Foster
> >
>
> I'm not sure those lists could help him either, as the abbreviation for
> Firefox is Fx, not FF.
>
> Thanks
> Ash
> www.ashleysheridan.co.uk
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
Only officially:
http://en.wikipedia.org/wiki/FF<http://en.wikipedia.org/wiki/FF>
-- 
Luke Slater
:O)


[PHP] unsubscription not working

2009-07-31 Thread Luke
Trying to unsubscribe from the list, send the email and get this response:
'Acknowledgment: The address



   tinmach...@googlemail.com



was not on the php-general mailing list when I received your request and is
not a subscriber of this list.'


Where I'm sure that is the address I'm subscribed with.

-- 
Luke Slater
:O)

this text is protected by international copyright. it is illegal for
anybody apart from the recipient to keep a copy of this text.
dieser text wird von internationalem urheberrecht geschuetzt. allen
ausser dem/der empfaenger/-in ist untersagt, eine kopie dieses textes
zu behalten.


Re: [PHP] Another date exercise

2009-08-17 Thread Luke
2009/8/17 tedd 

> At 4:22 PM -0400 8/16/09, Paul M Foster wrote:
>
>> On Sun, Aug 16, 2009 at 08:36:17AM +0100, Lester Caine wrote:
>> -snip-
>>  > But as has been said, the real solution is a date picker.
>>
>> I *hate* date pickers. They slow down input. I can type 082309
>> faster than I can ever do it with a date picker. The date class knows
>> I'm in America and since it's a six-digit date, it must be mmddyy. (Yes,
>> for those of you *not* in America, I agree our dates are goofy. I think
>> we all ought to be on the metic system, too, but America and the UK seem
>> intent on sticking to Imperial measure.)
>>
>> Paul
>>
>
>
> Paul:
>
> Yes, that's part of the problem. I was suggesting an exercise where people
> could put their collective heads together and create a php solution.
>
> I realize that US has DD, MM,  and the Euros have , MM, DD and
> others have other things (i.e., Year of the York).
>
> Not addressing the "other things" -- to me, if one uses a character for a
> month, then there's no problem in deciphering any entry regardless of
> format.
>
> For example, 2009 Aug 23, or Aug 23 2009, or Aug 2009 23, or 23 2009 Aug,
> -- they could all be entered in whatever order you want and deciphered
> correctly. The rules of course are:
>
> Year must be in thousands -- 1000-5000.
> Month must be a character -- D for December, May for May, Jun for June and
> so on.
> Day must be in ones or tens -- 1 or 09, or 31.
>
> It's certainly not a problem to write such code, I only suggested the
> exercise to get people to expound on the problems they encountered. Instead,
> I received "use javascript". Okay... but that's not a php solution, right?
>
> Cheers,
>
> tedd
>
> --
> ---
> http://sperling.com  http://ancientstones.com  http://earthstones.com
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
What would be really cool is if someone wrote a PHP script that generates
some Javascript code that could do this.

I mean while we're on the subject of complicating things ;)

-- 
Luke Slater
:O)

this text is protected by international copyright. it is illegal for
anybody apart from the recipient to keep a copy of this text.
dieser text wird von internationalem urheberrecht geschuetzt. allen
ausser dem/der empfaenger/-in ist untersagt, eine kopie dieses textes
zu behalten.


Re: [PHP] Another date exercise

2009-08-17 Thread Luke
2009/8/17 tedd 

> At 4:10 PM +0100 8/17/09, Luke wrote:
>
>> What would be really cool is if someone wrote a PHP script that generates
>> some Javascript code that could do this.
>>
>> I mean while we're on the subject of complicating things ;)
>>
>> --
>> Luke Slater
>> :O)
>>
>
> While writing/creating javascript from php can be done, that's not the
> problem.
>
> The problem is that the data provided from a javascript program that cannot
> be trusted. All data taken from javascript routines must be sanitized.
>
> So if you want to talk about complicating things, start accepting data from
> javascript routines without sanitizing and see how that works out for you.
>
>
> Cheers,
>
> tedd
>
> --
> ---
> http://sperling.com  http://ancientstones.com  http://earthstones.com
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
I didn't say anything about accepting unsanitized data now did I?

-- 
Luke Slater
:O)

this text is protected by international copyright. it is illegal for
anybody apart from the recipient to keep a copy of this text.
dieser text wird von internationalem urheberrecht geschuetzt. allen
ausser dem/der empfaenger/-in ist untersagt, eine kopie dieses textes
zu behalten.


Re: [PHP] Another date exercise

2009-08-17 Thread Luke
2009/8/17 Luke 

>
>
> 2009/8/17 tedd 
>
>> At 4:10 PM +0100 8/17/09, Luke wrote:
>>
>>  What would be really cool is if someone wrote a PHP script that generates
>>> some Javascript code that could do this.
>>>
>>> I mean while we're on the subject of complicating things ;)
>>>
>>> --
>>> Luke Slater
>>> :O)
>>>
>>
>> While writing/creating javascript from php can be done, that's not the
>> problem.
>>
>> The problem is that the data provided from a javascript program that
>> cannot be trusted. All data taken from javascript routines must be
>> sanitized.
>>
>> So if you want to talk about complicating things, start accepting data
>> from javascript routines without sanitizing and see how that works out for
>> you.
>>
>>
>> Cheers,
>>
>> tedd
>>
>> --
>> ---
>> http://sperling.com  http://ancientstones.com  http://earthstones.com
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
> I didn't say anything about accepting unsanitized data now did I?
>
>
> --
> Luke Slater
> :O)
>
> this text is protected by international copyright. it is illegal for
> anybody apart from the recipient to keep a copy of this text.
> dieser text wird von internationalem urheberrecht geschuetzt. allen
> ausser dem/der empfaenger/-in ist untersagt, eine kopie dieses textes
> zu behalten.
>

Sorry to annoy you Tedd,

I guess stage one would be something like

$date = $_GET['datestring'];
$exploded_date = explode(' ', $date);

foreach($exploded_date as $constituent)
{
if(preg_match('/^{1,31}$/', $constituent))
{
$sane_date["day"] = $constituent;
}
}

Then in the foreach loop would also be something that would check for months
and years, setting the constituent to $sane_date["month"] and
$sane_date["year"] respectively.

Something like that?

I would try it out but I'm at work ;)

-- 
Luke Slater
:O)

this text is protected by international copyright. it is illegal for
anybody apart from the recipient to keep a copy of this text.
dieser text wird von internationalem urheberrecht geschuetzt. allen
ausser dem/der empfaenger/-in ist untersagt, eine kopie dieses textes
zu behalten.


Re: [PHP] Another date exercise

2009-08-19 Thread Luke
2009/8/19 Shawn McKenzie 

> Shawn McKenzie wrote:
> > tedd wrote:
> >> At 3:40 PM +0530 8/17/09, kranthi wrote:
> >>> dont you think http://in3.php.net/strtotime is a solution to your
> >>> problem ?
> >> No, it's not a solution to my problem -- I have he problem solved.
> >>
> >> I was just asking if anyone wanted to submit their php solution. It was
> >> only an exercise.
> >>
> >> I know there are numerous javascript solutions (some good, some bad),
> >> but ALL of their data has to be accepted and scrubbed by a php script
> >> anyway, so I was suggesting creating a php script to do it.
> >>
> >> If it's not a good exercise, then don't do it.
> >
> > First stab at it.  Of course it needs US date ordering (month day year).
> >  You can't do euro type dates or any other format because there is no
> > way to tell the difference between 1/2/2009 (January) and 1/2/2009
> > (February):
> >
> >  >
> > $dates = array(
> > 'August 5, 2009',
> > 'Aug 05 2009',
> > 'Aug 5, 9',
> > '08/05/09',
> > '8-5-9',
> > '8 05 2009',
> > '8,5,9',);
> >
> > foreach($dates as $date) {
> > $date = preg_replace("#([\d])+[^/\d]+([\d]+)[^/\d]+([\d]+)#",
> > "$1/$2/$3", $date);
> > echo date("M j, Y", strtotime($date)) ."\n";
> > }
> >
> > ?>
> >
>
> Guess you didn't like this one?  Also, if you change the / to - in the
> preg_replace() it should work on Euro style dates.
>
> $date = preg_replace("#([\d])+[^-\d]+([\d]+)[^-\d]+([\d]+)#",
> "$1-$2-$3", $date);
>
> -Shawn
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
Perhaps you could detect the region of the user to pick which kind of date
to use

-- 
Luke Slater
:O)

this text is protected by international copyright. it is illegal for
anybody apart from the recipient to keep a copy of this text.
dieser text wird von internationalem urheberrecht geschuetzt. allen
ausser dem/der empfaenger/-in ist untersagt, eine kopie dieses textes
zu behalten.


Re: [PHP] unset( $anobject) does not invoce __destruct()

2009-08-24 Thread Luke
2009/8/24 Ralph Deffke 

> typing error sorry
>
> forget my last post
>
> is there a was to destroy an object if there is hold a reference somewhere?
>
> "Stuart"  wrote in message
> news:a5f019de0908240606x5fdca70bkb31dd32b072e5...@mail.gmail.com...
> > 2009/8/24 kranthi :
> > > unset($obj) always calls the __destruct() function of the class.
> > >
> > > in your case clearly you are missing something else. Probably
> > > unset($anobject) is not being called at all ?
> >
> > That's not entirely correct. PHP uses reference counting, so if
> > unsetting a variable did not cause the object to be destructed then
> > it's highly likely that there is another variable somewhere that is
> > holding a reference to that object.
> >
> > -Stuart
> >
> > --
> > http://stut.net/
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
Then I assume you would have to copy the object into another variable rather
than reference the one you are trying to destroy?

-- 
Luke Slater
:O)

this text is protected by international copyright. it is illegal for
anybody apart from the recipient to keep a copy of this text.
dieser text wird von internationalem urheberrecht geschuetzt. allen
ausser dem/der empfaenger/-in ist untersagt, eine kopie dieses textes
zu behalten.


Re: [PHP] IRC and English

2009-09-01 Thread Luke
2009/9/1 Martin Scotta 

> On Tue, Sep 1, 2009 at 9:44 AM, tedd  wrote:
>
> > At 9:06 PM -0400 8/31/09, Paul M Foster wrote:
> >
> >> I'm sorry, but is anyone else annoyed by people who attempt to use IRC
> >> jargon on mailing lists? For example, substituting "u" for "you". Oddly
> >> enough, I'm seeing this primarily in foreign language posters, not in
> >> native English speakers. It's often accompanied by English so broken I
> >> don't even bother trying to decypher it, and sometimes an *attitude*
> >> (after which, I blacklist the poster).
> >>
> >> Am I the only one? It's okay if I am. Just wondering.
> >>
> >> Paul
> >>
> >
> > Paul:
> >
> > u r not the only 1. I h8 that 2!
> >
> > l8er  :)
> >
> > tedd
> >
> > --
> > ---
> > http://sperling.com  http://ancientstones.com  http://earthstones.com
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
> Yo estoy de acuerdo en que respetar el idioma es importante, aunque claro,
> redactando sobre la computadora tiene ciertos "beneficios". Yo, por
> ejemplo,
> evito utilizar acentos.
>
> Entiendo que pueda molestarles el hecho de las comunes abreviaturas. Eso es
> lo malo del lenguaje. Es de todos y, al mismo tiempo, de nadie. Nadie puede
> cambiarlo individualmente, sólo se puede mutar a través de su uso por parte
> la población, éste va cambiando día a día.
>
> Lamentablemente, a mi modo de ver, los mas jóvenes son quienes incurren en
> este tipo de acciones, y no se reduce solamente al ingles, creo que este
> fenómeno se da tambien en otros lenguajes (supongo) impulsado por la
> deficiencia de los métodos de ingreso de texto de dispositivos moviles.
>
> ¿Por que utilizo el español? Después de todo hay una lista para ello.
> El mundo en internet esté en ingles y yo, como hispano-hablante debi pasar
> por un proceso de varios años para poder lograr entender, hablar y luego
> redactar en ingles. ¿pasaron ustedes por el mismo proceso para participar
> en
> esta lista?
>
> Aqui somos muchos, de diferentes paises y culturas, lo importante -a mi
> modo
> de ver- es la comunicación, no el medio o la forma. Con lo cual esta
> recriminación carece totalmente de sentido.
>
> Es realmente triste que en una lista de un lenguaje de "codigo abierto" que
> pregona la libre participación y el mutuo beneficio a través de "compartir
> conocimiento" se realize semejante acotación; aunque mucho mas triste es
> que
> una persona oficialmente perteneciente a dicha comunidad se sume a dicho
> reclamo.
>
> Please do not reply that It's a English based list.
> Or is it allowed  to discriminate here?
>
> As a non-english speaker I feel very uncomfortable with this thread.
>
> With the best intentions for the community, sincerely yours,
>
> Martin Scotta
> Spanish Speaker
>

I don't think we were implicating anyone in particular for this kind of
behaviour, Martin, I'm certainly not.

I'm a 'young person' myself (being 17) and do not under any circumstances
write in such a way purely because it's harder to understand.

To be honest, on this list it is mostly the foreign people that tend to use
'u' and such, is it discriminatory to state a fact?

-- 
Luke Slater
:O)

this text is protected by international copyright. it is illegal for
anybody apart from the recipient to keep a copy of this text.
dieser text wird von internationalem urheberrecht geschuetzt. allen
ausser dem/der empfaenger/-in ist untersagt, eine kopie dieses textes
zu behalten.


Re: [PHP] CodeWorks 09

2009-09-02 Thread Luke
2009/9/2 Peter Ford 

> Jim Lucas wrote:
> > Elizabeth Naramore wrote:
> >> Hey all,
> >> Just wanted to make sure you knew about php|architect's upcoming
> >> CodeWorks
> >> conference, coming to 7 cities in 14 days:
> >>
> >> - San Francisco, CA:  Sept 22-23
> >> - Los Angeles, CA:  Sept 24-25
> >> - Dallas, TX:  Sept 26-27
> >> - Atlanta, GA:  Sept 28-29
> >> - Miami, FL: Sept 30 - Oct 1
> >> - Washington, DC: Oct 2-3
> >> - New York, NY: Oct 4-5
> >>
> >> Each two-day event includes a day of *in-depth PHP tutorials* and a
> >> day of *PHP
> >> conference talks* arranged across three different tracks, all
> >> presented by
> >> the *best experts* in the business.
> >>
> >> Each event is limited to 300 attendees and prices increase the closer
> >> we get
> >> to each event. Get your tickets today before we run out or the price
> goes
> >> up!
> >>
> >> For more information and to register, you can go to
> http://cw.mtacon.com.
> >> Hope to see you there!
> >>
> >> -Elizabeth
> >>
> >
> > Is their anything like this in the Pacific NORTH WEST??
> >
> > Seattle or Portland Oregon area would be great!
> >
>
> Or even in the rest of the world - PHP is bigger than just the USA :)
>
> --
> Peter Ford  phone: 01580 89
> Developer   fax:   01580 893399
> Justcroft International Ltd., Staplehurst, Kent
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
What I would do for UK PHP events :-(

-- 
Luke Slater
:O)

this text is protected by international copyright. it is illegal for
anybody apart from the recipient to keep a copy of this text.
dieser text wird von internationalem urheberrecht geschuetzt. allen
ausser dem/der empfaenger/-in ist untersagt, eine kopie dieses textes
zu behalten.


Re: [PHP] CodeWorks 09

2009-09-03 Thread Luke
2009/9/2 Ben Dunlap 

> > What I would do for UK PHP events :-(
>
> Something like this perhaps?
>
> http://conference.phpnw.org.uk/phpnw09/
>
> Ben
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
Nice one, I might be able to get to that one :)

Thanks,

-- 
Luke Slater
:O)

this text is protected by international copyright. it is illegal for
anybody apart from the recipient to keep a copy of this text.
dieser text wird von internationalem urheberrecht geschuetzt. allen
ausser dem/der empfaenger/-in ist untersagt, eine kopie dieses textes
zu behalten.


Re: [PHP] php File upload

2008-08-07 Thread Luke
Tom's machine only has 1 GB of physical memory doesn't it? Could that be the
problem?

2008/8/7 Jim Lucas <[EMAIL PROTECTED]>

> Tom wrote:
>
>> Hi,
>>
>> on a linux system (Suese 10.2) with 1 GB memory its not possible to upload
>> via http a  1 Gb File. Thats no limit problem  on my php config. i can look
>> the mem stats when uploading and the growing tmp file. If the temp file has
>> 900 MB, Main Memory free is 0 and the script aborts and php deletes the tmp
>> file.
>>
>> Why don't php use swap memory ?
>>
>> Greets Tom
>>
>>
>>
> After reading this thread, I would like to add my thoughts.
>
> What Apache starts, it reads the PHP memory limits in to the running Apache
> process.  When you try and upload a file, it is a straight HTTP upload.  PHP
> plays no part in the actual upload, except for the upload limits set in
> place by the php settings found in the php.ini or other Apache config files.
>  Now, Apache actually handles the Upload.  Once the file has been received
> completely, Apache then passes the file and process running to PHP.
>
> I have never seen a case where Apache has stored the file on the file
> system.  In my past experience it has always held the file in memory,
> therefor limited to the max physical memory that was install, minus a little
> for other things.
>
> I have worked on Debian (potato|woody|sarge), Redhat 5.0 -> 9, Fedora 1 ->
> 7, OpenBSD 3.6->current, and older versions of NetBSD and FreeBSD.
>
> I have also frequented a number of friends installs and I have never seen
> uploads happen any other way.  Nor have I heard of uploads happening any
> other way.
>
> Just my 2cents :)
>
> --
> Jim Lucas
>
>   "Some men are born to greatness, some achieve greatness,
>   and some have greatness thrust upon them."
>
> Twelfth Night, Act II, Scene V
>by William Shakespeare
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
Luke Slater


Re: [PHP] php File upload

2008-08-08 Thread Luke
I think the sentiment is that you can't fit all of the file in the  
memory at once


Luke Slater

On 8 Aug 2008, at 07:59, Per Jessen <[EMAIL PROTECTED]> wrote:


Jim Lucas wrote:


What Apache starts, it reads the PHP memory limits in to the running
Apache process.  When you try and upload a file, it is a straight  
HTTP
upload.  PHP plays no part in the actual upload, except for the  
upload

limits set in place by the php settings found in the php.ini or other
Apache config files.


Correct.


Now, Apache actually handles the Upload.  Once the file has been
received completely, Apache then passes the file and process running
to PHP.


Also correct.


I have never seen a case where Apache has stored the file on the file
system. In my past experience it has always held the file in memory,
therefor limited to the max physical memory that was install, minus a
little for other things.


Well, I can easily show you such a case - I can upload a 1Gb file
without apache memory usage changing one bit.  Even if Apache did
upload into memory, why would that make the file limited to the max
amount of physical memory??

How about if I upload a 1Gb file to a webserver on a machine that only
has 256Mb memory - would you say that's impossible?


/Per Jessen, Zürich


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] php File upload

2008-08-08 Thread Luke
Maybe there is some configuration in the server somewhere causing it  
to incorrectly use the tmp?


Luke Slater

On 8 Aug 2008, at 08:48, Torsten Rosenberger <[EMAIL PROTECTED]>  
wrote:



Hello

on a linux system (Suese 10.2) with 1 GB memory its not possible to  
upload
via http a  1 Gb File. Thats no limit problem  on my php config. i  
can look
the mem stats when uploading and the growing tmp file. If the temp  
file has
900 MB, Main Memory free is 0 and the script aborts and php deletes  
the tmp

file.

Why don't php use swap memory ?

no need for swap

my system OpenSuSE 10.3 512MB RAM

my uploaded file
-rw-r--r-- 1 wwwrun www 10  8. Aug 09:39 mytestfile.out

memory befor upload and during upload are nearly the same
and no swap
total   used   free sharedbuffers
cached
Mem:510488 504728   5760  0  60728
301476
-/+ buffers/cache: 142524 367964
Swap:  2104432  287562075676

a du shows that the tmp file is greater as the memory

du -h /tmp/phpMmAGdN
659M/tmp/phpMmAGdN
and grows
du -h /tmp/phpMmAGdN
663M/tmp/phpMmAGdN


So i think your script is wrong
maybe you trie to read the hole contend from the upload file in a
variable so you reach the memory

post your script ro see if its is correct.

BR/Torsten


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: php File upload

2008-08-08 Thread Luke
You could always program in something (perhaps in Ajax) to monitor the  
progress of the file upload and check for errors periodically.


Luke Slater

On 8 Aug 2008, at 11:55, Peter Ford <[EMAIL PROTECTED]> wrote:


Per Jessen wrote:

Tom wrote:

Im very glad to fix this problem, but the next one is here: Other
machine (but 2 GB Ram), same suse version, same (working now)   
php.ini
with limits to 5000M now and i can't upload a File greater than  
900MB.

A file under 900MB i see the tmp file growing. A File with +1 GB no
temp file seeing at all and break after a view minutes. It's  
horrible

with no error codes and wasting pure of time :-(

The maximum size of an HTTP request is 2Gb. /Per Jessen, Zürich


Also bear in mind that the file is MIME encoded (so probably  
actually a base-64 stream or some such) and the actual size of the  
data sent in the request is therefore likely to be some fraction  
bigger than the file itself (like 33% bigger for base-64 encoding)



--
Peter Ford  phone: 01580 89
Developer   fax:   01580 893399
Justcroft International Ltd., Staplehurst, Kent

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] php File upload

2008-08-08 Thread Luke
Is a 1.9 gb file upload even sustainable on even a fairly small scale  
web application? Maybe you could implement FTP if you trust the people  
that want to upload the file.


Luke Slater
Lead Developer
NuVoo

On 9 Aug 2008, at 14:52, "Tom" <[EMAIL PROTECTED]> wrote:

Practical i  implement a robust filebase in my new gamer portal and  
go to
max. at upload values. If the users make a big upload, it should be  
stable.
I think, later (after release) i will enhance it with a ftp port.  
But not

yet.

Here you can see, what i have in filebase, but a 1.9 GB upload  
fails. I

don't know if this is the overhead.
http://www.guildmeets.de/index.php?onlydirid=78

(in Folder "Neue Game Demos")



"Per Jessen" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
news:[EMAIL PROTECTED]
Tom wrote:


Hi Per,

Execution Time ist set to 72000, i learned to set it not to low for
tests
:-)
I learned also the last days many things about the php.ini. Many
changes affect later, its mostly for me a trial and error thing and
results in much phenomenon.

At moment its okay, i can upload 1.2 Gb, no problem. I test to upload
a 1.9 GB file (reading the max is 2GB a browser can handle), but this
failes. I don't know is this the overhead or what else.


Well, it seems to me that you've achieved what you need, right?  You
don't need one big upload, you need many smaller but concurrent
uploads, yeah?
I'll try a bigger file later today and see what happens.


/Per Jessen, Zürich



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Why PHP4?

2008-08-08 Thread Luke

A friend works in a place where they use pascal as a database interface!

Luke Slater
Lead Developer
NuVoo

On 8 Aug 2008, at 16:25, V S Rawat <[EMAIL PROTECTED]> wrote:


On 8/8/2008 3:59 AM India Time, _Micah Gersten_ wrote:

You can't steal it, but you can't do anything with it either, so  
what's

the point of having it?


They are getting it printed and processing the printed hard copy  
further. That's all.


They even have full fledged working programs (say, in good old  
foxpro) to keep track of a clients work progress, next action date,  
reminders, track of payment from the clients, to the agents who get  
the work done, so on.


I mean it is a complete working system as it was in 80s.

--
V


Thank you,
Micah Gersten
onShore Networks
Internal Developer
http://www.onshore.com
V S Rawat wrote:

I was surprised to see some very busy and well to do Chartered
Accountants, Company Secretaries still using those 8086 pcs with
Wordstar and lotus that were there on mid 80s.

They say these are no more available so data in these pcs and these
formats are much more safer than that on a latest machine/ software.



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: PUT vs. POST (was: php File upload)

2008-08-09 Thread Luke

Except if paired with javadcript.

Luke Slater
Lead Developer
NuVoo

On 9 Aug 2008, at 15:09, Per Jessen <[EMAIL PROTECTED]> wrote:


Boyd, Todd M. wrote:

I had to use Java for the simple fact that PHP by itself cannot  
access

the local file system in a way that allows for the partial loading of
files.


Given that PHP doesn't run on the client, there is no way for anything
written in PHP to access anything on the client.


/Per Jessen, Zürich


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] If Column Exists

2008-08-17 Thread Luke
There is IF EXISTS for tables, is there the same thing for columns in the
table
like

IF EXISTS column IN TABLE table

? Just an idea

2008/8/13 VamVan <[EMAIL PROTECTED]>

> Interesting. Thanks guys!!
>
> On Wed, Aug 13, 2008 at 1:32 AM, Robin Vickery <[EMAIL PROTECTED]> wrote:
>
> > 2008/8/12 VamVan <[EMAIL PROTECTED]>:
> > > Hello,
> > >
> > > I am working on data migration for one mysql db to another using PHP.
> How
> > do
> > > I check if a particular table has a particular column. If not alter...
> > >
> > > Thanks
> > >
> >
> > Use the information_schema:
> >
> > SELECT COUNT(*) AS column_exists FROM information_schema.COLUMNS WHERE
> > TABLE_SCHEMA='db_name' AND TABLE_NAME='table_name' AND
> > COLUMN_NAME='column_name';
> >
> > -robin
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
>



-- 
Luke Slater


Re: [PHP] Re: SOAP - return a list of items

2008-08-17 Thread Luke
why use soap for this? I just use a javascript array for this kind of
thing...

2008/8/13 Dan Joseph <[EMAIL PROTECTED]>

> Maybe more info will help:
>
> Here is what I have so far for the WSDL...
>
>
>
>
>
>
>
>
>
>
>
>
> type="tns:ArrayOfgetQuoteHistoryResult" />
>
>
>
>
>
> name="getQuoteHistoryResult" nillable="true"
> type="tns:getQuoteHistoryResult" />
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> This validates fine in soapUI, and seems to work fine when the client
> connects to it.
>
> The piece from PHP:
>
>$count = 0;
>
>while ( $data = $this->dbconn->fetchrow( $res ) )
>{
>foreach ( $data as $key => $value )
>{
>$quotes[$count][$key] = $value;
>}
>
>$count++;
>}
>
> return $quotes;
>
> This is the soap response:
>
> http://schemas.xmlsoap.org/soap/encoding/"; xmlns:SOAP-ENV="
> http://schemas.xmlsoap.org/soap/envelope/"; xmlns:ns1="urn:ursquoteservice"
> xmlns:ns2="urn:ursquote" xmlns:xsd="http://www.w3.org/2001/XMLSchema";
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; xmlns:SOAP-ENC="
> http://schemas.xmlsoap.org/soap/encoding/";>
>   
>  
> 
>  
>   
> 
>
> It seems like I am just missing something somewhere.
>
> Anyone able to help?
>
> --
> -Dan Joseph
>
> www.canishosting.com - Plans start @ $1.99/month.
>
> "Build a man a fire, and he will be warm for the rest of the day.
> Light a man on fire, and will be warm for the rest of his life."
>



-- 
Luke Slater


Re: [PHP] php-gd problems on Ubuntu 8.04

2008-08-18 Thread Luke
Which gd package did you install? Php5-gd worked for me. Could be  
something like it trying to install a php4 module onto php5


Luke Slater
Lead Developer
NuVoo

On 18 Aug 2008, at 15:47, Chantal Rosmuller <[EMAIL PROTECTED]> wrote:


I did, but it doens't help

On Thursday 14 August 2008 18:58:57 Micah Gersten wrote:

Make sure  that your php.ini file for the cli is loading gd.

Thank you,
Micah Gersten
onShore Networks
Internal Developer
http://www.onshore.com

Chantal Rosmuller wrote:

Hi list,

I have a PHP problem on Ubuntu 8.04, the php-gd package for ubuntu
doesn't use the gd bundles library for security reasons if I  
understood

this correctly. I solved it by downloading a php-gd fedora rpm and
converting it to .deb with alien. it works for the apache websites  
but

not for the commandline. I get the follwoing error:


php /path/to/process.php variable1 variable2

Warning: Wrong parameter count for strpos() in /path/to/config.php  
on

line 30
JpGraph Error This PHP installation is not configured with the GD
library. Please recompile PHP with GD support to run JpGraph.  
(Neither

function imagetypes() nor imagecreatefromstring() does exist)ro

does anyone know how to fix this?

regards Chantal




--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: Sale 79% OFF !!!

2008-08-21 Thread Luke
Indeed. Hehe, i forgot about that film it's pretty good

2008/8/21 Colin Guthrie <[EMAIL PROTECTED]>

> Bastien Koert wrote:
>
>> I never cease to be amazed at the continuing stupidity of the human race.
>>
>
> There is a movie called "Idiocracy" that sums up the stupidity of the human
> race quite well it's a very funny movie if you're in the right mood,
> otherwise it's. well... stupid!
>
> Col
>
>
>
> --
>
> Colin Guthrie
> gmane(at)colin.guthr.ie
> http://colin.guthr.ie/
>
> Day Job:
>  Tribalogic Limited [http://www.tribalogic.net/]
> Open Source:
>  Mandriva Linux Contributor [http://www.mandriva.com/]
>  PulseAudio Hacker [http://www.pulseaudio.org/]
>  Trac Hacker [http://trac.edgewall.org/]
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
Luke Slater


Re: [PHP] Help and Advice needed please.

2008-08-23 Thread Luke
I'm up for helping too. Also, a big agree to Sean too, MySQL seems the best
way to go here.

2008/8/23 sean greenslade <[EMAIL PROTECTED]>

> I would be willing to help with this project. Because of all the different
> requirements of this, I would recommend a totally custom set of scripts,
> and
> a mysql database to hold all the data.
>
> On Sat, Aug 23, 2008 at 7:22 AM, Byron <[EMAIL PROTECTED]> wrote:
>
> > Hey.
> >
> > I do some part-time IT work for a voluntary paramilitary youth
> > organisation,
> > and we're loooking for a system to digitize the personell files of our
> > members. Here's a features list, all advice on how to implement will be a
> > great help.
> >
> > * Web-accesable via login
> > * Rank, Name, Phone Number, Address, Email Address, Physical Address.
> > * Training History
> > * Promotion History
> > * Miscellanous Notes.
> > * Different types of Administrator and notes that can be attached to
> > personell files that are seen by different types of administrator.
> > * Activity report page. I.e. This activity happenened on this date and
> > these
> > people attended from this time to this time. Attendance must be visible
> on
> > personell files.
> > * Attendance Register and counter for attendances of members.
> > * UI that a 65-year old who believes dialup is fast (the Unit Commander)
> > can
> > find his way around.
> > * Easily copiable and deployable. As in can be used by more than one
> unit.
> >
> > --
> > I'm going out to find myself, if you see me here, keep me here untill I
> can
> > catch up
> >
> > If I haven't said so already,
> >
> > Thanks
> > Byron
> >
>
>
>
> --
> Feh.
>



-- 
Luke Slater


[PHP] DNL by value

2008-08-26 Thread Luke
Hi everyone,

I was wondering if there is a way to create a dnl (or an array?) with all
the entries in an XML with a certain value in a certain tag in PHP DOM?

Thanks a lot.

Luke


Re: [PHP] Google Chrome

2008-09-02 Thread Luke
isn't the webkit based on KHTML?

2008/9/2 Stut <[EMAIL PROTECTED]>

> On 2 Sep 2008, at 12:34, Per Jessen wrote:
>
>> Richard Heyes wrote:
>>
>>> Hi,
>>>
>>> Looks like Google chrome is being released today (or soon). IE,
>>> Firefox, Opera, Safari and now Chrome, hmmm, can anyone say "browser
>>> war"?
>>>
>>>
>> Can anyone say "even more money & effort wasted on testing
>> webpages"  :-(
>>
>
> Webkit-based, so no need to add any more testing than you do now.
>
> -Stut
>
> --
> http://stut.net/
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
Luke Slater


Re: [PHP] Re: Google Chrome

2008-09-03 Thread Luke
yes but this would be the first time we see this kind of speed on a Windows
browser. Apple didn't pull it off too well.

2008/9/3 Colin Guthrie <[EMAIL PROTECTED]>

> Dan Joseph wrote:
>
>> Well its not that exciting I guess.  All the hype, and its a browser. :)
>>  It
>> is fast though, I'll give it that.
>>
>
> I think most of the kudos points for speed here are due to the WebKit team
> of KDE/Qt/Trolltech and Apple + others.
>
> Col
>
>
>
> --
>
> Colin Guthrie
> gmane(at)colin.guthr.ie
> http://colin.guthr.ie/
>
> Day Job:
>  Tribalogic Limited [http://www.tribalogic.net/]
> Open Source:
>  Mandriva Linux Contributor [http://www.mandriva.com/]
>  PulseAudio Hacker [http://www.pulseaudio.org/]
>  Trac Hacker [http://trac.edgewall.org/]
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
Luke Slater


Re: [PHP] CMS-Blog system

2008-09-03 Thread Luke
seperate databases is a hassle, since you have to mess with multiple
connections, I would go with the one database. Just cut down on data
storage, use userids instead of usernames for identification in the tables
and such.

2008/9/3 Martin Zvarík <[EMAIL PROTECTED]>

> Hi,
>
> I am working on CMS-Blog system, which will be using approx. 10 000 users.
>
> I have a basic question - I believe there are only two options - which one
> is better?
>
> 1) having separate databases for each blog = fast
> (problem: what if I will need to do search in all of the blogs for some
> article?)
>
> 2) having all blogs in one database - that might be 10 000 * 100 articles =
> too many rows, but easy to search and maintain, hmm?
>
> ---
>
> I am thinking of  having some file etc. "cms-core.php" in some base
> directory and every subdirectory (= users subdomains) would include this
> "cms-core" file with some individual settings. Is there better idea?
>
> I appreciate your discussion on this topic.
>
> Martin Zvarik
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
Luke Slater


Re: [PHP] Header() - POST

2008-09-05 Thread Luke
POST requests in Ajax (or without in js) is straight forward. On the  
iPod now but I'll POST an example later. Get it?


Luke Slater
Lead Developer
NuVoo

On 5 Sep 2008, at 18:14, mike <[EMAIL PROTECTED]> wrote:

On Fri, Sep 5, 2008 at 9:20 AM, Boyd, Todd M. <[EMAIL PROTECTED]>  
wrote:


On a side note... in the future, if you find that a particular  
process
calls for POSTing to a different page, the cURL library (which I  
believe
is now included with PHP by default in v5.x+) can accomplish a  
plethora

of wonderful stuff that would ordinarily be handled by a browser
(POSTing, basic HTTP authentication, SSL certs, etc.).


correct: curl is king for that

OP: sending POST to the browser doesn't do anything. POST is a
request, not a response.

if you want to re-post data you need to look at a client-side
alternative using javascript (or applets - flash, java, etc)

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: Interntet Explorer 8 beater 2

2008-09-11 Thread Luke
yeah, make an official no-support date. That would be great- it would help
with the whole IE6 problem.

It needs to be phased out, yet I know many companies that still haven't
upgraded to IE7 yet!

That's a big security problem as well as being a headache for all of us...

2008/9/11 Colin Guthrie <[EMAIL PROTECTED]>

> Ross McKay wrote:
>
>> Michael McGlothlin wrote:
>>
>> [...] I think web developers should look into a class action case against
>>> Microsoft for failing to make their browser standards compliant - it sure
>>> costs us a lot extra in development time. :p
>>>
>>
>> Let me know where the PayPal donate button is... DW & I are fed up with
>> having to find nasty kludges for IE6 every time we build a website!
>>
>
> I think by the changing shape of the web, all browsers should have a sunset
> date in there beyond which they do not operate (either that or open a nag
> screen on every page load that is impossible to turn off (other than with a
> low level hack/patch to the binary - or obviously just a comment/recompile
> in open source ones!)).
>
> It should be respected that browsers go out of date and beyond that time
> *noone* supports them, not their authors or the web developing public.
>
> Col
>
> --
>
> Colin Guthrie
> gmane(at)colin.guthr.ie
> http://colin.guthr.ie/
>
> Day Job:
>  Tribalogic Limited [http://www.tribalogic.net/]
> Open Source:
>  Mandriva Linux Contributor [http://www.mandriva.com/]
>  PulseAudio Hacker [http://www.pulseaudio.org/]
>  Trac Hacker [http://trac.edgewall.org/]
>
>
> --
>  PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
Luke Slater


Re: [PHP] Header() - POST

2008-09-11 Thread Luke
But surely you can post data with Javascript? Ach, at college now I can't
access my source, I forget how to do it exactly...

2008/9/11 mike <[EMAIL PROTECTED]>

> On Wed, Sep 10, 2008 at 3:42 PM, tedd <[EMAIL PROTECTED]> wrote:
>
> > Then use cURL as was suggested before.
>
> the reply was on his original attempt to header("POST: /foo") ... that was
> it.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
Luke Slater


Re: [PHP] switch case - to require the break statements seems strange to me

2008-09-12 Thread Luke
I wonder if this is a shared trait between C and PHP (since I understand PHP
is written in C) that the break; and the default: are placed for good
practice in all switch statements since they prevent memory leaks?

2008/9/10 Jochem Maas <[EMAIL PROTECTED]>

> tedd schreef:
>
> At 6:46 PM -0600 8/31/08, Govinda wrote:
>>
>>> Not that it is an issue, but just to understand the logic-
>>> Why do we have to use 'break' statements in each case?
>>>
>>> switch ($i) {
>>> case 0:
>>>echo "i equals 0";
>>>break;
>>> case 1:
>>>echo "i equals 1";
>>>break;
>>> case 2:
>>>echo "i equals 2";
>>>break;
>>> }
>>>
>>> all 3 cases fire, even though $i only equals ONE of those case values (if
>>> I said that right).
>>> I mean if $i==1, then in other languages I don't expect the first or last
>>> case to fire!  (?)
>>> Is the purpose just so one has the OPTION of letting them all fire, and
>>> turning that off with 'break'?
>>> Or is there a better reason?
>>>
>>> -G
>>>
>>
>>
>> The "break" is to separate each case (i.e., condition)
>>
>> The switch ($i) isn't even needed if you do it like this:
>>
>> switch (true)
>>   {
>>   case $i==0:
>>echo "i equals 0";
>>break;
>>
>>   case $i==1:
>>echo "i equals 1";
>>break;
>>
>>   case $i==2:
>>echo "i equals 2";
>>break;
>>   }
>>
>
> this is 'true' ;-) and works very well when you want to
> check disparate truths but there are caveats:
>
> 1. it's less performant IIRC
> 2. there is no type checking, so auto-casting occurs during the
> test of each case's expression
> 3. it will become even less performant ... someone clever sod has
> a patch that heavily optimizes 'simple' switch statements ... see
> the internal mailing list archives for details (I can't remember the
> details) ... I gather this patch will eventually make it into the core,
> if it hasn't already.
>
>
>> If you wanted to combine conditions, you could do this:
>>
>> switch (1)
>>   {
>>   case $i==-2:
>>   case $i==-1:
>>   case $i==0:
>>
>>echo "i is less than 0 but greater than -3 and is a counting number
>> (i.e., no fraction)";
>>break;
>>
>>   case $i==1:
>>echo "i equals 1";
>>break;
>>
>>   case $i==2:
>>echo "i equals 2";
>>break;
>>   }
>>
>>
>> Typed without checking and after my vacation.
>>
>> Cheers,
>>
>> tedd
>>
>>
>
> --
>  PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
Luke Slater


  1   2   3   >