[PHP] session objects crossing applications
I need help. I've got two copies of my application.foobar and foobar_dev When I go to http://foo.com/foobar/ a session is created and a database connection class is established and placed into this session. Then if within the same browser (using internet explorer) I go to http://foo.com/foobar_dev/ it will see not create a new database connection b/c it finds the one from http://foo.com/foobar. foobar and foobar_dev are suppose to point to different databases, but other than that all is identical. If I open a new internet explorer window via the windows Start menu all is fine. I thought if the url base is different then the session would be different? This is how it is with JSP. Am I miss-understanding something? Thanks for any assistance with this. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] RE: Paying Job...
I just thought I would share a personal experience that I am currently going through that relates to this. I was approached by a client to develop a full e-commerce solution for his company. I am only one guy, and I had never done any PHP code on this scale before. I knew this, but I wanted to do the job. So I undercut myself. I mean really undercut (in hindsight, I shouldn't have undercut myself as much as I did). I am in the process of delivering a $20,000 - $25,000 website to this company, and I am only making $2000 on it. I have spent close to 700 hours on the development of this project in my evenings and weekends. So why did I do it? Three reasons... 1) I wanted the job. 2) I needed a 'good' portfolio piece. 3) I can now buy computer parts cheaper than Future Shop. If you decide to charge by the project make sure you know what you're getting yourself into, and that its going to be something you can deliver. Since I have started working on my project I have gained 3 more contracts without even trying just by showing them this project. That and being able to say "I did this... ALL BY MYSELF!" is pretty cool. Jason L Cathcart BSc. Computer Information Systems [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> -Original Message- From: Gerard Samuel [mailto:[EMAIL PROTECTED]] Sent: July 25, 2002 9:47 AM To: php-gen Subject: Paying Job... Basically, someone is looking to get a database driven site built, and Ive never written code for money before. Im looking for advice, as to how the experienced coders in here charge for their work. Do you charge by the page, script or by the hour (that would be nice). Thanks for any input you may provide... -- Gerard Samuel http://www.trini0.org:81/ http://dev.trini0.org:81/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Determining if a variable is blank.
I have a simplistic forum, and I am trying to write some code to determine if the message box actually contains information, because if it is blank I obviously don't want to post it to the database. The message box has the name of 'reply'. Here is the code I'm trying to use, but its not working: $reply2 = str_replace(" ","",$reply); if(empty($reply2)){ // echo some error message to the user that they can't post a blank message } else{ // post the message } This however didn't work for me. So I had the thought that maybe the variable $reply2 isn't set because it is blank. So I tried this: $reply2 = str_replace(" ","",$reply); if(empty($reply2) || !isset($reply2)){ // echo an error message } else{ // post the message. } I've tried different variations on this same idea, but somehow none of them are working. Can anyone give me any suggestions or insight? Jason Cathcart Check Out My Site: http://www.biohazardous.org
[PHP] multiple keywords in search boxes
Hi, What is the necessary code to return a recordset from a single text box with more than one keyword in it (like most search engines do)? Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Weird problem with Windows XP and IE6
Hi... I've written a shopping cart program that is in use at www.dangeo.com and I'm having a weird problem that has just been brought to my attention. As far as I can tell everything works perfectly fine with the shopping cart in windows 98, and 2000. However the problem I'm having is that when customers using XP get into the shopping cart they can't get past the screen where they put in their address. I haven't been able to duplicate this problem. What I'm hoping is that some of you might be able to take a look at it, duplicate the problem, and give me some suggestions as to what the problem is. Jason Cathcart Check Out My Site: http://www.biohazardous.org
[PHP] RE: Weird problem with Windows XP and IE6
As an adendum to this... my initial thoughts are that the forms are not posting correctly in XP. I'm using the POST method. Jason Cathcart Check Out My Site: http://www.biohazardous.org -Original Message- From: Jason [mailto:[EMAIL PROTECTED]] Sent: September 18, 2002 7:50 PM To: Php-General Subject: Weird problem with Windows XP and IE6 Hi... I've written a shopping cart program that is in use at www.dangeo.com and I'm having a weird problem that has just been brought to my attention. As far as I can tell everything works perfectly fine with the shopping cart in windows 98, and 2000. However the problem I'm having is that when customers using XP get into the shopping cart they can't get past the screen where they put in their address. I haven't been able to duplicate this problem. What I'm hoping is that some of you might be able to take a look at it, duplicate the problem, and give me some suggestions as to what the problem is. Jason Cathcart Check Out My Site: http://www.biohazardous.org
[PHP] Uploading Files
I would like to be able to upload files from the client computer to the server via a form. I know how to build the form, but am not sure of the best way to process this. I know there are certain ftp functions that can do this, which I'm not sure how to use. Are there any others? Jason D. Williard -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Uploading Files
Okay, I checked out the link listed below, and tried using what is given there, but I get the following error: Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in d:\www_root\locutus\phpman\admin\test.php on line 16 Here's the code that I am using: Send this file: I am able to get rid of this error, but changing the line to: move_uploaded_file($_FILES['userfile']['tmp_name'], "../images/$_FILES[userfile][name]"); However, the file is then uploaded as Array[name] How do I get past this? Jason Williard "Eriol" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > "Jason" <[EMAIL PROTECTED]> disgorged: > > : I would like to be able to upload files from the client computer to the > : server via a form. I know how to build the form, but am not sure of the > : best way to process this. I know there are certain ftp functions that can > : do this, which I'm not sure how to use. Are there any others? > > > > http://www.php.net/manual/en/features.file-upload.php > > More specifically, move_uploaded_file() and is_uploaded_file() > > HTH.. > > Take care.. peace.. > eriol > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] lynx and crontab
I have a tutorial for using lynx to monitor a firewall. http://frontiertech.ca/tutorial_web_page_monitor.php www.frontiertech.ca Free Open Source Software for Data Collection and Data Mining. On Tue, 15 Oct 2002, adrian murphy wrote: > my isp lets me control crontab so i've been trying to > run a php script every 30 mins. > > the command is like this: > lynx - dump http://www.mysite.com/test.php > > which gives the error > > lynx: Start file could not be found or is not text/html or text/plain > > what do i telll my isp to do to get lynx to supprt .php files? > (i get a better response from them if i tell them exactly what to do ;-) ) > > tia > adrian > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] MySQL GMT --> Local time
My logging application is feeding a MySQL database with data records that are time stamped with GMT time. I would like to query the database for records matching local time(eg. all records created on oct 17,2002 local time). I would prefer if the records could be formated in local time when returned from MySQL. What is the best way to do this. Jason -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] MySQL GMT --> Local time
To the server. On Thu, 17 Oct 2002, Smith, Benjamin wrote: > Local to the client or local to the server? > > -Original Message- > From: Jason [mailto:[EMAIL PROTECTED]] > Sent: Thursday, 17 October 2002 3:26 PM > To: php_gen > Subject: [PHP] MySQL GMT --> Local time > > > > My logging application is feeding a MySQL database with data records > that are time stamped with GMT time. I would like to query the database > for records matching local time(eg. all records created on oct > 17,2002 local time). I would prefer if the records could be formated > in local time when returned from MySQL. What is the best way to do this. > > Jason > > > > > > -- > 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 GMT --> Local time
On Thu, 17 Oct 2002, 1LT John W. Holmes wrote: > > My logging application is feeding a MySQL database with data records > > that are time stamped with GMT time. I would like to query the database > > for records matching local time(eg. all records created on oct > > 17,2002 local time). I would prefer if the records could be formated > > in local time when returned from MySQL. What is the best way to do this. > > I don't know if there is an automatic way to do it, but if you know you are > 5 hours ahead of GMT for example, and you want all records for Oct 17, 2002 > GMT+5, then you could do this: > > SELECT * FROM your_table WHERE TO_DAYS(datetime_column + INTERVAL 5 HOUR) = > TO_DAYS(20021017) > > You can use DATE_FORMAT() in your query to reformat the MySQL timestamp, or > use UNIX_TIMESTAMP() to retrieve a unix timestamp instead and format it in > PHP. With the above query, the "5" and actual date "20021017" can be PHP > variables, to make it more flexible. > > ---John Holmes... > Where it gets messy is when daylight saving kicks in. Knowing what dates are included with standard or daylight savings time offsets is a problem. It gets more complicated when I want to return a distinct date record set from the timestamp column. Jason -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Windows XP Session Issues
I've been noticing that with Windows XP session variables migrate between open browser windows, where in other versions of Windows the session variables are kept within the browser window that they were initialized in. The problem with this is that it seems like my website gets confused by this, and thus people are unable to properly use some of the functionality. I was wondering if anyone else has encountered problems like this, and if so, how they managed to solve the issue. Jason Cathcart President - Acanthus Media Inc. BSc. Computer Information Systems 403.710.0378 www.acanthusmedia.ca [EMAIL PROTECTED]
[PHP] simple?
Hello all, I have written a script for the purpose of uploading an image and block of text for a site. Real simple stuff but I can't get the form to write? code looks like this... I have some error checking above this but the meat of it still doesn't work. I get: Parse error: parse error in /var/www/html/site/directory/subdirectory/upload.php on line 68 in the upload.php file there are only 64 or so lines of code. HELP! Jason -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] upload_tmp_dir has no value... could that be the problem?
All, Trying to run an upload script. Looks like the problems is in the "if (move_uploaded_file.." line also a look at the configuration of PHP4.1.2 shows "no value" for upload_tmp_dir Any hints? Jason -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Walking Through Mail Headers
Hi, I need a way to walk through mail headers and search for a specific string in the subject. If the message contains the string, it will be forwarded to a different account, otherwise it will trigger an autoresponse with a certain message to the sender. Does anyone have any infomation on doing this, or can point me where to start. I think the thing I'm caught up on is how I walk through the mail headers in the mail file (We are on FreeBSD). Thanks. Jason -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] mySQL table joins are slow, need rebuild?
hi, i have a query that is comparing a table with 1235 rows with another that has 635 rows. The query looks like this: $res = mysql_query("select cust_info.ID, cust_info.first_name, cust_info.last_name, cust_info.address, cust_info.datestamp from cust_info, cust_order_info where cust_info.ID=cust_order_info.cust_id order by $mainsort" . $order . ";"); The parse time with the join is 19 seconds. I have to do a join because there a different methods that the user must be able to sort by. The parse time on the cust_info table alone, with a order by is .95 seconds. Now, we have a RPM binary of mySQL, and when performing the query, not only is it slow, but sometimes will dump its core. Does anyone see anything wrong with the query, or should we consider building the source on our box.. or? Thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Converting mySQL to PostgreSQL
Hi, I am in need a transfering an existing mySQL database to PostgreSQL. I have seen info on the converter. Before I get started I wanted to see info anyone has any insight or tips on converting these DBs (ie- is it problematic, inconsistent, etc). Thanks! John -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Web Hosting That Supports PostgreSQL?
Hi, I am looking for a cheap hosting plan that supports PostgreSQL (hopefully 7.1) with PHP4 on a unix platform (BSD prefered, Linux would be OK though). It would be nice if phpPgAdmin was already configured with the account. But if not, that's ok, I can set it up myself. This is only for the development of my site, not production, so that's why I'm looking at a cheap solution. Anyone have any recommendations? Thanks. Jason -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Easily Making Post Vars Session Vars
Hi, I realize you cannot override session variables through GET or POST for security reasons. I have a complex multipage form that I would like to store in a session for insertion in the database when the last step is completed. The form field names are arrays, so they can be listed and inserted quite easily (ie-custinfo[name], custinfo[state], etc). So, is there anyway to assign $HTTP_POST_VARS to a session array holding the same values without assign each variable one by one (there are a ton of variables). I tried doing something like this and it didn't seem to work: session_start(); if(!isset($custinfo)) { session_register("custinfo"); $custinfo = array(); } $custinfo = $HTTP_POST_VARS; So, it doesn't appear it will be that easy. Anybody have any hints on doing this? Thanks! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Easily Making Post Vars Session Vars
Ok, I see where that's going. I actually was a bit off in my first posting. The form field names are a multi-dimesional array. The goal it to make writing all of the info to the db a breeze. ie- name="cust[personal][phone]" and name="cust[history][interests]" etc etc lets also say $cust[history][interests] = "tv"; The reasoning behind it is the data does not need to be stored in a consistent or usable (just readable) manner. so... say history is a table, and has a column name details. I would cycle through the array two levels deep on the first associative "history", i suppose with nested while(list = each). The two values I want to return from that array would be the 2nd associative key name and the value, in this case "interests" and "tv". SO... back on track... how would i utilize that loop below to get my multi-dimesion form variables into a session. Once I get it into a session I think I can break it up no problem. Thanks. > -Original Message- > From: Johnson, Kirk [mailto:[EMAIL PROTECTED]] > Sent: Monday, May 14, 2001 1:07 PM > To: Php-General > Subject: RE: [PHP] Easily Making Post Vars Session Vars > > > This isn't quite what you are asking, but maybe it will be of > help. Use the > loop below to create and assign GLOBAL versions of the $HTTP_POST_VARS:; > > reset($HTTP_POST_VARS); > while(list($key, $val) = each($HTTP_POST_VARS)) { > $GLOBALS[$key] = $val; > } > > Kirk > > > -Original Message- > > From: Jason [mailto:[EMAIL PROTECTED]] > > Sent: Monday, May 14, 2001 1:32 PM > > To: Php-General > > Subject: [PHP] Easily Making Post Vars Session Vars > > > > > > Hi, > > > > So, is there anyway to assign $HTTP_POST_VARS to a session > > array holding the > > same values without assign each variable one by one (there > > are a ton of > > variables). > > [snip] > > I tried doing something like this and it didn't seem to work: > > session_start(); > > if(!isset($custinfo)) { > > session_register("custinfo"); > > $custinfo = array(); > > } > > $custinfo = $HTTP_POST_VARS; > > > > > > So, it doesn't appear it will be that easy. Anybody have any > > hints on doing > > this? > > > > Thanks! > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] PLEASE --> Compiling an extension for PHP module (pgsql.so --> missing libpq.so.2)
Hi, I'm trying to compile an extension for Postgre support which I will either load in the php.ini or use the dl() function. Both methods fail right now. The dl() function gives me verbose though. I compiled the module like this: ./configure --with-apache=/usr/local/Apache/apache_13 --with-pgsql=shared make I entered the php_4.0.5/modules directory. I see two files pgsql.so and pgsql.la. I copy both to /usr/local/lib (where my libs sit as specified in php.ini). I restart the server and I get an error saying a shared library (libpq.so.2) cannot be found. I went to /usr/local/pgsql/lib and copy libpq.so.2 to /usr/local/lib. Now I get the following error: Warning: Unable to load dynamic library '/usr/local/lib/pgsql.so' - /usr/local/lib/pgsql.so: Undefined symbol "zend_ini_boolean_displayer_cb" in /public_html/inc/mainfile.php on line 3 Whats the deal with this? I am compiling right? Should php have produced a different libpq.so.2 file elsewhere? THANKS!!! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Trimming 2 Characters from the end of a string?
Hi, What would be the syntax to trim 2 characters off of a given string? Thanks! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Unlucky Situation Involving CURL
I'm developing a website that has the unlucky situation of being situated on a host that does not have CURL installed on it. This is basically what I'm trying to do: $ch = curl_init(); /// initialize a cURL session curl_setopt ($ch, CURLOPT_URL,"https://www.ups.com/ups.app/xml/Rate";); /// set the post-to url (do not include the ?query+string here!) curl_setopt ($ch, CURLOPT_HEADER, 0); /// Header control curl_setopt($ch, CURLOPT_POST, 1); /// tell it to make a POST, not a GET curl_setopt($ch, CURLOPT_POSTFIELDS, "$y"); /// put the query string here starting with "?" curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); /// This allows the output to be set into a variable $xyz $xyz = curl_exec ($ch); /// execute the curl session and return the output to a variable $xyz curl_close ($ch); /// close the curl session Basically what this will do is send an XML file to UPS, to get shipping rates which are returned as an XML file from UPS. The script has to sit and wait for an answer from the UPS servers. Does anybody know of a way of doing this without using CURL? Jason Cathcart
[PHP] PHP and MySQL queries
As of yet I have tried all sorts for date formating for the search field to work. I.E. 2001-10-23, 10/23/2001, 10/%/2001, 10%, %10%, etc. The date field in the database is stored as 10/23/2001 and yet when a user enters the date and clicks the search button it does not display the results. I am almost certain that as the user clicks the submit button the php script is parsing the search string (i.e. 10/23/2001) incorrectly. I believe it is parsing the sting as 10&nsb;23&nsb;2001 or something to that effect. If anyone has some more information on this please let me know. I am pretty sure I have exhausted my resources. "Jason" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED]... > I am having a hard time setting up a form for users to enter a date in the > format of 00/00/ (of course they would use an actual date). My form is > as follows... > > *I.E. - Format is 04/01/2001* > Search for Ads by date: > > > > value="Submit"> > > > > > On my search.php page I have the following MySQL connection and search > parameters... > > mysql_connect ("db_hostname", "db_username", "db_password"); > > mysql_select_db ("db_name"); > > if ($date == "") > {$date = '%';} > > $result = mysql_query ("SELECT > fname,lname,address,city,state,zip,phonea,phone,email,crty,crnum,crmo,cryr,w > eeks,ogden,rock,logan,ipaddress,ad,total,num,date,time > FROM ads WHERE date LIKE '%$date%' LIMIT 0, 30 "); > $count = -1; > if ($row = mysql_fetch_array($result)) { > $count ++; > do { > echo "Name: "; > printf(mysql_result($result,$count,"fname")); > echo " "; > printf(mysql_result($result,$count,"lname")); > echo "\n"; > > echo "Address: "; > printf(mysql_result($result,$count,"address")); > echo "\n"; > > echo "City: "; > printf(mysql_result($result,$count,"city")); > echo "\n"; > > echo "State: "; > printf(mysql_result($result,$count,"state")); > echo "\n"; > > echo "Zip: "; > printf(mysql_result($result,$count,"zip")); > echo "\n"; > > echo "Phone: ("; > printf(mysql_result($result,$count,"phonea")); > echo ") "; > printf(mysql_result($result,$count,"phone")); > echo "\n"; > > echo "Email: "; > printf(mysql_result($result,$count,"email")); > echo "\n"; > > echo "Credit Type: "; > printf(mysql_result($result,$count,"crty")); > echo "\n"; > > echo "Credit Number: "; > printf(mysql_result($result,$count,"crnum")); > echo "\n"; > > echo "Credit Card Date: "; > printf(mysql_result($result,$count,"crmo")); > echo " "; > printf(mysql_result($result,$count,"cryr")); > echo "\n"; > > echo "Weeks: "; > printf(mysql_result($result,$count,"weeks")); > echo "\n"; > > echo "town1: "; > printf(mysql_result($result,$count,"town1")); > echo "\n"; > > echo "town2: "; > printf(mysql_result($result,$count,"town2")); > echo "\n"; > > echo "town3: "; > printf(mysql_result($result,$count,"town3")); > echo "\n"; > > echo "IP Address: "; > printf(mysql_result($result,$count,"ipaddress")); > echo "\n"; > > echo "Ad: "; > > $ad[$count] = (mysql_result($result,$count,"ad")); > > $ad[$count] = ereg_replace ("&a&", "'", $ad[$count]); > $ad[$count] = ereg_replace ("&q&", "\"", $ad[$count]); > $ad[$count] = ereg_replace ("&p&", "%", $ad[$count]); > $ad[$count] = ereg_replace ("&bs&", "\\", $ad[$count]); > > > echo $ad[$count]; > echo "\n"; > > echo "Total: "; > printf(mysql_result($result,$count,"total")); > echo "\n"; > > echo "Ad Number: "; > printf(mysql_result($result,$count,"num")); > echo "\n"; > > echo "Date: "; > printf(mysql_result($result,$count,"date")); > echo "\n"; > > echo "Time: "; > printf(mysql_result($result,$count,"time")); > echo "\n"; > > } while($row = mysql_fetch_array($result)); > > } else {print "Sorry, no records were found!";} > > ?> > So far I have come to the conclusion that the input from the user is > probably where my problem is because I am assuming it is taking the "/" in > the date they enter and doing something I don't want it to. In any event if > someone could give me a clue as to how to resolve this issue it would be > greatly appreciated. > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Using php to verify fields in form...
I am new to php and I have been using a book to learn a bit about it and well I could not find a chapter on how to use php to verify a form is filled out properly, for instance I have a form with 3 fields... name, email and words. once the user clicks the submit button i want it to verify those 3 fields before running the php script to pass the info to a database. I have used java-script for this function in the past but would like to use php. Anyone know how i can accomplish this? Thanks in advance, Jason -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] PHP to MySQL and Date field
Here is my problem once again... =P I am wondering if I should change the date table to something other than date... maybe something like date_1? Would doing that resolve my issue, because of the fact that the date variable in php is function? Thanks in advance... Jason /* Form to supply variables */ http://path/to/search.php";> Search for Ads First name: Last name: Area Code: Phone: Date: Once user clicks submit button it links to this php script to connect, query and display results... eveything works fine except for the date variables. If anyone with a little more know how can point me out the error I would greatly appriciate it. /* php script to connect, query and display results */ "; PRINT "First Name: "; print $row["fname"]; print (""); PRINT "Last Name: "; print $row["lname"]; print (""); PRINT "Address: "; print $row["address"]; print (""); PRINT "City: "; print $row["city"]; print (""); PRINT "State: "; print $row["state"]; print (""); PRINT "Zip: "; print $row["zip"]; print (""); PRINT "Area Code: "; print $row["phonea"]; print (""); PRINT "Phone: "; print $row["phone"]; print (""); PRINT "Email: "; print $row["email"]; print (""); PRINT "Weeks: "; print $row["weeks"]; print (""); PRINT "City 1: "; print $row["cty1"]; print (""); PRINT "City 2: "; print $row["cty2"]; print (""); PRINT "City 3: "; print $row["cty3"]; print (""); PRINT "Ad: "; print $row["ad"]; print (""); PRINT "Total: "; print $row["total"]; print (""); PRINT "Number of weeks: "; print $row["num"]; print (""); PRINT "Date: "; print $row["date"]; print (""); PRINT "Time: "; print $row["time"]; print (""); print (""); } while($row = mysql_fetch_array($result)); } else {print "Sorry, no records were found!";} ?> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Verisign Payflow Pro? Freebsd... Any ideas?
Hi, I'm trying to get payflow pro working on my server (unfortunately a client took it upon themselves to get their gateway). I am on a freebsd box and I am having all sorts of problems getting this working. Either as an extension (pfpro.so) or just exec() externally. I've read that Verisign stopped distributing a FreeBSD of their SDK... which seems true since it is not offered on their site. So... first I downloaded the BSDi SDK. I thought I might be able to hack it up a bit... no such luck, as a module or just scripting to it. So, if all else fails go for the linux dist. I downloaded, gunziped, and proceeded to make a php extension. ./configure --with-pfpro=shared,/usr/local/verisign/payflowpro/linux Compiles fine... creates pfpro.so. I copy pfpro.so and libpfpro.so (which came with the SDK) to /usr/local/lib (this is the lib directory my ini file points to, which is where my other extensions are). i copy pfpro.h to usr/local/include. i add the following to my php script dl('pfpro.so'); It won't load... I get a error stating it cannot find libc.so.6. So I copy over the lib from the linux compat files to /usr/lib (not usr/local/lib). Refresh... apparently it found that, as it is now cannot locate ld-linux.so.2 (i think). Again, I copy this from the compat to /usr/lib. I am expecting an error, but it tells me it still cannot locate it. I do a bunch of steps probably unneccessary just to try everything. I copied this to my /usr/local/lib, i run ldconfig, i do a bunch of stuff to no avail. Can anyone give me some insight on setting payflow pro up on freebsd as a php module? Now, I know it "can" work. I dropped to my shell, ran /linux/bin/test.sh. Works... i run ./pfpro as is and it can't find libraries (the test.sh script defines their location). So, I decide I'll try to hack up something exec(pfpro)'ing from the script, despite i am no good at this. i found a snipet of code in the anotated php manual. I could not get it to work. I even exec() the same code that defines the libs in the shell script (test.sh) before exec() the pfpro call. the code is: function pfpro_shell($arFields) { $signio_cmd = "/usr/local/verisign/payflowpro/linux/bin/pfpro test-payflow.verisign.com 443\""; foreach($arFields as $key=>$val) $signio_cmd .= $key . "=". urlencode($val) . "&"; $signio_cmd .= "\""; $signio_result = exec($signio_cmd); parse_str($signio_result,$arResult); if (!isset($arResult["RESULT"])) die ("Exec command failed to return proper result"); return($arResult); } I pass the following array just to test it $transaction = array(USER => 'mylogin', PWD => 'mypassword', TRXTYPE => 'S', TENDER => 'C', AMT => 1.50, ACCT => '4111', EXPDATE => '0904'); pfpro_shell($transaction); It just dies with the error message everytime (Exec command failed to return proper result). It does not pass anything back ($arResult is empty). If I could get the entension working, that would be ideal, but a work around through some shell scripting would suffice. I am not willing to recompile apache again right now, so a static --with-pfpro is not an option. Thanks in advance. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Re: Help with directory !
$loc = "doos.txt"; $loc = "files\doos.txt"; don't put .\ to reference the current directory. if you were trying to move up a directory to access 'files' then $loc= "..\files\doors.txt". Just a thought, I've coded something for a windows box once, and remember it was finicky about stuff. but then again, to the best of my memory i thought you could use forwards slashes in php code for windows too. =) - Original Message - From: "De Necker Henri" <[EMAIL PROTECTED]> To: "PHP-General (E-mail)" <[EMAIL PROTECTED]> Sent: Friday, November 30, 2001 1:37 AM Subject: RE: [PHP] Re: Help with directory ! > The first one works both ways!O and im working on windows > This works fine : $loc = "./doos.txt" > This works fine : $loc = ".\doos.txt" > > The second one does work at all! > Is it in the correct order/way? > > > -Original Message- > From: Fred [mailto:[EMAIL PROTECTED]] > Sent: 30 November 2001 10:25 > To: [EMAIL PROTECTED] > Subject: [PHP] Re: Help with directory ! > > > The first one looks like a *nix directory and the second one looks like a > windows direcrory. Perhaps it will work if you switch your slashes around. > > Fred > > De Necker Henri <[EMAIL PROTECTED]> wrote in message > 3A8ED7A62794D311AA7700508B6164EC08DCA3F2@SCPTS01">news:3A8ED7A62794D311AA7700508B6164EC08DCA3F2@SCPTS01... > > Hi there.Im cant just get to access a file in a directory form my > localhost > > dir. > > The file : $loc = "./doos.txt" i can access, > > > > but the following i can't : $loc = ".\files\doos.txt" > > What am i doibg wrong? > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] HTTP_POST_VARS truncated
try: reset($HTTP_POST_VARS); at the begining of the code. if that doesn't work verify your html again. make sure the 's are between the form tag. php doesn't ignore certain form fields. =) i'm the habit of reading arrays like... while(list($k,$v) = each($HTTP_POST_VARS)) { echo "key is $k - val is $v \n"; } > To test the http/php setup on one of my computers I wrote a > very simple html form, with two select fields, > two text fields, and the submit field. Pushing submit the > data are sent via POST method to an extremely simple PHP > page which only contains something like: > > foreach (var, key) in HTTP_POST_VARS { > > print "VAR: $var KEY = $key > } > > It works, (meaning that php code is correct, html output is displayed, > and no error are reported) but only prints three lines, i.e. the two select fields are missing. > Both the php and the html code are syntactically correct: I > double checked that on the books, just to be sure. > > It looks like the select fields, and them only, are not passed > to the form by the server, or that in some other way they never > make it into HTTP_POST_VARS. > > Any ideas? Setup is plain Red Hat 7.2 with its default apache/php > packages. > > TIA, > mweb > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Help - mail
http://download.php.net/manual/en/ref.mail.php - Original Message - From: "Chamarty Prasanna Kumar" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Friday, November 30, 2001 1:28 AM Subject: [PHP] Help - mail > > Hi all, > > using mail() function to send a mail using php. > > I want to send that mail so that the receiver should > > not see the FROM address or the mail should go without > > any FROM address. > > Please write with an example !! > > > Thanking You, > > Regards, > > Kumar. > > > > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Sending Form Result to File
just pico a file called myforms.csv or something. use the first line for you schema... "name","date","comments","etc" chmod the file to rw permissions or chown to nobody. $file = fopen("/home/myaccnt/public_html/protected/myforms.csv", "w"); fputs($file, "\n\"$form_name\",\"$form_date\",\"$form_comments\",\$form_etc\""); fclose($file); - Original Message - From: "Ben Clumeck" <[EMAIL PROTECTED]> To: "PHP General" <[EMAIL PROTECTED]> Sent: Thursday, November 29, 2001 5:34 PM Subject: [PHP] Sending Form Result to File > I am looking for a script to send my form results to a .txt file in CSV (to > import into Excel) format. Does anyone have a simple code? > > Ben > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] payflow pro advice
Hi, I'm trying to get payflow pro working on my server (unfortunately a client took it upon themselves to get their gateway). I am on a freebsd box and I am having all sorts of problems getting this working. Either as an extension (pfpro.so) or just exec() externally. I've read that Verisign stopped distributing a FreeBSD of their SDK... which seems true since it is not offered on their site. So... first I downloaded the BSDi SDK. I thought I might be able to hack it up a bit... no such luck, as a module or just scripting to it. So, if all else fails go for the linux dist. I downloaded, gunziped, and proceeded to make a php extension. ./configure --with-pfpro=shared,/usr/local/verisign/payflowpro/linux Compiles fine... creates pfpro.so. I copy pfpro.so and libpfpro.so (which came with the SDK) to /usr/local/lib (this is the lib directory my ini file points to, which is where my other extensions are). i copy pfpro.h to usr/local/include. i add the following to my php script dl('pfpro.so'); It won't load... I get a error stating it cannot find libc.so.6. So I copy over the lib from the linux compat files to /usr/lib (not usr/local/lib). Refresh... apparently it found that, as it is now cannot locate ld-linux.so.2 (i think). Again, I copy this from the compat to /usr/lib. I am expecting an error, but it tells me it still cannot locate it. I do a bunch of steps probably unneccessary just to try everything. I copied this to my /usr/local/lib, i run ldconfig, i do a bunch of stuff to no avail. Can anyone give me some insight on setting payflow pro up on freebsd as a php module? Now, I know it "can" work. I dropped to my shell, ran /linux/bin/test.sh. Works... i run ./pfpro as is and it can't find libraries (the test.sh script defines their location). So, I decide I'll try to hack up something exec(pfpro)'ing from the script, despite i am no good at this. i found a snipet of code in the anotated php manual. I could not get it to work. I even exec() the same code that defines the libs in the shell script (test.sh) before exec() the pfpro call. the code is: function pfpro_shell($arFields) { $signio_cmd = "/usr/local/verisign/payflowpro/linux/bin/pfpro test-payflow.verisign.com 443\""; foreach($arFields as $key=>$val) $signio_cmd .= $key . "=". urlencode($val) . "&"; $signio_cmd .= "\""; $signio_result = exec($signio_cmd); parse_str($signio_result,$arResult); if (!isset($arResult["RESULT"])) die ("Exec command failed to return proper result"); return($arResult); } I pass the following array just to test it $transaction = array(USER => 'mylogin', PWD => 'mypassword', TRXTYPE => 'S', TENDER => 'C', AMT => 1.50, ACCT => '4111', EXPDATE => '0904'); pfpro_shell($transaction); It just dies with the error message everytime (Exec command failed to return proper result). It does not pass anything back ($arResult is empty). If I could get the entension working, that would be ideal, but a work around through some shell scripting would suffice. I am not willing to recompile apache again right now, so a static --with-pfpro is not an option. Thanks in advance.
[PHP] Slick Time Zone Coversions
Hey, I wanted to see if anybody has a some ideas or code for a good time zone coversion function. Basically, I would like something where the user can input their timezone (or if php doesn't recognize timezones, maybe just the current time for them, and it can caluculate the difference, but timezones would be preferred). They then enter a time (hh:mm am/pm) which is not local to them, and the function will output a time that has been converted to their timezone. Basically i just want users to be able to take a non-local time and get the local time in their timezone with it. This will be for US times only also. Thanks a bunch!
RE: [PHP] Mixing PHP with a FAX Gateway? HELP!!! IDEAS???
Hey, If anyone has any better solutions too, let me know, I'm open to anything. > -Original Message- > From: Fotwun [mailto:[EMAIL PROTECTED]] > Sent: Thursday, August 23, 2001 5:32 PM > To: [EMAIL PROTECTED] > Subject: [PHP] Mixing PHP with a FAX Gateway? HELP!!! IDEAS??? > > > > > Hey, > > I'm wondering if anyone here has any experiencing mixing webware > with a FAX > solution on the unix platform, particulary FreeBSD 4.2. > > I have 2 seperate possilble solutions here. The first involves > faxing using > software configured on the server. The 2nd is a PHP type > solution, capturing > HTML from a URL and assembling it into an attachment for email. > Please give > me any thoughts you can offer on these. > > What I currently have is a e-commerce solution I wrote in PHP. There are > pages that are generated (sort of like a populated form) that need to be > faxed. This is all theory I am talking right now, because I have > never done > anything like this, including just faxing from a server. > > Now, what would it entail to get our dedicated server preped to do faxing > for starters. It's at our colo facility and gobs of bandwidth. > Obviously we > have no modem connected at this point, and I don't even know if an actual > phone line would be available to us. So, what I am guessing is that there > are services that offer dial-out gateways for faxing and such, over the > Internet. Where, our software can send data to a faxing gateway, which in > turn sends the fax through their lines. Anyone know of any services like > this? > > Also, what type of faxing software is available on FreeBSD? How does it > integrate with actual means of faxing (gateways/modem) etc. > > Basically, the whole fax over server thing is new to me, and I'm trying to > see if anyone has any experience at all doing this. The goal is: when you > are looking at this rendered HTML page, you have a button that says "Fax" > and when you click on it, the web page you are looking at is faxed off, > through the server, looking just as it appeared on the screen basically > (which merely consists of text in tables, and a couple 's). > The goal is > to make this as seamless as possible. > > 2nd solution- > Now, eFax offers you a service where you can send an email, containing an > attachment, such as .html and it will render the email and attachments and > fax them off like they look. This would not be such a bad idea, > but we want > to avoid people having to manually "Send Page By Email" through > outlook each > time. What I am thinking if I can capture the HTML that is generated from > the script (ie- showdetails.php?order_id=432) and then create an > attachment > of that HTML (ie- my_attachment_to_fax.html) and then send it > through email > ( function mail(); ) that would be perfect. Anyone have any code on how > capture the HTML from a URL (fopen(); ?) and then assemble that into an > attachment (.html / correct mime type/headers) and send it off? > > Sound plausible? > > Please give me any insight to either of these methods. Thank you. > > Fotwun > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Named anchors, POST failure
PHP 4.3.4 MySQL 4.0.2 Apache 2.0.48 RedHat 9.0 I have a form that post some data to a DB. After the post, I send it back to another page with a named anchor like this: Comments By way of a URL that looks like this: http://www.domain.com/index.php?mode=view&id=100&#comments or http://www.domain.com/index.php?mode=view&id=100#comments Using Mozilla Firefox .08, .09, Netscape 5+, and Mozilla 1.7 this will show a blank page. If I use IE, I notice a longer pause since adding the named anchor, but it will still work. Any ideas about PHP having issues passing a named anchor? Thank You. - Jason -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Named anchors, POST failure
Sure. This is my function for posting a comment via the form I mentioned previously: [code] case "post_comment": // SQL to insert new psot into DB // $sql = "INSERT INTO table(value1, value2, value3) VALUES ('" . $_POST["value1"] . "', '" . $_POST["value2"] . "', '" . $_POST["value3"] . "')"; $result = mysql_query($sql) or die ("inserting_values:".mysql_error()); // Grab the ID so we can refer to it later // $id = mysql_insert_id(); // Redirect back to comments page // echo"window.location.href='index.php?mode=view&id=$id&#comments';"; break; [/code] - Jason Jay Blanchard wrote: [snip] I have a form that post some data to a DB. After the post, I send it back to another page with a named anchor like this: Comments By way of a URL that looks like this: http://www.domain.com/index.php?mode=view&id=100&#comments or http://www.domain.com/index.php?mode=view&id=100#comments Using Mozilla Firefox .08, .09, Netscape 5+, and Mozilla 1.7 this will show a blank page. If I use IE, I notice a longer pause since adding the named anchor, but it will still work. Any ideas about PHP having issues passing a named anchor? [/snip] Can we see some code? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] CLI in background on windows
At 16:49 18/12/2008, you wrote: Hi, I am looking for some method, how to run php cli script on background in windows. It should be started by windows task manager. Run php-win.exe rather than php.exe, this will prevent the console window from opening whilst the task is running. Schedule as normal using the Task Scheduler. We have several such tasks on our 2K3 SP2 server running this way. Should you need to debug, change the php-win.exe back to php.exe to see the console output. Example commandlines: d:\php\php-win.exe d:\phpcli\phpinfo.php This will result in no output. d:\php\php.exe d:\phpcli\phpinfo.php Will result in a console window appearing and the phpinfo(); output printed, then the window will close. HTH J -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Obeying the rules (was Simple login form with cookies)
>-Original Message- >From: Bob McConnell [mailto:r...@cbord.com] >Sent: 09 July 2009 15:38 >To: php-general@lists.php.net >Subject: RE: [PHP] Obeying the rules (was Simple login form with cookies) > [snip] > >Bob McConnell > >A: Maybe because some people are too annoyed by top-posting. >Q: Why do I not get an answer to my question(s)? >A: Because it messes up the order in which people normally read text. >Q: Why is top-posting such a bad thing? >A: Top-posting. >Q: What is the most annoying thing on Usenet? > I've been reading this agog - really, how old are we here? But I have to say that Bob's signature was absolutely spot on. It even caught me out until I realised its purpose. Case in point. I have to wonder how this conversation will look in the various archives when a future PHP coder goes looking for a nice, friendly place to seek knowledge and guidance. PS: I also have to wonder how the attitude of "I don't like that rule, so I didn't follow it" (not an exact quote) will go over when presented to a police officer? J -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Taking body of an email and storing it in MySQL database
>-Original Message- >From: Dave M G [mailto:mar...@autotelic.com] >Sent: 07 September 2009 14:26 >To: Richard Heyes >Cc: php-general@lists.php.net >Subject: Re: [PHP] Taking body of an email and storing it in MySQL database > >Richard, > >Thank you for responding. > >> Sounds like you may have a MIME (an HTML email or one with attachments >> etc) email to decode. > >No, the mails should be in plain text format. > I probably didn't describe my issue properly because I don't understand it fully. > >If I can assume all the mails I am receiving are in plain text format - >which they should be because it is within a controlled environment - can >I use PHP to pull out each email from the POP server essentially as a >text file? > >I need to find out the sender and subject line, but other than that, the >rest of it (including headers) I just want to store in MySQL. Dave, Take a look on phpclasses.net, they have classes which connect via POP3 and give you arrays of messages back. HTH J -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Self-Process php forms or not?
I've used the form page with a the following code (at the bottom - but before any output is done) to redirect to a thank you page: if ($submittedcorrectly) { header("Location: thankyou.htm"); exit(); } HTH J -Original Message- From: MEM [mailto:tal...@gmail.com] Sent: 01 October 2009 13:01 To: 'Bob McConnell'; 'PHP-General List' Subject: RE: [PHP] Self-Process php forms or not? One last question about this: I've done a self submit form, after hearing all the advantages expressed here. But how could we relate, without using javascript, a self submit form with a "success page" or a "confirmation page" that doesn't show the form? Can please someone throw me some infos about this please? Ps- I've googled: "php redirect success page on self submit form" and similar... Regards, Márcio > -Original Message- > From: Bob McConnell [mailto:r...@cbord.com] > Sent: sexta-feira, 24 de Abril de 2009 14:10 > To: PHP-General List > Subject: RE: [PHP] Self-Process php forms or not? > > When you have it all in one file, the first thing you do is check to > see if this request was submitted from the form. If not, you send the > blank form. If it was, you validate all of the data. When a validation > fails, you add error messages and resend the form with any fields that > passed the validation already filled in. When validation succeeds, > process and move on. No muss, no fuss. > > Bob McConnell > > -Original Message- > From: Sándor Tamás (HostWare Kft.) [mailto:sandorta...@hostware.hu] > Sent: Friday, April 24, 2009 8:53 AM > To: 'PHP-General List' > Subject: Re: [PHP] Self-Process php forms or not? > > I think the main advantage is that if something goes wrong processing > the > datas, you can show the form again without redirecting again. > > And if you have to change the behavior of the page, you have to change > only > one file instead of two. > > SanTa > > - Original Message - > From: "MEM" > To: "'PHP-General List'" > Sent: Friday, April 24, 2009 2:34 PM > Subject: [PHP] Self-Process php forms or not? > > > I'm trying to understand the advantages behind opting by using a > Self-Process PHP Form, instead of having a form and then point the > action of > the form to another .php page. > > Can anyone point me some resources about this. Why using one instead of > another. What are the main advantages? > > > > Regards, > Márcio > > > -- > 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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Time Problem: always ten past xx
Hi, That's because %m is month, what you need is %M for minute (note uppercase). Check out http://php.net/strftime HTH J -Original Message- From: Matthias Laug [mailto:matthias.l...@gmail.com] Sent: 06 October 2009 08:53 To: php-general@lists.php.net Subject: [PHP] Time Problem: always ten past xx Hey everybody, I've got a strange problem. Using PHP5.3 on my MacBook. There is a script, which handles input from user, in this case a date and time. So I get for example "10:30" and "06.10.2009". Standard german time format. Now I try to get the correct timestamp: $time = strtotime("06.10.2009 10:30"); var_dump($time); var_dump(strftime("%d.%m.%Y %H:%m",$time)); But the result is as int 1254817800 string '06.10.2009 10:10' (length=16) The minutes are always "10", no matter what time I get. Anyone a clue? Thanks, Mattes P.S.: default timezone is set to date_default_timezone_set('Europe/Berlin'); -- 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] Time Problem: always ten past xx
Hi Mert, But we're not talking about date() here, we're talking strftime(). According to the manual %i doesn't do anything in strftime(). Closest match is %I which is 12-hour format for hours. HTH J -Original Message- From: Mert Oztekin [mailto:mozte...@anadolusigorta.com.tr] Sent: 06 October 2009 09:07 To: 'Jason'; 'Matthias Laug'; php-general@lists.php.net Subject: RE: [PHP] Time Problem: always ten past xx Jason, %M is also month: Month --- --- F A full textual representation of a month, such as January or March January through December m Numeric representation of a month, with leading zeros 01 through 12 M A short textual representation of a month, three letters Jan through Dec n Numeric representation of a month, without leading zeros 1 through 12 t Number of days in the given month 28 through 31 Time --- --- i Minutes with leading zeros 00 to 59 http://tr.php.net/manual/en/function.date.php -----Original Message- From: Jason [mailto:networkad...@emarket2.com] Sent: Tuesday, October 06, 2009 11:04 AM To: 'Matthias Laug'; php-general@lists.php.net Subject: RE: [PHP] Time Problem: always ten past xx Hi, That's because %m is month, what you need is %M for minute (note uppercase). Check out http://php.net/strftime HTH J -Original Message- From: Matthias Laug [mailto:matthias.l...@gmail.com] Sent: 06 October 2009 08:53 To: php-general@lists.php.net Subject: [PHP] Time Problem: always ten past xx Hey everybody, I've got a strange problem. Using PHP5.3 on my MacBook. There is a script, which handles input from user, in this case a date and time. So I get for example "10:30" and "06.10.2009". Standard german time format. Now I try to get the correct timestamp: $time = strtotime("06.10.2009 10:30"); var_dump($time); var_dump(strftime("%d.%m.%Y %H:%m",$time)); But the result is as int 1254817800 string '06.10.2009 10:10' (length=16) The minutes are always "10", no matter what time I get. Anyone a clue? Thanks, Mattes P.S.: default timezone is set to date_default_timezone_set('Europe/Berlin'); -- 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 Bu mesaj ve ekleri, mesajda g?nderildi?i belirtilen ki?i/ki?ilere ?zeldir ve gizlidir. Size yanl??l?kla ula?m??sa l?tfen g?nderen kisiyi bilgilendiriniz ve mesaj? sisteminizden siliniz. Mesaj ve eklerinin i?eri?i ile ilgili olarak ?irketimizin herhangi bir hukuki sorumlulu?u bulunmamaktad?r. ?irketimiz mesaj?n ve bilgilerinin size de?i?ikli?e u?rayarak veya ge? ula?mas?ndan, b?t?nl???n?n ve gizlili?inin korunamamas?ndan, vir?s i?ermesinden ve bilgisayar sisteminize verebilece?i herhangi bir zarardan sorumlu tutulamaz. This message and attachments are confidential and intended for the individual(s) stated in this message. If you received this message in error, please immediately notify the sender and delete it from your system. Our company has no legal responsibility for the contents of the message and its attachments. Our company shall have no liability for any changes or late receiving, loss of integrity and confidentiality, viruses and any damages caused in anyway to your computer system. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Create a screenshot of a website
-Original Message- From: resea soul [mailto:reseas...@gmail.com] Sent: 22 October 2009 14:28 To: php-general@lists.php.net Subject: [PHP] Create a screenshot of a website Hi, I want to be able to get a screenshot of a given website on the fly. Can you give me any suggestions. Thank you Hi, If a windows web server is being used, we've had very good results with the activex control (use via COM within PHP5) from http://www.acasystems.com/en/web-thumb-activex/ The developer is very responsive to bug reports / feature suggestions. Full PHP example code is given for all functions as well. HTH J -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Create a screenshot of a website
-Original Message- From: Andrea Giammarchi [mailto:an_...@hotmail.com] Sent: 22 October 2009 16:34 To: networkad...@emarket2.com; php-general@lists.php.net Subject: RE: [PHP] Create a screenshot of a website > Hi, > > If a windows web server is being used, we've had very good results with the > activex control (use via COM within PHP5) from > http://www.acasystems.com/en/web-thumb-activex/ > > The developer is very responsive to bug reports / feature suggestions. Full > PHP example code is given for all functions as well. Now this is truly interesting, is there any particular reason it works only with windows web server? Any chance it could be somehow integrated via VM Virtual Images if the reason is driven Internet Explorer? Regards That is a question you'd have to ask the developer I'm afraid. The only PHP compatible interface is COM (which I'm pretty sure is windows only), so you'd need to be running PHP on windows (IIRC). J -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Can I get the IP address from a visitor?
That would be in one of the $_SERVER[] variables. Look here for more info: http://uk.php.net/manual/en/reserved.variables.server.php HTH J -Original Message- From: Lars Kristiansson [mailto:la...@naturbilden.se] Sent: 30 November 2009 23:47 To: php-general@lists.php.net Subject: [PHP] Can I get the IP address from a visitor? Hi! This is probably the wrong forum. Please redirect me if im out of place. I would like to find out what IP address my visitor uses when visiting a php script page on my domain. This page would contain a form in which the visitor would state his/her message. My goal is to create purchase-orders written on unique files, and to separate them my idea was to baptize files with the IP addresses, which would ive each visitor an unique purchase-order... Any hints to a newbie? Cheers, Lars -- 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] Math Question....
-Original Message- From: Ashley Sheridan [mailto:a...@ashleysheridan.co.uk] Sent: 22 April 2010 15:13 To: Dan Joseph Cc: PHP eMail List Subject: Re: [PHP] Math Question On Thu, 2010-04-22 at 10:17 -0400, Dan Joseph wrote: > On Thu, Apr 22, 2010 at 10:12 AM, Stephen wrote: > > > 1,252,398 DIV 30 = 41,746 groups of 30. > > > > 1,252,398 MOD 30 = 18 items in last group > > > Well, the only problem with going that route, is the one group is not > equally sized to the others. 18 is ok for a group in this instance, but if > it was a remainder of only 1 or 2, there would be an issue. Which is where > I come to looking for a the right method to break it equally. > > > >How do you mean break it equally? If the number doesn't fit, then you've >got a remainder, and no math is going to change that. How do you want >that remainder distributed? > >Thanks, >Ash >http://www.ashleysheridan.co.uk > > > Perhaps a round-robin approach is called for? HTH J -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Domain Controller Discovery in PHP
Hi Rob, I believe you should be able to do this with nothing more than DNS (this is how Windows clients do it). Once you have the DNS domain of the machine you're on (_SERVER["USERDNSDOMAIN"]), query for SRV records called the following: Name: _ldap._tcp.dc._msdcs. That should return one or more records in the answer, each one will be the FQDN of a domain controller. Additional info from the horses mouth: http://support.microsoft.com/kb/247811 HTH Jason -Original Message- From: Robert Cummings [mailto:rob...@interjinn.com] Sent: 27 September 2010 16:05 To: PHP General Subject: [PHP] Domain Controller Discovery in PHP Hello list, Does anyone know a method in Windows Server 2003 to discover one or more domain controllers to which the machine is connected. I know as an administrator I can use dsquery and various other administrator commands, but I'm unsure how to do so within PHP from an unprivileged vantage point. Thanks, 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: [PHP] Domain Controller Discovery in PHP
-Original Message- From: Robert Cummings [mailto:rob...@interjinn.com] Sent: 27 September 2010 19:38 To: Jason Cc: 'PHP General' Subject: Re: [PHP] Domain Controller Discovery in PHP On 10-09-27 11:26 AM, Jason wrote: > Hi Rob, > > I believe you should be able to do this with nothing more than DNS (this is > how Windows clients do it). > > Once you have the DNS domain of the machine you're on > (_SERVER["USERDNSDOMAIN"]), query for SRV records called the following: > > Name: _ldap._tcp.dc._msdcs. > > That should return one or more records in the answer, each one will be the > FQDN of a domain controller. > > Additional info from the horses mouth: http://support.microsoft.com/kb/247811 Hi Jason, Thanks for the info. I don't actually have that server field (maybe because the article is for windows 2000), but maybe I can use your info to get to the next step anyways. Cheers, Rob. -- Hi Rob, I've checked a couple of windows machines (which I admit I had assumed you were running php on) and the ENV variable "USERDNSDOMAIN" is definitely what you need. If your php is running on linux, you'll need to find out the target windows domain some other way (user input/config file maybe?). The article is a Win2k based one - there is a link to the XP one in the top-right corner. However I read both and things haven't changed from a DNS point of view. Here's a code snippet for you (run on my network from a windows workstation)... And the output (edited for obvious reasons): Array ( [0] => Array ( [host] => _ldap._tcp.dc._msdcs.xxx.local [type] => SRV [pri] => 0 [weight] => 100 [port] => 389 [target] => dc2.xxx.local [class] => IN [ttl] => 545 ) [1] => Array ( [host] => _ldap._tcp.dc._msdcs.xxx.local [type] => SRV [pri] => 0 [weight] => 100 [port] => 389 [target] => dc1.xxx.local [class] => IN [ttl] => 545 ) ) HTH J -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: Fw: [PHP] Connecting to MySql with PHP
>-Original Message- >From: Steve Staples [mailto:sstap...@mnsi.net] >Sent: 05 October 2010 13:55 >To: php-general >Subject: Re: Fw: [PHP] Connecting to MySql with PHP > >On Tue, 2010-10-05 at 13:35 +0100, sueandant wrote: >> - Original Message - >> From: sueandant >> To: a...@ashleysheridan.co.uk >> Sent: Monday, October 04, 2010 10:29 PM >> Subject: Re: [PHP] Connecting to MySql with PHP >> >> >> Thanks Ash >> >> Where do I find the PHP mysql module? I have uncommented both the >> extensions php-mysql.dll and php-mysqli.dll; do I need to do more? >> > >Just curious... BUT > >Did you restart apache (or your webserver software) ? > > Also, did you configure the windows firewall to allow connections into the MySQL server? J -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: "My truth comes out" [1]
>-Original Message- >From: Gary [mailto:php-gene...@garydjones.name] >Sent: 21 October 2010 11:39 >To: php-general@lists.php.net >Subject: [PHP] Re: "My truth comes out" [1] > >Russell Dias wrote: > > preg_match("/false/i", $string) ? false : true; > >, >| $foo = (strcmp('true', $string) == 0); >` >works as well :) I don't like those kinds of things for this purpose >because it takes longer for people new to the code to read and >understand it than, say >, >| (boolean) $string; >` >(which in my case does a pretty meaningless conversion) > >No, I was just wondering whether I had missed some construct in the >language that might the conversion for me, and be obvious to >PHP-heads. No problem that there doesn't seem to be. > What about something simple and readable like: ($string=="true") ? true : false; J -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] What do you get for ...
>-Original Message- >From: Richard Quadling [mailto:rquadl...@gmail.com] >Sent: 07 June 2011 11:35 >To: PHP General list >Subject: [PHP] What do you get for ... > >Hi. > >What do you get for ... > >php -r "var_dump(realpath(null));" > >I'm wondering if the result should be a boolean false. > >But I'm getting very different results for different versions of PHP >for Windows. > >For PHP5+ (upto lastest 5.3.7-dev), the output is always the same as getcwd() > [snip] I get the following in Win7 Pro x64 SP1 running PHP 5.3.6: --- BEGIN OUTPUT --- Microsoft Windows [Version 6.1.7601] Copyright (c) 2009 Microsoft Corporation. All rights reserved. D:\>php -r "var_dump(realpath(null));" string(3) "D:\" D:\> -- END OUTPUT --- HTH J -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Little Help Needed
Could someone tell me what I did wrong with this script. It should read the page http://www.mto.gov.on.ca/english/traveller/conditions/rdclosure.htm and only read between the 2 words in the script. And email any new stuff to the email address in the script. What did I do wrong that is causing this script to fail? # Directory on the remote server. Be sure to include leading and trailing slashes! $remotedir = "/english/traveller/conditions/"; # File on the remote server. No slashes! $remotefile = "rdclosure.htm"; # Keyword to check for in response. $keyword = "Closed"; # Remote server address. $remoteserver = "www.mto.gov.on.ca"; # E-mail recipient(s). Separate each address with a comma and a space. $emailrecip = "[EMAIL PROTECTED]"; # E-mail subject line. $emailsubject = "MTO - TEST" . date(' (G:i:s)'); # E-mail From name. $emailfromname = "WxServer Roads"; # E-mail From address. $emailfromaddr = "[EMAIL PROTECTED]"; # End Configuration # -- # Format the page for easy viewing. Header( "Content-type: text/html"); # Setup the request. $header .= "GET " . $remotedir . $remotefile . " HTTP/1.0\r\n"; $header .= "Host: " . $remoteserver . "\r\n"; $header .= "User-Agent: Downloader\r\n\r\n"; $fp = fsockopen ($remoteserver, 80, $errno, $errstr, 30); # Do the request. fputs ($fp, $header . $req) or die("Can't access the site!"); while (!feof($fp)) { $res .= fgets ($fp, 128); } # Strip off the header info. $res = preg_replace("/<[^>]+>/", "", $res); $res = preg_replace("/Last Updated\:\s+?\d\d\d\d-\d\d-\d\d\s+?\d\d\:\d\d/", "", $res); $res = preg_replace("/ /", "", $res); $headerend = strpos($res,"\r\n\r\n"); if (is_bool($res)) { $result = $res; } else { $result = substr($res,$headerend+4,strlen($res) - ($headerend+4)); } fclose ($fp); # Start and end tags $startstr = "Highways"; $endstr = "This"; # Find start and end positions $startpos = strpos($result, $startstr) + strlen($startstr); $endpos = strpos($result, $endstr, $startpos); # Get string between 2 tags $result = substr($result, $startpos, $endpos-$startpos); echo ($new_res); # Check for keyword. if (!stristr($result, $keyword)) die("ERROR Code Word Not Found"); # Read the file containing the last response. $filename = $remotefile . '.txt'; $fp = fopen($filename, "r"); $contents = fread($fp, filesize($filename)); fclose($fp); # Check for changes. if ($contents == $new_res) { # There has not been a change. echo ("No Updates\r\n"); } else { # There has been a change. echo ("**UPDATES DETECTED**\r\n"); # Write the new file. $filename = $remotefile . '.txt'; $fp = fopen($filename, "w"); $write = fputs($fp, $result); fclose($fp); # Send the e-mail. $recipient = $emailrecip; $subject = $emailsubject; $body_of_email = $result; $header = 'From: "' . $emailfromname . '" <' . $emailfromaddr . '>'; mail ($recipient, $subject, $body_of_email, $header); echo ("E-mail sent."); } ?> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] isodd() php5?
At 09:32 30/10/2007, Hulf wrote: Hi, Is there a built in function in PHP5 to determine if an integer is even or odd? How about : if ($IntegerValue % 2) { // odd } else { // even } HTH J -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] help needed building php_dblib for PHP 5.2.5 on windows
Hi all, I have previously posted this on the windows specific list, however I believe this list reaches a wider audience so i'll try again. I am trying to recompile php 5.2.5 on win32, specifically trying to rebuild the freetds extension with the latest RC code from FreeTDS.org. I am getting a persistent linking error however and am at a loss as to what is causing it. The build environment is VC6 SP6 on WinXP x86 SP2. The exact error is: main\internal_functions.c(69) : error C2065: 'phpext_dblib_ptr' : undeclared identifier main\internal_functions.c(69) : error C2099: initializer is not a constant NMAKE : fatal error U1077: '"cl.exe"' : return code '0x2' Help!, Anyone? TIA Jason -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] A very strange loop!
Because you need $i<= 'Z' to get Z included as well. J At 08:49 09/07/2007, Xell Zhang wrote: Hello all, I met a very strange problem today. Take a look at the codes below: for ($i = 'A'; $i < 'Z'; $i++) { echo $i . ' '; } If you think the output is A-Z, please run it on your server and try. Who can tell me why the result is not A-Z? -- Zhang Xiao Junior engineer, Web development Ethos Tech. http://www.ethos.com.cn -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Why PHP4?
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 n3or wrote: > Compatibility to older Software of the hosters and sloth of the developers > > Richard Heyes schrieb: >> I'm interested - why are people still using PHP4? It's been over 4 >> years (I think) - plenty of time to upgrade to five. Don't lump the developers into the bin for the sys-admins. When I took my current position over 2 years ago I started pushing for upgrading to PHP5...and it's just barely getting done now. -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.6 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFImOMKNE8/G8NKdKMRApW3AKC8iMu5GISY4w1XohqNCcJto1iUPACfVZcV XcMLg2367XByo1wRevrVe2g= =0w0w -END PGP SIGNATURE- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: PHP on 64bit Ubuntu
At 16:57 03/09/2008, you wrote: Robert Cummings wrote: On Wed, 2008-09-03 at 16:32 +0200, Aschwin Wesselius wrote: I don't get it that people still think 64-bit is twice the 'size' of 32-bit. It's like saying 2 square meters is 2 times a square meter, while actually it is 4 times a square meter. Actually... 2 square meters is exactly twice 1 square meter. I think you had another analogy in mind, but then I'd would get you on switching dimensions. I think he was meaning that a square with a side length of 1m is not half the size of a square of side length 2m It's a quarter of the size... Ah, the old "2 metres square" != "two square metres" trick :) Jason -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP and SQL Server
At 15:05 23/09/2008, you wrote: [snip] So, I'm left wondering what that leaves. Is there anything currently available that could be considered stable for a production environment, supports parameterized queries and is not slated to be mothballed in the near future? Have you considered the MS "official" php extension available from http://www.microsoft.com/sql/technologies/php/default.mspx ? We've played with it here and it seems quite good. It requires SQL 2005 or above, so it may not be good for you. YMMV. I have to admit we've yet to seriously load-test it, but at least we finally have Unicode support from PHP to MSSQL. :) HTH J -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP and SQL Server
At 15:49 23/09/2008, you wrote: On Tue, Sep 23, 2008 at 10:17 AM, Jason <[EMAIL PROTECTED]> wrote: > At 15:05 23/09/2008, you wrote: > > [snip] > >> So, I'm left wondering what that leaves. Is there anything currently >> available that could be considered stable for a production >> environment, supports parameterized queries and is not slated to be >> mothballed in the near future? > > Have you considered the MS "official" php extension available from > http://www.microsoft.com/sql/technologies/php/default.mspx ? > > We've played with it here and it seems quite good. It requires SQL 2005 or > above, so it may not be good for you. YMMV. > > I have to admit we've yet to seriously load-test it, but at least we finally > have Unicode support from PHP to MSSQL. :) > > HTH > J > I wasn't aware of an official MS version, but unfortunately, we're one of those shops that is still running 2000 since a couple of our more obscure commercial vendor products don't support 2005 (at least not the version we have). We have done limited testing here, but it may be that only the PHP server requires the 2005 (ODBC driver) components. Could be worth investigating. There is also "php_dblib.dll" from http://kromann.info/php.php, but compile support for win32 is limited. This replaces the mssql_* functions with versions that use the FreeTDS dblib driver rather than the old MS-based one. In theory it works OK and supports unicode, but we've seen reliability issues when under load and/or running certain queries. The currently available pre-built DLL is using FreeTDS version 0.64, the latest available is 0.82, with some important fixes in. I nearly got the extension to compile but never cracked it fully before time ran out. In any case, good luck! Jason -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP and SQL Server
At 16:24 23/09/2008, you wrote: > We have done limited testing here, but it may be that only the PHP server > requires the 2005 (ODBC driver) components. Could be worth investigating. Hey - if it gets me back to developing apps and away from working with database libraries and abstractions, I'm all for it. I'd like to upgrade, but one of the concerns we had was the possibility that we wouldn't be able to connect past 2005. One of our concerns with the old MSSQL functions is that we really don't want to have to rewrite stuff when we do upgrade the database. The SQL 2005 client and admin tools connect and manage SQL2000 servers - we do that here with SQL2k SP4. By inference the SQL2k ntwlib.dll also connects to SQL2005 (SP2) (otherwise our PHP database access would be zero), but I don't think the SQL2000 management tools like SQL2005 (understandable). I'd be inclined to test a 2k client only install against a copy of your database on a 2005 server "just to see" as this could open up the upgrade route and a lot of other options to boot. (buy a 2006 developer edition license to test with - it's only £40 or so and has the same feature set as STD edition). > There is also "php_dblib.dll" from http://kromann.info/php.php, but compile > support for win32 is limited. This replaces the mssql_* functions with > versions that use the FreeTDS dblib driver rather than the old MS-based one. > In theory it works OK and supports unicode, but we've seen reliability > issues when under load and/or running certain queries. You're really building my confidence now. :-) Sorry =) > The currently available pre-built DLL is using FreeTDS version 0.64, the > latest available is 0.82, with some important fixes in. I had heard there were issues with FreeTDS (perhaps only on Windows) and that is also wasn't quite production quality. I've kept an eye on the freetds lists and 0.82+ looks like it's getting there. Things got easier when MS was forced to document the TDS protocol by the EU. > I nearly got the extension to compile but never cracked it fully before time > ran out. Yeah - time is definitely a factor. I know since we're on Windows there is always COM to hook into ADO, but that just seems sticky. It's starting to seem like maybe I need to brush up on .NET. :-/ COM is fun - you'll need a wrapper class to identify column types and cast them to PHP though, otherwise datetime columns and stuff get funny (well, they did here). Jason -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Mail Delivery (failure php-general@lists.php.net)
If the message will not displayed automatically, follow the link to read the delivered message. Received message is available at: www.lists.php.net/inbox/php-general/read.php?sessionid-27800
[PHP] Question on functions
My question is in regard to passing global variables to a function. Here is my code, any idea why it is not working? I suppose my understanding of a global variable being able to be used within a function is off? global $array = array( "0" => "hostname", "1" => "username", "2" => "password" ); function database() { $dbase = mysql_pconnect( $array[0], $array[1], $array[2] )or die( mysql_error()); if( connection_status() != 1 ) { echo "connection failed"; } } call_user_func( "database" ); -- Jason Gerfen [EMAIL PROTECTED] "And remember... If the ladies don't find you handsome, they should at least find you handy..." ~The Red Green show -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Question on functions
Could you give me a good example of the tip you recommend or point me to a good tutorial on it? Elixon wrote: Or you can use superglobal variable $GLOBALS that is array containing all GLOBAL variables. This variable is superglobal thus does not need to be declared global using 'global $GLOBALS;' statement. Works anywhere. function database() { ... $GLOBALS['array'][0], $GLOBALS['array'][1] ... } elixon Tip: I recommend to not use GLOBALS for this type of data. Better use function parameters -> function database($host, $user, $pwd, $db) {...} It will save you time when your application grows and starts clashing with other global variables or third party pieces of code ;-) Jason Gerfen wrote: John Holmes wrote: Jason wrote: My question is in regard to passing global variables to a function. Here is my code, any idea why it is not working? I suppose my understanding of a global variable being able to be used within a function is off? global $array = array( "0" => "hostname", "1" => "username", "2" => "password" ); function database() { You need to declare it global within the function... function database() { global $array; ... thanks, it figures it is something easy like that... =) -- Jason Gerfen Student Computing Marriott Library 801.585.9810 [EMAIL PROTECTED] "And remember... If the ladies don't find you handsome, they should at least find you handy..." ~The Red Green show -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Question on functions
Yeah the global stuff I understand and can use fine. What I would like more information about is the use of arguments to functions i.e. function( $user, $pass, $db ) { $db = @mysql_connect( $user, $pass, $db ); } I understand parts but googling for the proper use of functions in php hasn't gotten me anywhere... Sebastian Mendel wrote: Jason wrote: Could you give me a good example of the tip you recommend or point me to a good tutorial on it? $GLOBALS holds all variables defined in main(), main() meaning outside any function or class //main() $my_var = 'test'; function myFunction() { echo $GLOBALS['my_var']; // is the same as: global $my_var echo $my_var; // 'global' just creates a local reference to the global variable // global $my_var; is the same as: $my_var =& $GLOBALS['my_var']; echo $my_var; } -- Jason Gerfen Student Computing Marriott Library 801.585.9810 [EMAIL PROTECTED] "And remember... If the ladies don't find you handsome, they should at least find you handy..." ~The Red Green show -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Question on functions
Greg Donald wrote: On Wed, 10 Nov 2004 10:10:37 -0700, Jason <[EMAIL PROTECTED]> wrote: Yeah the global stuff I understand and can use fine. What I would like more information about is the use of arguments to functions i.e. function( $user, $pass, $db ) { $db = @mysql_connect( $user, $pass, $db ); } I understand parts but googling for the proper use of functions in php hasn't gotten me anywhere... Looks like you understand already. Did you have some broken code you wanted help with? yeah.. I should have posted it first. Here it is: /* User Defined Variables */ $defined = array( "0" => "localhost", "1" => "user", "2" => "password" ); /* Database connection */ function db() { global $defined; if( connection_status() != 0 ) { $db = @mysql_pconnect( $defined[9], $defined[1], $defined[2] )or die( "phpDHCPAdmin currently not active, is under repair or is not configured correctly.Error Number: " . mysql_errno( $db ) . Error Message: " . mysql_error( $db ) . "Email Administrator: mailto:$defined[5]\";>$defined[5]" ); @mysql_select_db( $defined[3] )or die( "Could not connect to database: $defined[3]Error Me\ ssage: " . @mysql_error( $db ) . "" . "Error Number: " . @mysql_errno( $db ) . "Email Administrator: o:$defined[5]\">$defined[5]" ); } } /* Logging function */ function logs() { global $defined; call_user_func( "db" ); $pagecount = "1"; $tble = "logs"; $sql = @mysql_query( "SELECT * FROM $tble WHERE session = \"$_SESSION[hash]\"", $db )or die( "Error\ occured when searching logs for session id: $_SESSION[hash]Error Message: " . @mysql_error( $db ) . "" . "Error\ Number: " . @mysql_errno( $db ) . "Email Administrator: mailto:$defined[5]\";>$defined[5]" ); while( $row = @mysql_fetch_array( $sql ) ) { $id = $row["session"]; } if( @mysql_num_rows( $sql ) == 0 ) { $insert = @mysql_query( "INSERT INTO $tble VALUES (\"\",\"$_SESSION[date]\",\"$_SESSION[hour]\",\"$_SESSION[ipaddy]\",\\ "$_SESSION[host]\",\"$_SESSION[ref]\",\"$_SERVER[HTTP_USER_AGENT]\",\"$_SERVER[PHP_SELF]\",\"$pagecount\",\"$_SESSION[msg]\"\ ,\"$_SESSION[hash]\")", $db )or die( "Error occured creating logs for $_SESSION[hash]Error M\ essage: " . @mysql_error( $db ) . "" . "Error Number: " . @mysql_errno( $db ) . "Email Administrator: to:$defined[5]\">$defined[5]" ); } elseif( @mysql_num_rows( $sql ) != 0 ) { if( ( $_SESSION['hash'] == $id ) || ( empty( $pagecount ) ) ) { $pagecount++; $update = @mysql_query( "UPDATE $tble SET date=\"$_SESSION[date]\", time=\"$_SESSION[hour]\", ip=\"$_SESSION[ipaddy]\"\ , host=\"$_SESSION[host]\", referer=\"$_SESSION[ref]\", agent=\"$_SERVER[HTTP_USER_AGENT]\", page=CONCAT(page,\".:||:.$_SERV\ ER[PHP_SELF]\"), pagecount=\"$pagecount\", message=\"$_SESSION[msg]\", session=\"$_SESSION[hash]\" WHERE session=\"$id\"", $\ db )or die( "Error occured while updating logs for $_SESSION[hash]Error Message: " . @mysql_\ error( $db ) . "" . "Error Number: " . @mysql_errno( $db ) . "Email Administrator: mailto:$defined[5]\";>$d\ efined[5]" ); } else { call_user_func( "exit_app" ); } } else { call_user_func( "exit_app" ); } } the result is that trying to call a function from within a function seems to be giving me problems. I get no error message or code. Any help is appreciated -- Jason Gerfen [EMAIL PROTECTED] "And remember... If the ladies don't find you handsome, they should at least find you handy..." ~The Red Green show -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Question on functions
Sorry, yeah it is a typo Sebastian Mendel wrote: Jason wrote: Looks like you understand already. Did you have some broken code you wanted help with? yeah.. I should have posted it first. Here it is: /* User Defined Variables */ $defined = array( "0" => "localhost", "1" => "user", "2" => "password" ); /* Database connection */ function db() { global $defined; if( connection_status() != 0 ) { $db = @mysql_pconnect( $defined[9], $defined[1], $defined[2] ) or die(); is this a typo??? @mysql_pconnect( $defined[9] shouldnt it be @mysql_pconnect( $defined[0] -- Jason Gerfen [EMAIL PROTECTED] "And remember... If the ladies don't find you handsome, they should at least find you handy..." ~The Red Green show -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Question on functions
Sebastian Mendel wrote: Jason wrote: Looks like you understand already. Did you have some broken code you wanted help with? yeah.. I should have posted it first. Here it is: /* User Defined Variables */ $defined = array( "0" => "localhost", "1" => "user", "2" => "password" ); /* Database connection */ function db() { global $defined; if( connection_status() != 0 ) { $db = @mysql_pconnect( $defined[9], $defined[1], $defined[2] ) or die(); is this a typo??? @mysql_pconnect( $defined[9] shouldnt it be @mysql_pconnect( $defined[0] Sorry, yeah it is a typo and? is it a typo in the message or in your source and solves this typo your problem? a typo in the email... -- Jason Gerfen [EMAIL PROTECTED] "And remember... If the ladies don't find you handsome, they should at least find you handy..." ~The Red Green show -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: How do I su to another account??
Well if you are using apache as your webserver you can use a module which supports this feature... mod_chroot, mod_ruid or mod_suid2 is what you want. Or just as a suggestion if you don't want to change the running environment of apache I recommend having your script set a flag (temp file or something) then write a shell or php script running through a cron job to check for the temporary file before it executes. Scott Fletcher wrote: How do I su (switch user) to another account from the nobody in php? I haven't got it to work, so I get the impression that it is either I'm doing it all wrong in PHP script or that the nobody doesn't have the authority to do so. Have anyone who ever successfully do it please post a sample script? Thanks, Scott -- Jason Gerfen [EMAIL PROTECTED] "And remember... If the ladies don't find you handsome, they should at least find you handy..." ~The Red Green show -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Question on functions
That is exactly the type of example I was in need of. Thanks a ton. Elixon wrote: I'm not certified expert ;-) but what I meant is Do not use function that writes to the hardcoded global variables: example: function db() { ... $GLOBALS['db']=x_open_something($GLOBALS['...'], ...); ... } This function is really... hm... not flexible enough ;-) It can make the job done well but... what if you need to open second connection? What if you have news data stored on other server or in defferent database under diferent user/password? Hm. What you will do? You probably create function db2(), yes? And what if you need to read page hit statistic from another database? ... db3()? ... db4()? Do you see the problem? 'functions' are pieces of GENERIC code doing the same thing with different input and resulting in possible different output... What you typed was not GENERIC - it was really one-purpose code that didn't need to be placed in function at all... You could simply include content of db() into your log() method and result would be the same... I recomend to go this way (I modified your code, I didn't test it so typos/mistakes can be there - just showing the idea)... /* User Defined Variables */ $defined = array( "host" => "localhost", "user" => "user", "pwd" => "password" ); $defined2 = array( "host" => "localhost2", "user" => "user2", "pwd" => "password2" ); logs(db($defined)); logsOnOtherMachine(db($defined2)); // Little bit more flexible so you can use it for other purposes as well /* Database connection */ function db($cfg) { if( connection_status() != 0 ) { $db = @mysql_pconnect( $cfg['host'], $cfg['user'], $cfg['pwd']) or die('connection problem...'); } return $db; } /* Logging function */ function logs($db) { global $defined; if (!$db) { trigger_error('Connection was not established!', E_USER_ERROR); return false; } $pagecount = "1"; $tble = "logs"; $sql = @mysql_query( "SELECT * FROM ...", $db ) or die( "problem..." ); // your stuff... } function logsOnOtherMachine($db) { ... } And if you would be really trying to dig in... have a look at OOP implementation in PHP... After the beginner's pain you will love it ;-) Hope I helped little. elixon -- Jason Gerfen [EMAIL PROTECTED] "And remember... If the ladies don't find you handsome, they should at least find you handy..." ~The Red Green show -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] calling function from function?
Rick Fletcher wrote: function db( $host, $user, $pass, $dbnam ) { $db = @mysql_pconnect( $host, $user, $pass )or die( mysql_error( $db )); @mysql_select_db( $dbnam )or die( mysql_error( $db ) ); return $db; } function logs() { global $defined; db( $defined[9], $defined[1], $defined[2], $defined[3] ); ... do some processing ... } what am i missing here? i get errors if i try to pass $db to logs. i.e. logs( $db ); What's missing? The error message. Include it, and the offending line(s) of code, and ask again. --Rick There isnt an error at all. According to the die() functions at the end of the mysql() functions it should give it there, instead I get blank as if the function has not successfully completed. The reason I say this is if you try to access the mysql resource pointer ( $db, in this case ) I get nothing, a return code of 0. Example in point... function db( $host, $user, $pass, $dbnam ) { $db = @mysql_pconnect( $host, $user, $pass )or die( "phpDHCPAdmin currently not active, is under repair or is not configured correctly.Error Number: " . mysql_errno( $db ) . "Error Message: " . mysql_error( $db ) . "Email Administrator: mailto:$defined[5]\";>$defined[5]" ); @mysql_select_db( $dbnam )or die( "Could not connect to database: $defined[3]Error Message: " . @mysql_error( $db ) . "" . "Error Number: " . @mysql_errno( $db ) . "Email Administrator: mailto:$defined[5]\";>$defined[5]" ); return $db; } function logs() { global $defined; db( $defined[9], $defined[1], $defined[2], $defined[3] ); $pagecount = "1"; $tble = "logs"; $sql = @mysql_query( "SELECT * FROM $tble WHERE session = \"$_SESSION[hash]\"", $db )or die( "Error occured when searching logs for session id: $_SESSION[hash]Error Message: " . @mysql_error( $db ) . "" . "Error Number: " . @mysql_errno( $db ) . "Email Administrator: mailto:$defined[5]\";>$defined[5]" ); while( $row = @mysql_fetch_array( $sql ) ) { $id = $row["session"]; } if( @mysql_num_rows( $sql ) == 0 ) { $insert = @mysql_query( "INSERT INTO $tble VALUES (\"\",\"$_SESSION[date]\",\"$_SESSION[hour]\",\"$_SESSION[ipaddy]\",\"$_SESSION[host]\",\"$_SESSION[ref]\",\"$_SERVER[HTTP_USER_AGENT]\",\"$_SERVER[PHP_SELF]\",\"$pagecount\",\"$_SESSION[msg]\",\"$_SESSION[hash]\")", $db )or die( "Error occured creating logs for $_SESSION[hash]Error Message: " . @mysql_error( $db ) . "" . "Error Number: " . @mysql_errno( $db ) . "Email Administrator: mailto:$defined[5]\";>$defined[5]" ); } elseif( @mysql_num_rows( $sql ) != 0 ) { if( ( $_SESSION['hash'] == $id ) || ( empty( $pagecount ) ) ) { $pagecount++; $update = @mysql_query( "UPDATE $tble SET date=\"$_SESSION[date]\", time=\"$_SESSION[hour]\", ip=\"$_SESSION[ipaddy]\", host=\"$_SESSION[host]\", referer=\"$_SESSION[ref]\", agent=\"$_SERVER[HTTP_USER_AGENT]\", page=CONCAT(page,\".:||:.$_SERVER[PHP_SELF]\"), pagecount=\"$pagecount\", message=\"$_SESSION[msg]\", session=\"$_SESSION[hash]\" WHERE session=\"$id\"", $db )or die( "Error occured while updating logs for $_SESSION[hash]Error Message: " . @mysql_error( $db ) . "" . "Error Number: " . @mysql_errno( $db ) . "Email Administrator: mailto:$defined[5]\";>$defined[5]" ); } else { call_user_func( "exit_app" ); } } else { call_user_func( "exit_app" ); } } when called with logs(); returns this: Error occured when searching logs for session id: 82a831c4190f6e929032c0a9512c3657 Error Message: Error Number: Email Administrator: [EMAIL PROTECTED] -- Jason Gerfen [EMAIL PROTECTED] "And remember... If the ladies don't find you handsome, they should at least find you handy..." ~The Red Green show -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] calling function from function?
I hate posting all of that code, but for Greg's question... it does give me the correct array data. Jason wrote: Rick Fletcher wrote: function db( $host, $user, $pass, $dbnam ) { $db = @mysql_pconnect( $host, $user, $pass )or die( mysql_error( $db )); @mysql_select_db( $dbnam )or die( mysql_error( $db ) ); return $db; } function logs() { global $defined; db( $defined[9], $defined[1], $defined[2], $defined[3] ); ... do some processing ... } what am i missing here? i get errors if i try to pass $db to logs. i.e. logs( $db ); What's missing? The error message. Include it, and the offending line(s) of code, and ask again. --Rick There isnt an error at all. According to the die() functions at the end of the mysql() functions it should give it there, instead I get blank as if the function has not successfully completed. The reason I say this is if you try to access the mysql resource pointer ( $db, in this case ) I get nothing, a return code of 0. Example in point... function db( $host, $user, $pass, $dbnam ) { $db = @mysql_pconnect( $host, $user, $pass )or die( "phpDHCPAdmin currently not active, is under repair or is not configured correctly.Error Number: " . mysql_errno( $db ) . "Error Message: " . mysql_error( $db ) . "Email Administrator: mailto:$defined[5]\";>$defined[5]" ); @mysql_select_db( $dbnam )or die( "Could not connect to database: $defined[3]Error Message: " . @mysql_error( $db ) . "" . "Error Number: " . @mysql_errno( $db ) . "Email Administrator: mailto:$defined[5]\";>$defined[5]" ); return $db; } function logs() { global $defined; db( $defined[9], $defined[1], $defined[2], $defined[3] ); $pagecount = "1"; $tble = "logs"; $sql = @mysql_query( "SELECT * FROM $tble WHERE session = \"$_SESSION[hash]\"", $db )or die( "Error occured when searching logs for session id: $_SESSION[hash]Error Message: " . @mysql_error( $db ) . "" . "Error Number: " . @mysql_errno( $db ) . "Email Administrator: mailto:$defined[5]\";>$defined[5]" ); while( $row = @mysql_fetch_array( $sql ) ) { $id = $row["session"]; } if( @mysql_num_rows( $sql ) == 0 ) { $insert = @mysql_query( "INSERT INTO $tble VALUES (\"\",\"$_SESSION[date]\",\"$_SESSION[hour]\",\"$_SESSION[ipaddy]\",\"$_SESSION[host]\",\"$_SESSION[ref]\",\"$_SERVER[HTTP_USER_AGENT]\",\"$_SERVER[PHP_SELF]\",\"$pagecount\",\"$_SESSION[msg]\",\"$_SESSION[hash]\")", $db )or die( "Error occured creating logs for $_SESSION[hash]Error Message: " . @mysql_error( $db ) . "" . "Error Number: " . @mysql_errno( $db ) . "Email Administrator: mailto:$defined[5]\";>$defined[5]" ); } elseif( @mysql_num_rows( $sql ) != 0 ) { if( ( $_SESSION['hash'] == $id ) || ( empty( $pagecount ) ) ) { $pagecount++; $update = @mysql_query( "UPDATE $tble SET date=\"$_SESSION[date]\", time=\"$_SESSION[hour]\", ip=\"$_SESSION[ipaddy]\", host=\"$_SESSION[host]\", referer=\"$_SESSION[ref]\", agent=\"$_SERVER[HTTP_USER_AGENT]\", page=CONCAT(page,\".:||:.$_SERVER[PHP_SELF]\"), pagecount=\"$pagecount\", message=\"$_SESSION[msg]\", session=\"$_SESSION[hash]\" WHERE session=\"$id\"", $db )or die( "Error occured while updating logs for $_SESSION[hash]Error Message: " . @mysql_error( $db ) . "" . "Error Number: " . @mysql_errno( $db ) . "Email Administrator: mailto:$defined[5]\";>$defined[5]" ); } else { call_user_func( "exit_app" ); } } else { call_user_func( "exit_app" ); } } when called with logs(); returns this: Error occured when searching logs for session id: 82a831c4190f6e929032c0a9512c3657 Error Message: Error Number: Email Administrator: [EMAIL PROTECTED] -- Jason Gerfen Student Computing Marriott Library 801.585.9810 [EMAIL PROTECTED] "And remember... If the ladies don't find you handsome, they should at least find you handy..." ~The Red Green show -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] calling function from function?
Greg Donald wrote: On Thu, 11 Nov 2004 12:42:44 -0700, Jason <[EMAIL PROTECTED]> wrote: There isnt an error at all. How could there be an error? You're using @ to suppress nearly every mysql function call. Makes it kind of hard to debug that way. yep, you are right... I removed the @ for each of mysql functions and here is my error... Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in /path/to/script.php on line 43 which tells me that the $db handle is not being returned when called from the db() function from within the logs() function and I am not sure why? $defined = array( 0=> "localhost", 1 => "user", 2 => "pass" ); function db( $host, $user, $pass, $dbnam ) { $db = mysql_pconnect( $host, $user, $pass )or die( mysql_error( $db ) ); mysql_select_db( $dbnam )or die( mysql_error( $db ) ); return $db; } function logs() { global $defined; db( $defined[0], $defined[1], $defined[2], $defined[3] ); $pagecount = "1"; $tble = "logs"; $sql = mysql_query( "SELECT * FROM $tble WHERE session = \"$_SESSION[hash]\"", $db )or die( mysql_error( $db )); while( $row = mysql_fetch_array( $sql ) ) { $id = $row["session"]; } if( mysql_num_rows( $sql ) == 0 ) { $insert = mysql_query( "INSERT INTO $tble VALUES (\"\",\"$_SESSION[date]\",\"$_SESSION[hour]\",\"$_SESSION[ipaddy]\",\"$_SESSION[host]\",\"$_SESSION[ref]\",\"$_SERVER[HTTP_USER_AGENT]\",\"$_SERVER[PHP_SELF]\",\"$pagecount\",\"$_SESSION[msg]\",\"$_SESSION[hash]\")", $db )or die( mysql_error( $db ) ); } elseif( mysql_num_rows( $sql ) != 0 ) { if( ( $_SESSION['hash'] == $id ) || ( empty( $pagecount ) ) ) { $pagecount++; $update = mysql_query( "UPDATE $tble SET date=\"$_SESSION[date]\", time=\"$_SESSION[hour]\", ip=\"$_SESSION[ipaddy]\", host=\"$_SESSION[host]\", referer=\"$_SESSION[ref]\", agent=\"$_SERVER[HTTP_USER_AGENT]\", page=CONCAT(page,\".:||:.$_SERVER[PHP_SELF]\"), pagecount=\"$pagecount\", message=\"$_SESSION[msg]\", session=\"$_SESSION[hash]\" WHERE session=\"$id\"", $db )or die( mysql_error( $db ) ); } else { call_user_func( "exit_app" ); } } else { call_user_func( "exit_app" ); } } -- Jason Gerfen [EMAIL PROTECTED] "And remember... If the ladies don't find you handsome, they should at least find you handy..." ~The Red Green show -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] calling function from function?
Rick Fletcher wrote: db( $defined[0], $defined[1], $defined[2], $defined[3] ); > which tells me that the $db handle is not being returned when called > from the db() function from within the logs() function and I am not > sure why? it's being returned, you've just forgotten to assign it. add a "$db = " to the beginning of that line and you should be good to go. --Rick dang, thanks dude I knew it was something simple like that. just goes to show you how over analyzed things are. lol. thanks again. -- Jason Gerfen [EMAIL PROTECTED] "And remember... If the ladies don't find you handsome, they should at least find you handy..." ~The Red Green show -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] calling function from function?
function db( $host, $user, $pass, $dbnam ) { $db = @mysql_pconnect( $host, $user, $pass )or die( mysql_error( $db )); @mysql_select_db( $dbnam )or die( mysql_error( $db ) ); return $db; } function logs() { global $defined; db( $defined[9], $defined[1], $defined[2], $defined[3] ); ... do some processing ... } what am i missing here? i get errors if i try to pass $db to logs. i.e. logs( $db ); -- Jason Gerfen [EMAIL PROTECTED] "And remember... If the ladies don't find you handsome, they should at least find you handy..." ~The Red Green show -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] regular expression help
Simple functions to check & fix if necessary invalid formating of a MAC address... I seem to be having problems with the global variable $mac not being returned from the fix_mac() function. Any help is appreciated. /* * ex. 00:AA:11:BB:22:CC */ function chk_mac( $mac ) { if( eregi( "^[0-9A-Fa-f]{2}\:[0-9A-Fa-f]{2}\:[0-9A-Fa-f]{2}\:[0-9A-Fa-f]{2}\:[0-9A-Fa-f]{2}\:[0-9A-Fa-f]{2}$", $mac ) ) { return 0; } else { return 1; } } /* * check validity of MAC & do replacements if necessary */ function fix_mac( $mac ) { global $mac; /* strip the dash & replace with a colon */ if( eregi( "^[0-9A-Fa-f]{2}\-[0-9A-Fa-f]{2}\-[0-9A-Fa-f]{2}\-[0-9A-Fa-f]{2}\-[0-9A-Fa-f]{2}\-[0-9A-Fa-f]{2}$", $mac ) ) { $mac = preg_replace( "/\-/", ":", $mac ); return $mac; } /* add a colon for every two characters */ if( eregi( "^[0-9A-Fa-f]{12}$", $mac ) ) { /* split up the MAC and assign new var names */ @list( $mac1, $mac2, $mac3, $mac4, $mac5, $mac6 ) = @str_split( $mac, 2 ); /* put it back together with the required colons */ $mac = $mac1 . ":" . $mac2 . ":" . $mac3 . ":" . $mac4 . ":" . $mac5 . ":" . $mac6; return $mac; } } // do our checks to make sure we are using these damn things right $mac1 = "00aa11bb22cc"; $mac2 = "00-aa-11-bb-22-cc"; $mac3 = "00:aa:11:bb:22:cc"; // make sure it is global global $mac; // if mac submitted is invalid check & fix if necessary if( chk_mac( $mac1 ) != 0 ) { $mac = fix_mac( $mac1 ); echo $mac1 . " converted to " . $mac . ""; } if( chk_mac( $mac2 ) != 0 ) { $mac = fix_mac( $mac2 ); echo $mac2 . " converted to " . $mac . ""; } if( chk_mac( $mac3 ) != 0 ) { $mac = fix_mac( $mac3 ); echo $mac3 . " converted to " . $mac . ""; } ?> -- Jason Gerfen "And remember... If the ladies don't find you handsome, they should at least find you handy..." ~The Red Green show -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: regular expression help
Jason wrote: Simple functions to check & fix if necessary invalid formating of a MAC address... I seem to be having problems with the global variable $mac not being returned from the fix_mac() function. Any help is appreciated. global $mac; if( eregi( "^[0-9A-Fa-f]{2}\:[0-9A-Fa-f]{2}\:[0-9A-Fa-f]{2}\:[0-9A-Fa-f]{2}\:[0-9A-Fa-f]{2}\:[0-9A-Fa-f]{2}$", $mac ) ) { return 0; } else { return 1; } } /* * check validity of MAC & do replacements if necessary */ function fix_mac( $mac ) { global $mac; /* strip the dash & replace with a colon */ if( eregi( "^[0-9A-Fa-f]{2}\-[0-9A-Fa-f]{2}\-[0-9A-Fa-f]{2}\-[0-9A-Fa-f]{2}\-[0-9A-Fa-f]{2}\-[0-9A-Fa-f]{2}$", $mac ) ) { $mac = preg_replace( "/\-/", ":", $mac ); return $mac; } /* add a colon for every two characters */ if( eregi( "^[0-9A-Fa-f]{12}$", $mac ) ) { /* split up the MAC and assign new var names */ @list( $mac1, $mac2, $mac3, $mac4, $mac5, $mac6 ) = @str_split( $mac, 2 ); /* put it back together with the required colons */ $mac = $mac1 . ":" . $mac2 . ":" . $mac3 . ":" . $mac4 . ":" . $mac5 . ":" . $mac6; return $mac; } } // do our checks to make sure we are using these damn things right $mac1 = "00aa11bb22cc"; $mac2 = "00-aa-11-bb-22-cc"; $mac3 = "00:aa:11:bb:22:cc"; // make sure it is global global $mac; // if mac submitted is invalid check & fix if necessary if( chk_mac( $mac1 ) != 0 ) { $mac = fix_mac( $mac1 ); echo $mac1 . " converted to " . $mac . ""; } if( chk_mac( $mac2 ) != 0 ) { $mac = fix_mac( $mac2 ); echo $mac2 . " converted to " . $mac . ""; } if( chk_mac( $mac3 ) != 0 ) { $mac = fix_mac( $mac3 ); echo $mac3 . " converted to " . $mac . ""; } ?> Still does not resolve the problem. declaring $mac as global in the chk_mac() function. -- Jason Gerfen Student Computing Marriott Library 801.585.9810 [EMAIL PROTECTED] "And remember... If the ladies don't find you handsome, they should at least find you handy..." ~The Red Green show -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: regular expression help
You were right, I removed the reference to global $mac and it started working great. Thanks. It seems sometimes another set of eyes to catch stuff really helps... thanks. Jason wrote: Jason wrote: Simple functions to check & fix if necessary invalid formating of a MAC address... I seem to be having problems with the global variable $mac not being returned from the fix_mac() function. Any help is appreciated. global $mac; if( eregi( "^[0-9A-Fa-f]{2}\:[0-9A-Fa-f]{2}\:[0-9A-Fa-f]{2}\:[0-9A-Fa-f]{2}\:[0-9A-Fa-f]{2}\:[0-9A-Fa-f]{2}$", $mac ) ) { return 0; } else { return 1; } } /* * check validity of MAC & do replacements if necessary */ function fix_mac( $mac ) { global $mac; /* strip the dash & replace with a colon */ if( eregi( "^[0-9A-Fa-f]{2}\-[0-9A-Fa-f]{2}\-[0-9A-Fa-f]{2}\-[0-9A-Fa-f]{2}\-[0-9A-Fa-f]{2}\-[0-9A-Fa-f]{2}$", $mac ) ) { $mac = preg_replace( "/\-/", ":", $mac ); return $mac; } /* add a colon for every two characters */ if( eregi( "^[0-9A-Fa-f]{12}$", $mac ) ) { /* split up the MAC and assign new var names */ @list( $mac1, $mac2, $mac3, $mac4, $mac5, $mac6 ) = @str_split( $mac, 2 ); /* put it back together with the required colons */ $mac = $mac1 . ":" . $mac2 . ":" . $mac3 . ":" . $mac4 . ":" . $mac5 . ":" . $mac6; return $mac; } } // do our checks to make sure we are using these damn things right $mac1 = "00aa11bb22cc"; $mac2 = "00-aa-11-bb-22-cc"; $mac3 = "00:aa:11:bb:22:cc"; // make sure it is global global $mac; // if mac submitted is invalid check & fix if necessary if( chk_mac( $mac1 ) != 0 ) { $mac = fix_mac( $mac1 ); echo $mac1 . " converted to " . $mac . ""; } if( chk_mac( $mac2 ) != 0 ) { $mac = fix_mac( $mac2 ); echo $mac2 . " converted to " . $mac . ""; } if( chk_mac( $mac3 ) != 0 ) { $mac = fix_mac( $mac3 ); echo $mac3 . " converted to " . $mac . ""; } ?> Still does not resolve the problem. declaring $mac as global in the chk_mac() function. -- Jason Gerfen "And remember... If the ladies don't find you handsome, they should at least find you handy..." ~The Red Green show -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Information
Important document! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Session problems
I am having a problem with sessions. For some reason it keeps creating a new session for every page link you click and not using the original session created when session_start() gets called. Below is the code I am testing with. [one.php] [/one.php] [test1.php] [/test1.php] [test.php] POSTS: "; print_r( $_POST ); echo "GETS: "; print_r( $_GET ); ?> [/test.php] Any help is appreciated, so far I have found that if I use the include_once 'one.php'; and simply refresh the page sessions work fine, but if you call the test1.php then submit the form the session variables aren't found in the old session and a new one is being created on the server. -- Jason G. "In my opinion anyone interested in improving themselves should not rule out becoming pure energy." ~Jack Handley, The New Mexican, 1988. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Session problems [SOLVED]
Well after a bit of tweaking of my script I realized it was not the code that was causing the problem. It was a php.ini setting, I run a few virtual hosts on my webserver and it turned out to be the session.referer_check was set to 0, modify this to equal session.referer_check = and it worked fine after a restart of the webserver. Hope this helps someone else. Jason wrote: > I am having a problem with sessions. For some reason it keeps creating > a new session for every page link you click and not using the original > session created when session_start() gets called. Below is the code I > am testing with. > > [one.php] > > $SessionID = md5( uniqid( rand () ) ); > > session_start(); > > if( ( !session_is_registered( 'hash' ) ) || ( $_SESSION['hash'] != > $_SESSION['chkhash'] ) ) { > session_name( 'prostarinventory' ); > session_register( 'hash' ); > session_register( 'chkhash' ); > session_register( 'count' ); > $_SESSION['hash'] = $SessionID; > $_SESSION['chkhash'] = $SessionID; > $_SESSION['count'] = 1; > } else { > $_SESSION['count']++; > } > > print_r( $_SESSION ); > > ?> > [/one.php] > [test1.php] > include 'one.php'; > print_r( $_SESSION ); > ?> > type="text"> > [/test1.php] > > [test.php] > include 'one.php'; > echo "SESSIONS: "; > print_r( $_SESSION ); > echo "POSTS: "; > print_r( $_POST ); > echo "GETS: "; > print_r( $_GET ); > ?> > [/test.php] > > Any help is appreciated, so far I have found that if I use the > include_once 'one.php'; and simply refresh the page sessions work fine, > but if you call the test1.php then submit the form the session variables > aren't found in the old session and a new one is being created on the > server. > -- Jason Gerfen Student Computing Marriott Library 801.585.9810 [EMAIL PROTECTED] "In my opinion anyone interested in improving themselves should not rule out becoming pure energy." ~Jack Handley, The New Mexican, 1988. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] compiling php to use imagettftext
been fighting this for a while but can find no definitave docs that say how exactly and with what options are needed to enable this.. Here is what Im using for my config ./configure -v --with-oci8=/apps/oracle --with-apxs=/local/apache-1333/bin/apxs --with-gd=/local/stuff --with-mysql=/local/stuff --with-curl --with-imap=/local/jason/imap-2002d --with-config-file-path=/local/apache/libexec --enable-bcmath --enable-calendar --with-zlib --with-dom --with-db4=/local/stuff --with-dba --with-gettext --with-iconv --with-mcrypt=/local/stuff --with-openssl=/local/stuff --with-mcal=/local/jason/libmcal --with-curl=/local/stuff --with-jpeg-dir=/local/stuff --with-png-dir=/local/stuff --with-ldap=/local/stuff --enable-gd-native-ttf --with-ttf=/local/stuff --with-xpm-dir=/local/stuff/X11 and im using freetype-2.1.10 gd-2.0.33 but cannot get it working.. Heres what the libphp.so looks like [EMAIL PROTECTED] ldd libphp4.so libcrypt_i.so.1 => /usr/lib/libcrypt_i.so.1 libmcal.so =>/local/jason/libmcal/libmcal.so libmysqlclient.so.10 => /local/stuff/lib/mysql/libmysqlclient.so.10 libmcrypt.so.4 =>/local/stuff/lib/libmcrypt.so.4 libltdl.so.3 => /local/stuff/lib/libltdl.so.3 libldap-2.3.so.0 => /local/stuff/lib/libldap-2.3.so.0 liblber-2.3.so.0 => /local/stuff/lib/liblber-2.3.so.0 libpam.so.1 => /usr/lib/libpam.so.1 libintl.so.1 => /usr/lib/libintl.so.1 libgd.so.2 =>/local/stuff/lib/libgd.so.2 libX11.so.4 => /usr/lib/libX11.so.4 libXpm.so.4.11 =>/local/stuff/X11/lib/libXpm.so.4.11 libpng.so.3 => /local/stuff/lib/libpng.so.3 libz.so => /local/stuff/lib/libz.so libjpeg.so.62 => /local/stuff/lib/libjpeg.so.62 libdb-4.3.so => /local/stuff/lib/libdb-4.3.so libssl.so.0.9.7 => /local/stuff/lib/libssl.so.0.9.7 libcrypto.so.0.9.7 =>/local/stuff/lib/libcrypto.so.0.9.7 libresolv.so.2 =>/usr/lib/libresolv.so.2 libm.so.1 => /usr/lib/libm.so.1 libdl.so.1 =>/usr/lib/libdl.so.1 libnsl.so.1 => /usr/lib/libnsl.so.1 libsocket.so.1 =>/usr/lib/libsocket.so.1 libcurl.so.3 => /local/stuff/lib/libcurl.so.3 libxml2.so.2 => /usr/lib/libxml2.so.2 libgen.so.1 => /usr/lib/libgen.so.1 libsched.so.1 => /usr/lib/libsched.so.1 libclntsh.so.8.0 => /apps/oracle/lib/libclntsh.so.8.0 libc.so.1 => /usr/lib/libc.so.1 libz.so.1 => /usr/lib/libz.so.1 /opt/local/gcc/3.4.2/lib/libgcc_s.so.1 libcmd.so.1 => /usr/lib/libcmd.so.1 libfreetype.so.6 => /local/stuff/lib/libfreetype.so.6 libpng12.so.0 => /local/stuff/lib/libpng12.so.0 libXext.so.0 => /usr/openwin/lib/libXext.so.0 librt.so.1 =>/usr/lib/librt.so.1 libmp.so.2 =>/usr/lib/libmp.so.2 libpthread.so.1 => /usr/lib/libpthread.so.1 libwtc8.so =>/apps/oracle-8.1.7/lib/libwtc8.so libaio.so.1 => /usr/lib/libaio.so.1 /usr/platform/SUNW,UltraAX-e2/lib/libc_psr.so.1 libthread.so.1 =>/usr/lib/libthread.so.1 but looking at the PHPinfo page, under GD section, it says GD Support enabled GD Version 2.0 or higher GIF Read Supportenabled GIF Create Support enabled JPG Support enabled PNG Support enabled WBMP Supportenabled shouldnt it say something about freetype being enabled if done right? Jason -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] compiling php to use imagettftext
seems like as soon as I post to the list, I end up figgereing it out.. anyway, heres what ended up working. ./configure -v --with-oci8=/apps/oracle --with-apxs=/local/apache-1333/bin/apxs --with-gd=/local/stuff --with-mysql=/local/stuff --with-curl --with-imap=/local/jason/imap-2002d --with-config-file-path=/local/apache/libexec --enable-bcmath --enable-calendar --with-zlib --with-dom --with-db4=/local/stuff --with-dba --with-gettext --with-iconv --with-mcrypt=/local/stuff --with-openssl=/local/stuff --with-mcal=/local/jason/libmcal --with-curl=/local/stuff --with-jpeg-dir=/local/stuff --with-png-dir=/local/stuff --with-ldap=/local/stuff --enable-gd-native-ttf --with-ttf --with-xpm-dir=/local/stuff/X11 --with-freetype-dir=/local/stuff Jason -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: [Off] Cheap SSL certificates?
> Problem is when you have cheap ssl certs they might pop up in browser on > visit, when they are not in the browser cert list though. > > I just know verisign, and truesign. but kinda expensive > -- > Smileys rule (cX.x)C --o(^_^o) > Dance for me! ^(^_^)o (o^_^)o o(^_^)^ o(^_^o) I use GoDaddy personally and have never had any issues with them. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] FULLTEXT: It worked?? Why?
On Monday 25 November 2002 10:59, John Taylor-Johnston wrote: > MySQL4.0.1 Question. HTOK > > FULLTEXT index confusion. > > Why does my SQL work? > > SELECT YR,AU,ST,SD,SC,BT,BD,BC,AT,AD,AC,AUS > FROM ccl_main > WHERE MATCH (AUS) > AGAINST ('+margaret +atwood' IN BOOLEAN MODE) > ORDER BY id desc > > > AUS is not part of my FULLTEXT Index. So why does it work? How does > FULLTEXT work then??? > > CREATE TABLE ccl_main ( > id int(10) unsigned NOT NULL auto_increment, > ... > PRIMARY KEY (id), > FULLTEXT KEY CCL2002 (YR,AU,ST,SD,SC,BT,BD,BC,AT,AD,AC) > ) TYPE=MyISAM COMMENT='CCL Bibliography - Bibliographie ECC'; This has nowt to do with PHP, please ask on the MySQL list. -- Jason Wong -> Gremlins Associates -> www.gremlins.biz Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * /* Passionate hatred can give meaning and purpose to an empty life. -- Eric Hoffer */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: security of stand alone script
On Monday 25 November 2002 02:10, gamin wrote: > i guess i can use $remote_addr to see if the user has an IP. > > But still out of curosity - any way of knowing the user that called the > script ? Use phpinfo(). -- Jason Wong -> Gremlins Associates -> www.gremlins.biz Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * /* Ontogeny recapitulates phylogeny. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Stripslashes through an array.........
On Sunday 24 November 2002 20:30, Cookra wrote: > Hi all is it possible to stripslahes from this query? > > > > $results = mysql_query("SELECT * FROM $DB_Table_A ORDER BY name ASC LIMIT > $page, $limit"); > > while ($data = (mysql_fetch_array($results))) > { > //-->< something here would be nice > } Usually, it's not necessary to use stripslashes() on data retrieved from a db. But if you insist ... foreach ($data as $key => $value) { $data[$key] = stripslashes($value); } ... should work. -- Jason Wong -> Gremlins Associates -> www.gremlins.biz Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * /* spagmumps, n.: Any of the millions of Styrofoam wads that accompany mail-order items. -- "Sniglets", Rich Hall & Friends */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Secureing PHP.
On Sunday 24 November 2002 14:41, Steven Adams wrote: > Hi, > I am looking to secure my php install, like the settings in php.ini > etc. > > I am using apache 1.3.27 and running latest php. > > Is there like a tut or something that can take u thought the php.ini and > explain ina little more detail? If there are tutorials on this type of stuff then google would know -- just go and ask it nicely. And of course there's always the chapter in the manual which deals with "Security", some good stuff there. -- Jason Wong -> Gremlins Associates -> www.gremlins.biz Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * /* QOTD: I looked out my window, and saw Kyle Pettys' car upside down, then I thought 'One of us is in real trouble'. -- Davey Allison, on a 150 m.p.h. crash */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] does //commenting reduce performance?
On Sunday 24 November 2002 22:58, DL Neil wrote: > Neatly done Ernest! > Also in showing how these questions are best answered with five minutes on > the PC, than a msg to the list... ... until someone else comes along and asks a similar question and you have to show them again how it's best answered with five minutes on the PC, than a msg to the list ... ad infinitum -- Jason Wong -> Gremlins Associates -> www.gremlins.biz Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * /* Who's on first? */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Passing Variables
On Sunday 24 November 2002 03:42, Craig Edgmon wrote: > I am sure this question has been answered, but there is a ton of data to > sift through on this. By asking again and having people answer again you'll be generating MORE data for the next person who asks to sift through. >I am running Apache 1.3 and the latest PHP 4.2.3. . > I am just working with variables and I cannot seem to get them to pass from > my html file to the php call. I will get the html portion fine, but not the > variable. I have checked my language and have compared my files with > supposed good code from a reliable source with the same results. Any idea > on this. It happens on multiple systems. -- Jason Wong -> Gremlins Associates -> www.gremlins.biz Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * /* Advertising is the rattling of a stick inside a swill bucket. -- George Orwell */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: image generation with PHP
I did this just today -- http://www.php.net/manual/en/function.imagecreate.php Its real short and sweet. If you're running on Linux, I'm sure you'll be able to get it to work just fine - on Windows, make sure you have the gd extention, and that it will be loaded with php.ini. Hope this helps! -Jason Myrage wrote: is it possible to generate images with texts automatically?? like for eg. if the text is 7555 then automatically an image is generated with the text 7555 in it any help? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: image generation with PHP
You'll need the full PHP package (the 5 MB zip file, not the 400k quickie) .. it'll be in the extensions/ directory of there.. php_gd.dll.. Myrage wrote: i am using windows and I cannot seem to find the necessary libs and dlls "Jason Young" wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... >I did this just today -- >http://www.php.net/manual/en/function.imagecreate.php > >Its real short and sweet. If you're running on Linux, I'm sure you'll be >able to get it to work just fine - on Windows, make sure you have the gd >extention, and that it will be loaded with php.ini. > >Hope this helps! >-Jason > >Myrage wrote: > > >>is it possible to generate images with texts automatically?? like for >>eg. if >>the text is 7555 then automatically an image is generated with the >>text 7555 >>in it >> >>any help? >> >> > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] FULLTEXT: It worked?? Why?
On Monday 25 November 2002 13:33, John Taylor-Johnston wrote: > Sorry Jason ... No offense, Don't apologise to me. Apologise to the list members if you have to. > I learned my MySQL here :) Jolly good. > It's for a PHP > script, after all. And what has this got to do with the price of fish? > Besides unless I want to fill my mail box quota in 3 > minutes ... Here I can post using a news-reader. This is absolutely no excuse for OT posting. Get a bigger mailbox if you have to. I'm not trying to be rude -- I just want say: - whatever your reasons are, your post is OT - if you have to post a db related question to a php related list then use php-db (as opposed to php-general) - the bottom line is if you post to the right place you'll get a better answer (I would like to think that the people on the MySQL list knows MySQL better than the people on the PHP-General list). -- Jason Wong -> Gremlins Associates -> www.gremlins.biz Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * /* knowledge, n.: Things you believe. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: BBCode?
On Monday 25 November 2002 14:20, Kyle Gibson wrote: > Leif K-Brooks wrote: > > I'm working on adding simple BBCode to my site. I'm currently using the > > [i] tag for testing, with the following code: > > > > > function bbcode($text){ > > $text = ereg_replace('\\[i\\](.{1,})\\[/i\\]','\\1',$text); > > return $text; > > } > > print bbcode('[i]This[/i] is a [i]test[/i].'); > > ?> > > > > But it prints "This[/i] is a [i]test". Is there a better way to > > do this? It's not working because it's doing a greedy match. Try (I prefer the PCRE functions over EREG): $text = preg_replace("/\[i\](.*)\[\/i\]/U", "$1", $text); > function bbcode($text) > { > $text = str_replace("[","<",$text); > $text = str_replace("]",">",$text); > return $text; > } > > print bbcode("[i]This[/i] is a [i]test[/i]."); > > ?> This code is simply not suitable. The object is to replace tags as an entity as opposed to simply replacing '[' with '<'. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: image generation with PHP
Did you tell php.ini to load this extension, and then restart your webserver? (I am taking it that you're using IIS or PWS? -- Someone else will have to field the question on whether or not GD/PHP works with this.. I would imagine so, but I am not sure enough to put any money on it :) ) Myrage wrote: No luck I have installed GD lib and zlib and all into c:\php\extensions bur i still get an error *Fatal error*: Call to undefined function: imagecreate() in *c:\inetpub\wwwroot\image.php* on line *24* image.php code : -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Dumb POST Array question
On Monday 25 November 2002 16:48, David Russell wrote: > Hi all, > > I have a multiple select called Consultants[] In one page. > > On the target page, how would I reference it? Would it be: > > $_POST['Consultants'][0] > $_POST['Consultants'][1] If in doubt, print it out (TM): print_r($_POST); The best way to do it (IMHO) is to: foreach ($_POST['Consultants'] as $key => value) { print "$key: $value"; } -- Jason Wong -> Gremlins Associates -> www.gremlins.biz Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * /* Make it myself? But I'm a physical organic chemist! */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Setting values of php.ini file at runtime
On Monday 25 November 2002 19:37, DL Neil wrote: > Excuse me breaking in...somewhat similar problem: > > Have set up a client recently, preaching security persuaded them into > updating so that could run Register_Globals=Off. Now they want to install a > 'wiki' which requires (to my horror) Register_Globals=On. > > Short of two Apache/PHP servers, what is a logical way to structure things > so that the 'wiki' runs 'insecure' but other/'my' PHP work runs more > securely? Set it on a per directory basis. If using Apache something like: php_value register_globals 1 -- Jason Wong -> Gremlins Associates -> www.gremlins.biz Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * /* There is nothing more silly than a silly laugh. -- Gaius Valerius Catullus */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP.net spam protection
On Tuesday 26 November 2002 00:02, Gene Bandy wrote: > Hello all, > > > > I have searched the archives and cannot find an answer to this question. Which archives did you search? Not the PHP ones I hope? > I would like to implement the same type of white list spam protection > (where you must send a confirmation to be accepted) that php.net is > using at my company. Does anyone know what type of software packages are > used to protect the @php.net addresses? Look at the headers of any of the posts to this mailing list, you'll see that this list is managed by something called ezmlm. It is something that runs in conjunction with qmail. Google for more details. -- Jason Wong -> Gremlins Associates -> www.gremlins.biz Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * /* I have never been one to sacrifice my appetite on the altar of appearance. -- A.M. Readyhough */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: BBCode?
On Tuesday 26 November 2002 01:42, Leif K-Brooks wrote: > Thanks, but that doesn't allow nested tags (a [b] tag inside of an [i] > tag, for example). If you want to deal with nested tags then it's probably best to replace each opening and closing tag individually. Otherwise you might end up with some fiendishly complicated regex. Did I say I preferred the PCRE functions to the EREG ones? Well using preg_replace() you can put all your search strings in one array and all the corresponding replacement strings in another and it'll replace all those tags for you in a single operation: $text = '[i]This[/i] is a [i]test[/i].'; $search_for_tags = array("/\[i\]/", "/\[\/i\]/"); $replace_with_tags = array("", ""); $text = preg_replace($search_for_tags, $replace_with_tags, $text); print $text; -- Jason Wong -> Gremlins Associates -> www.gremlins.biz Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * /* Ignorance must certainly be bliss or there wouldn't be so many people so resolutely pursuing it. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] imagecopyresized
On Tuesday 26 November 2002 02:10, [EMAIL PROTECTED] wrote: > hi > i'm having problems resizing jpegs. > here's an e.g. using manual example. > code used : > $new_w=395; > $new_h=297; > header("Content-type: image/jpeg"); > $dst_img=ImageCreate($new_w,$new_h); > $src_img=ImageCreateFromJpeg($name); > ImageCopyResized($dst_img,$src_img,0,0,0,0,$new_w,$new_h,ImageSX($src_img), >ImageSY($src_img)); ImageJpeg($dst_img); > ?> > > and the result can be seen here. > http://www.sitestogo.biz/temp/test.php You may get a better response if you actually copy and paste the error message or whatever. If that's not possible at least give a brief description as to what the problem is. Having to make people go through extra steps to help you is not a very good idea. -- Jason Wong -> Gremlins Associates -> www.gremlins.biz Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * /* Too much is just enough. -- Mark Twain, on whiskey */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php