[PHP] Sending e-mail via socket

2010-02-22 Thread Andre Polykanine
Hello everyone,
I've just subscribed to the list, and I already have a question.
what I need to do is to send mail using sockets. Actually, the
built-in Mail() function is great and I wouldn't have to search for
something else if I didn't need more than one message to be sent at a
time. Say, I have ten or a hundred of users who want to receive a
notification about new blog entries. If I use the mail() function in
the loop, it will be performed too slow since it constantly opens and
closes the door, I mean, the SMTP connection.
So I need an alternative.
And here's what I'm doing:

";
$connect = fsockopen ("smtp.yandex.ru", 25, $errno, $errstr, 30); 
if ($connect) {
$out="HELO localhost\r\n";
$out.="MAIL FROM: $from\n"; 
$out.="RCPT TO: $to\n";
$out.="DATA\r\n";
$out.="Content-Type: text/plain; charset=utf-8\n"; 
$out.="To: $to\n"; 
$out.="Subject: $subject\n"; 
$out.="\n\n"; 
$out.=$message." \r\n"; 
$out.=".\r\n"; 
$out.="RSET\r\n"; 
fwrite ($connect, $out);
fclose ($connect);
} else {
die ("Error: ".$errstr." ($errno)");
} 
}

socketmail ("arthae...@yandex.ru", "this is a socket mail test",
"Testing mail sending");
?>

And what I get is absolutely nothing. No errors, no warnings, no
message in the mailbox.
So three questions:
1. What's wrong with my script?
2. How to look where the error exactly is? Can't get server logs for
some reason (will talk to tech support probably).
3. How to do the same thing but with an ability to send multiple
messages without closing the connection after each message?

Thanks!

-- 
With best regards from Ukraine,
Andre
Http://oire.org/ - The Fantasy blogs of Oire
Skype: Francophile; Wlm&MSN: arthaelon @ yandex.ru; Jabber: arthaelon @ 
jabber.org
Yahoo! messenger: andre.polykanine; ICQ: 191749952
Twitter: http://twitter.com/m_elensule


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



Re[2]: [PHP] Sending e-mail via socket

2010-02-23 Thread Andre Polykanine
Hello Rene,

Can't do that since the message is personalized: I need to put in the
user name ("Hello $username") and some other data, so the BCC is not a
solution, unfortunately...
-- 
With best regards from Ukraine,
Andre
Skype: Francophile; Wlm&MSN: arthaelon @ yandex.ru; Jabber: arthaelon @ 
jabber.org
Yahoo! messenger: andre.polykanine; ICQ: 191749952
Twitter: m_elensule

- Original message -
From: Rene Veerman 
To: Andre Polykanine 
Date: Tuesday, February 23, 2010, 2:58:41 AM
Subject: [PHP] Sending e-mail via socket

have you tried mail() with a large bcc header?

On Tue, Feb 23, 2010 at 1:16 AM, Andre Polykanine  wrote:
> Hello everyone,
> I've just subscribed to the list, and I already have a question.
> what I need to do is to send mail using sockets. Actually, the
> built-in Mail() function is great and I wouldn't have to search for
> something else if I didn't need more than one message to be sent at a
> time. Say, I have ten or a hundred of users who want to receive a
> notification about new blog entries. If I use the mail() function in
> the loop, it will be performed too slow since it constantly opens and
> closes the door, I mean, the SMTP connection.
> So I need an alternative.
> And here's what I'm doing:
>
>  function socketmail($to, $subject, $message) {
> $from="Oire.org Administration ";
>    $connect = fsockopen ("smtp.yandex.ru", 25, $errno, $errstr, 30);
> if ($connect) {
> $out="HELO localhost\r\n";
> $out.="MAIL FROM: $from\n";
> $out.="RCPT TO: $to\n";
> $out.="DATA\r\n";
> $out.="Content-Type: text/plain; charset=utf-8\n";
> $out.="To: $to\n";
> $out.="Subject: $subject\n";
> $out.="\n\n";
> $out.=$message." \r\n";
> $out.=".\r\n";
> $out.="RSET\r\n";
> fwrite ($connect, $out);
> fclose ($connect);
> } else {
> die ("Error: ".$errstr." ($errno)");
> }
> }
>
> socketmail ("arthae...@yandex.ru", "this is a socket mail test",
> "Testing mail sending");
> ?>
>
> And what I get is absolutely nothing. No errors, no warnings, no
> message in the mailbox.
> So three questions:
> 1. What's wrong with my script?
> 2. How to look where the error exactly is? Can't get server logs for
> some reason (will talk to tech support probably).
> 3. How to do the same thing but with an ability to send multiple
> messages without closing the connection after each message?
>
> Thanks!
>
> --
> With best regards from Ukraine,
> Andre
> Http://oire.org/ - The Fantasy blogs of Oire
> Skype: Francophile; Wlm&MSN: arthaelon @ yandex.ru; Jabber: arthaelon @ 
> jabber.org
> Yahoo! messenger: andre.polykanine; ICQ: 191749952
> Twitter: http://twitter.com/m_elensule
>
>
> --
> 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 General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] XML functions

2010-03-06 Thread Andre Polykanine
Hello Ahmad and all,

  I will expand a little bit your question joining to it: what is
  the better technique to make an RSS feed on the website? The
  website is manually written, no CMS.
-- 
With best regards from Ukraine,
Andre
Skype: Francophile; Wlm&MSN: arthaelon @ yandex.ru; Jabber: arthaelon @ 
jabber.org
Yahoo! messenger: andre.polykanine; ICQ: 191749952
Twitter: m_elensule

- Original message -
From: Ahmad F AlTwaijiry 
To: php-general@lists.php.net 
Date: Saturday, March 6, 2010, 7:00:04 PM
Subject: [PHP] XML functions

Dears

When i checked the php manual i found many Solutions to read/write xml  
files and im confused now :)

Which function/library is better and is there any new article that  
compare each function/library?

Thanks

Ahmad AlTwaijiry
http://www.AlTwaijiry.com

-- 
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] EHLO error 554: what can it be?

2010-03-08 Thread Andre Polykanine
Hello everyone,

I'm writing a class to send mail via an SMTP server with authorization.
Everything seems to work but I get an EHLO error:
554 SMTP synchronization error
Where should I look to avoid this?
Thanks!

-- 
With best regards from Ukraine,
Andre
Http://oire.org/ - The Fantasy blogs of Oire
Skype: Francophile; Wlm&MSN: arthaelon @ yandex.ru; Jabber: arthaelon @ 
jabber.org
Yahoo! messenger: andre.polykanine; ICQ: 191749952
Twitter: http://twitter.com/m_elensule


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



Re[2]: [PHP] EHLO error 554: what can it be?

2010-03-09 Thread Andre Polykanine
Hello Kevin and all,

  Sorry Kevin, How do I do that? Excuse me if it's a stupid
  question...( the only way I know is to set the timeout on
  the fsockopen function (the fifth parameter). I set it even
  to 60 but no change...
Thanks a lot!

-- 
With best regards from Ukraine,
Andre
Skype: Francophile; Wlm&MSN: arthaelon @ yandex.ru; Jabber: arthaelon @ 
jabber.org
Yahoo! messenger: andre.polykanine; ICQ: 191749952
Twitter: m_elensule

- Original message -
From: Kevin Kinsey 
To: Andre Polykanine 
Date: Tuesday, March 9, 2010, 6:46:24 AM
Subject: [PHP] EHLO error 554: what can it be?

Andre Polykanine wrote:
> Hello everyone,
> 
> I'm writing a class to send mail via an SMTP server with authorization.
> Everything seems to work but I get an EHLO error:
> 554 SMTP synchronization error
> Where should I look to avoid this?
> Thanks!
> 


Be polite :-D

Make sure your class waits for the other server's greeting
before you send HELO/EHLO.  ;-)

HTH,

Kevin Kinsey


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



Re: [PHP] PHP Sessions

2010-03-12 Thread Andre Polykanine
Hello Martine,

Try to make on the second page a
print_r ($_SESSION);

-- 
With best regards from Ukraine,
Andre
Skype: Francophile; Wlm&MSN: arthaelon @ yandex.ru; Jabber: arthaelon @ 
jabber.org
Yahoo! messenger: andre.polykanine; ICQ: 191749952
Twitter: m_elensule

- Original message -
From: Martine Osias 
To: php-general@lists.php.net 
Date: Saturday, March 13, 2010, 2:29:41 AM
Subject: [PHP] PHP Sessions

Hi:

I need to store variables to send then between pages. I don't need the 
variables in a database so I try to send them with sessions. The variables 
don't seem to be there when I try to get them. What could be the problem. 
Here are the pages where I store and retrieve the variables.

Page 1 (variables stored):



Page 2 (variables retrieved):


http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
http://www.w3.org/1999/xhtml";>







 
 


 
 








-- 
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 Sessions

2010-03-13 Thread Andre Polykanine
Hello Martine,

As you have been already told, the  is not always supported.
However I'd suggest you to do the following (since I love this form of
tag):
 «»

 Note: I put within the tag only the variable.

-- 
With best regards from Ukraine,
Andre
Skype: Francophile; Wlm&MSN: arthaelon @ yandex.ru; Jabber: arthaelon @ 
jabber.org
Yahoo! messenger: andre.polykanine; ICQ: 191749952
Twitter: m_elensule

- Original message -
From: Martine Osias 
To: php-general@lists.php.net 
Date: Saturday, March 13, 2010, 4:33:34 AM
Subject: [PHP] Re: PHP Sessions

The sessions variables are OK. They don't print when I put them on the HTML 
page with this code.


 
 


 
 

Thank you.


Martine

""Martine Osias""  wrote in message 
news:95.0c.13686.c7cda...@pb1.pair.com...
> Hi:
>
> I need to store variables to send then between pages. I don't need the 
> variables in a database so I try to send them with sessions. The variables 
> don't seem to be there when I try to get them. What could be the problem. 
> Here are the pages where I store and retrieve the variables.
>
> Page 1 (variables stored):
>
> 
> session_start();
>
> $_SESSION['scripture_text']  = $row_scripture['ScriptureText'];
> $_SESSION['scripture_ref']  = $row_scripture['ScriptureRef'];
>
> ?>
>
> Page 2 (variables retrieved):
>
>  session_start();
> include("includes/config.php");
> ?>
>  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
> http://www.w3.org/1999/xhtml";>
> 
> 
> 
>
> 
>
> 
> 
> 
>
> 
>  align="right">
> 
>
> 
>
> 
> 
>
> 


-- 
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[2]: [PHP] Re: PHP Sessions

2010-03-13 Thread Andre Polykanine
Hello Ashley,

And if the site is full of that code?)) I think it's worth to learn
what's really the reason of the fact that it doesn't work. Besides
that, it's more readable for me.
And the right thing that was said here is the following: check the
php.ini settings and change them if possible.

-- 
With best regards from Ukraine,
Andre
Skype: Francophile; Wlm&MSN: arthaelon @ yandex.ru; Jabber: arthaelon @ 
jabber.org
Yahoo! messenger: andre.polykanine; ICQ: 191749952
Twitter: m_elensule

- Original message -
From: Ashley Sheridan 
To: Andre Polykanine 
Date: Saturday, March 13, 2010, 12:33:46 PM
Subject: [PHP] Re: PHP Sessions

On Sat, 2010-03-13 at 12:22 +0200, Andre Polykanine wrote:

> Hello Martine,
> 
> As you have been already told, the  is not always supported.
> However I'd suggest you to do the following (since I love this form of
> tag):
>  «»
> 
>  Note: I put within the tag only the variable.
> 
> -- 
> With best regards from Ukraine,
> Andre
> Skype: Francophile; Wlm&MSN: arthaelon @ yandex.ru; Jabber: arthaelon @ 
> jabber.org
> Yahoo! messenger: andre.polykanine; ICQ: 191749952
> Twitter: m_elensule
> 
> - Original message -
> From: Martine Osias 
> To: php-general@lists.php.net 
> Date: Saturday, March 13, 2010, 4:33:34 AM
> Subject: [PHP] Re: PHP Sessions
> 
> The sessions variables are OK. They don't print when I put them on the HTML 
> page with this code.
> 
> 
>  
>  
> 
> 
>   align="right">
>  
> 
> Thank you.
> 
> 
> Martine
> 
> ""Martine Osias""  wrote in message 
> news:95.0c.13686.c7cda...@pb1.pair.com...
> > Hi:
> >
> > I need to store variables to send then between pages. I don't need the 
> > variables in a database so I try to send them with sessions. The variables 
> > don't seem to be there when I try to get them. What could be the problem. 
> > Here are the pages where I store and retrieve the variables.
> >
> > Page 1 (variables stored):
> >
> >  >
> > session_start();
> >
> > $_SESSION['scripture_text']  = $row_scripture['ScriptureText'];
> > $_SESSION['scripture_ref']  = $row_scripture['ScriptureRef'];
> >
> > ?>
> >
> > Page 2 (variables retrieved):
> >
> >  > session_start();
> > include("includes/config.php");
> > ?>
> >  > "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
> > http://www.w3.org/1999/xhtml";>
> > 
> > 
> > 
> >
> > 
> >
> > 
> > 
> > 
> >
> > 
> >  > align="right">
> > 
> >
> > 
> >
> > 
> > 
> >
> > 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 


That's still using short tags. The time you save on typing is nothing
compared to the time you spend trying to figure out why your script
doesn't work since you moved servers, or copied it to your live server,
or why you are having trouble using XML...

Thanks,
Ash
http://www.ashleysheridan.co.uk




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



[PHP] bug tracking system

2010-03-28 Thread Andre Polykanine
Hello everyone,

Can you recommend a bug tracking system to be installed on the site?
Requirements: written in PHP (or maybe Perl); tickets system; e-mail
notifications.
-- 
With best regards from Ukraine,
Andre
Http://oire.org/ - The Fantasy blogs of Oire
Skype: Francophile; Wlm&MSN: arthaelon @ yandex.ru; Jabber: arthaelon @ 
jabber.org
Yahoo! messenger: andre.polykanine; ICQ: 191749952
Twitter: http://twitter.com/m_elensule


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



Re: [PHP] Re: Web Design

2010-03-28 Thread Andre Polykanine
Hello Nathan, Parham and all,

Actually, I confirm that you can code if
you're blind. Parham, you have probably
seen me on the other accessibility-related
lists, so no need to say that I'm blind
myself, too). I have a chance to have a
wife who is also a programmer and
designer, so we make our projects always
together and I don't bother myself with
the visual things.
By the way, I have looked at Mantis bugtracking system. It seems to me
rather accessible except of the visual CAPTCHA needed during the
signup process. Will think what to do: either to search for another
solution or to modify the code implementing a logical CAPTCHA
developed by ourselves).
Anyway, glad that there are people like you, Nathan, here around.

-- 
With best regards from Ukraine,
Andre
Skype: Francophile; Wlm&MSN: arthaelon @ yandex.ru; Jabber: arthaelon @ 
jabber.org
Yahoo! messenger: andre.polykanine; ICQ: 191749952
Twitter: m_elensule

- Original message -
From: Nathan Rixham 
To: Parham Doustdar 
Date: Sunday, March 28, 2010, 9:06:57 PM
Subject: [PHP] Re: Web Design

Hi Parham,

Long term, I would suggest viewing this as an ideal opportunity to move
to strictly back end PHP only; thus negating and skirting around the
visual issues; it is often more fun this way any way!

Jobs such as web service integrations; payment service provider
integrations and similar provide a broad scope and some enjoyable jobs.

Additionally, there are often many good bug fixing and optimisation jobs
that stay well clear of the visual side of output.

I'm sure many will be keen to work with you, I know that I for one do
not view your blindness as a disability when it comes to coding, and I'm
hoping that I'll have the chance to work with you next time a suitable
project arises.

Many Regards,

Nathan

Parham Doustdar wrote:
> Hello there,
> I am a blind, Iranian web developer. I have worked with PHP for about a 
> year, and have created websites for clients who, due to their close bonds 
> with me (E.G. as a friend, relative, etc) has been able to walk through 
> every step of the website design stages with me (E.G. placement of 
> navigation menu, footers, headers, content, etc). I considered myself a 
> beginner, stepping towards the stage marked "intermediate". Today, though, 
> my idea of where I stand made a jarring change.
> 
> I took a look at websites offering freelance jobs, namely 
> http://www.freelancer.com and http://www.project4hire.com. I saw instantly 
> that what a client expects of me is to just "get it right", meaning, don't 
> call them and ask where should everything be, what color it should be, etc, 
> etc. Realizing that I am far behind due to my blindness, and dismayed, I 
> contacted my other blind friends that have done web development. I have been 
> offered one solution that has always worked: find partner(s).
> 
> I thought long and hard on this, trying to find out a place I could reach to 
> other fellow web developers, and in the end of the day, I came up with the 
> PHP.general mailing list that has always helped me in the past.
> 
> So, in the end, here is my question. Is anyone willing to work with an 
> Iranian PHP developer that has experience with cooperative development 
> tools, enthusiasm towards groupwork, is a fast-learner (meaning is willing 
> to read documentations, ask questions, etc), and has good 
> writing/reading/speaking knowledge, and is completely blind? If so, would 
> you be kind as to email me off-list?
> 
> Thank you,
> Parham Doustdar
> 
> P.S.: Please, if this is off-topic, do not shout at me. I tried going to 
> http://news.php.net to find any rules regarding what is and isn't allowed on 
> the list, but found none. This is of course my shortcoming, but I prefer 
> being contacted off-list, rather than being bombarded by messages that read, 
> "read the rules" or "just fucking google it"; believe me, I have tried.
> Thank you once again, and sorry for the long email. 
> 
> 


-- 
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] Still searching for a bugtracking system

2010-03-30 Thread Andre Polykanine
Hello everyone,
The best of all suggested bugtrackers is JotBug, on my opinion. But it
works only with SQLite databases, and I have no access to such one
(only MySql).
Any solutions?
P.S. I'd use Trac, but since I have no own server yet, we have no
access to Python, either... Only Php, MySql, Perl.
I have looked at Bugzilla... seems to heavy for our service).

-- 
With best regards from Ukraine,
Andre
Http://oire.org/ - The Fantasy blogs of Oire
Skype: Francophile; Wlm&MSN: arthaelon @ yandex.ru; Jabber: arthaelon @ 
jabber.org
Yahoo! messenger: andre.polykanine; ICQ: 191749952
Twitter: http://twitter.com/m_elensule


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



[PHP] How to redefine a function if it doesn't exist?

2010-03-30 Thread Andre Polykanine
Hello everyone,
Sorry, I've forgotten how to do this...
I need a quoted_printable_encode function but it's available only
since PHP 5.3. How do I redefine that function only if PHP version is
lower than 5.3?
Would it be valid:
function quoted_printable_encode ($str) {
$x=quoted_printable_encode ($str);
if (!isset($x)) {
// blah blah, alternative code
} else {
return $x;
}
}
Is it valid code or not?)
 Thanks!


-- 
With best regards from Ukraine,
Andre
Http://oire.org/ - The Fantasy blogs of Oire
Skype: Francophile; Wlm&MSN: arthaelon @ yandex.ru; Jabber: arthaelon @ 
jabber.org
Yahoo! messenger: andre.polykanine; ICQ: 191749952
Twitter: http://twitter.com/m_elensule


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



Re[2]: [PHP] Still searching for a bugtracking system

2010-03-30 Thread Andre Polykanine
Hello Jan,

And what do you use then?)

-- 
With best regards from Ukraine,
Andre
Skype: Francophile; Wlm&MSN: arthaelon @ yandex.ru; Jabber: arthaelon @ 
jabber.org
Yahoo! messenger: andre.polykanine; ICQ: 191749952
Twitter: m_elensule

- Original message -
From: Jan G.B. 
To: Alex Major 
Date: Tuesday, March 30, 2010, 6:04:20 PM
Subject: [PHP] Still searching for a bugtracking system

2010/3/30 Alex Major 
>
> Surely if it's not suitable for your situation, it's not the best? :)
>
> Mantis is what I'd recommend and believe has already been recommend to you.
> Runs using PHP and MySQL, it's flexible for public or private projects,
> multiple projects etc.
>
> I do agree with you that Bugzilla seems heavy, I know it has its supporters
> but I've always found it to be overkill for the projects I've worked on.
>
> Alex.
>
> -Original Message-
> From: Andre Polykanine [mailto:an...@oire.org]
> Sent: 30 March 2010 14:14
> To: php-general@lists.php.net
> Subject: [PHP] Still searching for a bugtracking system
>
> Hello everyone,
> The best of all suggested bugtrackers is JotBug, on my opinion. But it
> works only with SQLite databases, and I have no access to such one
> (only MySql).
> Any solutions?
> P.S. I'd use Trac, but since I have no own server yet, we have no
> access to Python, either... Only Php, MySql, Perl.
> I have looked at Bugzilla... seems to heavy for our service).
>
> -

Well. I'm not a fan of mantis. Mantis has some annoying bugs and the
codebase seems weird.
It basically works, but that is all about it.


I quote http://sqlite.org/about.html :

> SQLite is a software library that implements 
>a self-contained,serverless, zero-configuration, transactional SQL database 
>engine.
...
> Unlike most other SQL databases, SQLite does not have a separate server 
> process. SQLite reads and writes directly to ordinary disk files. A complete 
> SQL database with multiple tables, indices, triggers, and views, is contained 
> in a single disk file.

So you don't need "access" to such a database.


Regards

--
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] MySQL query not working!

2010-03-31 Thread Andre Polykanine
Hello Parham,

Adding to Ash's question, why to use the @ operator before
mysql_query?
-- 
With best regards from Ukraine,
Andre
Skype: Francophile; Wlm&MSN: arthaelon @ yandex.ru; Jabber: arthaelon @ 
jabber.org
Yahoo! messenger: andre.polykanine; ICQ: 191749952
Twitter: m_elensule

- Original message -
From: Parham Doustdar 
To: php-general@lists.php.net 
Date: Wednesday, March 31, 2010, 2:50:07 PM
Subject: [PHP] MySQL query not working!

Hi there,
Here is a snippet of code... that doesn't work for some reason. Please note 
that I have put some

@mysql_query($query) or die(mysql_error());

statements, to see if MySQL gives an error. I receive nothing other than the 
file starting to download. This is supposed to be a file download counter:

[code]
http://www.qwitter-client.net/' . $_GET['file']);
}
else //it's the first time we're adding this file to the DB.
{
$query = "insert into " . $table . " (filename, hits) values ('" . 
$_GET['file'] . "', 1)";
@mysql_query($query) or die(mysql_error());
header('location:http://www.qwitter-client.net/' . $_GET['file']);
}
?> 



-- 
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[2]: [PHP] MySQL query not working!

2010-03-31 Thread Andre Polykanine
Hello Parham,

I know what the @ operator does (it stops PHP from reporting errors
and makes it ignore error_reporting() or any INI directives) but I
don't understand why to use it here, with mysql_query() function.
-- 
With best regards from Ukraine,
Andre
Skype: Francophile; Wlm&MSN: arthaelon @ yandex.ru; Jabber: arthaelon @ 
jabber.org
Yahoo! messenger: andre.polykanine; ICQ: 191749952
Twitter: m_elensule

- Original message -
From: Parham Doustdar 
To: Andre Polykanine 
Date: Wednesday, March 31, 2010, 3:20:54 PM
Subject: [PHP] MySQL query not working!

Andre,
The @ operator is used for error catching statements. When you put:

@mysql_connect('localhost', 'username', 'password') or die('Could not 
connect.');

If PHP fails to make a connection, the script execution is stopped, and the 
error message between the apostrophes is given.

And, I found out what the problem was; I should have put:

if (mysql_num_rows($result))

rather than just

if ($result)

Thanks!
- Original Message - 
From: "Andre Polykanine" 
To: "Parham Doustdar" 
Cc: 
Sent: Wednesday, March 31, 2010 4:41 PM
Subject: Re: [PHP] MySQL query not working!


> Hello Parham,
>
> Adding to Ash's question, why to use the @ operator before
> mysql_query?
> -- 
> With best regards from Ukraine,
> Andre
> Skype: Francophile; Wlm&MSN: arthaelon @ yandex.ru; Jabber: arthaelon @ 
> jabber.org
> Yahoo! messenger: andre.polykanine; ICQ: 191749952
> Twitter: m_elensule
>
> - Original message -
> From: Parham Doustdar 
> To: php-general@lists.php.net 
> Date: Wednesday, March 31, 2010, 2:50:07 PM
> Subject: [PHP] MySQL query not working!
>
> Hi there,
> Here is a snippet of code... that doesn't work for some reason. Please 
> note
> that I have put some
>
> @mysql_query($query) or die(mysql_error());
>
> statements, to see if MySQL gives an error. I receive nothing other than 
> the
> file starting to download. This is supposed to be a file download counter:
>
> [code]
>  //connect to the DB
> mysql_connect() //There is no problem with the connection so I didn't
> include the complete code.
>
> //The table where the hits are stored.
> $table = "files";
>
> $query = "select * from " . $table . " where filename = '" . $_GET['file'] 
> .
> "'";
> $result = mysql_query($query);
>
> if ($result) //Has the file previously been added?
> {
> $query = "update " . $table . " set hits = hits + 1 where filename = '" .
> $_GET['file'] . "'";
> @mysql_query($query) or die(mysql_error());
> header('location:http://www.qwitter-client.net/' . $_GET['file']);
> }
> else //it's the first time we're adding this file to the DB.
> {
> $query = "insert into " . $table . " (filename, hits) values ('" .
> $_GET['file'] . "', 1)";
> @mysql_query($query) or die(mysql_error());
> header('location:http://www.qwitter-client.net/' . $_GET['file']);
> }
> ?>
>
>
>
> -- 
> 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[2]: [PHP] Still searching for a bugtracking system

2010-03-31 Thread Andre Polykanine
Hello Jorge,

Hm... that seems quite fine) If I don't manage to deal with JotBug,
will try Flyspray, thanks!
-- 
With best regards from Ukraine,
Andre
Skype: Francophile; Wlm&MSN: arthaelon @ yandex.ru; Jabber: arthaelon @ 
jabber.org
Yahoo! messenger: andre.polykanine; ICQ: 191749952
Twitter: m_elensule

- Original message -
From: Jorge Gomes 
To: Shawn McKenzie 
Date: Tuesday, March 30, 2010, 10:50:08 PM
Subject: [PHP] Still searching for a bugtracking system

What about flyspray?

http://flyspray.org/

Demo: http://flyspray.org/demo

They use it for tracking the bugs of their software (obviously):
http://bugs.flyspray.org/

They have bad documentation but I tested the software and seems to be fine.
They are slowly working in the final 1.0 version.

Rewards
___
Jorge Gomes


2010/3/30 Shawn McKenzie 

> Andre Polykanine wrote:
> > Hello Jan,
> >
> > And what do you use then?)
> >
> If you're able to, you enable the sqllite extension in your php.ini and
> then you create your database as a flat file.  The installer for the bug
> tracker would probably do that for you.
>
> --
> Thanks!
> -Shawn
> http://www.spidean.com
>
> --
> 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] convert a string into an array

2010-04-02 Thread Andre Polykanine
Hello everyone,

It's quite simple but I'm still stuck.
What I need is the following: I have an array as a parameter of my
custom function. However, I'd like to allow users to enter a string
instead of an array. In this case (if the parameter is a string), it
must be replaced with an array containing only one item - actually,
that string.
What I'm doing gives me (presumably) errors;
function Send ($tonames, $toemails, $subject, $message) {
...
if ((!is_array($tonames)) || (!is_array($toemails))) {
$tonames[]=$tonames;
$toemails[]=$toemails;
}

I can't give the new array a new name since I address it further in a
loop as my function's parameter... hope you understand what I'm
saying)
Thanks!

-- 
With best regards from Ukraine,
Andre
Http://oire.org/ - The Fantasy blogs of Oire
Skype: Francophile; Wlm&MSN: arthaelon @ yandex.ru; Jabber: arthaelon @ 
jabber.org
Yahoo! messenger: andre.polykanine; ICQ: 191749952
Twitter: http://twitter.com/m_elensule


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



Re: [PHP] About the php mail function and imap_mail function

2010-04-04 Thread Andre Polykanine
Hello ttplayer,

If GMail does allow sending through socket, wait a bit, I'll upload a
class written on my own for sending mail through a custom SMTP via
socket.
-- 
With best regards from Ukraine,
Andre
Skype: Francophile; Wlm&MSN: arthaelon @ yandex.ru; Jabber: arthaelon @ 
jabber.org
Yahoo! messenger: andre.polykanine; ICQ: 191749952
Twitter: m_elensule

- Original message -
From: ttplayer 
To: php-general 
Date: Sunday, April 4, 2010, 3:28:33 PM
Subject: [PHP] About the php mail function and imap_mail function

Hi, everyone!
 I have a problem about the php mail function and imap_mail function.
 When I use the mail or imap_mail function to send a email, the php script 
sends the email through the local mail sever with sendmail or another MTA 
supported. However, I have a gmail account. I just want the php script to send 
emails via my gmail account. How can I do it?
 Thank you.


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



[PHP] Who uses Mantis, please help!

2010-04-07 Thread Andre Polykanine
Hello everyone,
I decided to use Mantis before I'll be able to use something like Trac
:-).
The problem is: I'm not getting mail about issues reported by my
testers, only by myself. The preferences are set correctly (all the
checkboxes are checked).
Could you help me please?
Thanks!


-- 
With best regards from Ukraine,
Andre
Http://oire.org/ - The Fantasy blogs of Oire
Skype: Francophile; Wlm&MSN: arthaelon @ yandex.ru; Jabber: arthaelon @ 
jabber.org
Yahoo! messenger: andre.polykanine; ICQ: 191749952
Twitter: http://twitter.com/m_elensule


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



Re: [PHP] contant /

2010-04-08 Thread Andre Polykanine
Hello Jack,

I have tons of errors like this and now I'm eliminating them, so I'll
tell what to do:
1. Put apostrophes (single quotes) around the array item:
$auth['company_name'] instead of $auth[company_name];
2. (Just a suggestion) It's better to put the SQL tables and
fields between grave accents (backquotes).

-- 
With best regards from Ukraine,
Andre
Skype: Francophile; Wlm&MSN: arthaelon @ yandex.ru; Jabber: arthaelon @ 
jabber.org
Yahoo! messenger: andre.polykanine; ICQ: 191749952
Twitter: m_elensule

- Original message -
From: Jack 
To: php-general@lists.php.net 
Date: Thursday, April 8, 2010, 7:26:56 PM
Subject: [PHP] contant /

I get a couple of errors like this one for undefined variable:

PHP Notice:  Undefined variable: s_company_name

And this one for undefined contstant

PHP Notice:  Use of undefined constant account_type - assumed 'account_type'

 

I am putting a piece of code from each so that hopefully someone can explain
what I need to do to correct this, I know it still runs OK, but want to
eliminate error/warnings as much as possible.

 

 

CONSTANT CODE:

if($_POST) {

 

 

   if($username && $password)

  {

  f_db_open();

  $q = mysql_query("SELECT * FROM uas_users WHERE
user_email='$username'");

  $auth = mysql_fetch_array($q);

 

  if($auth['user_password'] == $password && $auth['user_email'] ==
$username && $auth['account_status'] == "Approved")

 {

 

 

 $type = $auth['account_type'];

 

   mysql_query("INSERT INTO logon_log (user, date, time)
VALUES ('$username', NOW(), NOW())");

 

 
f_put_cookie($auth[user_name],$auth[user_email],$auth[account_type],$auth[co
mpany_name]);

 

 

VARIABLE CODE:

function f_option_menu($status_message ) {

global $s_url, $s_logo, $s_logo_h, $s_logo_w;

 

echo "



  



  

  ".$s_company_name."
".$status_message."

 

 

THANKS

 

 

 

Thanks!

Jack

 



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



Re: [PHP] No notices for undefined index

2010-04-08 Thread Andre Polykanine
Hello Shawn,

Hm... isn't it expected behavior? Since you haven't defined a
$a['test'] item, PHP throws a notice... or I'm wrong?
-- 
With best regards from Ukraine,
Andre
Skype: Francophile; Wlm&MSN: arthaelon @ yandex.ru; Jabber: arthaelon @ 
jabber.org
Yahoo! messenger: andre.polykanine; ICQ: 191749952
Twitter: m_elensule

- Original message -
From: Shawn McKenzie 
To: php-general@lists.php.net 
Date: Thursday, April 8, 2010, 8:36:21 PM
Subject: [PHP] No notices for undefined index

So the first two print statements generate NO notices, while the second
obviously generates:

Notice: Undefined offset:  1 in /home/shawn/www/test.php on line 11

Notice: Undefined index:  test in /home/shawn/www/test.php on line 12

This sucks.  A bug???

error_reporting(E_ALL);
ini_set('display_errors', '1');


$a = 5;
print $a[1];
print $a['test'];

$a = array();
print $a[1];
print $a['test'];

-- 
Thanks!
-Shawn
http://www.spidean.com

-- 
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] Sending e-mail through an SMTP with authentification

2010-04-09 Thread Andre Polykanine
Hello everyone,
Sorry, don't remember who exactly needed this functionality. My class
is finally ready and approved by the site admins)
http://www.phpclasses.org/package/6128

-- 
With best regards from Ukraine,
Andre
Http://oire.org/ - The Fantasy blogs of Oire
Skype: Francophile; Wlm&MSN: arthaelon @ yandex.ru; Jabber: arthaelon @ 
jabber.org
Yahoo! messenger: andre.polykanine; ICQ: 191749952
Twitter: http://twitter.com/m_elensule


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



[PHP] How to do i18n better?

2010-04-18 Thread Andre Polykanine
Hi everyone,

I posted this in the PHP-i18n list, however got no answer so trying
here).
We are making a blog platform (http://oire.org/) which is provided in
several languages (currently they are Russian, Ukrainian, and
English).
Now the i18n process is made as follows: we set a cookie on the site
and depending on it we select the language to display the site in. We
have three (currently) interface files: rus.lng, ukr.lng, and enu.lng
(for English US). the format is the following:
define ("MSG379", "Welcome!");
etc. I know that PHP does support somehow exporting the strings into a
.pod file. Maybe it would be better to do that? If so, how can I do
it?
Could you suggest me maybe a better solution than we currently have?
Thanks a lot!

-- 
With best regards from Ukraine,
Andre
http://oire.org/ - The Fantasy blogs of Oire
Skype: Francophile; Wlm&MSN: arthaelon @ yandex.ru; Jabber: arthaelon @ 
jabber.org
Twitter: http://twitter.com/m_elensule


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



Re[2]: [PHP] How to do i18n better?

2010-04-19 Thread Andre Polykanine
Hello Peter,

Regarding the URL switching suggested by you and Michiel, how do I do
this if I have a rather complicated .htaccess file? For instance, a
blog entry URL is formed as follows:
http://oire.org/menelion/entry/190/ which is phisically
http://oire.org/oire.php?o=menelion&e=190
If I need to insert the locale somewhere inhere, sorry, I just don't
know how to do that)
-- 
With best regards from Ukraine,
Andre
Skype: Francophile; Wlm&MSN: arthaelon @ yandex.ru; Jabber: arthaelon @ 
jabber.org
Yahoo! messenger: andre.polykanine; ICQ: 191749952
Twitter: m_elensule

- Original message -
From: Peter Lind 
To: Andre Polykanine 
Date: Monday, April 19, 2010, 11:10:59 AM
Subject: [PHP] How to do i18n better?

Consider checking out http://php.net/gettext - it's the set of
functions in PHP for i18n.

With regards to language switching, you should consider using a url
hierarchy for it, instead of just serving all pages with changing
content.

Regards
Peter

-- 

WWW: http://plphp.dk / http://plind.dk
LinkedIn: http://www.linkedin.com/in/plind
Flickr: http://www.flickr.com/photos/fake51
BeWelcome: Fake51
Couchsurfing: Fake51



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



Re[2]: [PHP] How to do i18n better?

2010-04-20 Thread Andre Polykanine
Hi Ash,

Yepp, it's understood. But how exactly did you store the
language-specific strings: in an array or using another way?


-- 
With best regards from Ukraine,
Andre
Skype: Francophile; Wlm&MSN: arthaelon @ yandex.ru; Jabber: arthaelon @ 
jabber.org
Yahoo! messenger: andre.polykanine; ICQ: 191749952
Twitter: m_elensule

- Original message -
From: Ashley Sheridan 
To: Jason Pruim 
Date: Tuesday, April 20, 2010, 2:17:47 AM
Subject: [PHP] How to do i18n better?

On Mon, 2010-04-19 at 19:17 -0400, Jason Pruim wrote:

> On Apr 18, 2010, at 6:55 PM, Andre Polykanine wrote:
> 
> > Hi everyone,
> >
> > I posted this in the PHP-i18n list, however got no answer so trying
> > here).
> > We are making a blog platform (http://oire.org/) which is provided in
> > several languages (currently they are Russian, Ukrainian, and
> > English).
> > Now the i18n process is made as follows: we set a cookie on the site
> > and depending on it we select the language to display the site in. We
> > have three (currently) interface files: rus.lng, ukr.lng, and enu.lng
> > (for English US). the format is the following:
> > define ("MSG379", "Welcome!");
> > etc. I know that PHP does support somehow exporting the strings into a
> > .pod file. Maybe it would be better to do that? If so, how can I do
> > it?
> > Could you suggest me maybe a better solution than we currently have?
> > Thanks a lot!
> 
> I've never actually had to do this... But one idea that I came up with  
> is using the browser language in taking a best guess at what language  
> to display... In other words, if the user's browser language is set to  
> Chinese, you can be fairly certain they read Chinese :)
> 
> And now that I typed that out, I realize that may not be what you are  
> really looking for...  And that's when we get into the part where I  
> can't help alot because I've never had to do it :)
> 
> So good luck! :)
> 
> 
> 
> 


That's the check I did on the last site i worked on (vicestyle.com) The
user agent string is checked for a language and the site uses that. If
none is found (bearing in mind that there's no hard and fast rule about
what can go into a UA string) then it defaults to English.

Links within the site itself allow the user to change their language
afterwards, and you could store that in a cookie to it remembers their
choice.

Thanks,
Ash
http://www.ashleysheridan.co.uk




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



Re[2]: [PHP] replying to list

2010-04-21 Thread Andre Polykanine
Hello David,

I agree with you, David. I'm subscribed to twenty mailing lists or so,
and it's the only one that is set in a such weird way. I have a
template that works if replying to the list, but here it obviously
doesn't work.
-- 
With best regards from Ukraine,
Andre
Skype: Francophile; Wlm&MSN: arthaelon @ yandex.ru; Jabber: arthaelon @ 
jabber.org
Yahoo! messenger: andre.polykanine; ICQ: 191749952
Twitter: m_elensule

- Original message -
From: David McGlone 
To: Michiel Sikma 
Date: Wednesday, April 21, 2010, 1:33:34 PM
Subject: [PHP] replying to list

On Wed, 2010-04-21 at 11:34 +0200, Michiel Sikma wrote:
> On 21 April 2010 11:23, David McGlone  wrote:
> 
> >
> > Why is the list set up to reply to the OP and not the list?
> >
> > --
> > Blessings,
> > David M.
> >
> >
> Is it? I didn't notice. I just use "reply to all" which puts the list in the
> CC, and that works just fine for me.

reply to all works, but then we end up with 2 messages, and if you have
your mail client set up to filter mail into folders, then each message
ends up in 2 different places.

I've replied to several posts on the list, and I forget that the reply
button only replies to the OP and my posts don't make it to the list
unless I send them again.
-- 
Blessings,
David M.


-- 
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] Security/Development Question

2010-04-28 Thread Andre Polykanine
Hello David,

I'm not a PHP god but I would never ever do such things.I can't even
imagine what can be the reason of passing an SQL query through a
form...
-- 
With best regards from Ukraine,
Andre
Skype: Francophile; Wlm&MSN: arthaelon @ yandex.ru; Jabber: arthaelon @ 
jabber.org
Yahoo! messenger: andre.polykanine; ICQ: 191749952
Twitter: m_elensule

- Original message -
From: David Stoltz 
To: php-general@lists.php.net 
Date: Wednesday, April 28, 2010, 11:54:56 PM
Subject: [PHP] Security/Development Question

Hi folks,

 

This isn't really a PHP question per se, but could apply to any
language...

 

I have a public facing web server, which we have a software component
that helps protect us from SQL Injection, and the like.

 

We recently have added a very small web application that is vendor
supported. They said it's not working, so I investigated. I found that
our software protection was blocking their pages because they are
actually passing entire SQL queries in their form POSTs. Now, the app is
SSL protected, and they claim the queries are not executed - only
inserted into the database to be used later. They also said it's
protected by the ASP.NET framework authenticationnot sure about any
of that.

 

My concern is passing SQL queries in this way is not best practice - am
I wrong? Please let me know how you would react to this?

 

See below for the stuff they are passing in the POST (obvious things
like table names have been changed):

 

/wEWBQLciq6UBwLEhISFCwLa2223bD3wK3+56LBAKc37iSDEsHMFjpB6o1vHld19wT+Tt3sY
8E&CRITICAL_RESULT&on&Declare @critical varchar (40)

set @critical = (select top 1 code from table where id = 'clr7' and
thename = 'critical')

 

sELECT 

 OPR_SECD.REC USER_REC_NO,

 RESULT.*, 

 (SELECT RESULT_DESC FROM table WHERE code = RESULT.RES_MSTR_CODE)
[DESC], 

 [ORDER].*, 

 (SELECT VALUE FROM table WHERE this_CODE = 'Email' AND USER_REC =
OPR_SECD.RECNUM) MBMD_EMAIL, 

 OPR_SECD.OPR_INITIAL 

 FROM RESULTING LEFT JOIN [ORDER] ON RESULTING.ORDER_REC =
[ORDERBY].RECNUM 

 LEFT JOIN OPR_SECD ON [ORDER].DR_CODE = OPR_SECD.XREF_CODE 

 where (RESULT.FLAG_TEXT) = @critical  AND RESULT.REC = @ID&Save



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



Re: [PHP] How to Force IE to download text file?

2010-04-30 Thread Andre Polykanine
Hello Ali,

It's attachment, not attachement. Maybe here's the reason? Just a
thought.
-- 
With best regards from Ukraine,
Andre
Skype: Francophile; Wlm&MSN: arthaelon @ yandex.ru; Jabber: arthaelon @ 
jabber.org
Yahoo! messenger: andre.polykanine; ICQ: 191749952
Twitter: m_elensule

- Original message -
From: Ali Asghar Toraby Parizy 
To: php-general@lists.php.net 
Date: Friday, April 30, 2010, 7:19:38 PM
Subject: [PHP] How to Force IE to download text file?

I have written this code to export data to a text file and asks user
to save generated file. It works with Firefox perfectly, but IE shows
content of file instead of prompting the download window.
How can I force IE to show the download dialog?



-- 
Ali Asghar Torabi

-- 
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] A stupid question about classes

2010-05-01 Thread Andre Polykanine
Hello everyone,
Just a basic question.
I have my class starting like this:

Class OireMail {
// these are required
public $smtp_server="";
public $domain="";
public $from="";
public $login="";
public $pass="";

And then go the function themselves.
I was told that it's better to put the initial variables in the
__construct() function. What are the advantages of doing that and if I
need to do it, how would I call the class from another file then?
Thanks!

-- 
With best regards from Ukraine,
Andre
Http://oire.org/ - The Fantasy blogs of Oire
Skype: Francophile; Wlm&MSN: arthaelon @ yandex.ru; Jabber: arthaelon @ 
jabber.org
Yahoo! messenger: andre.polykanine; ICQ: 191749952
Twitter: http://twitter.com/m_elensule


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



Re[2]: [PHP] A stupid question about classes

2010-05-01 Thread Andre Polykanine
Hello Nilesh,

So could you illustrate a bit the __construct() function, please?
Should I pass those variables as parameters of that function? And what
if I need to change their values?)
Thanks!
-- 
With best regards from Ukraine,
Andre
Skype: Francophile; Wlm&MSN: arthaelon @ yandex.ru; Jabber: arthaelon @ 
jabber.org
Yahoo! messenger: andre.polykanine; ICQ: 191749952
Twitter: m_elensule

- Original message -
From: Nilesh Govindarajan 
To: php-general@lists.php.net 
Date: Saturday, May 1, 2010, 8:16:37 PM
Subject: [PHP] A stupid question about classes

On 05/01/2010 10:23 PM, Andre Polykanine wrote:
> Hello everyone,
> Just a basic question.
> I have my class starting like this:
>
> Class OireMail {
> // these are required
> public $smtp_server="";
> public $domain="";
> public $from="";
> public $login="";
> public $pass="";
>
> And then go the function themselves.
> I was told that it's better to put the initial variables in the
> __construct() function. What are the advantages of doing that and if I
> need to do it, how would I call the class from another file then?
> Thanks!
>

The advantages of initializing the variables in __construct() is that 
whenever an object of the class is created, the variables have the 
values you expect.

If you don't put them in __construct(), you will have to create another 
method which will have to be called after you have created the object 
using the new operator.

Ultimately its the same thing, __construct() is called automatically, 
only that's the difference.

-- 
Nilesh Govindarajan
Site & Server Administrator
www.itech7.com
   !
?? : ??  !

-- 
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[4]: [PHP] A stupid question about classes

2010-05-01 Thread Andre Polykanine
Hello Richard,

thanks a lot!

-- 
With best regards from Ukraine,
Andre
Skype: Francophile; Wlm&MSN: arthaelon @ yandex.ru; Jabber: arthaelon @ 
jabber.org
Yahoo! messenger: andre.polykanine; ICQ: 191749952
Twitter: m_elensule

- Original message -
From: Richard Quadling 
To: Andre Polykanine 
Date: Saturday, May 1, 2010, 10:49:49 PM
Subject: [PHP] A stupid question about classes

On 1 May 2010 20:38, Andre Polykanine  wrote:
> Hello Nilesh,
>
> So could you illustrate a bit the __construct() function, please?
> Should I pass those variables as parameters of that function? And what
> if I need to change their values?)
> Thanks!

stmp_server = $smtp_server;
$this->domain = $domain;
$this->from = $from;
$this->login = $login;
$this->pass = $pass;
}
}

// Let's create a generic email class and supply all the params.
$Mail = new OireMail('Server', 'Domain', 'f...@domain.com', 'login',
'Passw0rd');


// A more specialised version of the class with all the required params pre set.
Class SpecialisedOireMail extends OireMail {
public function __construct() {
parent::__construct('SpecServer', 'SpecDomain',
's...@specdomain.com', 'SpecLogin', 'SpecPassw0rd');
}
}

// Let's create a specialised version. Note - no need to supply params
as the sub-class deals with that.
$SpecMail = new SpecialisedOireMail();

var_dump($Mail, $SpecMail);
?>

outputs ...

object(OireMail)#1 (6) {
  ["smtp_server"]=>
  string(0) ""
  ["domain"]=>
  string(6) "Domain"
  ["from"]=>
  string(15) "f...@domain.com"
  ["login"]=>
  string(5) "login"
  ["pass"]=>
  string(8) "Passw0rd"
  ["stmp_server"]=>
  string(6) "Server"
}
object(SpecialisedOireMail)#2 (6) {
  ["smtp_server"]=>
  string(0) ""
  ["domain"]=>
  string(10) "SpecDomain"
  ["from"]=>
  string(19) "s...@specdomain.com"
  ["login"]=>
  string(9) "SpecLogin"
  ["pass"]=>
  string(12) "SpecPassw0rd"
  ["stmp_server"]=>
  string(10) "SpecServer"
}


Hope that helps.

-- 
-
Richard Quadling
"Standing on the shoulders of some very clever giants!"
EE : http://www.experts-exchange.com/M_248814.html
EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
ZOPA : http://uk.zopa.com/member/RQuadling


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



Re: [PHP] Joomla FrameWork ::

2010-05-02 Thread Andre Polykanine
Hello Nick,

That means that the function SetVar is situated in the jRequest class.
So if you want to modify the function, for example, you need to know
where the class jRequest is situated.
-- 
With best regards from Ukraine,
Andre
Skype: Francophile; Wlm&MSN: arthaelon @ yandex.ru; Jabber: arthaelon @ 
jabber.org
Yahoo! messenger: andre.polykanine; ICQ: 191749952
Twitter: m_elensule

- Original message -
From: Nick Balestra 
To: php-general@lists.php.net 
Date: Sunday, May 2, 2010, 5:41:07 PM
Subject: [PHP] Joomla FrameWork ::

I am trying to understand how the joomla framework works, i see an heavy usage 
of  "  ::  " in its code, here an example:

function edit ()
{
JRequest::setVar('view, 'single');
$this ->display();
}


from my really basic php understanding in the function edit i call a function 
setVar() and i pass the paramter 'view' and 'single' in it then the output 
($this) is passed to the display() function.

My question is what does :: means? an more precisely referring to the example: 
JRequest::setVar('view, 'single');   how do you read it and how do you manage 
it?

Cheers, Nick
--
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] Inserting rows with missing IDs

2010-05-03 Thread Andre Polykanine
Hello everyone,
It's not a strictly PHP question, however since I use that with PHP,
I'm asking it there.
How can I accomplish the task of inserting rows into MySql database
with missing IDs? Say, I have rows with IDs 1, 2, 3, 5, 9, 12, 17, and
195. How do I make the check that allows to insert firstly the missing
IDs and only then apply the auto-increment?
Thanks!


-- 
With best regards from Ukraine,
Andre
Http://oire.org/ - The Fantasy blogs of Oire
Skype: Francophile; Wlm&MSN: arthaelon @ yandex.ru; Jabber: arthaelon @ 
jabber.org
Yahoo! messenger: andre.polykanine; ICQ: 191749952
Twitter: http://twitter.com/m_elensule


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



Re[2]: [PHP] Inserting rows with missing IDs

2010-05-03 Thread Andre Polykanine
Hello Bob,

Nope; they're not. They are blog entries that were deleted along with
their comments. I'm just thinking about doing this when the amount of
entries exceeds a reasonable number.
-- 
With best regards from Ukraine,
Andre
Skype: Francophile; Wlm&MSN: arthaelon @ yandex.ru; Jabber: arthaelon @ 
jabber.org
Yahoo! messenger: andre.polykanine; ICQ: 191749952
Twitter: m_elensule

- Original message -
From: Bob McConnell 
To: Andre Polykanine 
Date: Monday, May 3, 2010, 4:40:18 PM
Subject: [PHP] Inserting rows with missing IDs

From: Andre Polykanine

> It's not a strictly PHP question, however since I use that with PHP,
> I'm asking it there.
> How can I accomplish the task of inserting rows into MySql database
> with missing IDs? Say, I have rows with IDs 1, 2, 3, 5, 9, 12, 17, and
> 195. How do I make the check that allows to insert firstly the missing
> IDs and only then apply the auto-increment?

Why are they missing? Were they present at one time then deleted? If so,
were they used as foreign keys from another table or referenced in
queries for other data that may still reference those empty rows?

Think about the ramifications of old data in other tables that may be
inherited when new rows are assigned a deleted ID.

Bob McConnell


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



Re[2]: [PHP] Inserting rows with missing IDs

2010-05-04 Thread Andre Polykanine
Hello Richard,

Thanks, will try this!)
-- 
With best regards from Ukraine,
Andre
Skype: Francophile; Wlm&MSN: arthaelon @ yandex.ru; Jabber: arthaelon @ 
jabber.org
Yahoo! messenger: andre.polykanine; ICQ: 191749952
Twitter: m_elensule

- Original message -
From: Richard Quadling 
To: Andre Polykanine 
Date: Tuesday, May 4, 2010, 6:08:28 PM
Subject: [PHP] Inserting rows with missing IDs

On 3 May 2010 14:34, Andre Polykanine  wrote:
> Hello everyone,
> It's not a strictly PHP question, however since I use that with PHP,
> I'm asking it there.
> How can I accomplish the task of inserting rows into MySql database
> with missing IDs? Say, I have rows with IDs 1, 2, 3, 5, 9, 12, 17, and
> 195. How do I make the check that allows to insert firstly the missing
> IDs and only then apply the auto-increment?
> Thanks!

Using PHP, you could find the missing IDs by using the following steps.

1 - Get the current maximum ID.

SELECT max(ID) as Max FROM table

If you aren't interested in the ones before the first valid ID then
also retrieve the min(ID).

So you end up with $MinID = 1, $MaxID = 195.

2 - Get all the current IDs.

SELECT ID FROM table

So you end up with $KnownIDs = array(1,2,3,5,9,12,17,195);

3 - Use the range() function in PHP to build an array from the lowest
id (or 1) to the highest id.

$RangeIDs = range($MinID, $MaxID);

4 - Use array_diff($RangeIDs, $KnownIDs); to find the missing IDs.


So ...



outputs ...

Array
(
[3] => 4
[5] => 6
[6] => 7
[7] => 8
[9] => 10
[10] => 11
[12] => 13
[13] => 14
[14] => 15
[15] => 16
[17] => 18
[18] => 19
[19] => 20
[20] => 21
[21] => 22
[22] => 23
[23] => 24
[24] => 25
[25] => 26
[26] => 27
[27] => 28
[28] => 29
)


-- 
-
Richard Quadling
"Standing on the shoulders of some very clever giants!"
EE : http://www.experts-exchange.com/M_248814.html
EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
ZOPA : http://uk.zopa.com/member/RQuadling


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



[PHP] A simple question, however it's urgent

2010-05-17 Thread Andre Polykanine
Hello everyone,
Just can't imagine what happens. There is the simplest function in the
world:

function LineBreaks ($str) {
$what=array("\r\n", "\n", "\r");
$with=array("");
$str=str_replace($what, $with, $str);
return $str;
}

And... it does work on one site and doesn't on another. Same hosting
provider, same settings, all the same.
When I call
$_POST['uwork']=LineBreaks($_POST['uwork']);
Nothing happens. Yes, it does see \r\n's but it doesn't replace them
with 's. Tried built-in nl2br(), but no result...
Thank you!..

-- 
With best regards from Ukraine,
Andre
Http://oire.org/ - The Fantasy blogs of Oire
Skype: Francophile; Wlm&MSN: arthaelon @ yandex.ru; Jabber: arthaelon @ 
jabber.org
Yahoo! messenger: andre.polykanine; ICQ: 191749952
Twitter: http://twitter.com/m_elensule


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



Re[2]: [PHP] A simple question, however it's urgent

2010-05-17 Thread Andre Polykanine
Hey Ash,

I do a print_r($_POST) and see there the \r\n's. Please don't pay
attention to question marks, there is some Cyrillic here:


Original POST:

Array ( [uwork] => 
asdfsadf\r\nasdfasdf\r\nasdfasdf\r\nasdfasdf\r\nasdfasdf\r\nasdf [lid] => 23 
[stud] => 1587 [sfac] => 3 [stid] => 9 [report] => 0 [Add]

=> ? ?? ) 

Modified POST: 

Array ( [uwork] => 
asdfsadf\r\nasdfasdf\r\nasdfasdf\r\nasdfasdf\r\nasdfasdf\r\nasdf [lid] => 23 
[stud] => 1587 [sfac] => 3 [stid] => 9 [report] => 0 [Add]

=> ? ?? ) 
 
-- 
With best regards from Ukraine,
Andre
Skype: Francophile; Wlm&MSN: arthaelon @ yandex.ru; Jabber: arthaelon @ 
jabber.org
Yahoo! messenger: andre.polykanine; ICQ: 191749952
Twitter: m_elensule

- Original message -
From: Ashley Sheridan 
To: Andre Polykanine 
Date: Monday, May 17, 2010, 3:24:37 PM
Subject: [PHP] A simple question, however it's urgent

On Mon, 2010-05-17 at 15:26 +0300, Andre Polykanine wrote:

> Hello everyone,
> Just can't imagine what happens. There is the simplest function in the
> world:
> 
> function LineBreaks ($str) {
> $what=array("\r\n", "\n", "\r");
> $with=array("");
> $str=str_replace($what, $with, $str);
> return $str;
> }
> 
> And... it does work on one site and doesn't on another. Same hosting
> provider, same settings, all the same.
> When I call
> $_POST['uwork']=LineBreaks($_POST['uwork']);
> Nothing happens. Yes, it does see \r\n's but it doesn't replace them
> with 's. Tried built-in nl2br(), but no result...
> Thank you!..
> 
> -- 
> With best regards from Ukraine,
> Andre
> Http://oire.org/ - The Fantasy blogs of Oire
> Skype: Francophile; Wlm&MSN: arthaelon @ yandex.ru; Jabber: arthaelon @ 
> jabber.org
> Yahoo! messenger: andre.polykanine; ICQ: 191749952
> Twitter: http://twitter.com/m_elensule
> 
> 


If nl2br() doesn't even work, are you really sure that those character
exist in the string? Just for our own sake, could you demonstrate how
you determine that the carriage return and line break characters exist
in the string?

Thanks,
Ash
http://www.ashleysheridan.co.uk




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



Re[4]: [PHP] A simple question, however it's urgent

2010-05-17 Thread Andre Polykanine
Ash,

Magic quotes are disabled:
http://gviragon.org/study/php.php
Any ideas?
Thanks a lot!


-- 
With best regards from Ukraine,
Andre
Skype: Francophile; Wlm&MSN: arthaelon @ yandex.ru; Jabber: arthaelon @ 
jabber.org
Yahoo! messenger: andre.polykanine; ICQ: 191749952
Twitter: m_elensule

- Original message -
From: Ashley Sheridan 
To: Andre Polykanine 
Date: Monday, May 17, 2010, 3:34:07 PM
Subject: [PHP] A simple question, however it's urgent

On Mon, 2010-05-17 at 15:36 +0300, Andre Polykanine wrote:

> Hey Ash,
> 
> I do a print_r($_POST) and see there the \r\n's. Please don't pay
> attention to question marks, there is some Cyrillic here:
> 
> 
> Original POST:
> 
> Array ( [uwork] => 
> asdfsadf\r\nasdfasdf\r\nasdfasdf\r\nasdfasdf\r\nasdfasdf\r\nasdf [lid] => 23 
> [stud] => 1587 [sfac] => 3 [stid] => 9 [report] => 0 [Add]
> 
> => ? ?? ) 
> 
> Modified POST: 
> 
> Array ( [uwork] => 
> asdfsadf\r\nasdfasdf\r\nasdfasdf\r\nasdfasdf\r\nasdfasdf\r\nasdf [lid] => 23 
> [stud] => 1587 [sfac] => 3 [stid] => 9 [report] => 0 [Add]
> 
> => ? ?? ) 
>  
> -- 
> With best regards from Ukraine,
> Andre
> Skype: Francophile; Wlm&MSN: arthaelon @ yandex.ru; Jabber: arthaelon @ 
> jabber.org
> Yahoo! messenger: andre.polykanine; ICQ: 191749952
> Twitter: m_elensule
> 
> - Original message -
> From: Ashley Sheridan 
> To: Andre Polykanine 
> Date: Monday, May 17, 2010, 3:24:37 PM
> Subject: [PHP] A simple question, however it's urgent
> 
> On Mon, 2010-05-17 at 15:26 +0300, Andre Polykanine wrote:
> 
> > Hello everyone,
> > Just can't imagine what happens. There is the simplest function in the
> > world:
> > 
> > function LineBreaks ($str) {
> > $what=array("\r\n", "\n", "\r");
> > $with=array("");
> > $str=str_replace($what, $with, $str);
> > return $str;
> > }
> > 
> > And... it does work on one site and doesn't on another. Same hosting
> > provider, same settings, all the same.
> > When I call
> > $_POST['uwork']=LineBreaks($_POST['uwork']);
> > Nothing happens. Yes, it does see \r\n's but it doesn't replace them
> > with 's. Tried built-in nl2br(), but no result...
> > Thank you!..
> > 
> > -- 
> > With best regards from Ukraine,
> > Andre
> > Http://oire.org/ - The Fantasy blogs of Oire
> > Skype: Francophile; Wlm&MSN: arthaelon @ yandex.ru; Jabber: arthaelon @ 
> > jabber.org
> > Yahoo! messenger: andre.polykanine; ICQ: 191749952
> > Twitter: http://twitter.com/m_elensule
> > 
> > 
> 
> 
> If nl2br() doesn't even work, are you really sure that those character
> exist in the string? Just for our own sake, could you demonstrate how
> you determine that the carriage return and line break characters exist
> in the string?
> 
> Thanks,
> Ash
> http://www.ashleysheridan.co.uk
> 
> 
> 
> 


You shouldn't actually be able to see the \ chracters, so I would assume
that you're escaping them somehow and magic quotes are getting in the
way on the live server with the problems.

Have you checked the magic quotes settings on both servers. Also, as a
general rule of thumb, if something stops working on a new server, check
to see if the setup is the same. Compare the output of phpinfo() on both
of them first, as that will show you any obvious differences.

Thanks,
Ash
http://www.ashleysheridan.co.uk




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



[PHP] preg_replace: avoiding double replacements

2010-05-17 Thread Andre Polykanine
Hello everyone,

Sorry for bothering you again.
Today I met a problem exactly described by a developer in users' notes
that follow the preg_replace description in the manual:
info at gratisrijden dot nl
02-Oct-2009 02:48 
if you are using the preg_replace with arrays, the replacements will apply as 
subject for the patterns later in the array. This means replaced values can
be replaced again.

Example:
 and OLDTAG with the ';

$patterns 
= array(
'/BOLD/i', 
'/OLDTAG/i');
$replacements 
= array(
'', 
'');

echo preg_replace 
($patterns, $replacements, $text);
?>

Output:
We want to replace > with the <>tag> and  with the 


Look what happend with BOLD. 

Is there any solution to this besides any two-step sophisticated trick
like case changing?
Thanks!

--
With best regards from Ukraine,
Andre
Http://oire.org/ - The Fantasy blogs of Oire
Skype: Francophile; Wlm&MSN: arthaelon @ yandex.ru; Jabber: arthaelon @ 
jabber.org
Yahoo! messenger: andre.polykanine; ICQ: 191749952
Twitter: http://twitter.com/m_elensule


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



Re[2]: [PHP] preg_replace: avoiding double replacements

2010-05-18 Thread Andre Polykanine
Hello Jim,

That might work for that particular example, but I have utf-8 strings
containing different characters of different alphabets, so neither
str_replace nor strtr work...
Thanks!
-- 
With best regards from Ukraine,
Andre
Skype: Francophile; Wlm&MSN: arthaelon @ yandex.ru; Jabber: arthaelon @ 
jabber.org
Yahoo! messenger: andre.polykanine; ICQ: 191749952
Twitter: m_elensule

- Original message -
From: Jim Lucas 
To: Andre Polykanine 
Date: Tuesday, May 18, 2010, 3:33:09 AM
Subject: [PHP] preg_replace: avoiding double replacements

Andre Polykanine wrote:
> Hello everyone,
> 
> Sorry for bothering you again.
> Today I met a problem exactly described by a developer in users' notes
> that follow the preg_replace description in the manual:
> info at gratisrijden dot nl
> 02-Oct-2009 02:48 
> if you are using the preg_replace with arrays, the replacements will apply as 
> subject for the patterns later in the array. This means replaced values can
> be replaced again.
> 
> Example:
>  $text = 
> 'We want to replace BOLD with the  and OLDTAG with the ';
> 
> $patterns 
> = array(
> '/BOLD/i', 
> '/OLDTAG/i');
> $replacements 
> = array(
> '', 
> '');
> 
> echo preg_replace 
> ($patterns, $replacements, $text);
> ?>
> 
> Output:
> We want to replace > with the <>tag> and  with 
> the 
> 
> Look what happend with BOLD. 
> 
> Is there any solution to this besides any two-step sophisticated trick
> like case changing?
> Thanks!
> 
> --
> With best regards from Ukraine,
> Andre
> Http://oire.org/ - The Fantasy blogs of Oire
> Skype: Francophile; Wlm&MSN: arthaelon @ yandex.ru; Jabber: arthaelon @ 
> jabber.org
> Yahoo! messenger: andre.polykanine; ICQ: 191749952
> Twitter: http://twitter.com/m_elensule
> 
> 

Well, for the example you gave, why use regex?  Check this out as an example.

 and OLDTAG with the 
';

$regex = array(
'/BOLD/i',
'/OLDTAG/i',
);
$oldtags = array(
'BOLD',
'OLDTAG',
);
$replacements = array(
'',
'',
);

# Original String
echo $text."\n";

# After regex is applied
echo preg_replace($regex, $replacements, $text)."\n";

# After plain tag replacement happens
echo str_replace($oldtags, $replacements, $text)."\n";

?>

See if that works for you.

-- 
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


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



Re[4]: [PHP] preg_replace: avoiding double replacements

2010-05-18 Thread Andre Polykanine
Hello Peter,

Hm... I see I need to specify what I'm really doing. Actually, I need
to change the letters in the text. It's a famous and ancient crypting
method: you divide the alphabet making two parts, then you change the
letters of one part with letters for other part (so A becomes N, B
becomes O, etc., and vice versa). it works fine and slightly with
strtr or str_replace... but only if the text is not in utf-8 and it
doesn't contain any non-English letters such as Cyrillic what I need.
What my regex does is the following: it sees an A, well it changes it
to N; then it goes through the string and sees an N... what does it
do? Surely, it changes it back to A! I hoped (in vain) that there
exists a modifier preventing this behavior... but it seems that it's
false(
Thanks!
-- 
With best regards from Ukraine,
Andre
Skype: Francophile; Wlm&MSN: arthaelon @ yandex.ru; Jabber: arthaelon @ 
jabber.org
Yahoo! messenger: andre.polykanine; ICQ: 191749952
Twitter: m_elensule

- Original message -
From: Peter Lind 
To: Andre Polykanine 
Date: Tuesday, May 18, 2010, 10:19:51 AM
Subject: [PHP] preg_replace: avoiding double replacements

On 18 May 2010 09:04, Andre Polykanine  wrote:

[snip]

> Andre Polykanine wrote:
>> Hello everyone,
>>
>> Sorry for bothering you again.
>> Today I met a problem exactly described by a developer in users' notes
>> that follow the preg_replace description in the manual:
>> info at gratisrijden dot nl
>> 02-Oct-2009 02:48
>> if you are using the preg_replace with arrays, the replacements will apply 
>> as subject for the patterns later in the array. This means replaced values 
>> can
>> be replaced again.
>>
>> Example:
>> > $text =
>> 'We want to replace BOLD with the  and OLDTAG with the ';
>>
>> $patterns
>> = array(
>> '/BOLD/i',
>> '/OLDTAG/i');
>> $replacements
>> = array(
>> '',
>> '');
>>
>> echo preg_replace
>> ($patterns, $replacements, $text);
>> ?>
>>
>> Output:
>> We want to replace > with the <>tag> and  with 
>> the 
>>
>> Look what happend with BOLD.
>>
>> Is there any solution to this besides any two-step sophisticated trick
>> like case changing?
>> Thanks!
>>

Use better regexes: either match for word endings or use a delimiter
in your markers (i.e. ###BOLD### instead of BOLD).

Regards
Peter

-- 

WWW: http://plphp.dk / http://plind.dk
LinkedIn: http://www.linkedin.com/in/plind
Flickr: http://www.flickr.com/photos/fake51
BeWelcome: Fake51
Couchsurfing: Fake51


-- 
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[6]: [PHP] preg_replace: avoiding double replacements

2010-05-18 Thread Andre Polykanine
Hello Peter,

Good point. And more than that, I make a decrypting script, also... so
gibberish defenitely is an issue)
-- 
With best regards from Ukraine,
Andre
Skype: Francophile; Wlm&MSN: arthaelon @ yandex.ru; Jabber: arthaelon @ 
jabber.org
Yahoo! messenger: andre.polykanine; ICQ: 191749952
Twitter: m_elensule

- Original message -
From: Peter Lind 
To: a...@ashleysheridan.co.uk 
Date: Tuesday, May 18, 2010, 3:00:56 PM
Subject: [PHP] preg_replace: avoiding double replacements

On 18 May 2010 13:43, Ashley Sheridan  wrote:
>
> On Tue, 2010-05-18 at 13:46 +0200, Peter Lind wrote:
>
> On 18 May 2010 13:32, Ashley Sheridan  wrote:
> >
> > On Tue, 2010-05-18 at 13:09 +0200, Peter Lind wrote:
> >
> > On 18 May 2010 12:35, Andre Polykanine  wrote:
> > > Hello Peter,
> > >
> > > Hm... I see I need to specify what I'm really doing. Actually, I need
> > > to change the letters in the text. It's a famous and ancient crypting
> > > method: you divide the alphabet making two parts, then you change the
> > > letters of one part with letters for other part (so A becomes N, B
> > > becomes O, etc., and vice versa). it works fine and slightly with
> > > strtr or str_replace... but only if the text is not in utf-8 and it
> > > doesn't contain any non-English letters such as Cyrillic what I need.
> > > What my regex does is the following: it sees an A, well it changes it
> > > to N; then it goes through the string and sees an N... what does it
> > > do? Surely, it changes it back to A! I hoped (in vain) that there
> > > exists a modifier preventing this behavior... but it seems that it's
> > > false(
> > > Thanks!
> >
> > Hmmm, what comes to mind is using your string as an array and
> > translating one character after another, building your output string
> > using a lookup table. Not entirely sure how that will play with utf8
> > characters, you'd have to try and see.
> >  I don't think you'll get any of PHPs string functions to do the work
> > for you - they'll do the job in serial, not parallel.
> >
> > Regards
> > Peter
> >
> > --
> > 
> > WWW: http://plphp.dk / http://plind.dk
> > LinkedIn: http://www.linkedin.com/in/plind
> > Flickr: http://www.flickr.com/photos/fake51
> > BeWelcome: Fake51
> > Couchsurfing: Fake51
> > 
> >
> >
> > If you're wanting to use the Caesar cypher (for that's what it is) then why 
> > not just modify the entire string, character by character, to use a 
> > character code n characters ahead. For example, a capital A is ascii 65, 
> > you want to change it to an N to add 14 to that. Just keep n the same 
> > throughout and it's easy to convert back.
> >
> > Thanks,
> > Ash
> > http://www.ashleysheridan.co.uk
> >
> >
>
> You probably overlooked the part where the OP points out he's not
> using ascii but utf8. If it was just ascii, using str_rot13() would be
> the weapon of choice I'd say (note that adding 14 to every character
> of an ascii string will turn lots of it into gibberish - you have to
> wrap round when you reach a certain point).
>
> Regards
> Peter
>
> --
> 
> WWW: http://plphp.dk / http://plind.dk
> LinkedIn: http://www.linkedin.com/in/plind
> Flickr: http://www.flickr.com/photos/fake51
> BeWelcome: Fake51
> Couchsurfing: Fake51
> 
>
>
> I gave the example as Ascii because I knew the code for A off the top of my 
> head, I don't see a reason why it won't work for utf, the characters still 
> have incremental codes.
>
> Also, is gibberish really an issue to worry about? The Caesar cypher is 
> already rendering the string unreadable.

You normally want output in the same range that you encode from (i.e.
you're remapping within the alphabet, not within the entire range of
printable characters) if you're doing a caesar/rot13.

Regards
Peter

--

WWW: http://plphp.dk / http://plind.dk
LinkedIn: http://www.linkedin.com/in/plind
Flickr: http://www.flickr.com/photos/fake51
BeWelcome: Fake51
Couchsurfing: Fake51



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



Re[6]: [PHP] preg_replace: avoiding double replacements

2010-05-19 Thread Andre Polykanine
Ash,

Actually it's not the Caesar cypher itself (see
http://en.wikipedia.org/wiki/Temurah_(Kabbalah), third method), but
your way of transformation seems to me the best for a while)
Thanks!

-- 
With best regards from Ukraine,
Andre
Skype: Francophile; Wlm&MSN: arthaelon @ yandex.ru; Jabber: arthaelon @ 
jabber.org
Yahoo! messenger: andre.polykanine; ICQ: 191749952
Twitter: m_elensule

- Original message -
From: Ashley Sheridan 
To: Peter Lind 
Date: Tuesday, May 18, 2010, 2:32:11 PM
Subject: [PHP] preg_replace: avoiding double replacements

On Tue, 2010-05-18 at 13:09 +0200, Peter Lind wrote:

> On 18 May 2010 12:35, Andre Polykanine  wrote:
> > Hello Peter,
> >
> > Hm... I see I need to specify what I'm really doing. Actually, I need
> > to change the letters in the text. It's a famous and ancient crypting
> > method: you divide the alphabet making two parts, then you change the
> > letters of one part with letters for other part (so A becomes N, B
> > becomes O, etc., and vice versa). it works fine and slightly with
> > strtr or str_replace... but only if the text is not in utf-8 and it
> > doesn't contain any non-English letters such as Cyrillic what I need.
> > What my regex does is the following: it sees an A, well it changes it
> > to N; then it goes through the string and sees an N... what does it
> > do? Surely, it changes it back to A! I hoped (in vain) that there
> > exists a modifier preventing this behavior... but it seems that it's
> > false(
> > Thanks!
> 
> Hmmm, what comes to mind is using your string as an array and
> translating one character after another, building your output string
> using a lookup table. Not entirely sure how that will play with utf8
> characters, you'd have to try and see.
>  I don't think you'll get any of PHPs string functions to do the work
> for you - they'll do the job in serial, not parallel.
> 
> Regards
> Peter
> 
> -- 
> 
> WWW: http://plphp.dk / http://plind.dk
> LinkedIn: http://www.linkedin.com/in/plind
> Flickr: http://www.flickr.com/photos/fake51
> BeWelcome: Fake51
> Couchsurfing: Fake51
> 
> 


If you're wanting to use the Caesar cypher (for that's what it is) then
why not just modify the entire string, character by character, to use a
character code n characters ahead. For example, a capital A is ascii 65,
you want to change it to an N to add 14 to that. Just keep n the same
throughout and it's easy to convert back.

Thanks,
Ash
http://www.ashleysheridan.co.uk




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



[PHP] One more time about regexes

2010-05-26 Thread Andre Polykanine
Hello everyone,

Sorry, but I'm asking one more time (since it's really annoying me and
I need to apply some really dirty hacks):
Is there a way making preg_replace() pass through the regex one single
time searching from left to right and not to erase what it has already
done?
I can give you a real task I'm accomplishing but the tasks requiring
that tend to multiply...
Thanks a lot!

-- 
With best regards from Ukraine,
Andre
Http://oire.org/ - The Fantasy blogs of Oire
Skype: Francophile; Wlm&MSN: arthaelon @ yandex.ru; Jabber: arthaelon @ 
jabber.org
Yahoo! messenger: andre.polykanine; ICQ: 191749952
Twitter: http://twitter.com/m_elensule


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



Re[2]: [PHP] One more time about regexes

2010-05-27 Thread Andre Polykanine
Hello Adam,

You did understand me exactly and perfectly).
Ordering arrays is a good idea but I don't know how to do that
exactly.
For instance, there's a cypher called Polybius square. You write in
the alphabet in a grid like this:
1 a b c d e
2 f g h i j
3 k l m n o
4 p q r s t
5 u v w x y
6 z

There is a way where i/j are equal to make a 5 by 5 square but for me
it's equal since I'm working with a 33-letter Russian alphabet, so no
way to make it a perfect square.
Anyway, a letter has two coordinates and is represented by a two-digit
number. For example, E is 15, K is 21, Z is 61 and so on.
So we have a word, say, PHP. It will look like this: 412341.
What does preg_replace do? Exactly, it's searching 41, then 12, then
23, and so on.
I tried to make a loop:
$length=mb_strlen($str);
for ($i=0; $i<$length; $i+=2) {
$pair=mb_substr($str, $i, 2);
$pair=preg_replace($numbers, $letters, $str);
}

It already smells something not good, but anyway.
If I do that, I have one more problem: say, we have a phrase "PHP is
the best". So we crypt it and get:
412341 2444 452315 12154445
Then the parser begins: "41=>p, 23=>h, 41=>p, (attention!) \s2=>"
I marked a whitespace as \s so you see what happens.
I might split the string by spaces but I can't imagine what a user
inputs: it might be a dash, for example...
Sorry for such a long message but I'm really annoyed with this
preg_replace's behavior. And it's not the only one task to
accomplish...
Thanks a lot!

-- 
With best regards from Ukraine,
Andre
Skype: Francophile; Wlm&MSN: arthaelon @ yandex.ru; Jabber: arthaelon @ 
jabber.org
Yahoo! messenger: andre.polykanine; ICQ: 191749952
Twitter: m_elensule

- Original message -
From: Adam Richardson 
To: php-general@lists.php.net 
Date: Thursday, May 27, 2010, 7:56:28 AM
Subject: [PHP] One more time about regexes

On Wed, May 26, 2010 at 11:10 PM, Nilesh Govindarajan wrote:

> -- Forwarded message --
> From: Nilesh Govindarajan 
> Date: Thu, May 27, 2010 at 8:40 AM
> Subject: Re: [PHP] One more time about regexes
> To: Andre Polykanine 
>
>
> On Thu, May 27, 2010 at 3:33 AM, Andre Polykanine  wrote:
> > Hello everyone,
> >
> > Sorry, but I'm asking one more time (since it's really annoying me and
> > I need to apply some really dirty hacks):
> > Is there a way making preg_replace() pass through the regex one single
> > time searching from left to right and not to erase what it has already
> > done?
> > I can give you a real task I'm accomplishing but the tasks requiring
> > that tend to multiply...
> > Thanks a lot!
> >
> > --
> > With best regards from Ukraine,
> > Andre
> > Http://oire.org/ - The Fantasy blogs of Oire
> > Skype: Francophile; Wlm&MSN: arthaelon @ yandex.ru; Jabber: arthaelon @
> jabber.org
> > Yahoo! messenger: andre.polykanine; ICQ: 191749952
> > Twitter: http://twitter.com/m_elensule
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
>
>
> If you don't want to replace the stuff it has searched then use preg_match
> !
>
> --
> Nilesh Govindarajan
> Facebook: nilesh.gr
> Twitter: nileshgr
> Website: www.itech7.com
>
>
>
> --
> Nilesh Govindarajan
> Facebook: nilesh.gr
> Twitter: nileshgr
> Website: www.itech7.com
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
If I'm understanding correctly, Andre, you want to perform a replace
operation, but you're observing that there's an element of recursion
happening (e.g., you replace one item with its replacement, and then the new
replacement is also replaced.)

To my knowledge, this won't happen with a standard preg_replace():

$string = 'Bil & Tom & Phil';
$pattern = '/&/';
$replacement = '&';
// outputs Bil & Tom & Phil
echo preg_replace($pattern, $replacement, $string);

However, if you're using arrays to pass in the patterns and replacements,
then one array item could later be replaced by another (see comment and
example on this page by info at gratisrijden dot nl):
http://php.net/manual/en/function.preg-replace.php

If that's the case, you have to carefully structure the order of the array
items so-as to preclude one replacement having the opportunity to override a
subsequent replacement.

Sorry if I misunderstood.  You might want to create a simple example of code
showing what you're working through.

Adam


-- 
Nephtali:  PHP web framework that functions beautifully
http://nephtaliproject.com


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



Re: [PHP] Convert UTF-8 to PHP defines

2010-05-27 Thread Andre Polykanine
Hello Guus,

Actually, we are using the same method here on http://oire.org/. We
have all of the language files in UTF8 format and everything seems to
be OK. Yes, unicode support in PHp laisse à désirer, like the French
say, but it does support UTF8 files.
-- 
With best regards from Ukraine,
Andre
Skype: Francophile; Wlm&MSN: arthaelon @ yandex.ru; Jabber: arthaelon @ 
jabber.org
Yahoo! messenger: andre.polykanine; ICQ: 191749952
Twitter: m_elensule

- Original message -
From: Guus Ellenkamp 
To: php-general@lists.php.net 
Date: Wednesday, May 26, 2010, 5:20:59 PM
Subject: [PHP] Convert UTF-8 to PHP defines

We use PHP defines for defining text in different languages. As far as I 
know PHP files are supposed to be ASCII, not UTF-8 or something like that. 
What I want to make is a conversion program that would convert a given UTF-8 
file with the format

definetext1=this is a text in random UTF-8, probably arabic or similar text
definetext2=this is another text in random UTF-8, probably arabic or similar 
text

into a file with the following defines

define('definetext1',chr().chr().chr()...).chr());
define('definetext2,chr().chr().chr()...).chr());

Not sure if I'm using the correct chr/ord function, but I hope the above is 
clear enough to make clear what I'm looking for. Basically the output file 
should be ascii and not contain any utf-8.

Any advise? The html_special_chars did not seem to work for Vietnamese text 
I tried to convert, so something seems to get wrong with just reading an 
array of strings and converting the strings and putting them in defines. 



-- 
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] Inserting, storing, outputting dates and selections

2010-06-02 Thread Andre Polykanine
Hi Dave,

Let's look and see)
1. You can re-format your date so that it will fit the needed format
for MySql:
$_POST['EndDate']=date("Y-m-d", $_POST['EndDate']);

 2. There's a PHP
 function called
 isset() that checks
 whether a variable is
 set. But you probably
 will find this one
 much handier:
if (!empty($_POST['EndDate'])) {
// blahblah, inserting into database
}

3. This is quite simple, I think. You write:
Choice 1
What would you like PHP to write in the DB? It has nothing to write at
all) You should do this instead:
Choice 1
Choice 2

So now you have values to insert)
Hope I could help you!)

-- 
With best regards from Ukraine,
Andre
Skype: Francophile; Wlm&MSN: arthaelon @ yandex.ru; Jabber: arthaelon @ 
jabber.org
Yahoo! messenger: andre.polykanine; ICQ: 191749952
Twitter: m_elensule

- Original message -
From: David Mehler 
To: php-general 
Date: Wednesday, June 2, 2010, 11:20:55 PM
Subject: [PHP] Inserting, storing, outputting dates and selections

Hello,
I've got two questions which are probably fairly simple, my issue is
i'm staring at this so long it's blurring together.
I'm working on a form to insert data in to a mysql database. I've got
a startdate and and enddate field in the database both of type DATE,
i'm needing this as i'm wanting to do a calculation against the date
and only display records greater than or equal to the current date. My
understanding is dates have to be entered as 2010-06-02 with this
format.
I'm having several issues: the first of which is I entered a date as
probably a user would as June 2, 2010 and on the display page got all
zeroes, is there a way i can be more flexible with my data entry,
enter it, then store it in the format mysql needs?
My second issue is that the startdate field is NOT NULL while the
enddate field is. On submission I only want those forms that are
actually in the post data to get inserted in to the database, and
displayed, i.e. if enddate was not entered I shouldn't see all zeroes
in the field in the database, if using the mysql commandline client,
or all zeroes in displayed output. I'm not sure how to conditionally
insert or display a field based on whether it's set.
My last issue, not on dates, is on a selection box. I've got two
choices to choose from, choice1 and choice2 just for this example. If
a user goes through and selects nothing I want choice1 to be
automatically selected on form submission, if a user selects choice2
then the form should go with that. Here's my code.


Choose*:

 - choice1 - 
 - choice2 - 



On form submission the php script processes it and enters an empty
field in the database if the user doesn't select an option.
Thanks.
Dave.

-- 
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] Parse info from 1,000 files to file

2010-06-02 Thread Andre Polykanine
Hello Sam,

Consider using opendir(), readdir(), fopen(), file_get_contents(),
fwrite().
-- 
With best regards from Ukraine,
Andre
Skype: Francophile; Wlm&MSN: arthaelon @ yandex.ru; Jabber: arthaelon @ 
jabber.org
Yahoo! messenger: andre.polykanine; ICQ: 191749952
Twitter: m_elensule

- Original message -
From: Sam Smith 
To: php-general@lists.php.net 
Date: Wednesday, June 2, 2010, 9:24:20 PM
Subject: [PHP] Parse info from 1,000 files to file

Can someone briefly point me to the functions I'll need to parse some
information from thousands of files in a single directory and then
prepare the extracted info into a single file for SQL import?

Like file() or readfile() and some regex and writefile??

Thanks

-- 
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] Login form + User level access

2010-06-29 Thread Andre Polykanine
Hello Carlos,

Something like this (assuming that the field with the type of the user
- admin, sales, etc. - is called `Status`, and the table is called
`Users`):
$f=mysql_fetch_assoc(mysql_query("SELECT `Status`, COUNT(*) AS
`UserExists` FROM `Users` WHERE
`Name`='".$_POST['name']."' AND
`Password`='".md5($_POST['pass'])."'"));
if ($f['UserExists']>0) { // name and password are correct
switch ($f['Status']) {
 case 'ADMIN': include "adminmenu.php"; break;
 case 'SALES': include "salesmenu.php"; break;
 // ...
 }
 } else {
 die ("You entered either an incorrect login or an
 incorrect password.");
 }
 
 I assume you store crypted passwords in your
 database, and the algorythm is md5 (there are
 better solutions, but I used it simply for this
 example).

-- 
With best regards from Ukraine,
Andre
Skype: Francophile; Wlm&MSN: arthaelon @ yandex.ru; Jabber: arthaelon @ 
jabber.org
Yahoo! messenger: andre.polykanine; ICQ: 191749952
Twitter: m_elensule

- Original message -
From: Carlos Sura 
To: php-general@lists.php.net 
Date: Tuesday, June 29, 2010, 10:46:14 PM
Subject: [PHP] Login form + User level access




Hello everyone.

I have this question: I'm developing a login system but what I need is to do is 
access levels

I mean, in my database I have this users:

Admin
Superusers
sales
purchase
etc

So, What I do basically need is, when a user from sales log in.. I want him to 
see just the menu from SALES, He cannot see others menu options, and he can't 
get access, I was reading that I can do that with  Switch,  but really I have 
no idea about it... Any help?

Thank you.

Carlos Sura.




  
_
http://clk.atdmt.com/UKM/go/19780/direct/01/
Do you have a story that started on Hotmail? Tell us now


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



Re[2]: [PHP] Login form + User level access

2010-06-29 Thread Andre Polykanine
Hello Carlos,

What I forgot to add is the following:
I'd suggest you to put in the integers and not the strings
(1 instead of PURCHASER, 2 instead of SALES etc.). It will
quicken the process.
-- 
With best regards from Ukraine,
Andre
Skype: Francophile; Wlm&MSN: arthaelon @ yandex.ru; Jabber: arthaelon @ 
jabber.org
Yahoo! messenger: andre.polykanine; ICQ: 191749952
Twitter: m_elensule

- Original message -----
From: Andre Polykanine 
To: Carlos Sura 
Date: Tuesday, June 29, 2010, 11:04:53 PM
Subject: [PHP] Login form + User level access

Hello Carlos,

Something like this (assuming that the field with the type of the user
- admin, sales, etc. - is called `Status`, and the table is called
`Users`):
$f=mysql_fetch_assoc(mysql_query("SELECT `Status`, COUNT(*) AS
`UserExists` FROM `Users` WHERE
`Name`='".$_POST['name']."' AND
`Password`='".md5($_POST['pass'])."'"));
if ($f['UserExists']>0) { // name and password are correct
switch ($f['Status']) {
 case 'ADMIN': include "adminmenu.php"; break;
 case 'SALES': include "salesmenu.php"; break;
 // ...
 }
 } else {
 die ("You entered either an incorrect login or an
 incorrect password.");
 }
 
 I assume you store crypted passwords in your
 database, and the algorythm is md5 (there are
 better solutions, but I used it simply for this
 example).

-- 
With best regards from Ukraine,
Andre
Skype: Francophile; Wlm&MSN: arthaelon @ yandex.ru; Jabber: arthaelon @ 
jabber.org
Yahoo! messenger: andre.polykanine; ICQ: 191749952
Twitter: m_elensule

- Original message -
From: Carlos Sura 
To: php-general@lists.php.net 
Date: Tuesday, June 29, 2010, 10:46:14 PM
Subject: [PHP] Login form + User level access




Hello everyone.

I have this question: I'm developing a login system but what I need is to do is 
access levels

I mean, in my database I have this users:

Admin
Superusers
sales
purchase
etc

So, What I do basically need is, when a user from sales log in.. I want him to 
see just the menu from SALES, He cannot see others menu options, and he can't 
get access, I was reading that I can do that with  Switch,  but really I have 
no idea about it... Any help?

Thank you.

Carlos Sura.




  
_
http://clk.atdmt.com/UKM/go/19780/direct/01/
Do you have a story that started on Hotmail? Tell us now


--
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[4]: [PHP] Login form + User level access

2010-06-29 Thread Andre Polykanine
Hello Carlos,

Yes, it would be the same. You'll have some double info in your DB,
though.
-- 
With best regards from Ukraine,
Andre
Skype: Francophile; Wlm&MSN: arthaelon @ yandex.ru; Jabber: arthaelon @ 
jabber.org
Yahoo! messenger: andre.polykanine; ICQ: 191749952
Twitter: m_elensule

- Original message -
From: Carlos Sura 
To: an...@oire.org 
Date: Tuesday, June 29, 2010, 11:13:08 PM
Subject: [PHP] Login form + User level access


Hello Andre,

Thank you so much, Now I really get the idea.
Oh, can I replace that adding inthe table of access_level a field called: 
'level_numbers' ?? would it be the same thing??

Carlos Sura.




> Date: Tue, 29 Jun 2010 23:08:51 +0300
> From: an...@oire.org
> To: an...@oire.org
> CC: carlos_s...@hotmail.com; php-general@lists.php.net
> Subject: Re[2]: [PHP] Login form + User level access
> 
> Hello Carlos,
> 
> What I forgot to add is the following:
> I'd suggest you to put in the integers and not the strings
> (1 instead of PURCHASER, 2 instead of SALES etc.). It will
> quicken the process.
> -- 
> With best regards from Ukraine,
> Andre
> Skype: Francophile; Wlm&MSN: arthaelon @ yandex.ru; Jabber: arthaelon @ 
> jabber.org
> Yahoo! messenger: andre.polykanine; ICQ: 191749952
> Twitter: m_elensule
> 
> - Original message -
> From: Andre Polykanine 
> To: Carlos Sura 
> Date: Tuesday, June 29, 2010, 11:04:53 PM
> Subject: [PHP] Login form + User level access
> 
> Hello Carlos,
> 
> Something like this (assuming that the field with the type of the user
> - admin, sales, etc. - is called `Status`, and the table is called
> `Users`):
> $f=mysql_fetch_assoc(mysql_query("SELECT `Status`, COUNT(*) AS
> `UserExists` FROM `Users` WHERE
> `Name`='".$_POST['name']."' AND
> `Password`='".md5($_POST['pass'])."'"));
> if ($f['UserExists']>0) { // name and password are correct
> switch ($f['Status']) {
>  case 'ADMIN': include "adminmenu.php"; break;
>  case 'SALES': include "salesmenu.php"; break;
>  // ...
>  }
>  } else {
>  die ("You entered either an incorrect login or an
>  incorrect password.");
>  }
>  
>  I assume you store crypted passwords in your
>  database, and the algorythm is md5 (there are
>  better solutions, but I used it simply for this
>  example).
> 
> -- 
> With best regards from Ukraine,
> Andre
> Skype: Francophile; Wlm&MSN: arthaelon @ yandex.ru; Jabber: arthaelon @ 
> jabber.org
> Yahoo! messenger: andre.polykanine; ICQ: 191749952
> Twitter: m_elensule
> 
> - Original message -
> From: Carlos Sura 
> To: php-general@lists.php.net 
> Date: Tuesday, June 29, 2010, 10:46:14 PM
> Subject: [PHP] Login form + User level access
> 
> 
> 
> 
> Hello everyone.
> 
> I have this question: I'm developing a login system but what I need is to do 
> is access levels
> 
> I mean, in my database I have this users:
> 
> Admin
> Superusers
> sales
> purchase
> etc
> 
> So, What I do basically need is, when a user from sales log in.. I want him 
> to see just the menu from SALES, He cannot see others menu options, and he 
> can't get access, I was reading that I can do that with  Switch,  but really 
> I have no idea about it... Any help?
> 
> Thank you.
> 
> Carlos Sura.
> 
> 
> 
> 
> 
> _
> http://clk.atdmt.com/UKM/go/19780/direct/01/
> Do you have a story that started on Hotmail? Tell us now
> 
> 
> --
> 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
> 
  
_
http://clk.atdmt.com/UKM/go/19780/direct/01/
Do you have a story that started on Hotmail? Tell us now


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



Re[2]: [PHP] opening link in new window

2010-07-24 Thread Andre Polykanine
Hi Rob and all,

   Btw, is there a way to do window.close without any questions of a
   browser? I know the only one: the window is generated via
   window.open.

-- 
With best regards from Ukraine,
Andre
Skype: Francophile; Wlm&MSN: arthaelon @ yandex.ru; Jabber: arthaelon @ 
jabber.org
Yahoo! messenger: andre.polykanine; ICQ: 191749952
Twitter: m_elensule

- Original message -
From: Robert Cummings 
To: Adam Richardson 
Date: Saturday, July 24, 2010, 5:20:03 PM
Subject: [PHP] opening link in new window

On 10-07-24 04:19 AM, Adam Richardson wrote:
>
> Code that resembled the below is how I used to open new windows before I
> started using jQuery  Note, this completely avoids use of the target
> attribute.
>
> function wireNewWindows(){
> if(document.getElementsByTagName){
>var anchors = document.getElementsByTagName("a");
>for(var i = 0; i<  anchors.length; i++){
>   var node = anchors[i];
>   if(node.getAttribute('rel') == 'external' ||
> node.getAttribute('rel') == 'nofollow'){
>  node.onclick = function(){
> var url = this.href;
> window.open(
>url,
>
>   'newWin','width=700,height=500,Menubar=yes,Toolbar=no,Location=no'
> );
> return false;
>  }
>   }
>}
> }
> }

I try to avoid window.open() due to the proliferation of popup blocking.

Cheers,
Rob.
-- 
E-Mail Disclaimer: Information contained in this message and any
attached documents is considered confidential and legally protected.
This message is intended solely for the addressee(s). Disclosure,
copying, and distribution are prohibited unless authorized.

-- 
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[2]: [PHP] Do you have some standard for defined the variable in program language?

2010-07-27 Thread Andre Polykanine
Hello viraj,

As for classes, it's suggested to start a class name with a capital:
class MyBestClass {
...
}

As for functions and class methods, there are lots of people who name
them like this:

function the_greatest_function_in_the_world () {
...
}

Maybe it's readable and great, but I have a little problem: I'm using
a screenreader, so the word "underscore" (and its Russian equivalent)
is too long for me. So I prefer

function TheGreatestFunctionInTheWorld () {
...
}

However, just discussed it with my wife. She prefers the same method
as me, though she doesn't use any screenreading software for
developing.

-- 
With best regards from Ukraine,
Andre
Skype: Francophile
Twitter: http://twitter.com/m_elensule

- Original message -
From: viraj 
To: a...@ashleysheridan.co.uk 
Date: Tuesday, July 27, 2010, 12:42:36 PM
Subject: [PHP] Do you have some standard for defined the variable in  program 
language?

$firstName is the most readable.. for variables.

does anybody have negative thoughts on using the same naming format
for method/function and for class names?

i guess it's worth sharing! many thanks!

~viraj

On Tue, Jul 27, 2010 at 3:02 PM, Ashley Sheridan
 wrote:
> On Tue, 2010-07-27 at 10:10 +0200, Jordan Jovanov wrote:
>
>> Hello Everybody
>>
>> I start to write PHP script and all veritable a defined without some
>> rules. I want to ask to you somebody know how is correct do different
>> some variable.
>>   Like from next three variable who is correct:
>> $firstname  $FirstName $firstName $first_name etc.
>>
>> I know that from this variable can work all, but i want to know how is
>> use in company.
>> Do you have some standard for defined the variable in program language?
>> (like ISO9001, ISO14001)
>>
>> Best Regard,
>> Jordan Jovanov
>>
>
>
> There is no enforced standard on how you define your variable names in
> PHP. However, you should try and remain consistent with whichever way
> you decide to use. Personally, I find the $firstName style the best of
> the four examples you gave. It's easily readable when I look over code
> at a later date, and slightly faster to type than $first_name (although
> even if only by a mere fraction of a second!)
>
> Some existing codebases might use a particular method though, and if
> you're working on a project with a team, then it really helps to all be
> using the same convention of naming variables.
>
> At the end of the day, this is all down to preference, along with code
> indentation and layout.
>
> Thanks,
> Ash
> http://www.ashleysheridan.co.uk
>
>
>

--
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 Reference

2010-08-14 Thread Andre Polykanine
Hello Karl,

If I understood you properly, try this:

-- 
With best regards from Ukraine,
Andre
Skype: Francophile
Twitter: http://twitter.com/m_elensule
Facebook: http://facebook.com/menelion

- Original message -
From: Karl DeSaulniers 
To: php-general 
Date: Saturday, August 14, 2010, 9:08:20 AM
Subject: [PHP] PHP Reference

Hello all,
I was wondering, can you reference php in a url string like you can  
javascript.
EG:
"javascript:someFunction()"

Can you do something similar in php like

"php:someFunction()"

I am thinking that you can not do this, but was wondering if there  
was something like that.
Thanks,


Karl DeSaulniers
Design Drumm
http://designdrumm.com



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



Re: [PHP] Re: How safe is a .htaccess file?

2010-08-19 Thread Andre Polykanine
Hello Nathan,

Sorry, could you provide any links to read for a security noob?)
Actually, I know that the md5 is decryptable (there are bases with
words encrypted in md5), but I thought the SHA1 was secure...
-- 
With best regards from Ukraine,
Andre
Skype: Francophile
Twitter: http://twitter.com/m_elensule
Facebook: http://facebook.com/menelion

- Original message -
From: Nathan Rixham 
To: tedd 
Date: Thursday, August 19, 2010, 12:03:12 PM
Subject: [PHP] Re: How safe is a .htaccess file?

tedd wrote:
> Hi gang:
> 
> The subject line says it all.
> 
> How secure is a .htaccess file to store passwords and other sensitive 
> stuff?
> 
> Can a .htaccess file be viewed remotely?

Semi-safe,

.htaccess is prevented from being served by configuration options (which 
come as default), however these can be overwritten so best to check by 
doing a GET on the resource URI.

This doesn't prevent them from being exposed via other processes though, 
for instance a poorly coded 'download.php?path=/path/to/.htaccess' could 
still expose the file.

Typically, its obviously better to store only a hash of a password 
rather than the pass in plain text, choosing the strongest algorithm you 
can; password security is of course relative though, a sha-512 of 
'password1' is far from secure.

A good way to approach encryption for files is to openssl_seal them 
using a public key which is only available to your application - this 
doesn't negate insecure code, but it at least ensures the raw files are 
encrypted securely enough to negate any of these worries. (just keep 
your private key safe, preferably in a pkcs12 w/a strong 64char+ pass)

Best,

Nathan

-- 
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] Making multiple RSS feeds for the blog website

2010-08-26 Thread Andre Polykanine
Hi everyone,
We are developing a blog service website.
What we need now is the ability to make multiple RSS feeds from
several pages (an RSS of each user's blog, a feed from each timeline -
timelines are our representation of users' favorites; a feed filled
with comments to a separate entry, etc.). What would be great is the
following: a user enters, say, in my blog and sees the mark that there
are RSS feeds. Then he/she clicks the mark or presses a keystroke
(Alt+J in IE8, for instance), finds the feed and double-clicks on it.
Then he/she can either read the feed or subscribe to it. The feeds
have usually file extensions of .rss or .xml.
Question: how do we do that with PHP?
Thanks!



-- 
With best regards from Ukraine,
Andre
Skype: Francophile
Twitter: http://twitter.com/m_elensule
Facebook: http://facebook.com/menelion


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



Re: [PHP] Re: Making multiple RSS feeds for the blog website

2010-08-27 Thread Andre Polykanine
Hello Michelle,

Hm. link rel="alternate"... that's a good one, thanks (btw, you say me
that I should RTFM, but if I knew what to read).
Now there are two questions:
1. How do I do those .RSS files with PHP? All of mmy blog entries and
other stuff are in MySql. There are classes that can echo the
appropriate data as RSS, but there will be more .PHP files, not
.RSS/.XML ones. So how do we manage that?
2. Should I make a separate .RSS file for each type of feeds (blog
feed, comments feed, timeline feed, news feed)?
thanks!

-- 
With best regards from Ukraine,
Andre
Skype: Francophile
Twitter: http://twitter.com/m_elensule
Facebook: http://facebook.com/menelion

- Original message -
From: Michelle Konzack 
To: php-general@lists.php.net 
Date: Friday, August 27, 2010, 3:31:58 AM
Subject: [PHP] Re: Making multiple RSS feeds for the blog website

Hello Andre Polykanine,

Am 2010-08-27 02:52:48, hacktest Du folgendes herunter:
> Hi everyone,
> We are developing a blog service website.

Very interesting  ;-)

> Question: how do we do that with PHP?

By reading the Documentation...  :-D



Blubber Blog
  
  
  




Thanks, Greetings and nice Day/Evening
Michelle Konzack

-- 
# Debian GNU/Linux Consultant ##
   Development of Intranet and Embedded Systems with Debian GNU/Linux

itsyst...@tdnet France EURL   itsyst...@tdnet UG (limited liability)
Owner Michelle KonzackOwner Michelle Konzack

Apt. 917 (homeoffice)
50, rue de Soultz Kinzigstraße 17
67100 Strasbourg/France   77694 Kehl/Germany
Tel: +33-6-61925193 mobil Tel: +49-177-9351947 mobil
Tel: +33-9-52705884 fix

<http://www.itsystems.tamay-dogan.net/>  <http://www.flexray4linux.org/>
<http://www.debian.tamay-dogan.net/> <http://www.can4linux.org/>

Jabber linux4miche...@jabber.ccc.de
ICQ#328449886

Linux-User #280138 with the Linux Counter, http://counter.li.org/


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



Re: [PHP] PHP, Soap, and WDSL

2010-09-02 Thread Andre Polykanine
Hello Gino,

  Just put at the end the following:

  echo $response;

  That will echo it into the browser.
-- 
With best regards from Ukraine,
Andre
Skype: Francophile
Twitter: http://twitter.com/m_elensule
Facebook: http://facebook.com/menelion

- Original message -
From: SBS Computers 
To: php-general@lists.php.net 
Date: Thursday, September 2, 2010, 10:16:26 PM
Subject: [PHP] PHP, Soap, and WDSL


Hi everyone,

I am trying to write a simple php page using an sdk. The SDK api contains all 
wsdl files which do all the work.

There's a soap.php which has all the functions and stores the output in 
$response.

My
 php page includes soap.php and a function. The function is handled by 
soap.php and it will get the date from the appropriate wdsl file and 
store it in $response. It is stored in xml format using utf-16.

If
 I run my php page frmo console, I get the output fine. If I run it from
 a browser, the page is empty but if I "view source", the date is there.

What do I need to do in my php page to get $response actually displayed in a 
browser.

Thanks

Gino  


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



[PHP] RegExp question: how to add a number?

2010-10-14 Thread Andre Polykanine
Hi everyone,
I hope you're doing well (haven't written here for a long time :-)).
The question is as follows: I have a regexp that would do the
following. If the string begins with "Re:", it will change the
beginning to "Re[2]:"; if it doesn't, then it would add "Re:" at the
beginning. But (attention, here it is!) if the string starts with
something like "Re[4]:", it should replace it by "Re[5]:".
Here's the code:

$start=mb_strtolower(mb_substr($f['Subject'], 0, 3));
if ($start=="re:") {
$subject=preg_replace("/^re:(.+?)$/usi", "re[2]:$1", $f['Subject']);
} elseif ($start=="re[") {
// Here $1+1 doesn't work, it returns "Re[4+1]:"!
$subject=preg_replace("/^re\[(\d+)\]:(.+?)$/usi", "re[$1+1]:$2", $f['Subject']);
} else {
$subject="Re: ".$f['Subject'];
}

I know there actually exists a way to do the numeral addition
("Re[5]:", not "Re[4+1]:").
How do I manage to do this?
Thanks!

-- 
With best regards from Ukraine,
Andre
Skype: Francophile
Twitter: http://twitter.com/m_elensule
Facebook: http://facebook.com/menelion


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



Re: [PHP] questions about if statements regarding a checkbox

2010-10-31 Thread Andre Polykanine
Hello Ben,

You should use isset:
if (isset($_POST['check'])) {
// The checkbox is checked
} else {
// It's unchecked
}

-- 
With best regards from Ukraine,
Andre
Skype: Francophile
Twitter: http://twitter.com/m_elensule
Facebook: http://facebook.com/menelion

- Original message -
From: Ben Brentlinger 
To: php-general@lists.php.net 
Date: Sunday, October 31, 2010, 4:05:06 AM
Subject: [PHP] questions about if statements regarding a checkbox

hello,

I'd like to know the proper code to use in a php script that processes a 
form with a checkbox in order to send one email if the checkbox has been 
checked and another email if the checkbox hasn't.  I tried if($check == 
true) and I tried putting the word "true" in double quotes, and both of 
them caused the "unexpected variable" syntax error.  The only problem 
is, all I could think to use was that line of code I just used, I'm not 
sure what the proper syntax is for checkbox when using the if statement 
to send one email when the checkbox is checked and a different email 
when it's not checked.  I'm wanting to send an email to the site admin 
with the information given by the person who filled out the form that 
contains the checkbox.


Thanks,

Ben

-- 
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] Open Source PHP/ mySQL Project Management

2010-11-11 Thread Andre Polykanine
Hello Don,

I would suggest Trac. It is written in Python, however I haven't seen
anything better for a while.
-- 
With best regards from Ukraine,
Andre
Skype: Francophile
Twitter: http://twitter.com/m_elensule
Facebook: http://facebook.com/menelion

- Original message -
From: Don Wieland 
To: php-general@lists.php.net 
Date: Friday, November 12, 2010, 12:23:11 AM
Subject: [PHP] Open Source PHP/ mySQL Project Management

Hi gang,

I am looking into Project Management apps for my projects. Any  
suggestions:

I am interested in tracking Projects, Milestones, Tickets, Files,  
Discussions, Documents, Time Tracking, etc... Also, would like to have  
the system have robust email integration Reminders, Email Ticket echos  
(where a user can reply it will post back into the PM system and echo  
back email to assigned users - with file attachments)

Suggestions? Thanks!

Don

-- 
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[2]: [PHP] Open Source PHP/ mySQL Project Management

2010-11-11 Thread Andre Polykanine
Hello Jonathan,

I tried to use Mantis, however it didn't send e-mails properly so I
gave up.
-- 
With best regards from Ukraine,
Andre
Skype: Francophile
Twitter: http://twitter.com/m_elensule
Facebook: http://facebook.com/menelion

- Original message -
From: Jonathan Tapicer 
To: Don Wieland 
Date: Friday, November 12, 2010, 3:00:32 AM
Subject: [PHP] Open Source PHP/ mySQL Project Management

Hi,

I don't know if it meets all of the features you enumerated but Mantis
(http://www.mantisbt.org/) is very good, and it is PHP+MySQL (or
Postgres, or MSSQL).

Jonathan

On Thu, Nov 11, 2010 at 7:23 PM, Don Wieland  wrote:
> Hi gang,
>
> I am looking into Project Management apps for my projects. Any suggestions:
>
> I am interested in tracking Projects, Milestones, Tickets, Files,
> Discussions, Documents, Time Tracking, etc... Also, would like to have the
> system have robust email integration Reminders, Email Ticket echos (where a
> user can reply it will post back into the PM system and echo back email to
> assigned users - with file attachments)
>
> Suggestions? Thanks!
>
> Don
>
> --
> 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 General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] question about preventing polling for more than once

2010-11-12 Thread Andre Polykanine
Hello ??,

Try to clean up your cookies. Maybe they set a cookie on your
computer.
-- 
With best regards from Ukraine,
Andre
Skype: Francophile
Twitter: http://twitter.com/m_elensule
Facebook: http://facebook.com/menelion

- Original message -
From: ?? 
To: php-general@lists.php.net 
Date: Friday, November 12, 2010, 5:14:49 PM
Subject: [PHP] question about preventing polling for more than once

I noticed that some websites such as
polldaddy has
fascinating poll service. And I am just curious about how it prevents user
from polling the same poll for more than once. Or more accurately, I am a
dynamic IP user. And I found that if I have polled once for a certain poll
and after some time, I changed my IP when I got connected to the Internet
again, I cannot poll the previous one for the second time. So I am confused
how polldaddy  can figure out that I
have polled even if I had changed my IP. Is there any way to achieve that?

Thanks in advance.


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



Re: [PHP] mysql help (sorry, a bit OT)

2010-11-19 Thread Andre Polykanine
Hello Gary,

Actually, what I do here is the following: I create a subdomain called
beta.mysite.com (for me it's http://beta.oire.org/ and
http://beta.gviragon.org/ :-)). There I have a copy of my database and
all of my files. The only difference is the mysql_select_db in the
connect.php file.
There I can easily test everything I need (including PHP files and
MySql queries) without any danger to crash the main release).
-- 
With best regards from Ukraine,
Andre
Skype: Francophile
Twitter: http://twitter.com/m_elensule
Facebook: http://facebook.com/menelion

- Original message -
From: Gary 
To: php-general@lists.php.net 
Date: Tuesday, November 16, 2010, 3:35:12 PM
Subject: [PHP] mysql help (sorry, a bit OT)

Is there a way to check the syntax of a query, short of running it? I've
got an insert to do (but of course it's a valid question for any query
that changes the db contents) and would like to know that the sql I am
generating (in php - see! not so off-topic!) is correct. 

What I don't want to do is run it for testing (live system *sigh*) and
find out it is correct (it will change the db), but... I have to test it
to check that the syntax (at least) *is* correct.


-- 
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] rewriteTextLinks.php - make URLs in plain text clickable

2010-11-22 Thread Andre Polykanine
Hello Yermo,

thanks a lot! I will try this on my project (http://oire.org/) and
I'll inform you if I modify it somehow.
-- 
With best regards from Ukraine,
Andre
Skype: Francophile
Twitter: http://twitter.com/m_elensule
Facebook: http://facebook.com/menelion

- Original message -
From: Yermo 
To: php-general@lists.php.net 
Date: Tuesday, November 23, 2010, 1:04:19 AM
Subject: [PHP] rewriteTextLinks.php - make URLs in plain text clickable

I'm posting this in the hopes that it will be of some use to someone.

I've put together a little regex function for finding and transforming 
links in blocks of plain text into clickable links while applying some 
heuristics to handle the more common edge cases.

Unlike so many solutions I've found online this one handles more edge 
cases including periods and commas at the end, surrounding parentheses, 
trailing periods on only the domain part, etc. etc.

http://formvista.com/fv-b-12-170/rewriteTextLinks-a-function-to-make-links-in-blocks-of-text--quot-clickable-quot-.html

---
Yermo LamersDTLink, LLC
Software Developerhttp://www.dtlink.com

http://miles-by-motorcycle.comFor Motorcycle Travellers
http://formvista.comEntrepreneurs CMS and Business Platform
---

-- 
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[2]: [PHP] Redirect output to a file on the web server

2010-12-06 Thread Andre Polykanine
Hello Steve,

Btw, the built-in mail() function is to slow to send such amount
of mail. Consider using SMTP (if you don't).
-- 
With best regards from Ukraine,
Andre
Skype: Francophile
Twitter: http://twitter.com/m_elensule
Facebook: http://facebook.com/menelion

- Original message -
From: Steve Staples 
To: php-general@lists.php.net 
Date: Monday, December 6, 2010, 6:41:34 PM
Subject: [PHP] Redirect output to a file on the web server

On Mon, 2010-12-06 at 16:19 +, Richard Quadling wrote:
> On 6 December 2010 15:46, Ferdi  wrote:
> > On 6 December 2010 20:47, Steve Staples  wrote:
> >
> >> On Mon, 2010-12-06 at 20:29 +0530, Ferdi wrote:
> >> > Greetings List members,
> >> >
> >> > I have a script that takes quite a while to run, one or two hours, I wish
> >> to
> >> > redirect the normal php output to a file on the webserver itself. I don't
> >> > mind if in the process, the browser displays a blank page. The reason I
> >> want
> >> > to do this is that if the script crashes or the browser Is closed by
> >> > mistake, I have absolutely no record of where the script stopped running.
> >> >
> >> > I could use code like below
> >> > At the beginning of the script:
> >> > ob_start();
> >> >
> >> > At the end of the script:
> >> > $page = ob_get_contents();
> >> > ob_end_flush();
> >> > $fp = fopen("output.html","w");
> >> > fwrite($fp,$page);
> >> > fclose($fp);
> >> >
> >> > However, I see some problems with this:
> >> > I'm not too sure of the size of the output. It may balloon to over the
> >> > buffering limit (in PHP? Apache?) and then what happens?
> >> > Secondly, if the script crashes before the end, I won't get any output.
> >> > Finally, I am using a library in the script that outputs status and error
> >> > messages of its own. So, if I manually opened a file and used fwrite()
> >> > alongside echo for my messages, I would lose out on those messages.
> >> >
> >> > Anybody has any pointers on how you could send the output not only to a
> >> > browser, but also to a file on the webserver? If not, at least to a file?
> >> >
> >> > Thanks and regards,
> >> > Ferdi
> >>
> >> Just curious, but if it takes that long to run, why are you running it
> >> from a browser?  why not run it from the commandline, that way you dont
> >> have to change your php.ini for the webserver (increasing the timeout,
> >> memory limits, etc etc... you can change those for the CLI only?
> >>
> >> 2 hours is a long time to "hope" that the browser doesn't close, or
> >> connectivity doesn't get interupted for even 1 microsecond...
> >>
> >> if the script has "breaks" in it, where it starts to do something else,
> >> you can put in an email to yourself, to say "hey, we're HERE now"
> >>
> >> but i would look into running it from the CLI over the webserver, you
> >> would be less likely to run into issues on something that takes that
> >> amount of time to run.
> >>
> >> If you needed the output to be displayed on a webpage, you can write the
> >> progress to a file, and then have a php webpage that reads the file, and
> >> using ajax or whatever, refresh the content.
> >>
> >> good luck in your script, and if you still run it from the browser, and
> >> need to output to a file, then i would continually be writing content to
> >> that file, every time you do soemthing, or start another part of the
> >> script so you know EXACTLY where you are, at all times...
> >>
> >> Steve
> >>
> >
> > Hi Steve,
> >
> > Thanks for the tips. To answer your queries, I don't mind using CLI. How do
> > I then ensure the messages, error or otherwise, output by the library I use,
> > show up in the file I'm outputting to? Please note that I only make calls to
> > the functions and object methods from this library and error or success
> > messages are probably echo'd by the code from the library.
> >
> > I believe some context is in order. I am actually sending an email to a
> > large number of our customers (around 10,000), each with the customer's
> > name.
> >
> > My script does output a simple success or failure message. The library
> > outputs more technical info. All I would like to know is which email got
> > sent and which one failed. As you point out, I could write the success /
> > failure messages to a file, but, I would also like to capture the messages
> > output by the library.
> >
> > Thanks and regards,
> > Ferdi
> >
> 
> I would log the success/failure with the data (assuming it is coming from a 
> DB).
> 
> If not, you could use a simple file_put_contents($filename, date('r')
> . $text . PHP_EOL, FILE_APPEND);
> 
> That would append 1 line of text at a time to the file. Using tail on
> that file would show you the last work done (and when it was done).
> 
> 
> -- 
> Richard Quadling
> Twitter : EE : Zend
> @RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY
> 

if you're using a linux based server, you could log (like Richard said)
each success / failure to the file, or each to its own success / failure
file, and then i

Re: [PHP] empty() in email message

2010-12-13 Thread Andre Polykanine
Hello Gary,

Try using this:
if (!empty($beefolives)) $msg.="Order: beef olives";
or:
$msg.=empty($beefolives)? "": "Order: beef olives";

-- 
With best regards from Ukraine,
Andre
Skype: Francophile
Twitter: http://twitter.com/m_elensule
Facebook: http://facebook.com/menelion

- Original message -
From: Gary 
To: php-general@lists.php.net 
Date: Monday, December 13, 2010, 7:47:49 PM
Subject: [PHP] empty() in email message

I have an email message

$msg =  'Name: $fname ' . ' $lname\n'
. "Phone: $phone\n"
. "Email: $email\n"

and it works fine, however in this message there are about 30 variables that 
are being called...as such

. "Order: beefschnitzel $beefschnitzel\n"
. "Order: beefstrips $beefstrips\n"
. "Order: cheesesausage $cheesesausage\n"
. "Order: crumbedsausage $crumbedsausage\n"
. "Order: chucksteak $chucksteak\n"
. "Order: cornedbeef $cornedbeef\n"
. "Order: dicedsteak $dicedsteak\n"
. "Order: filletmignon $filletmignon\n"

I want to only send the message if the submitter enters an amount in the 
form for the corresponding variable, instead of having a bunch of empty 
messages.  So I have been trying to use the empty() function as such:

. if empty($beefolives){''} elseif (isset($beefolives)) { 'Order: beefolives 
$beefolives\n'}

But I am getting the error

Parse error: syntax error, unexpected T_IF

Can someone point me in the right direction?

Thank you
-- 
Gary 



__ Information from ESET Smart Security, version of virus signature 
database 5699 (20101213) __

The message was checked by ESET Smart Security.

http://www.eset.com





-- 
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] Common session for all subdomains?

2010-12-20 Thread Andre Polykanine
Hello php-general,
I've got a question: I have a site http://oire.org/. Then we started
developing some applications at http://apps.oire.org/.
How can I manage it in the way so the session valid at
http://oire.org/ would be also valid at http://apps.oire.org/?
Thanks!
-- 
With best regards from Ukraine,
Andre
Skype: Francophile
Twitter: http://twitter.com/m_elensule
Facebook: http://facebook.com/menelion


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



[PHP] About sessions and subdomains

2012-06-02 Thread Andre Polykanine
Hi everyone,
Sorry, this might be a stupid question, but still.
Once  upon  a  time  I  had  done  so  my sessions were handled on all
subdomains of my website (shame on me for doing so!).
Now, when I comment out the line
session_set_cookie_params(0, "/", ".oire.org");
in  my  header  file,  I got an empty $_SESSION array after submitting
every single form on my website.
For  sure,  signing  out and back in, as well as cookie removing, were
tried several times.
Thanks in advance!

-- 
With best regards from Ukraine,
Andre
Skype: Francophile
Blog: http://oire.org/menelion
Twitter: http://twitter.com/m_elensule
Facebook: http://facebook.com/menelion


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



Re: [PHP] email address syntax checker

2011-01-20 Thread Andre Polykanine
Hej Nisse,

Me thinks it isn't a valid address :-).


-- 
With best regards from Ukraine,
Andre
Skype: Francophile
My blog: http://oire.org/menelion (mostly in Russian)
Twitter: http://twitter.com/m_elensule
Facebook: http://facebook.com/menelion

 Original message 
From: Nisse Engström 
To: php-general@lists.php.net
Date created: , 2:25:01 AM
Subject: [PHP] email address syntax checker


  On Thu, 20 Jan 2011 19:03:22 +0530, Nilesh Govindarajan wrote:

> Well, I had created an email validator long ago, after a neat research 
> on Google, reading RFCs, etc.
> I don't guarantee that it's without bugs, but it has been correct for me 
> in all valid & invalid email addresses I used for test.
> 
> Code:
> 
>  
> function checkMail($mail) {
> 
>if(strlen($mail) <= 0) {
>  return false;
>}
> 
>$split = explode('@', $mail);
> 
>if(count($split) > 2) {
>  return false;
>}

<"@"@example.com> is not a valid address?


/Nisse

-- 
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] Simplifying MySql queries

2011-02-12 Thread Andre Polykanine
Hi all,
I'm using in my PHP script the following four MySql queries:
$q1=mysql_query("SELECT *FROM`CandidateQuestions`WHERE
`Category`='1' ORDER BY RAND() LIMIT 1");
$q2=mysql_query("SELECT *FROM`CandidateQuestions`WHERE
`Category`='2' ORDER BY RAND() LIMIT 1");
$q3=mysql_query("SELECT *FROM`CandidateQuestions`WHERE
`Category`='3' ORDER BY RAND() LIMIT 1");
$q4=mysql_query("SELECT *FROM`CandidateQuestions`WHERE
`Category`='4' ORDER BY RAND() LIMIT 1");

and  here  goes the question: is there a way to make these four in one
so  strictly  one  random  question  is  selected from all of the four
categories?
Thanks!

-- 
With best regards from Ukraine,
Andre
Skype: Francophile
Twitter: http://twitter.com/m_elensule
Facebook: http://facebook.com/menelion


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



Re: [PHP] Howdy (new in here)

2011-02-15 Thread Andre Polykanine
Hello David,

As   for   me,   I  use  K&R style, also. I find it the most readable,
accessible and maintainable.

-- 
With best regards from Ukraine,
Andre
Skype: Francophile
My blog: http://oire.org/menelion (mostly in Russian)
Twitter: http://twitter.com/m_elensule
Facebook: http://facebook.com/menelion

 Original message 
From: David Harkness 
To: sstap...@mnsi.net
Date created: , 12:00:52 AM
Subject: [PHP] Howdy (new in here)


  
On Tue, Feb 15, 2011 at 1:08 PM, Steve Staples  wrote:

> My personal bracing style is the Allman Style.
>

I use K&R. I started with it just as shown but as monitors increased in size
I stopped cuddling the else so it's now on its own line, aligning the if,
elseif, and else nicely. One of the developers at my company uses the
truly abominable Horstmann style which makes moving code around a serious
PITA. :(

David


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



Re: [PHP] Custom function

2011-02-15 Thread Andre Polykanine
Hello Ron,

Give it a default (possible empty) value:

function MyFunction($x, $y, $z="") {
// function goes here
if (!empty($z)) {
// The optional parameter is given
}
}

-- 
With best regards from Ukraine,
Andre
Skype: Francophile
My blog: http://oire.org/menelion (mostly in Russian)
Twitter: http://twitter.com/m_elensule
Facebook: http://facebook.com/menelion

 Original message 
From: Ron Piggott 
To: php-general@lists.php.net
Date created: , 1:32:16 AM
Subject: [PHP] Custom function


  
Is there a way to make an optional flag in a custom function --- 2 parameters 
required, 1 optional?  Ron

The Verse of the Day
“Encouragement from God’s Word”
http://www.TheVerseOfTheDay.info


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



Re: [PHP] Custom function

2011-02-15 Thread Andre Polykanine
Hello Mark,

Hm... will

if ($z)

evaluate to true if $z==0?
I thought no...

Actually, we can use

if (isset($z))

-- 
With best regards from Ukraine,
Andre
Skype: Francophile
My blog: http://oire.org/menelion (mostly in Russian)
Twitter: http://twitter.com/m_elensule
Facebook: http://facebook.com/menelion

 Original message 
From: Mark Kelly 
To: php-general@lists.php.net
Date created: , 2:21:36 AM
Subject: [PHP] Custom function


  
Hi.

On Tuesday 15 Feb 2011 at 23:41 Andre Polykanine wrote:

> Give it a default (possible empty) value:
>
> function MyFunction($x, $y, $z="") {
> // function goes here
> if (!empty($z)) {
> // The optional parameter is given
> }
> }

Using an empty string and the empty() function in this way can lead to subtle 
and hard to find bugs - for example if $z = 0, the code will not be executed. 
Note the list of things that are considered empty:

http://uk.php.net/manual/en/function.empty.php

Instead, consider setting the default value for $z to boolean false:

function MyFunction ($x, $y, $z = FALSE) {
  if ($z) {
// do stuff with $z
  }
}

In this way almost any value in $z will trigger the conditional code, 
including 0 or an empty string. The exceptions are FALSE and NULL. If you 
explicitly need to react to a NULL value, use is_null() to detect it. 

Cheers,

Mark

-- 
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] Howdy (new in here)

2011-02-16 Thread Andre Polykanine
Hello Micky,

And I prefer this:

if ($foo==$baz)
:-).  I  don't know if it's kosher not to put spaces around the == but
still...
-- 
With best regards from Ukraine,
Andre
Skype: Francophile
My blog: http://oire.org/menelion (mostly in Russian)
Twitter: http://twitter.com/m_elensule
Facebook: http://facebook.com/menelion

 Original message 
From: Micky Hulse 
To: php-general@lists.php.net
Date created: , 3:43:57 AM
Subject: [PHP] Howdy (new in here)


  On Tue, Feb 15, 2011 at 2:00 PM, David Harkness
 wrote:
> I use K&R. I started with it just as shown but as monitors increased in size
> I stopped cuddling the else so it's now on its own line, aligning the if,
> elseif, and else nicely. One of the developers at my company uses the
> truly abominable Horstmann style which makes moving code around a serious

K&R here, unless existing guidelines are in place... CodeIgniter
framework and ExpressionEngine wants folks to use Allman.

I use a programming lang called Objectscript at work, and it will give
an error if there is not space between the "if" and the first "("...
For example:

if(...) <-- errors out.

I have had to learn to put a space in there:

if (...)

So I don't forget, I do this for everything now... I actually kinda
like the breathing room now.

Speaking of spaces, I am not a fan of putting spaces around the argument:

if ( foo == baz ) {

I definitely prefer this:

if (foo == baz) {

More on spaces: I am so glad that most PHP folks I know use tabs for
indentation and not spaces! Oops, did I just go there? Oh no I didn't!

Good thread! Thanks for that link Tedd!

Cheers,
Micky

-- 
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] errors after upgrade vom 5.2.10 to 5.3.0 howto solve or hide?

2011-02-16 Thread Andre Polykanine
Hello Fotoo,

   http://oire.org/menelion (mostly in Russian)
Twitter: http://twitter.com/m_elensule
Facebook: http://facebook.com/menelion

 Original message 
From: fo...@gmx.de 
To: php-general@lists.php.net
Date created: , 11:12:13 AM
Subject: [PHP] errors after upgrade vom 5.2.10 to 5.3.0  howto solve or hide?


  Hi everyone!


after upgrading vomn php 5.2.10 to 5.3.0 I get a lot of errors. I changed 
already in some files ereg_replace() to  preg_replace(), but it generates more 
errors as you can see.

The typo3 installation ins still working. 

So - how can I prevent php from printing out this errors on the beginning at 
the website?

display_errors = Off   in  php.ini


Any Ideas?
Greetz.





Warning: preg_replace() [function.preg-replace]: Delimiter must not be 
alphanumeric or backslash in /typo3_src-3.8.1/t3lib/class.t3lib_page.php on 
line 436

Warning: preg_replace() [function.preg-replace]: Delimiter must not be 
alphanumeric or backslash in /typo3_src-3.8.1/t3lib/class.t3lib_page.php on 
line 438

Warning: preg_replace() [function.preg-replace]: Delimiter must not be 
alphanumeric or backslash in /typo3_src-3.8.1/t3lib/class.t3lib_page.php on 
line 441

Deprecated: Function ereg_replace() is deprecated in 
/typo3_src-3.8.1/t3lib/class.t3lib_matchcondition.php on line 527

Deprecated: Function ereg_replace() is deprecated in 
/typo3_src-3.8.1/t3lib/class.t3lib_matchcondition.php on line 527

Deprecated: Function ereg() is deprecated in 
/typo3_src-3.8.1/t3lib/class.t3lib_div.php on line 801

Deprecated: Function ereg() is deprecated in 
/typo3_src-3.8.1/t3lib/class.t3lib_div.php on line 809

Deprecated: Function ereg() is deprecated in 
/typo3_src-3.8.1/t3lib/class.t3lib_div.php on line 801

Deprecated: Function ereg() is deprecated in 
/typo3_src-3.8.1/t3lib/class.t3lib_div.php on line 809

Deprecated: Function ereg() is deprecated in 
/typo3_src-3.8.1/t3lib/class.t3lib_div.php on line 801

Deprecated: Function ereg() is deprecated in 
/typo3_src-3.8.1/t3lib/class.t3lib_div.php on line 809

Deprecated: Function ereg() is deprecated in 
/typo3_src-3.8.1/typo3/sysext/cms/tslib/class.tslib_content.php on line 2748

Deprecated: Function ereg() is deprecated in 
/typo3_src-3.8.1/typo3/sysext/cms/tslib/class.tslib_content.php on line 2752

Deprecated: Function ereg() is deprecated in 
/typo3_src-3.8.1/t3lib/class.t3lib_div.php on line 801

Deprecated: Function ereg() is deprecated in 
/typo3_src-3.8.1/t3lib/class.t3lib_div.php on line 809

Deprecated: Function ereg() is deprecated in 
/typo3_src-3.8.1/t3lib/class.t3lib_stdgraphic.php on line 2097

Deprecated: Function ereg() is deprecated in 
/typo3_src-3.8.1/t3lib/class.t3lib_stdgraphic.php on line 2164

Deprecated: Function ereg() is deprecated in 
/typo3_src-3.8.1/t3lib/class.t3lib_div.php on line 801

Deprecated: Function ereg() is deprecated in 
/typo3_src-3.8.1/t3lib/class.t3lib_div.php on line 809

Deprecated: Function ereg() is deprecated in 
/typo3_src-3.8.1/t3lib/class.t3lib_stdgraphic.php on line 2097

Deprecated: Function ereg() is deprecated in 
/typo3_src-3.8.1/t3lib/class.t3lib_stdgraphic.php on line 2164

Deprecated: Function spliti() is deprecated in 
/typo3_src-3.8.1/t3lib/class.t3lib_parsehtml.php on line 227

Deprecated: Function eregi_replace() is deprecated in 
/typo3_src-3.8.1/t3lib/class.t3lib_div.php on line 1583

Deprecated: Function eregi_replace() is deprecated in 
/typo3_src-3.8.1/t3lib/class.t3lib_div.php on line 1585

Deprecated: Function split() is deprecated in 
/typo3_src-3.8.1/t3lib/class.t3lib_div.php on line 1598

Deprecated: Function ereg_replace() is deprecated in 
/typo3_src-3.8.1/t3lib/class.t3lib_div.php on line 1558

Deprecated: Function eregi_replace() is deprecated in 
/typo3_src-3.8.1/t3lib/class.t3lib_div.php on line 1583

Deprecated: Function eregi_replace() is deprecated in 
/typo3_src-3.8.1/t3lib/class.t3lib_div.php on line 1585

Deprecated: Function split() is deprecated in 
/typo3_src-3.8.1/t3lib/class.t3lib_div.php on line 1598

Deprecated: Function ereg_replace() is deprecated in 
/typo3_src-3.8.1/t3lib/class.t3lib_div.php on line 1558

Deprecated: Function eregi_replace() is deprecated in 
/typo3_src-3.8.1/t3lib/class.t3lib_div.php on line 1583

Deprecated: Function eregi_replace() is deprecated in 
/typo3_src-3.8.1/t3lib/class.t3lib_div.php on line 1585

Deprecated: Function split() is deprecated in 
/typo3_src-3.8.1/t3lib/class.t3lib_div.php on line 1598

Deprecated: Function split() is deprecated in 
/typo3_src-3.8.1/t3lib/class.t3lib_div.php on line 1598

Deprecated: Function ereg_replace() is deprecated in 
/typo3_src-3.8.1/t3lib/class.t3lib_div.php on line 1558

Deprecated: Function ereg_replace() is deprecated in 
/typo3_src-3.8.1/t3lib/class.t3lib_div.php on line 1558

Deprecated: Function eregi_replace() is deprecated in 
/typo3_src-3.8.1/t3lib/class.t3lib_div.php on line 1583

Deprecated: Function eregi_replace() is deprecated in 
/typo3_src-3.8.1

Re: [PHP] Custom function

2011-02-16 Thread Andre Polykanine
Hello Peter,

So is
func_get_args()
 the unique way?

-- 
With best regards from Ukraine,
Andre
Skype: Francophile
My blog: http://oire.org/menelion (mostly in Russian)
Twitter: http://twitter.com/m_elensule
Facebook: http://facebook.com/menelion

 Original message 
From: Peter Lind 
To: Dan Schaefer
Date created: , 10:21:20 PM
Subject: [PHP] Custom function


  On 16 February 2011 21:00, Dan Schaefer  wrote:
> In my code, I set the optional parameter to NULL and check for triple equals
> "===" or "!==" to see if the variable has been passed with a value. IMO,
> this is the safest way.
>
> function MyFunction($x, $y, $z=NULL) {
> if ($z !== NULL) {
> // Do Something
> }
> }

In case you're actually trying to test if a variable was passed or not
that doesn't work (as it doesn't detect NULL passed in). Use
func_get_args() as that gives you any and all arguments passed to the
function, excluding defaults.

That said, if you're making use of optional parameters and need to
check if anything was passed in, you're almost certainly doing things
wrong.

Regards
Peter

-- 

WWW: plphp.dk / plind.dk
LinkedIn: plind
BeWelcome/Couchsurfing: Fake51
Twitter: kafe15


-- 
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] Submitting data to MySQL database using HTML/PHP form

2011-02-20 Thread Andre Polykanine
Hello Nazish,

first  of  all, I'd suggest you to remove all of the quotes around the
variables:

mysql_connect($host, $user, $password) or die("could not connect!");

the same is to be done with the query itself.

Second, add an "or die" to the query:
mysql_query($insert)  or  die  ("Unable  to  add user to the database:
".mysql_error());

This  way  you'll know what exactly _MySql_ says for an error if there
is any.

and third just tiny thing... it's not >? but ?> :-).

-- 
With best regards from Ukraine,
Andre
Skype: Francophile
My blog: http://oire.org/menelion (mostly in Russian)
Twitter: http://twitter.com/m_elensule
Facebook: http://facebook.com/menelion

 Original message 
From: Nazish 
To: php-general@lists.php.net
Date created: , 7:44:24 PM
Subject: [PHP] Submitting data to MySQL database using HTML/PHP form


  Hi there,

I am creating a login page for my website. The users' information will be
stored in a MySQL database. I have a registration form on my home page, and
a separate file called "login.php" to process the user values. However, the
entries are not going to the MySQL database (however, the values can be
entered successfully using the command line).

I'd appreciate your insight on why the form entries are not making their way
to the MySQL database. Much thanks in advance!

This is the code for the form:


  Username: 
Password: 



This is the code in login.php:

?

It's a simple form which I will develop further once the basic submission
process has been ironed out... Thanks again for any insight!


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



Re: [PHP] Submitting data to MySQL database using HTML/PHP form

2011-02-20 Thread Andre Polykanine
Hello Nazish,

Try to do the following in your login.php:

$login$password$insert";

 So we'll see the result.

-- 
With best regards from Ukraine,
Andre
Skype: Francophile
My blog: http://oire.org/menelion (mostly in Russian)
Twitter: http://twitter.com/m_elensule
Facebook: http://facebook.com/menelion

 Original message 
From: Nazish 
To: php-general@lists.php.net
Date created: , 10:04:07 PM
Subject: [PHP] Submitting data to MySQL database using HTML/PHP form


  Thanks everyone! However, when I click the "submit" button, the url simply
moves to http://localhost/login.php (from home.php) and it is a blank page
(apart from asking whether it should remember the password for future use).
The values still do not move to the database.

I included most of your suggestions

a) added mysql _error()
b) different names for the variables
c) removed double quotes
d) changed ?> (silly error!)
e) modified the $insert query

The code now looks like this:




I could insert the values using the command line, and it was updated in
MySQL, but it doesn't work through the form... it just goes to a blank page
on login.php. I'd appreciate any insights on why that's happening.


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



Re: [PHP] Submitting data to MySQL database using HTML/PHP form

2011-02-20 Thread Andre Polykanine
Hello Nazish,

Echo the $insert variable.

-- 
With best regards from Ukraine,
Andre
Skype: Francophile
My blog: http://oire.org/menelion (mostly in Russian)
Twitter: http://twitter.com/m_elensule
Facebook: http://facebook.com/menelion

 Original message 
From: Nazish 
To: php-general@lists.php.net
Date created: , 10:53:35 PM
Subject: [PHP] Submitting data to MySQL database using HTML/PHP form


  Update:

I added "echo" statements after mysql_connect and mysql_select_db to check
where the code was broken. These statements show up on the login.php page
after submitting the form, which means the MySQL connection works. So, the
problem seems to lie with the *$insert *query... ideas?


On Sun, Feb 20, 2011 at 3:04 PM, Nazish  wrote:

> Thanks everyone! However, when I click the "submit" button, the url simply
> moves to http://localhost/login.php (from home.php) and it is a blank page
> (apart from asking whether it should remember the password for future use).
> The values still do not move to the database.
>
> I included most of your suggestions
>
> a) added mysql _error()
> b) different names for the variables
> c) removed double quotes
> d) changed ?> (silly error!)
> e) modified the $insert query
>
> The code now looks like this:
>
>
> 
> // Connect to server and select database.
> $host = "localhost";
> $user = "root";
> $mysql_pass = "abc";
> $db = "directory";
>
> mysql_connect($host, $user, $mysql_pass) or die(mysql_error());
>
> mysql_select_db($db) or die(mysql_error());
>
> // username and password sent to mysql database
>
>
> $login = $_POST['login'];
> $password = $_POST['password'];
>
> $insert = "INSERT INTO user_info
>(login, password)
> VALUES
>
> ('".mysql_real_escape_string($login)."',"'.mysql_real_escape_string($password)."')";
>
>
> mysql_query($insert)
> or  die  ("Unable  to  add user to the database:".mysql_error());
>
> ?>
>
>
> I could insert the values using the command line, and it was updated in
> MySQL, but it doesn't work through the form... it just goes to a blank page
> on login.php. I'd appreciate any insights on why that's happening.
>
>


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



Re: [PHP] Submitting data to MySQL database using HTML/PHP form

2011-02-20 Thread Andre Polykanine
Hello Tamara,

:-)) I assume that was a testcase...

-- 
With best regards from Ukraine,
Andre
Skype: Francophile
My blog: http://oire.org/menelion (mostly in Russian)
Twitter: http://twitter.com/m_elensule
Facebook: http://facebook.com/menelion

 Original message 
From: Tamara Temple 
To: PHP General
Date created: , 12:27:46 AM
Subject: [PHP] Submitting data to MySQL database using HTML/PHP form


  I'm wondering if anyone is going to comment on the transmittal and  
storage of plain text passwords


-- 
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] mysql_num_rows()

2011-02-22 Thread Andre Polykanine
Hello Gary,

Please wrap $i in braces in your variable variable:

if ( isset($_POST["county{$i}"] ) ) {
echo "You have chosen ". $_POST["county{$i}"]." ";

-- 
With best regards from Ukraine,
Andre
Skype: Francophile
My blog: http://oire.org/menelion (mostly in Russian)
Twitter: http://twitter.com/m_elensule
Facebook: http://facebook.com/menelion

 Original message 
From: Gary 
To: php-general@lists.php.net
Date created: , 7:40:48 AM
Subject: [PHP] mysql_num_rows()


  Can someone tell me why this is not working?  I do not get an error 
message, 
the results are called and echo'd to screen, the count does not work, I get 
a 0 for a result...



$result = mysql_query("SELECT * FROM `counties` WHERE name = 'checked'") or 
die(mysql_error());

if ( isset($_POST['submit']) ) {
for($i=1; $i<=$_POST['counties']; $i++) {
if ( isset($_POST["county$i"] ) ) {
echo "You have chosen ". $_POST["county$i"]." ";
}
}
}

$county_total=mysql_num_rows($result);

while($row = mysql_fetch_array($result))
{$i++;
echo $row['name'];
}
$county_total=mysql_num_rows($result);
echo "$county_total";

echo 'You Have '  .  "$county_total"  .  ' Counties ';

?>
-- 
Gary 



__ Information from ESET Smart Security, version of virus signature 
database 5894 (20110221) __

The message was checked by ESET Smart Security.

http://www.eset.com





-- 
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] Resizing an image

2011-03-28 Thread Andre Polykanine
Hi everyone,
Image  processing  is  a part of Php language completely unknown to me
:-(.
So   there  is  my task: I need to process an uploaded image. We allow
uploading  of  gif,  jpeg,  and  png images. If an image is wider than
600px, it should be proportionally resized to the width of 600px.
Yes, I've just read about ImageCopyResampled().
My questions are:
1.  what  are the restrictions of ImageCopyResampled()? Can I make a jpg
image  from  a jpg one, and a png image from a png one? And what about
gif's?
2.  I  don't  need to output the image as the script output, I need to
upload it as a file (replacing the uploaded larger file). Could I make
it with fwrite and then copy it to the server? All of the examples give 
header("image/jpeg")...
Thanks!

-- 
With best regards from Ukraine,
Andre
Skype: Francophile
Twitter: http://twitter.com/m_elensule
Facebook: http://facebook.com/menelion


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



[PHP] Config files: what is best? (was: Re: [PHP] XML... Useful or another layer of complexity?)

2011-04-03 Thread Andre Polykanine
Hello Peter,

Just because you mentioned config files.
What  would  you suggest me as better format for them? Database is not
available  yet  since  I  need to make a config file before creating a
database.

-- 
With best regards from Ukraine,
Andre
Skype: Francophile
My blog: http://oire.org/menelion (mostly in Russian)
Twitter: http://twitter.com/m_elensule
Facebook: http://facebook.com/menelion

 Original message 
From: Peter Lind 
To: Per Jessen
Date created: , 10:27:09 PM
Subject: [PHP] XML... Useful or another layer of complexity?


  Like every other technology, XML needs to have a use before it becomes
a useful tool. Just using XML because it's available quickly leads to
headaches, as it isn't the best tool for all scenarios (config files
written in XML for instance). That said, XML is awesome for a lot of
things ... however, without having a better grasp of XML you're
unlikely to know whether it'll fit your needs.

If for no other reason, learning XML and related technologies is worth
it simply because the rest of the world uses it. So get to know it,
then you'll be able to actually judge if your project can benefit from
it.

Regards
Peter

-- 

WWW: plphp.dk / plind.dk
LinkedIn: plind
BeWelcome/Couchsurfing: Fake51
Twitter: kafe15


-- 
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: Config files: what is best? (was: Re: [PHP] XML... Useful or another layer of complexity?)

2011-04-03 Thread Andre Polykanine
Hello Peter,

Thanks a lot! And is there a way to set (write) custom values in files
other than php.ini? Sorry, didn't find such a function.

-- 
With best regards from Ukraine,
Andre
Skype: Francophile
My blog: http://oire.org/menelion (mostly in Russian)
Twitter: http://twitter.com/m_elensule
Facebook: http://facebook.com/menelion

 Original message 
From: Peter Lind 
To: Andre Polykanine
Date created: , 10:44:31 PM
Subject: [PHP] Re: Config files: what is best? (was: Re: [PHP] XML... Useful or 
another layer of complexity?)


  On 3 April 2011 21:41, Andre Polykanine  wrote:
> Hello Peter,
>
> Just because you mentioned config files.
> What  would  you suggest me as better format for them? Database is not
> available  yet  since  I  need to make a config file before creating a
> database.

For config files I would suggest plain text config files - in the style of

key = value

php has built-in functions for reading those, so parsing them is very
fast and easy. See
http://dk2.php.net/manual/en/function.parse-ini-file.php

Regards
Peter

-- 

WWW: plphp.dk / plind.dk
LinkedIn: plind
BeWelcome/Couchsurfing: Fake51
Twitter: kafe15


-- 
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] Last Name extraction in query

2011-04-04 Thread Andre Polykanine
Hello Geoff,

As  I  dislike forums and like mailing lists (yes, an old habbit :-)),
so here it is:
mysql-subscr...@lists.mysql.com
(that's for subscribing, indeed).
And sorry for the offtopic.

-- 
With best regards from Ukraine,
Andre
Skype: Francophile
My blog: http://oire.org/menelion (mostly in Russian)
Twitter: http://twitter.com/m_elensule
Facebook: http://facebook.com/menelion

 Original message 
From: Geoff Lane 
To: php-general@lists.php.net
Date created: , 7:46:26 PM
Subject: [PHP] Last Name extraction in query


   On Monday, April 4, 2011, Jim Giner wrote:

> Actually - I can't seem to find a mysql newsgroup anywhere.  The
> ones that  come up in google search are all dead and buried.

You could try http://forums.mysql.com/ or have a look around Yahoo
groups (e.g. php_my...@yahoogroups.com).

HTH,

-- 
Geoff


-- 
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] the best 1 book for php

2011-04-07 Thread Andre Polykanine
Hello Kirk,

Php manual from php.net :-).


-- 
With best regards from Ukraine,
Andre
Skype: Francophile
My blog: http://oire.org/menelion (mostly in Russian)
Twitter: http://twitter.com/m_elensule
Facebook: http://facebook.com/menelion

 Original message 
From: Kirk Bailey 
To: PHP General
Date created: , 7:15:40 AM
Subject: [PHP] the best 1 book for php


  If I only had 1 book on php, what would it be?

-- 
end

Very Truly yours,
  - Kirk Bailey,
Largo Florida

kniht
   +-+
   | BOX |
   +-+
think


-- 
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] Destroying cookies... not working

2011-04-27 Thread Andre Polykanine
Hello Rick,

Pay attention how you did set the cookie.
When I tried to unset the cookie using only three parameters, I got no
luck because I had set it using five:
setCookie ("mycookie", "", time()-32557600, '/', '.oire.org');

-- 
With best regards from Ukraine,
Andre
Skype: Francophile
My blog: http://oire.org/menelion (mostly in Russian)
Twitter: http://twitter.com/m_elensule
Facebook: http://facebook.com/menelion

 Original message 
From: Rick Dwyer 
To: php-general@lists.php.net
Date created: , 2:16:43 AM
Subject: [PHP] Destroying cookies... not working


  Hello all.

I have a logout page that should be destroying cookies when loaded...  
but it is not.

setcookie("mycookie", "False", time() - 3600, "/");

However, I can still pull values stored in the cookie and I can still  
see the cookie in my browser's "Show Cookies" window.

So I tried the following:

setcookie('mycookie','',time()-3600);
unset($_COOKIE['mycookie']);

Still no luck.

Any help with this is appreciated.



  --Rick

-- 
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] What's faster using if else or arrays?

2011-04-28 Thread Andre Polykanine
Hello Dholmes1031,

I would write it like this:
switch($foo) {
   case 5: $dothis; break;
case 3: $dothat; break;
default: $donothing; break;
}


-- 
With best regards from Ukraine,
Andre
Skype: Francophile
My blog: http://oire.org/menelion (mostly in Russian)
Twitter: http://twitter.com/m_elensule
Facebook: http://facebook.com/menelion

 Original message 
From: dholmes1...@gmail.com 
To: php-general@lists.php.net
Date created: , 12:30:31 AM
Subject: [PHP] What's faster using if else or arrays?


  
I'm working on a project and I was wondering if I should use if else's or 
arrays ?? 

Example 

If($foo= 5)
{ 
$dothis
}
ElseIf($foo= 3)
{ 
$dothis
}
Else{ $donothing }

Or put it in some short of arrays and pregmatch what would be the best to use 
and easiest to read 
Sent via BlackBerry from T-Mobile

-- 
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: What's faster using if else or arrays?

2011-04-28 Thread Andre Polykanine
Hello Jim,

I heard of arrays in the following context:
if (($foo==5) || ($foo=="orange") || ($foo==88) ..
So *that* would be done much better and cleaner with arrays.
$FoosArray=array(5, "orange", 88);
if (in_array($foo, $FoosArray)) { ... }

-- 
With best regards from Ukraine,
Andre
Skype: Francophile
My blog: http://oire.org/menelion (mostly in Russian)
Twitter: http://twitter.com/m_elensule
Facebook: http://facebook.com/menelion

 Original message 
From: Jim Giner 
To: php-general@lists.php.net
Date created: , 12:36:26 AM
Subject: [PHP] Re: What's faster using if else or arrays?


  how many entries are you talking about, ie., how many conditions?  
Obviously 
if you have more than 4-5 it's going to be easier to code up as a case 
statement (?) rather than an if/else.

Never in all my days have I ever heard of using an array for such a 
determination though.

(remainder deleted for all reader's sakes :) ) 



-- 
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] Wiki formatting class or something similar

2011-04-29 Thread Andre Polykanine
Hi everyone,
I  allow my users to put some Html into their blogs. I filter it using
a  great  tool  called HtmLawed and written by Dr. Santosh Patnaik (if
you're reading this, many thanks to you!).
However, I would like to give them a possibility to mark-up their text
in  a  more  convenient  way  for beginners (such as Wiki or something
similar).
I searched through http://phpclasses.org/ but didn't find anything.
Could you suggest me something?
And one more question: maybe some of you already have a handy solution
to process smilies? Say, a user writes ":)" and this is replaced by an
image in my directory.
Thanks in advance!

  

-- 
With best regards from Ukraine,
Andre
Skype: Francophile
Twitter: http://twitter.com/m_elensule
Facebook: http://facebook.com/menelion


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



Re: [PHP] Why Constants could Not be Array?

2011-04-30 Thread Andre Polykanine
Hello Walkinraven,

I use serialize for that.
define("MY_CONSTANT", serialize(array("1", "2", "hello")));

-- 
With best regards from Ukraine,
Andre
Skype: Francophile
My blog: http://oire.org/menelion (mostly in Russian)
Twitter: http://twitter.com/m_elensule
Facebook: http://facebook.com/menelion

 Original message 
From: Walkinraven 
To: php-general@lists.php.net
Date created: , 12:51:15 PM
Subject: [PHP] Why Constants could Not be Array?


  For needing a constants=array, I have to use
'public static $a = array(...)'

instead.

Why the language could not relax the restriction of constants?

-- 
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] dynamic copyright in page footer?

2011-04-30 Thread Andre Polykanine
Hello Dave,

echo "Copyright © Dave Mehler, 2011 — ".date("Y")."";

-- 
With best regards from Ukraine,
Andre
Skype: Francophile
My blog: http://oire.org/menelion (mostly in Russian)
Twitter: http://twitter.com/m_elensule
Facebook: http://facebook.com/menelion

 Original message 
From: David Mehler 
To: php-general
Date created: , 2:06:17 PM
Subject: [PHP] dynamic copyright in page footer?


  Hello,

I am trying to use php to put a copyright notice in a page footer. I'm
using the date function with the "Y" value for the year. Here's the
code:



This works great for a site done in 2011 but next year I'm going to
want to have 2011 and 2012 in the copyright notice, adding an
additional year the site's up. I'd appreciate some suggestions i'm
very likely overthinking this.

Thanks.
Dave.

-- 
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] Wiki formatting class or something similar

2011-04-30 Thread Andre Polykanine
Hello Peter,

And what would you recommend as an Html sanitizing tool?

-- 
With best regards from Ukraine,
Andre
Skype: Francophile
My blog: http://oire.org/menelion (mostly in Russian)
Twitter: http://twitter.com/m_elensule
Facebook: http://facebook.com/menelion

 Original message 
From: Peter Lind 
To: Stuart Dallas
Date created: , 4:26:41 PM
Subject: [PHP] Wiki formatting class or something similar


  On 30 April 2011 15:13, Stuart Dallas  wrote:
> On Friday, 29 April 2011 at 22:04, Andre Polykanine wrote:
> Hi everyone,
>> I allow my users to put some Html into their blogs. I filter it using
>> a great tool called HtmLawed and written by Dr. Santosh Patnaik (if
>> you're reading this, many thanks to you!).
>> However, I would like to give them a possibility to mark-up their text
>> in a more convenient way for beginners (such as Wiki or something
>> similar).
>> I searched through http://phpclasses.org/ but didn't find anything.
>> Could you suggest me something?
>> And one more question: maybe some of you already have a handy solution
>> to process smilies? Say, a user writes ":)" and this is replaced by an
>> image in my directory.
>> Thanks in advance!
>
> Markdown is a pretty good option for a wiki: 
> http://michelf.com/projects/php-markdown/
>
> Textile is another option (and supports tables which markdown does not): 
> http://textile.thresholdstate.com/
>

MarkItUp is a favourite plugin editor of mine - will allow you to work
with a lot of different syntaxes and users don't need to know them.

http://markitup.jaysalvat.com/home/

If you're considering sanitizing html instead of using a markup
language to convert into html, I'd read
http://blog.astrumfutura.com/2010/08/html-sanitisation-the-devils-in-the-details-and-the-vulnerabilities/
before settling on any tool to do the job. Far as I can tell, HtmLawed
isn't actually capable of sanitizing properly, according to the author
- unless it's since been updated to fix the problems mentioned in the
blog.

Regards
Peter

-- 

WWW: plphp.dk / plind.dk
LinkedIn: plind
BeWelcome/Couchsurfing: Fake51
Twitter: kafe15



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



Re: [PHP] Custom function

2011-05-03 Thread Andre Polykanine
Hello Ashley,

By  the  way,  the  non-last  optional parameter can't be missed, am I
right? In some languages we could write something like:
function test ($a, $foo=50, $bar=true) {
// ...
}

Then call it like this:

$m=test("blah", , false);

meaning

$m=test("blah", 50, false);
This is impossible in PHP, isn't it?
Thanks!

-- 
With best regards from Ukraine,
Andre
Skype: Francophile
My blog: http://oire.org/menelion (mostly in Russian)
Twitter: http://twitter.com/m_elensule
Facebook: http://facebook.com/menelion

 Original message 
From: Ashley Sheridan 
To: Ron Piggott
Date created: , 1:37:59 AM
Subject: [PHP] Custom function


  On Mon, 2011-05-02 at 18:28 -0400, Ron Piggott wrote:

> On Mon, May 2, 2011 at 3:16 PM, Ron Piggott  
> wrote:
> 
> 
>   Is it possible to write a function with an optional flag?  What would the 
> syntax look like?
> 
>   So far I have:
> 
>   function load_advertisement( $web_page_reference , 
> $web_advertising_sizes_reference ) {
> 
> 
> 
> Hi Ron:
> 
> I'm not sure what you mean by "optional flag"? Do you mean an optional 
> parameter?
> 
> Richard 
> 
> 
> Correct Richard.  Ron


function load_advertisement( $web_page_reference ,
$web_advertising_sizes_reference=default_value)

This sets a default value for a parameter, which you can check for
within the function itself and use it if it differs from what you set.
Set it to something that it shouldn't be, like null or something.

Also note that these parameters have to occur after any that don't have
a default value

-- 
Thanks,
Ash
http://www.ashleysheridan.co.uk



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



Re: [PHP] mysql error

2011-05-05 Thread Andre Polykanine
Hello Grega,

What do you mean by uniqueid(idlog)?

-- 
With best regards from Ukraine,
Andre
Skype: Francophile
My blog: http://oire.org/menelion (mostly in Russian)
Twitter: http://twitter.com/m_elensule
Facebook: http://facebook.com/menelion

 Original message 
From: Grega Leskovšek 
To: php-general
Date created: , 5:29:44 PM
Subject: [PHP] mysql error


  Can smbd please look  at this sentence - I got an error and do not
know how to fix it - I am still very unfamiliar with MYSQL:

CREATE TABLE log (  idlog int auto_increment not null,  imepriimek
varchar(50),  clock timestamp,  action varchar(30),  onfile
varchar(100), filesize float(6,2), uniqueid(idlog) );

ERROR 1064 (42000): You have an error in your SQL syntax; check the
manual that corresponds to your MySQL server version for the right
syntax to use near '(idlog) )' at line 1

-- When the sun rises I receive and when it sets I forgive ->
http://moj.skavt.net/gleskovs/
Always in Heart, Grega Leskovšek

-- 
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] Bold links

2011-05-09 Thread Andre Polykanine
Hello tedd,

I'm standing up and applauding you.
Really, I'm... quite touched. There are too few people that care about
us,  I  mean,  JAWS  users.  Of course, we, my wife and I, develop accessible 
websites
ourselves but... there is lots of inaccessible stuff out there.

-- 
With best regards from Ukraine,
Andre
Skype: Francophile
My blog: http://oire.org/menelion (mostly in Russian)
Twitter: http://twitter.com/m_elensule
Facebook: http://facebook.com/menelion

 Original message 
From: tedd 
To: ad...@buskirkgraphics.com
Date created: , 12:56:34 AM
Subject: [PHP] Bold links


  At 1:39 PM -0400 5/7/11,  wrote:
>get_currentuserinfo();
>
>echo 'Welcome  ' . $current_user->user_firstname . "\n";
>echo '' . $current_user->user_lastname . "\n";
>?>
>
>Richard L. Buskirk

Really?

How does the blind via readers, such as JAWS, understand what a  is?

First, never use  -- or  for that matter.

Second, use  or  instead. Readers can understand and 
render STRONG and EMPHASIZED text, but not  and  text -- those 
tags mean nothing and that's the reason why they are not encouraged 
for use and even removed from XHTML.

Third, if neither of those tags (i.e.,  or  ) work for 
you, they try using a class (or an id) with a css rule of:

.whatever
{
 font-weight: bold;
}

or

#whatever
{
 font-weight: bold;
}

Cheers,

tedd

-- 
---
http://sperling.com/

-- 
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] Short tag: why is it bad practice?

2011-05-10 Thread Andre Polykanine
Hi everyone,
Many  times  I heard that the following two peaces of code are written
in a bad manner:
1.


2.

Your   e-mail:   
...


As for now, I use both quite often. Why is this considered not kosher,
I mean, good coding practice?
Thanks!

-- 
With best regards from Ukraine,
Andre
Skype: Francophile
Twitter: http://twitter.com/m_elensule
Facebook: http://facebook.com/menelion


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



Re: [PHP] Short tag: why is it bad practice?

2011-05-11 Thread Andre Polykanine
Hello,

 So, as I've understood, the only issue with  is
the  thing?
Thanks!



-- 
With best regards from Ukraine,
Andre
Skype: Francophile
My blog: http://oire.org/menelion (mostly in Russian)
Twitter: http://twitter.com/m_elensule
Facebook: http://facebook.com/menelion

 Original message 
From: Daevid Vincent 
To: php-general@lists.php.net
Date created: , 9:55:23 PM
Subject: [PHP] Short tag: why is it bad practice?


  > -Original Message-
> From: Joshua Kehn [mailto:josh.k...@gmail.com]
> Sent: Tuesday, May 10, 2011 8:19 AM
> To: Andre Polykanine
> Cc: php-general@lists.php.net
> Subject: Re: [PHP] Short tag: why is it bad practice?
> 
> On May 10, 2011, at 11:11 AM, Andre Polykanine wrote:
> 
> > Hi everyone,
> > Many  times  I heard that the following two peaces of code are written
> > in a bad manner:
> > 1.
> >  > echo "Hello, world!";
> > ?>
> >
> > 2.
> > 
> > Your   e-mail:> value="">
> > ...
> > 
> >
> > As for now, I use both quite often. Why is this considered not kosher,
> > I mean, good coding practice?
> > Thanks!
> >
> > --
> > With best regards from Ukraine,
> > Andre
> > Skype: Francophile
> > Twitter: http://twitter.com/m_elensule
> > Facebook: http://facebook.com/menelion
> 
> 
> Because short tags aren't always enabled and can cause things to break
when
> deploying code to different environments. Best practice dictates that your
> code should be as environmentally independent as possible.
> 
> It's another few characters, why neglect it?

This is always a source of confusion.

http://www.bin-co.com/php/articles/using_php_short_tags.php

 is generally NOT what the short tags controversy are about.

It's the use of   vs. 

While it is true that the 'short_open_tag' directive enables both (for some
stupid reason), the issue is that it's poor form to use JUST  (asp tags).

Using  way

This topic was very heated when the core PHP developers were going to remove
the http://php.net/manual/en/ini.core.php

http://www.php.net/~derick/meeting-notes.html#remove-support-for-and-script-
language-php-and-add-php-var





-- 
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] Functions/methods aliases in PHp 5.2

2011-05-15 Thread Andre Polykanine
Hi everyone,

Is there any possibility to make a method or function alias in PHP?
Yes, I know I can do the following:

http://twitter.com/m_elensule
Facebook: http://facebook.com/menelion


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



  1   2   >