[PHP] Re: date formatting

2007-08-30 Thread Haydar TUNA
Hello,
 You can DATE_FORMAT MySQL Command in your SQL Query. For example:
select DATE_FORMAT(yourdatetimefield,'%Y-%m-%d') from yourtable

-- 
Republic Of Turkey - Ministry of National Education
Education Technology Department Ankara / TURKEY
Web: http://www.haydartuna.net

Mike Ryan [EMAIL PROTECTED], haber iletisinde þunlarý 
yazdý:[EMAIL PROTECTED]
I would like to have my users input the date formate as mm-dd- mysql
 wants the data to come down as -mm-dd.

 The question I have is how do I convert from the mm-dd- to -mm-dd 
 so
 that I can write it out to the database? 

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



[PHP] Re: Include files....

2007-05-19 Thread Haydar TUNA
Hello,
Short tags (? ?) are only available when they are enabled via the 
short_open_tag php.ini configuration file directive, or if php was 
configured with the --enable-short-tags option. Did you configure your 
php.ini file?

-- 
Republic Of Turkey - Ministry of National Education
Education Technology Department Ankara / TURKEY
Web: http://www.haydartuna.net

Jason Pruim [EMAIL PROTECTED], haber iletisinde sunlari 
yazdi:[EMAIL PROTECTED]
 Okay, Very Newbie-ish question coming!

 I can't figure out why my include won't work... Here's the text:

 index.php:
 ?PHP

 include 'defaults.php';

 $link = mysql_connect($server, $username, $password) or die('Could
 not connect: ' . mysql_error());
 echo 'Connected successfully BR';
 mysql_select_db($database) or die('Could not select database: ' .
 mysql_error());
 echo 'DB selected BR';

 $result = mysql_query($query) or die(mysql_error());
 $num=mysql_numrows($result);
 $i= 0;


 while($i  $num) {

 $FName = mysql_result($result, $i,FName);
 $LName = mysql_result($result,$i,LName);
 $Add1 = mysql_result($result, $i,Add1);
 $Add2 = mysql_result($result, $i,Add2);
 $City = mysql_result($result, $i,City);
 $State = mysql_result($result, $i,State);
 $Zip = mysql_result($result, $i,Zip);
 $Date = date(m-d-y h:i:s,mysql_result($result, $i, Date));
 $Record = mysql_result($result, $i, Record);
 $subName = mysql_result($result, $i,subName);
 $subEmail = mysql_result($result, $i,subEmail);
 $subPhone = mysql_result($result, $i,subPhone);
 $chkMember = unserialize(mysql_result($result, $i,chkMember));
 $chkAdd = unserialize(mysql_result($result, $i,chkAdd));
 $chkDel = unserialize(mysql_result($result, $i, chkDel));

 $i++;

 //echo P$Record $FName, $LName,/P P$Add1,BR $Add2,BR/P
 P$City, $State, $Zip,/P $Date,BR $subName, $subEmail,
 $subPhone, $chkMember[$row], $chkAdd[$row], $chkDel[$row]BR;

 echo H3Name Address/H3;
 echo P id ='test' $FName $LName $Add1 $Add2 $Date/P;

 };




 ?
 *
 defaults.php:

 $server = 'localhost';
 $username = 'USERNAME';
 $password = 'PASSWORD';
 $database = 'DATABASE';
 $query = 'SELECT * FROM current';

 Yes I changed the values of username, password, and database. But
 when I use the same info inside the index.php file it all works just
 fine. Here is the error that it gives me:

 [Fri May 18 15:32:07 2007] [error] PHP Notice:  Undefined variable:
 server in /Volumes/RAIDer/webserver/Documents/tests/legion/index.php
 on line 5
 [Fri May 18 15:32:07 2007] [error] PHP Notice:  Undefined variable:
 username in /Volumes/RAIDer/webserver/Documents/tests/legion/
 index.php on line 5
 [Fri May 18 15:32:07 2007] [error] PHP Notice:  Undefined variable:
 password in /Volumes/RAIDer/webserver/Documents/tests/legion/
 index.php on line 5
 [Fri May 18 15:32:07 2007] [error] PHP Warning:  mysql_connect() [a
 href='function.mysql-connect'function.mysql-connect/a]: Access
 denied for user 'USERNAME'@'localhost' (using password: NO) in /
 Volumes/RAIDer/webserver/Documents/tests/legion/index.php on line 5


 Thanks in advance for helping me through my obvious friday afternoon
 brain fart...




 --

 Jason Pruim
 Raoset Inc.
 Technology Manager
 MQC Specialist
 3251 132nd ave
 Holland, MI, 49424
 www.raoset.com
 [EMAIL PROTECTED]


 

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



[PHP] Re: Simple question on simplexml

2007-04-07 Thread Haydar TUNA
Hello,
 You can use following example:)

?php
  $xml = simplexml_load_file(test.xml);
  $xml-body[0]-addChild(book, Atatürk The Rebirth Of A Nation);
?

Republic Of Turkey - Ministry of National Education
Education Technology Department Ankara / TURKEY
Web: http://www.haydartuna.net

Timothy Murphy [EMAIL PROTECTED], haber iletisinde sunlari
yazdi:[EMAIL PROTECTED]

 I have a catalog in XML format:
 ?xml version=1.0 encoding=iso-8859-1 ?
 catalog
  book
...
  book
  book
...
  book
  ...
 /catalog

 Now I want to add another book,
 which I have as a SimpleXMLElement:

$book = new SimpleXMLElement($string);

 where $string reads
  book
...
  book

 Can I add this new entry to the catalog
 using SimpleXML functions,
 or do I have to introduce a DOMDocument?

 As may be obvious, I am very new to PHP programming;
 and advice or suggestions gratefully received.

 -- 
 Timothy Murphy
 e-mail (80k only): tim /at/ birdsnest.maths.tcd.ie
 tel: +353-86-2336090, +353-1-2842366
 s-mail: School of Mathematics, Trinity College, Dublin 2, Ireland

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



[PHP] Re: read only texbox to html with php

2007-04-07 Thread Haydar TUNA
Hello,
 If you use read only textbox in HTML, you can use like a following 
HTML code.:)

input type=text name=txtYourname value=Haydar disabled

-- 
Republic Of Turkey - Ministry of National Education
Education Technology Department Ankara / TURKEY
Web: http://www.haydartuna.net

Ross [EMAIL PROTECTED], haber iletisinde þunlarý 
yazdý:[EMAIL PROTECTED]
I have a readonly textbox that gets mailed as a newsletter. The text is a 
standard covering letter. The problem is when I try and convert it to html 
it doesn't work  It is inserted into a variable via a form textarea 
$mail_text.

 available on the web site a 
 href=http://www.myurl.org;http://www.myurl.org/a so you can see who is 
 doing.

 I tried this

 htmlentities((stripslashes($mail_text)));


 Any ideas?

 R. 

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



[PHP] Re: form validation

2007-04-07 Thread Haydar TUNA
Hello,
 You can use javascript and Ajax together. If you use the ajax, you 
can validate your data with PHP code. Please visit the web site below. You 
will find information about PHP and Ajax::)

http://www.w3schools.com/php/default.asp




-- 
Republic Of Turkey - Ministry of National Education
Education Technology Department Ankara / TURKEY
Web: http://www.haydartuna.net

al phillips [EMAIL PROTECTED], haber iletisinde sunlari 
yazdi:[EMAIL PROTECTED]
 I''ve tried !preg_match and !eregi to validate my form. I get back 
 whatever the user inputs into the textboxes. I would like to validate each 
 textbox before submitting and redirect the user after submission?  Here's 
 part of the code

  ?php // Script 1 handle .html
 // Should accept First  Last Name email address phone city state
 // Validate input from textfields

 if (!preg_match(/[^a-zA-Z\.\-\Ä\ä\Ö\ö\Ü\ü\
   ]+$/s,$firstname)); {
 print 'pPlease enter Letters from A to Z/p';
 }


 -
 8:00? 8:25? 8:40?  Find a flick in no time
 with theYahoo! Search movie showtime shortcut. 

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



[PHP] Re: Sending mail through another (SMTP authenticated) host

2007-04-02 Thread Haydar TUNA
Hello,
 You can use phpmailer from http://phpmailer.sourceforge.net/   web 
adress:) . You can use examples like this:
?php
require(class.phpmailer.php);

$mail = new PHPMailer();

$mail-IsSMTP(); // send via SMTP
$mail-Host = post.somehost.com; // SMTP servers
$mail-SMTPAuth = true; // turn on SMTP authentication
$mail-Username = somebady; // SMTP username
$mail-Password = somepass; // SMTP password
$mail-CharSet = iso-8859-9;
$mail-From = [EMAIL PROTECTED];
$mail-FromName = Mailer;
$mail-AddAddress([EMAIL PROTECTED],Name Surname);

$mail-WordWrap = 50;

$mail-IsHTML(true);


$mail-Subject = Subject;
$mail-Body = Fýstýkçý Þahap;

if(!$mail-Send())
{
echo Message was not sent p;
echo Mailer Error:  . $mail-ErrorInfo;
exit;
}

echo Message has been sent;
?


Mário Gamito [EMAIL PROTECTED], haber iletisinde sunlari 
yazdi:[EMAIL PROTECTED]
 Hi,

 How can i use the mail function to send messages through another server
 that has authenticated SMTP ?

 Any help would be appreciated.

 Warm Regards
 -- 
 :wq! Mário Gamito 

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



[PHP] Re: Another SimpleXMLElement question...

2007-03-23 Thread Haydar TUNA
Hello,
This is Simple XML extensions. The SimpleXML extension requires PHP 5!. For 
this reason you can only use other XML extensions such as XML parser.:)


-- 
Haydar TUNA
Republic Of Turkey - Ministry of National Education
Education Technology Department Ankara / TURKEY
Web: http://www.haydartuna.net

Mikey [EMAIL PROTECTED], haber iletisinde sunlari 
yazdi:[EMAIL PROTECTED]
 If at first you don't succeed...

 Our production environment is running on an old version of PHP 5.0 and 
 cannot be easily updated.  My problem is that I have developed code 
 against a new version and it has the SimpleXMLElement::addChild() 
 function, but this is not present on the older version of PHP.
 Does anyone know how to work around this?  Can I just treat the 
 SimpleXMLElement object as an array and append as I see fit?

 regards,

 Mikey 

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



[PHP] Re: Preventing unwanted chars from outputting

2007-03-18 Thread Haydar TUNA
Hello,
  What is your database program? If your database program is MySQL, what 
is your default charset of database? These questions are more importont to 
solve your problem.:)

-- 
Haydar TUNA
Republic Of Turkey - Ministry of National Education
Education Technology Department Ankara / TURKEY
Web: http://www.haydartuna.net

Don Don [EMAIL PROTECTED], haber iletisinde sunlari 
yazdi:[EMAIL PROTECTED]
 Hi all,
  my program outputs some characters along with text from the database, 
 these texts contain chars like â?~ â?T.  How can i get rid of theses chars 
 and display their meaning instead ?  I am thinking htmlspecialchars or 
 html entities will do the job will it ?


  Cheers


 -
 Food fight? Enjoy some healthy debate
 in the Yahoo! Answers Food  Drink QA. 

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



[PHP] Re: install problems

2007-03-18 Thread Haydar TUNA
Hello,
  This is php.install question but I can help you. Two weeks ago, I 
faced same problem with Apache 2.2.4 and PHP 5.2.1 in Redhat Linux AS 4 
Update 3 operating system. I tried to install apache and php together but I 
faced to same problem. I tried to install PHP 5.1.6 and Apache 2.2.4, my 
problem could be solved.:)

-- 
Haydar TUNA
Republic Of Turkey - Ministry of National Education
Education Technology Department Ankara / TURKEY
Web: http://www.haydartuna.net

jekillen [EMAIL PROTECTED], haber iletisinde sunlari 
yazdi:[EMAIL PROTECTED]
 Hello;
 Well, this one I cannot seem to figure out:
 I installed Apache 1.3.37 with
 ./configure --enable-module=so --enable-module=rewrite --enable-shared=max
 Then tried to install
 php 5.2.1 --with-apxs=/usr/local/apache/bin etc etc

 libphp5.so is no where to be found. It sure is not
 in apache/libexec

 I saved the ./configure options in a file and had
 configure read from it. All seemed to go ok,
 no errors, bailouts. I can send that file if anyone
 thinks it may have the answer.

 The problem showed up when I tried to start apache and
 it would not start because it could not find libphp5.so

 OS: Freebsd 6.2
 (I know there is the ports system, I have install all of this successfully 
 on
  two other machines doing just untar, configure, make, make install. I had
  reasons for not dealing with ports)
 Any clues?
 Thanks in advance
 Jeff K 

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



[PHP] Re: php +html mail

2007-03-17 Thread Haydar TUNA
Hello,
  If you are new to php or other web technologies, you can find many 
information,examples about PHP and other web technologies in 
http://www.w3schools.com/ web sites. This is a great web site for web 
technology education. :)


-- 
Haydar TUNA
Republic Of Turkey - Ministry of National Education
Education Technology Department Ankara / TURKEY
Web: http://www.haydartuna.net


Wasantha De Silva [EMAIL PROTECTED], haber iletisinde sunlari 
yazdi:[EMAIL PROTECTED]
Dear all,

I want get a help from you for some php codes.

How can I get it.

Regards
wasantha 

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



[PHP] Re: php - web service (ajax/jscript)

2007-03-16 Thread Haydar Tuna
Hello,
   Have you ever use nuSOAP libarary? You can connect any web service or 
create your own service. If you connect to MS Web Service with digest 
authentication, you will face to problems. I think MS add extra header 
information them web services. But you can connect java web services easily. 
You can find any information about nuSOAP in the 
http://sourceforge.net/projects/nusoap/  web site:)

-- 
Haydar TUNA
Republic Of Turkey - Ministry of National Education
Education Technology Department Ankara / TURKEY
Web: http://www.haydartuna.net

bruce [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
 Hi

 I'm trying to find information with regards to how to create/implement a
 test web services app. I'm trying to find pointers to anyone who's 
 actually
 created this kind of functionality, or pointers to web sites where I can
 find the information I'm looking for.

 For my test, App1 has the web service, and provides the jscript/ajax code 
 to
 the 3rd Party, for use on the Test App. I'm trying to find php code for 
 the
 apps on the web servers as well as test php code for the api on the Master
 Server. I'm also trying to get/find a test situation that provides test
 client code (jscript/ajax) to be implemented on the test server/app.

 Assume:
   Master Server3rd Party Server (separate domain)
 App1   Test App
 API File   (aa.js) (from Master Server)
 JScript (aa.js) ---^

 The aa.js file allows the 3rd party client site to be able to interface 
 with
 the Master Server API via the API/services defined in the API File. I'm
 envisioning the following actions for the user

  3rd Party Site   Master Server
 -User Enters Name api checks/verifies name
 -gets response
   Master Server   returns response
 -user answers
  question based
  on response,
  sends response
  to master server
  via api api checks user input
 -gets response
   Master Server   returns response
 -jscript then
  gives reply/response
  to the 3rd Party site,
  allowing the site/app
  to continue processing

 In this case, the jscript/ajax app is really only communicating with the
 Master Server, which if I understand it correctly would be in the same
 domain as the ajax/jscript code. In other words, if the master server
 supplies the jscript file(s) for the jscript that's to be run on the 3rd
 party server, then any communication that's initiated from the jscript is
 going back to the master server. There shouldn't be a cross domain issue?
 Yes/No???

 So, anyone who's actually implemented a real live web service, that's
 willing to talk to me would be helpful, or if you can point me to sample
 docs/code...

 Thanks

 -bruce

 

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



[PHP] Re: php 4 and 5

2007-03-13 Thread Haydar Tuna
Hello,
   I haven't explain this topic clearly. I'm sorry. Both PHP 5 and PHP 4 
support OOP features but PHP 5 support
more OOP features than PHP 4 and version of PHP is 5 now. As you know, 5 is 
bigger than 4 :))). PHP 5 is very comfortable and easy to use. PHP 5 
supports more library than PHP 4 and so on:)))

-- 
Haydar TUNA
Republic Of Turkey - Ministry of National Education
Education Technology Department Ankara / TURKEY
Web: http://www.haydartuna.net

Tony Marston [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]

 Haydar Tuna [EMAIL PROTECTED] wrote in message 
 news:[EMAIL PROTECTED]
 Hello,
Most important change is Object Oriented Features. PHP 5 support 
 Object Oriented programming features.

 Technically this is incorrect. PHP 4 does provide basic support for OOP, 
 but PHP 5 provides better support.

 -- 
 Tony Marston
 http://www.tonymarston.net
 http://www.radicore.org

 PHP 5 also supports more library than PHP 4.:)


 -- 
 Haydar TUNA
 Republic Of Turkey - Ministry of National Education
 Education Technology Department Ankara / TURKEY
 Web: http://www.haydartuna.net


 [EMAIL PROTECTED] wrote in message 
 news:[EMAIL PROTECTED]
 Dear All,

 What different between 4 and 5 ?

 Edward. 

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



[PHP] Re: question regarding form filtering

2007-03-13 Thread Haydar Tuna
Hello,
   You can write some basic functions such as checking length of 
variable, removing special character, checking number or string, trimming 
blank lines and so on. And then you can use this functions together and you 
can write new functions. For example, if you want to check number (such as 
digit count is 4), you can write like a checknumber($number,$digit). With 
this function, you can use like length of variable function, removing 
special character function, checking number or string function and trimming 
blank lines function together. :)

-- 
Haydar TUNA
Republic Of Turkey - Ministry of National Education
Education Technology Department Ankara / TURKEY
Web: http://www.haydartuna.net

Tim Earl [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
 HI all,



 Well I have been going through various methods on filtering form data, and
 the one I never see is filtering form data using regular expressions,
 (although the html form and validition class by Manuel Lemos does seem to
 use them) this is the only I could find.



 I often see lines like (for checking a 4 character number for example):



 $input_value = html_entities($input_value);

 If (strval(intval($input_value))  strlen($input_value) == 4) {

// do something with validated data (maybe put in valid array 
 or
 something)

 }



 Ok so whats wrong with good ole:



 If (preg_match('/^[0-9]{4}$/',trim($input_value)) {

// do something with validated data (maybe put in valid array 
 or
 something)

 }



 Am I going to get a performance hit if I validate all my fields with 
 regular
 expressions?

 As I see it I am only calling one function (ok 2 with the trim()) to
 validate my form data.

 Just wondering what you all thought about these different methods, and 
 what
 approach suits best a given situation..





 Regards,



 Tim

 

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



[PHP] Re: Capitalizing the first letter

2007-03-13 Thread Haydar Tuna
Hello,
In PHP ucfirst() function make a string's first character uppercase. But 
ralph smith have two words respectivetely ralph and smith. For this reason, 
if you call the ucfirst(ralph smith) function, you cannot see the Ralph 
Smith. You see the Ralph smith. If you want to see Ralph Smith string, you 
should use explode() function. With this functions, you returns an array of 
strings, each of which is a substring of string formed by splitting it on 
boundaries formed by the string delimiter.In the ralph smith delimeter 
characeter is blank line. You can use like a following examples in your 
code:)

?php
$yourname = ralph smith;

$name = explode ( , $yourname);

$yournewname = ucfirst( $name[0] ) .   . ucfirst ( $name[1] );

echo ( $yournewname );
?

-- 
Haydar TUNA
Republic Of Turkey - Ministry of National Education
Education Technology Department Ankara / TURKEY
Web: http://www.haydartuna.net

Todd Cary [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
I would like to write a filter that takes the text smith or SMith and 
returns Smith; same for ralph smith.  Is the a good source on using 
filters this way?

 Thank you... 

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



[PHP] Re: Capitalizing the first letter

2007-03-13 Thread Haydar Tuna
Hello Again,
You can use ucwords() functions except my method. This function 
returns a string with the first character of each word in str capitalized, 
if that character is alphabetic. :)

-- 
Haydar TUNA
Republic Of Turkey - Ministry of National Education
Education Technology Department Ankara / TURKEY
Web: http://www.haydartuna.net

 Hello,
In PHP ucfirst() function make a string's first character uppercase. 
 But ralph smith have two words respectivetely ralph and smith. For this 
 reason, if you call the ucfirst(ralph smith) function, you cannot see 
 the Ralph Smith. You see the Ralph smith. If you want to see Ralph Smith 
 string, you should use explode() function. With this functions, you 
 returns an array of strings, each of which is a substring of string formed 
 by splitting it on boundaries formed by the string delimiter.In the ralph 
 smith delimeter characeter is blank line. You can use like a following 
 examples in your code:)

 ?php
$yourname = ralph smith;

$name = explode ( , $yourname);

$yournewname = ucfirst( $name[0] ) .   . ucfirst ( $name[1] );

echo ( $yournewname );
 ?

 -- 
 Haydar TUNA
 Republic Of Turkey - Ministry of National Education
 Education Technology Department Ankara / TURKEY
 Web: http://www.haydartuna.net

 Todd Cary [EMAIL PROTECTED] wrote in message 
 news:[EMAIL PROTECTED]
I would like to write a filter that takes the text smith or SMith and 
returns Smith; same for ralph smith.  Is the a good source on using 
filters this way?

 Thank you... 

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



[PHP] Re: Capitalizing the first letter

2007-03-13 Thread Haydar Tuna
Hello Again,
You can use ucwords() functions except my method. This function 
returns a string with the first character of each word in str capitalized, 
if that character is alphabetic. :)

-- 
Haydar TUNA
Republic Of Turkey - Ministry of National Education
Education Technology Department Ankara / TURKEY
Web: http://www.haydartuna.net

 Hello,
In PHP ucfirst() function make a string's first character uppercase. 
 But ralph smith have two words respectivetely ralph and smith. For this 
 reason, if you call the ucfirst(ralph smith) function, you cannot see 
 the Ralph Smith. You see the Ralph smith. If you want to see Ralph Smith 
 string, you should use explode() function. With this functions, you 
 returns an array of strings, each of which is a substring of string formed 
 by splitting it on boundaries formed by the string delimiter.In the ralph 
 smith delimeter characeter is blank line. You can use like a following 
 examples in your code:)

 ?php
$yourname = ralph smith;

$name = explode ( , $yourname);

$yournewname = ucfirst( $name[0] ) .   . ucfirst ( $name[1] );

echo ( $yournewname );
 ?

 -- 
 Haydar TUNA
 Republic Of Turkey - Ministry of National Education
 Education Technology Department Ankara / TURKEY
 Web: http://www.haydartuna.net

 Todd Cary [EMAIL PROTECTED] wrote in message 
 news:[EMAIL PROTECTED]
I would like to write a filter that takes the text smith or SMith and 
returns Smith; same for ralph smith.  Is the a good source on using 
filters this way?

 Thank you... 

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



[PHP] Re: Capitalizing the first letter

2007-03-13 Thread Haydar Tuna
Hello Again,
You can use ucwords() functions except my method. This function
returns a string with the first character of each word in str capitalized,
if that character is alphabetic. :)

-- 
Haydar TUNA
Republic Of Turkey - Ministry of National Education
Education Technology Department Ankara / TURKEY
Web: http://www.haydartuna.net

 Hello,
In PHP ucfirst() function make a string's first character uppercase.
 But ralph smith have two words respectivetely ralph and smith. For this
 reason, if you call the ucfirst(ralph smith) function, you cannot see
 the Ralph Smith. You see the Ralph smith. If you want to see Ralph Smith
 string, you should use explode() function. With this functions, you
 returns an array of strings, each of which is a substring of string formed
 by splitting it on boundaries formed by the string delimiter.In the ralph
 smith delimeter characeter is blank line. You can use like a following
 examples in your code:)

 ?php
$yourname = ralph smith;

$name = explode ( , $yourname);

$yournewname = ucfirst( $name[0] ) .   . ucfirst ( $name[1] );

echo ( $yournewname );
 ?

 -- 
 Haydar TUNA
 Republic Of Turkey - Ministry of National Education
 Education Technology Department Ankara / TURKEY
 Web: http://www.haydartuna.net

 Todd Cary [EMAIL PROTECTED] wrote in message
 news:[EMAIL PROTECTED]
I would like to write a filter that takes the text smith or SMith and
returns Smith; same for ralph smith.  Is the a good source on using
filters this way?

 Thank you...




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



[PHP] Re: displaying image from MySQL DB using HTML/PHP

2007-03-13 Thread Haydar Tuna
Hello,
I think your image field in mysql table is BLOB. Firstly, you can 
create like a image.php file for call image data from table. You can call 
your image data this file with GET,POST or SESSION variables and in image 
table there is a uqiue field for call any image such as personal id, id, 
student number and so on and then you can call the image from your main 
program. For example img src=image.php?id=1453.

-- 
Haydar TUNA
Republic Of Turkey - Ministry of National Education
Education Technology Department Ankara / TURKEY
Web: http://www.haydartuna.net

Bruce Gilbert [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
I am having some difficulty getting an image to display on a php that
 I have added to MySQL DB.

 Here is what I have tried so far

 in the MySQL DB I have a table called image_holder and the fields are
 id,mimename,filecontents...filecontents field is set to a type of blob
 using PHPMyAdmin and I have uploaded the image in MySQL.

 In the PHP code I have:

 [php]
 ?php
 $dbhost = 'hostaddress';
 $dbuser = 'username';
 $dbpass = 'password;
 $dbcnx = @mysql_connect($dbhost,$dbuser,$dbpass);

 if (!$dbcnx)
 {
 echo( connection to database server failed!);
 exit();
 }
 if (! @mysql_select_db(image_holder) )
 {
 echo( Image Database Not Available! );
 exit();
 }

 $img = $_REQUEST[img];

 $result = @mysql_query(SELECT * FROM images WHERE id= . $img . );

 if (!$result)
 {
 echo(Error performing query:  . mysql_error() . );
 exit();
 }
 while ( $row = @mysql_fetch_array($result) )
 {
 $imgid = $row[id];
 $encodeddata = $row[mimetype];
 $title = $row['filecontents'];
 }

 ?

 and in the HTML code

 centerimg src=image.php?img=1 width=200 border=1 alt=/center

 I am probably way off base, so need some help!


 -- 
 ::Bruce:: 

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



[PHP] Re: php 4 and 5

2007-03-12 Thread Haydar Tuna
Hello,
Most important change is Object Oriented Features. PHP 5 support 
Object Oriented programming features. PHP 5 also supports more library than 
PHP 4.:)


-- 
Haydar TUNA
Republic Of Turkey - Ministry of National Education
Education Technology Department Ankara / TURKEY
Web: http://www.haydartuna.net


[EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED]
 Dear All,

 What different between 4 and 5 ?

 Edward. 

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



[PHP] Re: Why won't this query go through?

2007-03-12 Thread Haydar Tuna
Hello,
   Did you control your user privileges? May be, your database user 
don't have enough privileges for INSERT. If your database user have enough 
database privileges for INSERT, you must control your SQL. Firstly you 
should write your SQL to the screen with echo ($q) and then paste this in 
the mysql command line. If you get an errors, there is a problem on your 
SQL. :)


-- 
Haydar TUNA
Republic Of Turkey - Ministry of National Education
Education Technology Department Ankara / TURKEY
Web: http://www.haydartuna.net


Mike Shanley [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
 Hi,

 I am just not understanding what I could have possibly done wrong with 
 this query. All of the variables are good, without special characters in 
 any sense of the word... So why isn't it importing anything?

 Thanks!

 $q = INSERT INTO 
 `visitors`(`username`,`password`,`email`,`firstname`,`lastname`,`birthdate`,`verifythis`)
VALUES ('.$username.',
'.md5($password1).',
'.$email.',
'.$firstname.',
'.$lastname.',
'.$birthdate.',
'.$verifythis.');;
 mysql_query($q);

 -- 
 Mike Shanley

 ~you are almost there~ 

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



[PHP] Re: Data Types Problem

2007-03-12 Thread Haydar Tuna
Hello,
   Becuase PHP don't convert 01 string to integer 1. In the PHP 
help file :

PHP Help for type casting

When a string is evaluated as a numeric value, the resulting value and type 
are determined as follows.

The string will evaluate as a float if it contains any of the characters 
'.', 'e', or 'E'. Otherwise, it will evaluate as an integer.

The value is given by the initial portion of the string. If the string 
starts with valid numeric data, this will be the value used. Otherwise, the 
value will be 0 (zero). Valid numeric data is an optional sign, followed by 
one or more digits (optionally containing a decimal point), followed by an 
optional exponent. The exponent is an 'e' or 'E' followed by one or more 
digits.

?php
$foo = 1 + 10.5;// $foo is float (11.5)
$foo = 1 + -1.3e3;  // $foo is float (-1299)
$foo = 1 + bob-1.3e3;   // $foo is integer (1)
$foo = 1 + bob3;// $foo is integer (1)
$foo = 1 + 10 Small Pigs;   // $foo is integer (11)
$foo = 4 + 10.2 Little Piggies; // $foo is float (14.2)
$foo = 10.0 pigs  + 1;  // $foo is float (11)
$foo = 10.0 pigs  + 1.0;// $foo is float (11)
?

You can use = = =  comparision operator for check your variable type 
and variable value at the same time:) $a = = = $b Identical TRUE if $a is 
equal to $b, and they are of the same type. (introduced in PHP 4)



?php
$theMessage = $_REQUEST['message'];

echo theMessage : ' . $theMessage . '\n;

if ($theMessage === 01)
{
echo message : '01';
}else if ($theMessage === 00)
{
echo message : '00';
}else if (is_numeric($theMessage))
{
 echo Numeric Input :  . $theMessage;
}else
{
echo Invalid Input;
}
?



-- 
Haydar TUNA
Republic Of Turkey - Ministry of National Education
Education Technology Department Ankara / TURKEY
Web: http://www.haydartuna.net


Arno Coetzee [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
 Hi Guys

 I seem to have a problem with data types in php

 when executing the following script , i do not get the desired output.

 i a pass url parameter (message) to the script.

 if i pass a numeric value (1) , the script accepts it as '01' and vice 
 versa.
 the same with 0 and '00'

 here is the script:

 ?php
$theMessage = $_REQUEST['message'];
   echo theMessage : ' . $theMessage . '\n;
   if ($theMessage == 01)
{
echo message : '01';
}else if ($theMessage == 00)
{
echo message : '00';
}else if (is_numeric($theMessage))
{
 echo Numeric Input :  . $theMessage;
}else
{
echo Invalid Input;
}
 ?

 i presume that i am not interpreting the data types it should be 
 interpreted.

 can anyone please help

 -- 
 Arno Coetzee
 Flash Media Group
 Developer
 Mobile : 27 82 693 6180
 Office : 27 12 430 7597 

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



Re: [PHP] Re: php 4 and 5

2007-03-12 Thread Haydar Tuna
Hello,
  Yes, you are right I mean supports more OOP features. PHP 5 support 
more OOP features than PHP 4. :)

-- 
Haydar TUNA
Republic Of Turkey - Ministry of National Education
Education Technology Department Ankara / TURKEY
Web: http://www.haydartuna.net

Robert Cummings [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
 On Mon, 2007-03-12 at 10:21 +0200, Haydar Tuna wrote:
 Hello,
 Most important change is Object Oriented Features. PHP 5 support
 Object Oriented programming features.

 I think you mean supports more OOP features. PHP4 had plenty of OOP
 support also.

 Cheers,
 Rob.
 -- 
 ..
 | InterJinn Application Framework - http://www.interjinn.com |
 ::
 | An application and templating framework for PHP. Boasting  |
 | a powerful, scalable system for accessing system services  |
 | such as forms, properties, sessions, and caches. InterJinn |
 | also provides an extremely flexible architecture for   |
 | creating re-usable components quickly and easily.  |
 `' 

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



[PHP] Re: Redirecting in a PHP script

2007-03-12 Thread Haydar Tuna
Hello,
   In my many projects, I have used PHP header function for redirecting 
any URL so you can use like a following command. I haven't got any problem 
with this command until now :)
header(Location: http://www.domain.com;);

-- 
Haydar TUNA
Republic Of Turkey - Ministry of National Education
Education Technology Department Ankara / TURKEY
Web: http://www.haydartuna.net


Larry Bradley [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
I need to goto  different PHP pages in my web site depending on what
 happens within some PHP code.

 For example, if the user is not logged in when he goes to a page, I want 
 to
 send him to a LOGIN page.

 I've have everything working fine, using the following Javascript code:
 $location = 'login.php';
 echo script language='javascript'\n;
 echo document.location.href = ' . $location . ';\n;
 echo /script\n;

 I also played around with using the header(location: ...) function.

 I understand that the header() function must be issued before any HMTL is
 output.

 But I'm not sure about the Javascript code. In every instance in my code, 
 I
 use the Javascript before any HTML - this type of action normally occurs 
 in
 PHP code called via a form POST.

 I presume that the Javascript code really does the same as the PHP stuff,
 and thus must obey the same rules, but I'm not sure.
 Comments?

 Larry Bradley
 Orleans (Ottawa), Ontario, CANADA 

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



[PHP] Re: Posting variable outside of the post form

2007-03-12 Thread Haydar Tuna
Hello,
If your variable is not most important for your application 
security, you should use HTML hidden form field but  If your variable is 
most important for your application security, you should use session 
variable. I think in your HTML form, you use GET method. In this method, all 
HTML form fields appear on your browser address bar and if you want to hide 
HTML form fields before send , you can use POST method. For a long HTML form 
variable you can use POST method:)

-- 
Haydar TUNA
Republic Of Turkey - Ministry of National Education
Education Technology Department Ankara / TURKEY
Web: http://www.haydartuna.net

Otto Wyss [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
I submit a form back to itself with

   action=?PHP echo $_SERVER['PHP_SELF']; ? methode=get

 yet I've a large PHP variable which I'd like to access afterwards as well. 
 Is this possible somehow?

 O. Wyss 

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



[PHP] Re: advise on consulting fees

2007-03-03 Thread Haydar Tuna
Hello,
You can developed private web site template for your clients. This 
template can be personal page, company page and so on. if you try this, you 
can deal with only graphic design. Your development time for the web site 
will decrease. :)



-- 
Haydar TUNA
Republic Of Turkey - Ministry of National Education
Education Technology Department Ankara / TURKEY
Web: http://www.haydartuna.net

John [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
 This may be deviating a bit from the intent of the list, and someone feel
 free to say so if the list shouldn't be used for this. My apologies in
 advance if that is the case. This is NOT a self-advertisement!



 My question is regarding the going rate for software development
 consulting -



 Currently, my clients are mostly companies requesting graphic design and 
 web
 development for websites, and my rate is 65-85 an hour, quoted per 
 project.



 I have a large prospective client who is looking for a consultant for
 development and support for ongoing software projects, and I'm wondering 
 how
 differently a client of this size/nature would be handled. They'd be 
 looking
 at around 100-150 hours a month on a continual basis.



 I recognize it is a bit different than my other clients who are usually
 single projects that are opened and closed fairly quickly, but would 65-85
 an hour be reasonable and fair? I know there are a lot of variables that
 would affect it, but generally, what would be a competitive rate?



 Feel free to respond to me privately rather than to the list.



 I appreciate any suggestions and insight that anyone may offer!



 Thanks



 J















 

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



[PHP] Re: rich html emailer

2007-03-03 Thread Haydar Tuna
Hello,
You can use AJAX technologies. In this technology, You can call the 
PHP functions with JavaScript and then you can use returning values of PHP 
functions with JavaScript. Returning values of PHP functions can be only one 
variable or array variables :)


-- 
Haydar TUNA
Republic Of Turkey - Ministry of National Education
Education Technology Department Ankara / TURKEY
Web: http://www.haydartuna.net


Ross [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
 Hi,

 I have created a basic HTML emailer with PHP where the body is created and 
 text is inserted via a text area.

 Now I would like to expand this so the client can put in live URL and 
 mailto links. I can use htmlentities() to do this but I would also like a 
 button that allow them to enter it through a dialog box.

 Is there a php/javascript class that can do this?


 R. 

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



Re: [PHP] [X-POST] PHP script to make sure MySQL is up?

2007-03-03 Thread Haydar Tuna
Hello,
 Richard Lynch is right. mysql_pconnect is a good connection method. 
In this method, we use only open connections. We don't open a new 
connection. If you use mysql_pconnect , you don't need mysql_close  because 
this is persistent connection.
 You can restart mysql with cron if your mysql server is down. 
Firstly, you can write a shell script to call from crontab file. In this 
shell script, you must call a php script that controls the connection. if 
your mysql connection is failed , the php script can set the your ENV 
variable (Envrimental Variables) true or false. In shell script , you can 
control that ENV variable. if ENV variable is false, your can start your 
mysql server:)


-- 
Haydar TUNA
Republic Of Turkey - Ministry of National Education
Education Technology Department Ankara / TURKEY
Web: http://www.haydartuna.net


Richard Lynch [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
 On Thu, March 1, 2007 1:37 pm, Brian Dunning wrote:
 I host at Rackspace, and one thing that their monitoring service does
 NOT catch is a problem when too many connections hit MySQL, and for
 some reason it remains hung up until the service is manually
 restarted. In the meantime, this is happening to us once or twice a
 month. It gets hammered with a huge number of brief connections from
 other Apache servers.

 Slow queries and mysql_close() are NOT the problem. It's just too
 many connections, even though they're super fast.

 Are you using mysql_pconnect?

 Because that is essentially going to lock one MySQL connection to each
 Apache child, and if you have a bigger httpd.conf MAX_CHILDREN than
 you have /etc/my.cnf number of connections, then, by definition, you
 are going to have problems all the time, because you have more users
 than connections available.

 Note also that each username/password gets its own persistent
 connection, so if you have two DB roles in your application, then you
 have just doubled the number of connections needed.

 In something like a shared hosting environment, pconnect is probably a
 death knell, since every little user will be tying up a connection for
 their app.  There are, of course, ways around this, such as dedicated
 apache pools per client, or super-short connection time-out on the
 persitence or...  But most shared hosts aren't going to go to this
 length.

 Is there such a thing as a PHP script that I can put on a cron job to
 run every minute and make a test query, and upon failure, restart the
 service and maybe send an email to Rackspace support? I don't know
 how you'd check that the query was refused due to too many
 connections, and I also don't know how PHP would restart the MySQL
 service.

 I think mysql_connect should be providing you with a nice error
 message if this does happen.

 Are you checking mysql_error right after your mysql_connect call?

 And you almost-for-sure don't want any random old php script capable
 of bouncing the MySQL server...
 [shudder]

 -- 
 Some people have a gift link here.
 Know what I want?
 I want you to buy a CD from some starving artist.
 http://cdbaby.com/browse/from/lynch
 Yeah, I get a buck. So? 

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



Fw: [PHP] Help! I cannot send e-mail to your mail groups

2007-03-02 Thread Haydar Tuna

Hello Again,
  If I send e-mail to your group, I have an error message below. There 
aren't any network problems. I try to send mail different places but I get 
same error message. May be, you can restrict Turkish IP address blocks 
becuase I haven't see any message from Turkey recently in your mail lists. 
May be, you can restrict my mail address in your group. I'm writing a book 
about PHP and I love helping any people about PHP on the world. Can you help 
me in this issuse? What is the problem? and this problem has been for 2 
weeks. 2 weeks ago, I could send mail your groups easily.

 I'm looking forward from hear you.


Error Message:
Outlook Express could not post your message.  Subject 'Re: PHP and cron', 
Account: 'news.php.net', Server: 'news.php.net', Protocol: NNTP, Port: 119, 
Secure(SSL): No, Socket Error: 10051, Error Number: 0x800CCC0E



- Original Message - 
From: Németh Zoltán [EMAIL PROTECTED]

To: Haydar Tuna [EMAIL PROTECTED]
Cc: php-general@lists.php.net
Sent: Friday, March 02, 2007 12:19 PM
Subject: Re: [PHP] Help! I cannot send e-mail to your mail groups





2007. 03. 2, péntek keltezéssel 09.57-kor Haydar Tuna ezt írta:

Hello,
I have been Linux user for 7 years and I have been membership of Linux
Community group for 3 years in Turkey. As you know, linux users share all 
of

experiences and knownledges and I'm writing a book about PHP. I'm a PHP
professional for this reason I want to help any people on the world but I
haven't send a message for two days. I got an abuse e-mail two times but
there isn't any problem my mails that I have send your mail group. I want 
to

send e-mail your mail group again, I want to help any people on the world
again if possible. Can you help me?
I'm looking forward here you.



It seems to me you can send mail to the list, as I have received it ;)

(or maybe I misunderstood your problem?)

greets
Zoltán Németh

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



Re: [PHP] Help! I cannot send e-mail to your mail groups

2007-03-02 Thread Haydar Tuna
:)


-- 
Haydar TUNA
Republic Of Turkey - Ministry of National Education
Education Technology Department Ankara / TURKEY
Web: http://www.haydartuna.net

Haydar Tuna [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
Hello Again,
   If I send e-mail to your group, I have an error message below. There
aren't any network problems. I try to send mail different places but I get
same error message. May be, you can restrict Turkish IP address blocks
becuase I haven't see any message from Turkey recently in your mail lists.
May be, you can restrict my mail address in your group. I'm writing a book
about PHP and I love helping any people about PHP on the world. Can you help
me in this issuse? What is the problem? and this problem has been for 2
weeks. 2 weeks ago, I could send mail your groups easily.
  I'm looking forward from hear you.


Error Message:
Outlook Express could not post your message.  Subject 'Re: PHP and cron',
Account: 'news.php.net', Server: 'news.php.net', Protocol: NNTP, Port: 119,
Secure(SSL): No, Socket Error: 10051, Error Number: 0x800CCC0E


- Original Message - 
From: Németh Zoltán [EMAIL PROTECTED]
To: Haydar Tuna [EMAIL PROTECTED]
Cc: php-general@lists.php.net
Sent: Friday, March 02, 2007 12:19 PM
Subject: Re: [PHP] Help! I cannot send e-mail to your mail groups





2007. 03. 2, péntek keltezéssel 09.57-kor Haydar Tuna ezt írta:
 Hello,
 I have been Linux user for 7 years and I have been membership of Linux
 Community group for 3 years in Turkey. As you know, linux users share all 
 of
 experiences and knownledges and I'm writing a book about PHP. I'm a PHP
 professional for this reason I want to help any people on the world but I
 haven't send a message for two days. I got an abuse e-mail two times but
 there isn't any problem my mails that I have send your mail group. I want 
 to
 send e-mail your mail group again, I want to help any people on the world
 again if possible. Can you help me?
 I'm looking forward here you.


It seems to me you can send mail to the list, as I have received it ;)

(or maybe I misunderstood your problem?)

greets
Zoltán Németh 

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



[PHP] Re: Your input would be appreciated.

2007-03-02 Thread Haydar TUNA
Hello,
 In some questions, you can use combobox  for easiest data analysis such 
as countries . except this, it's very good survey:)

-- 
Haydar TUNA
Republic Of Turkey - Ministry of National Education
Education Technology Department Ankara / TURKEY
Web: http://www.haydartuna.net

[EMAIL PROTECTED], haber iletisinde sunlari 
yazdi:[EMAIL PROTECTED]
 Hello

 My name is Lara Thynne and I am a PhD candidate at Deakin University
 Australia.

 I am currently running a survey at the following address.

 https://dcarf.deakin.edu.au/surveys/oss/

 The survey is completely confidential and looks at your views and
 motivations to use Open Source software and to participate in the
 community.

 It will only take a few minutes and your contact details will not be
 recorded. You can withdraw your participation at any stage.

 I sincerely apologize for the spammish nature of this e-mail - I
 don't mean to abuse this list.  I am trying to collect responses
 from as many open source developers and users as possible and a
 mailing list like this is probably the best way to reach many of you.

 Please personally CC me with any questions/comments posted to the
 list in response.

 Thanks again

 Lara

 P.S The program that I am using is open source, of course
 (www.phpsurveyor.org)! 

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



[PHP] Help! I cannot send e-mail to your mail groups

2007-03-01 Thread Haydar Tuna

Hello,
I have been Linux user for 7 years and I have been membership of Linux 
Community group for 3 years in Turkey. As you know, linux users share all of 
experiences and knownledges and I'm writing a book about PHP. I'm a PHP 
professional for this reason I want to help any people on the world but I 
haven't send a message for two days. I got an abuse e-mail two times but 
there isn't any problem my mails that I have send your mail group. I want to 
send e-mail your mail group again, I want to help any people on the world 
again if possible. Can you help me?
I'm looking forward here you. 


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



[PHP] Re: GET doesn't work as POST

2007-02-24 Thread Haydar TUNA
Hello,
if you send your complete code, I can help you.:)



-- 
Haydar TUNA
Republic Of Turkey - Ministry of National Education
Education Technology Department Ankara / TURKEY
Web: http://www.haydartuna.net


Otto Wyss [EMAIL PROTECTED], haber iletisinde sunlari 
yazdi:[EMAIL PROTECTED]
 On the page

 http://www.orpatec.ch/turniere/5erfussball/index.php?page=bvallist.phpkind=regions

 I have a form with method=post and action=?PHP $_SERVER['PHP_SELF']; 
 ?. While it works fine this way, as soon as I change the form to 
 method=get it looses the parameter kind when I change e.g. the second 
 parameter from -Alle- to Gültig. Has anybody an idea why it works with 
 POST but not with GET?

 form action=?PHP $_SERVER['PHP_SELF']; ? method=get
 ...
  select name=state onchange=this.form.submit()

 O. Wyss 

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



[PHP] Re: When to use exception, or When not to use exception

2007-02-23 Thread Haydar TUNA
Hello,
 You can use the following tutorial for error handling in PHP :)
http://www.devshed.com/c/a/PHP/Error-Handling-in-PHP-Introducing-Exceptions-in-PHP-5/



-- 
Haydar TUNA
Republic Of Turkey - Ministry of National Education
Education Technology Department Ankara / TURKEY
Web: http://www.haydartuna.net


js  [EMAIL PROTECTED], haber iletisinde sunlari 
yazdi:[EMAIL PROTECTED]
 Hello list,

 Recently I upgraded my dev environment and started to use PHP5 at last!
 Compared with the former one, PHP5 rocks in many ways.
 So I love it so much, but sadly, I don't exactly know when to use 
 exception.
 I'm never used to use Java, or languages that support exceptin
 so I have to learn the usage..

 So, my question is
 When to use, or when not to use exception?
 Now I'm using exception in 99% to handle errors because it's easier and 
 cleaner.
 The only problem I have using exception instead of normal
 if-error-then method is
 that I have to define logs of Exception-derived classes to effectively
 handling erros.
 It's cumbersome but not so bad compared with traditional error handling.


 Any suggestions, personal guidelines, tutoriral, documentation would
 be greatly appriciated. 

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



[PHP] Re: Capture the whole URL

2007-02-22 Thread Haydar Tuna
Hello,
   URL consist of two part HOST and URI respectivetely. HOST part likes 
example www.domain.com . URI part likes main.php?id=5 and so on. You can get 
the HOST part of URL with $HTTP_HOST and URI part of URL with 
$REQUEST_URI.:)


-- 
Haydar TUNA
Republic Of Turkey - Ministry of National Education
Education Technology Department Ankara / TURKEY
Web: http://www.haydartuna.net


Ken Kixmoeller -- reply to [EMAIL PROTECTED] [EMAIL PROTECTED] 
wrote in message news:[EMAIL PROTECTED]
 Hey - -

 I must be missing something, but in a URL such as:

   diddly.com?id=fredtotal=goof

 $_SERVER['PHP-SELF'] gives me the diddley.com part.

 I want to capture the whole URL. The documentation makes it seem like 
 $_SERVER['REQUEST_URI'] is supposed to do that, but I get an  Undefined 
 Index error.

 Do I have to enable this somehow? I realize that I could recreate the 
 rest of the URL from $_GET's, but I'd rather not if I don't have to.

 PHP 5.1

 Ken 

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



[PHP] Re: can this be fone with PHP?

2007-02-22 Thread Haydar Tuna
Hello,
You can use the fpdf free package. I have used this PDF package in my 
many project. It's very easy to use and free:)
www.fpdf.org



-- 
Haydar TUNA
Republic Of Turkey - Ministry of National Education
Education Technology Department Ankara / TURKEY
Web: http://www.haydartuna.net

Bruce Gilbert [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
I have created forms with PHP where the information in the fields is
 sent via sendmail to an email, but is there a way to have the
 information extracted and a pdf form created when the user hits the
 submit button?

 -- 
 ::Bruce:: 

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



[PHP] Re: Enable login prompt with main page of phpmyadmin

2007-02-22 Thread Haydar Tuna
Hello,
   Firstly, you should create a configuration file for your phpMyAdmin 
administration web site. If you extract phpMyAdmin in your htdocs folder, 
you will create easily configuration file to enter the phpMyAdmin web site 
on your localhost. (for example http://localhost/phpmyadmin/)  After this 
step, you can choose http in authentication and choose localhost in host:)



-- 
Haydar TUNA
Republic Of Turkey - Ministry of National Education
Education Technology Department Ankara / TURKEY
Web: http://www.haydartuna.net

[EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED]
 Dear All,

 I just install the phpMyAdmin 2.9.2 on the Web...
 So, how to enable the login prompt with the main page ?

 Edward. 

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



[PHP] Re: JPG Not supported on my server, but GDlib enabled?

2007-02-22 Thread Haydar Tuna
Hello,
Firstly, you should download latest GD library and Jpeg library and 
then you should compile your GD with jpeg enabled option and  then compile 
jpeg. After this step, you can compile Apache and PHP. In PHP installation, 
you should use such as --with-gd=/usr/local option for gd library and such 
as --with-jpeg-dir option for jpeg library. If you use --with-gd option 
without not write any folder name , PHP will use default GD folder ( 
extension directory).
http://www.libgd.org/Downloads
ftp://ftp.uu.net/graphics/jpeg/


-- 
Haydar TUNA
Republic Of Turkey - Ministry of National Education
Education Technology Department Ankara / TURKEY
Web: http://www.haydartuna.net


[EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
 after we (company I work for) mmoved to new hosting company (dedicated
 server), I requested from them to instal php5 with GDlib to be able play
 with images.
 they did.
 and then yesterday (2 months after we moved) I wasn't able to use
 ImageCreateFromJpeg() function:
 Fatal error: Call to undefined function ImageCreateFromJpeg() in
 /srv/www/mydomain.com/image_resize.php on line 11

 Then, I was searching a little bit and found this from gd_info()
 Array
 (
[GD Version] = bundled (2.0.28 compatible)
[FreeType Support] =
[T1Lib Support] =
[GIF Read Support] = 1
[GIF Create Support] = 1
[JPG Support] =
[PNG Support] = 1
[WBMP Support] = 1
[XPM Support] =
[XBM Support] = 1
[JIS-mapped Japanese Font Support] =
 )

 Looks like they didn't do correctly because JPG is not supported?

 In phpinfo() found this:
 Configure Command  './configure' '--with-apxs2=/etc/apache2/bin/apxs'
 '--with-mysql' '--with-gd' '--with-zlib-dir=/usr/local/lib'

 and this:
 gd
 GD Support  enabled
 GD Version  bundled (2.0.28 compatible)
 GIF Read Support  enabled
 GIF Create Support  enabled
 PNG Support  enabled
 WBMP Support  enabled
 XBM Support  enabled

 Now, when I talk to them they said we have to pay $250 to be fixed?!?

 I have root access and have some php/mysql/apache installation experience
 and want to fix myself - can somebody point me to the right direction?

 Thanks.

 -afan 

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



[PHP] Re: How to call image from mySql to php file

2007-02-21 Thread Haydar TUNA
Hello,
   Firstly, your image table field should be BLOB field then you create 
a image file (for example image.php). in this file, if your application is 
more secure, you can control the session variables. You get key column of 
your BLOB table (for example id, studentnumber and so on) with session 
variables, GET variables or any way. I always get this column with SESSION 
variables because it is more secure. After this, for get variables you can 
call the image to your main application from image.php file with  like the 
following HTML1 code. for session variables you can call the image to your 
main application from image.php file with  like the following HTML2 code.

HTML 1 Code - for get variables
img src=image.php?id=1923

HTML 2 Code - for session variables
img src=image.php

image.php
?php
session_start();
if (!session_is_registered ('username'))
{
 include('hack.inc.php');
 exit;
}

$id=$_SESSION[id]; //for session variables

$hostname=host.haydartuna.net;
$username=username;
$password=x;
$database=myapplication;
@ $db=mssql_pconnect ($hostname, $username,$password)
or die ('Error');
mssql_select_db($database);
$sql=select picture from table where id='$id' ;
$result=mssql_query($sql);
$row=mssql_fetch_assoc($result);
echo($row['resim']);
?


-- 
Haydar TUNA
Republic Of Turkey - Ministry of National Education
Education Technology Department Ankara / TURKEY
Web: http://www.haydartuna.net

Chris Carter [EMAIL PROTECTED], haber iletisinde sunlari 
yazdi:[EMAIL PROTECTED]

 I have a field in database called logos which has one value
 images/logos/some_logo.jpg

 In my php I am trying to call it in my php file as image. With this code.

 $sno = $_REQUEST['sno'];

 $query=SELECT logos FROM table WHERE sno = '$sno';

 $result=mysql_query($query);
 $num=mysql_numrows($result);

 mysql_close();
 $logos=mysql_result($result,$i,logos);

 echo 
 div
 p $logos /p
 /div;

 ?/div

 But getting errors. What is the way to call image in php file from the
 database. I know that this is a very basic question but first time for me. 
 I
 ignored this in the begining but now its right infront of me.

 Please advice.

 -- 
 View this message in context: 
 http://www.nabble.com/How-to-call-image-from-mySql-to-php-file-tf3267012.html#a9081704
 Sent from the PHP - General mailing list archive at Nabble.com. 

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



[PHP] Re: How to call image from mySql to php file

2007-02-21 Thread Haydar TUNA
Hello again,
I make a mistake in the image.php code at  echo($row['resim']); 
line. if you change this line echo($row['picture']) , your problem will be 
fixed. :
I have written table field in Turkish. in Turkish picture means that resim 
:)


-- 
Haydar TUNA
Republic Of Turkey - Ministry of National Education
Education Technology Department Ankara / TURKEY
Web: http://www.haydartuna.net

Chris Carter [EMAIL PROTECTED], haber iletisinde sunlari 
yazdi:[EMAIL PROTECTED]

 I have a field in database called logos which has one value
 images/logos/some_logo.jpg

 In my php I am trying to call it in my php file as image. With this code.

 $sno = $_REQUEST['sno'];

 $query=SELECT logos FROM table WHERE sno = '$sno';

 $result=mysql_query($query);
 $num=mysql_numrows($result);

 mysql_close();
 $logos=mysql_result($result,$i,logos);

 echo 
 div
 p $logos /p
 /div;

 ?/div

 But getting errors. What is the way to call image in php file from the
 database. I know that this is a very basic question but first time for me. 
 I
 ignored this in the begining but now its right infront of me.

 Please advice.

 -- 
 View this message in context: 
 http://www.nabble.com/How-to-call-image-from-mySql-to-php-file-tf3267012.html#a9081704
 Sent from the PHP - General mailing list archive at Nabble.com. 

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



[PHP] Re: Securing user table with sha function

2007-02-20 Thread Haydar Tuna
Hello again,
  if you crypt your usernames, it happened many problems. As you know, 
if you crypt any string to SHA1, you don't decrypt again. You cannot use 
username in your application. in my many application, I have crpyted 
password , I haven't cryrpt usernames. Becuase I used username for session 
authentication. for example if  I want to action on the usernames or list of 
usernames , what can I do this? All of usernames are crypted.

Haydar TUNA
Republic Of Turkey - Ministry of National Education
Education Technology Department Ankara / TURKEY
Web: http://www.haydartuna.net

Haydar Tuna [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
 Hello,

 1) If you protect your site from SQL Injection, you must replace all quote 
 and blank character in your form data. (with string functions)
 2) After this step, you can  compare your password (with SHA1) and 
 database password field (with SHA1).
 3) if comparing passwords are true, then you must use session variables 
 for username
 4) if user forget his or her password, you can send email to the user when 
 the user answer password protected question.


 -- 
 Haydar TUNA
 Republic Of Turkey - Ministry of National Education
 Education Technology Department Ankara / TURKEY
 Web: http://www.haydartuna.net

 Tim [EMAIL PROTECTED] wrote in message 
 news:[EMAIL PROTECTED]
 Hello,

 Now moving on into other aspects of security :P I was thinking of a way 
 to
 secure my login inputs the best way possible.
 Seeing how many different types of injection attacks their is and while
 observing different authentication systems I often notice the sha() 
 function
 being used for passwords, which of course is the minimum requirements to
 saving passwords but.. Why manipulate this information in clear text 
 wether
 it be email or username or pass fields, such as when you use
 sessions/cookies, or any other method of passing authentication 
 information
 from page to page (an sha hash is x times less geussable then any other
 human term)... AND how to secure for injection attacks?

 Now this is where i thought hey, on every login page there is a user and
 pass input field and thus this is the only place one could peak into my
 user table, and I don't want someone injecting through their as the user
 table (three fields seperate from profile, username, email, pass) is the 
 key
 to entry to the site.. SO, why not just encrypt all three fields? And 
 store
 copies of email and username (not pass :P) in another database 
 unecrypted
 or with a salt for further recovery..

 This would ensure that ANY information entered into the user and passowrd
 will be run through sha() thus creating a 40 char length hash and 
 covering
 any (?) injection possiblity through a forged input in one of those 
 fields
 via my select routine..

 Just wondering what other security conscious people think of this plan
 even though it may slow down logins a tad but the tight security in my
 opinion justifies this..

 Does anyone see an ugly flaw in this scheme?
 Does it look viable?

 Thanks for any input,

 Regards,

 Tim 

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



[PHP] Re: New To PHP

2007-02-20 Thread Haydar TUNA
Hello,
 if you test your machine support PHP, you can use the following 
script. if this script properly execute, your machine can execute php 
script. if not you must support PHP.:)

?php
  phpinfo();
?


-- 
Haydar TUNA
Republic Of Turkey - Ministry of National Education
Education Technology Department Ankara / TURKEY
Web: http://www.haydartuna.net

Larry Chu [EMAIL PROTECTED], haber iletisinde sunlari 
yazdi:[EMAIL PROTECTED]
I am new to php and was trying to view the code below.  I do see in my 
browser the question that is being asked, but for some reason the answer is 
not displayed.  I am copying this from a book and am sure I have typed 
everything as it should be typed.  Can you please tell mw what might be 
wrong?

  Thank you.

  html
 headbasefont face=Arial/head
 body
 h2Q: This Creature can change color to blend in with its surroundings.
 What is its name?/h2
  ?php
 // print output
 echo 'h2iA: Chameleon/i/h2';
 ?
  /body
 /html


 

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



Re: [PHP] Understanding session variables with input field and register_global

2007-02-20 Thread Haydar TUNA
Hello,
   Can you send your code? I can help you :)


-- 
Haydar TUNA
Republic Of Turkey - Ministry of National Education
Education Technology Department Ankara / TURKEY
Web: http://www.haydartuna.net

Jay Blanchard [EMAIL PROTECTED], haber iletisinde sunlari 
yazdi:[EMAIL PROTECTED]
[snip]
I've an input field in a form

input name=username type=text ...

and with register_global I can use this field in PHP as variable
$username. Yet if I use a session variable

$_SESSION['username'] = 'value'

the variable $username gets the same value. On the other side when I
enter a value in the input field, the session variable isn't changed. So

how can I set the session variable from the input field after it has
changed?
[/snip]

$_SESSION['username'] = $username;

But really, you should turn off register_globals (holy war will not
ensue at this point, everyone knows the value). 

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



[PHP] Re: php forcing a post??

2007-02-20 Thread Haydar TUNA
Hello,
  You can use the tutorial in the following link :)
http://www.phpbuilder.com/tips/item.php?id=239



-- 
Haydar TUNA
Republic Of Turkey - Ministry of National Education
Education Technology Department Ankara / TURKEY
Web: http://www.haydartuna.net

blackwater dev [EMAIL PROTECTED], haber iletisinde sunlari 
yazdi:[EMAIL PROTECTED]
I currently have an html page that posts to a cgi function.  I need to
 interject some php in the middle.  So, the form will post to itself, the 
 php
 page will catch the post, check on thing and then pass along to the cgi 
 page
 but the cgi page only handles posts.  How can I still php in the middle 
 and
 still have it 'post' to the cgi page?

 Thanks!
 

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



Re: [PHP] Re: Securing user table with sha function

2007-02-20 Thread Haydar Tuna
Hello,
 Yes you are right I have no idea what he is doing. I'm sorry. I write a 
book now about
PHP and I want to help people anywhere in the world. I like helping people
because I'm a linux user. I am membership of Linux Community in Turkey. As
you know, linux users share  their knowledges or experiences. Again I'm
sorry if you see me the wise guy. I only like helping people:)
  Sincercely.


Haydar TUNA
Republic Of Turkey - Ministry of National Education
Education Technology Department Ankara / TURKEY
Web: http://www.haydartuna.net

Richard Lynch [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
 On Tue, February 20, 2007 4:08 am, Tim wrote:


 -Message d'origine-
 De : Haydar Tuna [mailto:[EMAIL PROTECTED]
 Envoyé : mardi 20 février 2007 10:34
 À : php-general@lists.php.net
 Objet : [PHP] Re: Securing user table with sha function

 Hello again,
   if you crypt your usernames, it happened many problems.
 As you know, if you crypt any string to SHA1, you don't
 decrypt again. You cannot use username in your application.
 in my many application, I have crpyted password , I haven't
 cryrpt usernames. Becuase I used username for session
 authentication. for example if  I want to action on the
 usernames or list of usernames , what can I do this? All of
 usernames are crypted.

 OK then what if i consider using PHP's Mcrypt extension with a key to
 crypt/decrypt data, this would give me the possiblity to use a
 username
 crypted hash in the session variable and decrypt it at any moment with
 the
 proper key?

 MySQL also has AES_CRYPT which will do this, so you needn't restrict
 yourself to PHP.

 You then have the tough question of whether it's more likely that your
 PHP source will be exposed and the key will leak out leaving you
 vulnerable to attack, or, perhaps, somebody on your server will manage
 to RUN your script that authenticates them in some way that gives them
 more access than they should, just because they can run the script
 with the key in it.

 On a shared server, for MOST webhosts, all the other users on that
 server can just read your PHP scripts using PHP because, duh, PHP has
 to be able to read your PHP script so PHP can readexecute your PHP
 script. [*]

 On a dedicated box where you, and only you, are the only user that has
 a valid login, it could help slow down an attack, or, perhaps, might
 open up a hole, if you code it wrong.

 There isn't a right answer because Security is not an off-the-rack
 suit.  It's a custom-tailored suit to fit the application needs.

 Your online bank needs a lot different security than your local
 community forum.

 Applying bank level security measures to the local community forum
 adds user inconvenience with no real benefit.

 You should always consider Security in the context of the application
 with an eye to usability and smooth process flow on the business side,
 and not just ultimate security

 Nobody knows which is better for what you are doing, because we have
 NO IDEA what you are doing, and you can't really tell us in a post to
 PHP-General, even one as long as this. :-)

 * I am completely ignoring various commercial PHP-obfuscation tools
 other than this footnote to keep others from posting about them.
 They're out there, Google for them, use them if appropriate, coo coo
 ka choo.

 -- 
 Some people have a gift link here.
 Know what I want?
 I want you to buy a CD from some starving artist.
 http://cdbaby.com/browse/from/lynch
 Yeah, I get a buck. So? 

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



[PHP] Re: importing contacts

2007-02-19 Thread Haydar Tuna
Hello,
 You can access your gmail account with libgmailer PHP library. 
libgmailer (class GMailer) is a PHP library that allow you to write PHP 
program to access Google's free webmail. You can download this library from 
below links

http://gmail-lite.sourceforge.net/wordpress/index.php/about/libgmailer/


Haydar TUNA
Republic Of Turkey - Ministry of National Education
Education Technology Department Ankara / TURKEY
Web: http://www.haydartuna.net

kumar3k [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]

 hai
  I am doing MCA in India ,now i am doing final year project in php
 language,my project title is importing contact from gmail any one know 
 the
 coding in php language help me.

 my id:[EMAIL PROTECTED]
 -- 
 View this message in context: 
 http://www.nabble.com/importing-contacts-tf3256650.html#a9054316
 Sent from the PHP - General mailing list archive at Nabble.com. 

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



[PHP] Re: PHP Startup: Unable to load dynamic library

2007-02-18 Thread Haydar TUNA
Hi,
   I think , you work on a Linux machine and you install together PHP 
and Apache in the source code. Can I give your ./configure paratemether. I 
think there is a problem in the configuration parameters.

Noah [EMAIL PROTECTED], haber iletisinde sunlari 
yazdi:[EMAIL PROTECTED]

 Hi,

 I am running apache-2.2.4 and php5-5.2.1-2
 and I am find some php related errors accumulating in 
 /var/log/messages  - look below.

 I've rebuilt php5 and apache2.2.4 and still the same issues.  what else 
 could be going on here.

 also 'apache restart' is fine but 'apache graceful' core dumps.

 any clues,

 Noah


 here they are:

 Feb 17 17:07:03 typhoon httpd: PHP Warning:  PHP Startup: Unable to load 
 dynamic library '/usr/local/lib/php/20060613-debug/ftp.so' - Cannot open 
 quot;/usr/local/lib/php/20060613-debug/ftp.soquot; in Unknown on line 0
 Feb 17 17:07:03 typhoon httpd: PHP Warning:  PHP Startup: Unable to load 
 dynamic library '/usr/local/lib/php/20060613-debug/ldap.so' - Cannot open 
 quot;/usr/local/lib/php/20060613-debug/ldap.soquot; in Unknown on line 0 

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



[PHP] Re: reverse http authentication

2007-02-18 Thread Haydar TUNA
You can use this programming part in here. If you have any question, you can 
send mail

?php
if ( ( !isset( $PHP_AUTH_USER )) || (!isset($PHP_AUTH_PW)) || ( 
verify($PHP_AUTH_USER,$PHP_AUTH_PW) == false) )
{
header( 'WWW-Authenticate: Basic realm=Header of the password box' );
header( 'HTTP/1.0 401 Unauthorized' );
echo h1Authorization Required./h1;
exit;
}
else
{
session_start();
session_register(user);
$_SESSION[user]= $PHP_AUTH_USER;
header( 'Location: http://www.doain.com');
}


function verify($username, $password)
{
$usercount = 1;
$myusername = array (0=username);
$mypassword = array (0=password);
$auth = false;

for ($i = 0; $i  $usercount; $i ++)
if ( ($myusername[$i] == $username)  ($mypassword[$i] == $password) )
$auth = true;
return $auth;
}

?

Haydar TUNA
Republic Of Turkey - Ministry of National Education
Education Technology Department Ankara
Web: http://www.haydartuna.net

Chris W [EMAIL PROTECTED], haber iletisinde sunlari 
yazdi:[EMAIL PROTECTED]

I want to read a page that is protected with http authentication.  How do I 
pass the user name and password to be authenticated with my php code?

 -- 
 Chris W
 KE5GIX

 Protect your digital freedom and privacy, eliminate DRM, learn more at 
 http://www.defectivebydesign.org/what_is_drm;

 Gift Giving Made Easy
 Get the gifts you want  give the gifts they want
 One stop wish list for any gift, from anywhere, for any occasion!
 http://thewishzone.com 

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



[PHP] Re: Help with sessions on Log in and Log out

2007-02-18 Thread Haydar TUNA
Hi,
Firstly , you should unset all of session variables an then you 
should destroy the session variables. After this process, redirect the page 
to HTML file (for example quit.html). By the way , you should use the GET 
variables or POST variables to quit.
if (isset($_GET['quit']))
{
   session_unset();
   session_destroy();
   include('quit.html');
   exit;
}

in quit.html load the main page of your web site. If you can apply 
this process, you can easily quit the application. If you have even click 
the back button, you wouldn't have entered the page.
quit.html code

html
body
script type=text/javascript
window.top.location=index.php
/script
/body
/html


-- 
Haydar TUNA
Republic Of Turkey - Ministry of National Education
Education Technology Department Ankara / TURKEY
Web: http://www.haydartuna.net


Ashish Rizal [EMAIL PROTECTED], haber iletisinde þunlarý 
yazdý:[EMAIL PROTECTED]
I am having some problem working with my script on session
 stuffs. Well, i have a login page which authenticates users by
 using sql script then if login is successful i have
 PHP Code:

 $_SESSSION['logged in']=true; and $_SESSION[userid]=$userid

 and when login is true i have included the page based on the
 access level of users . Like if it is a regular user i have
 include user.php ; exit() and if admin i have included admin page.

 Also i have a log out script which unsets the sessions variable
 and distroy the session at last.
 Also when admin loggs in to admin page i have a small php script
 that checks for those session variables and if the are set and
 is true then the pages are displayed.

 My problem is when admin just comes out to the login page again
 without log out it allows to login to the main page but in main
 page if any  a href link is clicked it goes back to login page.
 So then i will have to go back and log out first and then log
 in.. I am not sure why this strange things happens.
 Also is there any way i can have a feature like when the users
 click back button it wont allow to go back to that page unless he
 is using the back button provided by the web interface.

 I am new at the session stuffs, so i am not sure what i am doing
 is really a safe way to code a php page. are there any other
 things that i need to be aware of while using sessions.

 Any suggestions or thoughts would be highly appreciated.
 Thanks 

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



[PHP] Re: Securing user table with sha function

2007-02-18 Thread Haydar Tuna
Hello,

1) If you protect your site from SQL Injection, you must replace all quote 
and blank character in your form data. (with string functions)
2) After this step, you can  compare your password (with SHA1) and database 
password field (with SHA1).
3) if comparing passwords are true, then you must use session variables for 
username
4) if user forget his or her password, you can send email to the user when 
the user answer password protected question.


-- 
Haydar TUNA
Republic Of Turkey - Ministry of National Education
Education Technology Department Ankara / TURKEY
Web: http://www.haydartuna.net

Tim [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
 Hello,

 Now moving on into other aspects of security :P I was thinking of a way to
 secure my login inputs the best way possible.
 Seeing how many different types of injection attacks their is and while
 observing different authentication systems I often notice the sha() 
 function
 being used for passwords, which of course is the minimum requirements to
 saving passwords but.. Why manipulate this information in clear text 
 wether
 it be email or username or pass fields, such as when you use
 sessions/cookies, or any other method of passing authentication 
 information
 from page to page (an sha hash is x times less geussable then any other
 human term)... AND how to secure for injection attacks?

 Now this is where i thought hey, on every login page there is a user and
 pass input field and thus this is the only place one could peak into my
 user table, and I don't want someone injecting through their as the user
 table (three fields seperate from profile, username, email, pass) is the 
 key
 to entry to the site.. SO, why not just encrypt all three fields? And 
 store
 copies of email and username (not pass :P) in another database 
 unecrypted
 or with a salt for further recovery..

 This would ensure that ANY information entered into the user and passowrd
 will be run through sha() thus creating a 40 char length hash and covering
 any (?) injection possiblity through a forged input in one of those fields
 via my select routine..

 Just wondering what other security conscious people think of this plan
 even though it may slow down logins a tad but the tight security in my
 opinion justifies this..

 Does anyone see an ugly flaw in this scheme?
 Does it look viable?

 Thanks for any input,

 Regards,

 Tim 

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