Taylor-Johnston wrote:
The deal is my ISP does a redirect from www.delete.compcanlit.ca to
www.delete.compcanlit.usherbrooke.ca. I'm trying to if statement the redirect. Again,
I find no variable in phpinfo().
John
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit
REFERRER isn't always set, so that may be the problem.
Try just a simple HTML page that has a link to a PHP page that echo's
out $_SERVER['HTTP_REFERRER'].
Does that work?
No.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
What do you get with this...
echo ( pre\n );
print_r ( $_SERVER );
echo ( /pre\n );
From a blank HTML page, I get:
Array
(
[DOCUMENT_ROOT] = /var/www/html2
[HTTP_ACCEPT] = image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, image/png,
*/*
[HTTP_ACCEPT_CHARSET] = iso-8859-1,*,utf-8
echo ( pre\n );
print_r ( $_SERVER );
echo ( /pre\n );
On the redirect from http://compcanlit.ca/, I get:
Array
(
[DOCUMENT_ROOT] = /var/www/html2
[HTTP_ACCEPT] = image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, image/png,
*/*
[HTTP_ACCEPT_CHARSET] = iso-8859-1,*,utf-8
comes thru on a
different port. If this is consistant, you may be able to use this.
John Taylor-Johnston wrote:
echo ( pre\n );
print_r ( $_SERVER );
echo ( /pre\n );
On the redirect from http://compcanlit.ca/, I get:
Array
(
[DOCUMENT_ROOT] = /var/www/html2
[HTTP_ACCEPT
there to tell it was redirected,
but it's not looking good.
John Taylor-Johnston wrote:
[SERVER_PORT] = 80
Server port does not change.
Will it do anything to change my php.ini?
session.referer_check =
It is set to nothing at the moment, copied and pasted.
How do I check
I understand the principle of mail. What I want to do is use a textarea as a mailing
list, something like this. How do I loop it?
?php
if (!$message)
{
?
form
textarea name=addresses[EMAIL PROTECTED]
[EMAIL PROTECTED]
[EMAIL PROTECTED]/textarea
textarea name=messagehi everyone,
how are
Ok, this is a basic MySQL question, but I don't know how to code it in PHP. I want to
check in StudentId. If it exists, ...
Anyone good humoured who would help me fill in the blank. Like I should know this, but
haven't even thought of coding SQL in a while :)
$myconnection =
Ok ... so I can do it this way (below), but there must be a more intelligent way? This
is like something I did with my Vic20, 19 years ago. (If you ever had a Vic20 ... :)
you might sympathise)
while ($mydata = mysql_fetch_object($news))
{
if ($mydata-StudentId = $StudentId)
{$found
OK,
I tried this, but am getting this error:
Warning: Wrong parameter count for mysql_num_rows() in /.../testals.php on line 189
189 if (mysql_num_rows() == 1)
What's up?
John
$myconnection = mysql_connect($server,$user,$pass);
mysql_select_db($db,$myconnection);
$news = mysql_query(select
I had a Vic20 sitting next to a Lisa... :)
The debate in them days was whether a timex-simplex would outlast. Commodore sold a
lot but never went anywhere past high school labs. I knew a guy with a PC who laughed
at every else. Funny how things turned out.
--
PHP General Mailing List
:) Tried that:
Warning: Supplied argument is not a valid MySQL result resource in /.../testals.php on
line 189
189 if (mysql_num_rows($news) == 1)
John
Matt mysql_num_rows($news)
$server = localhost;
$user = ;
$pass = ;
$db = redwards;
$table = testals;
$myconnection =
My question got buried on the bottom of the thread. Sorry for the repeat. I'm getting
this message:
Warning: Supplied argument is not a valid MySQL result resource in /.../testals.php on
line 189
189 if (mysql_num_rows($news) == 1)
Ideas?
$server = localhost;
$user = ;
$pass = ;
$db
Have I over done this? Can I clean up this code any?
I have two states
1) Admin mode
2) Normal mode
in Normal mode, I have two states:
a) student is not in the database
a) student is in the database and has likely reloaded the browser. I'm trying to avoid
multiple entries with the same
$P1OC1Q1 = 1¶some text or some comment;
echo trtdYour score is: /tdtd; $score=split($P1OC1Q1,¶); echo
$score[0]./td/tr\n;
Do I have to go through all that to get score[0] ?
John
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Kind of hoping to do shorten it like this:
echo trtdYour score is: /tdtd.$score[0]=split($P1OC1Q1,¶)./td/tr\n;
No such hopes?
Looks like a really simple piece of code except for the cryptic variable names.
$P1OC1Q1 = 1¶some text or some comment;
echo trtdYour score is: /tdtd;
Why not:
echo trtdYour score is:
/tdtd.split($P1OC1Q1,¶)./td/tr\n;
Ok, but what happens when $P1OC1Q1 = . It errors out.
$P1OC1Q1 = ;#left blank
$P1OC1Q2 = 1¶bunch of text;
$P1OC1Q3 = 1¶bunch of text;
$P1OC1Q4 = 1¶bunch of text;
$P1OC1Q5 = 1¶bunch of text;
$P1OC1Q6 = 1¶bunch of text;
--
; $score=split($P1OC1Q1,¶);
echo $score[0]./td/tr\n;
My problem becomes more difficult when $P1OC1Q1 = ;
Split errors out.
SævË Ölêöyp wrote:
Why not:
echo trtdYour score is:
/tdtd.split($P1OC1Q1,)./td/tr\n;
-Original Message-
From: John Taylor-Johnston [mailto:[EMAIL PROTECTED]
Sent
How can I find out if $mystring includes the character ¶?
Thought substr would do it?
J
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Sorry, scrap that:
if (substr_count($mystring,¶) 0)
John Taylor-Johnston wrote:
How can I find out if $mystring includes the character ¶?
Thought substr would do it?
J
--
John Taylor-Johnston
-
If it's not open
I was wondering.
http://www.php.net/date
gives me/redirects to:
http://www.php.net/manual/en/function.date.php
How do they do that?
What $_post[??] is that? Or is it a sevrer (Apache, I suppose?) thing?
--
John
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit:
Aw gee, $_SERVER['REMOTE_HOST'] (only REMOTE_ADDR) does not exist in PHP?
Bummer.
Why is that?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Not teasing, I know I could do this with some ready made script, but I want to make my
own.
I'm making a counter.
CREATE TABLE `counter` (
`IPAddress` VARCHAR NOT NULL ,
`RemoteHost` VARCHAR NOT NULL ,
`TimeStamp` TIMESTAMP NOT NULL,
`Date` VARCHAR NOT NULL
)
Question 1, how do I
Get your mail sysadmins to install spamassassin, which I believe is OpenSourced PHP,
and the filter your {SPAM} directly into the garbaaage. if everyone did this, and
therefore stopped opening dangerous mail, maybe we could slow some of this down. :) Oh
well, just my 2¢
On Wed, Aug 20, 2003
Help me out here. I want to get a numeral on the number of records in a table.
What is the function?
http://www.php.net/manual-lookup.php?pattern=fetch%2Browslang=en
http://www.php.net/manual-lookup.php?pattern=fetch%2Brecordslang=en
? :)
John
--
PHP General Mailing List (http://www.php.net/)
This is what I'm using so far. But I need to put in a time stamp to calculate if the
visitor is new. I want to use the IP so if the ip saved in MySQL is older than 60
minutes, it will write a new record, if not, don't:
$myconnection = mysql_connect($server,$user,$pass);
Anyone? Please :)
John Taylor-Johnston wrote:
This is what I'm using so far. But I need to put in a time stamp to calculate if the
visitor is new. I want to use the IP so if the ip saved in MySQL is older than 60
minutes, it will write a new record, if not, don't:
$myconnection
I'm creating a counter.
I want a timestamp where I can calculate if a time stamp is older than one hour, if so
do X, if not do Y.
Gabriel Guzman wrote:
http://us4.php.net/time
and
http://www.mysql.com/doc/en/DATETIME.html
I have looked at both, especially
Indeed easier than I thought?! :)
timestamp(14) is ok :)
Thanks John!
John
--
http://compcanlit.ca/
Quoting CPT John W. Holmes [EMAIL PROTECTED]:
SELECT * FROM Table WHERE timestamp_column NOW() - INTERVAL 60 MINUTE
will give you all rows that have a timestamp column that's over 60 minutes
This is my favourite question. Can I clean up my 'if then' statements a tad?
Must be a cleaner way?
Still learning, still having fun :)
Thanks,
John
$news = mysql_query($sql) or die(print document.write(\.mysql_error().\););
$found = 0;
while ($mydata = mysql_fetch_object($news))
{
Yes, but must be a better way to setup my if.then's ?
John
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
John Taylor-Johnston
-
If it's not open-source, it's Murphy's Law.
' ' ' Collège de Sherbrooke:
ô¿ô http://www.collegesherbrooke.qc.ca/languesmodernes/
- Université de Sherbrooke:
http
Sorry, hit sent by accident :)
I have a cookie:
if (!isset($_COOKIE[weather_htm]))
But I want the name of the cookie to include $StudentId like this:
if (!isset($_COOKIE[weather_htm.$StudentId]))
Of course, the line does not read the cookie.
What is the problem with my syntax please?
John
I create this cookie, using Javascript::
testals.flsh.usherb.ca FALSE / FALSE 1062433227 weather.htm9995 1
If the browser is reloaded, I want php to read the cookie and do my else statement.
Even after a browser shut-down and restart, I cannot get PHP to read the cookie (first
part of my if
I have a directory jammed-packed with images.
I want to read the directory contents /www/usr/htm/images/
and display randomly any *.gif or *.jpg in said directory.
Do-able? Seriously? Ideas? Places to start?
John
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit:
As it turned out, all I had to do was get rid of the period . and things began to
work better.
I also had to remember to close my browser and empty the cookie jar.
Thanks,
J
Jaap Van Ganswijk wrote:
At 2003-09-01 00:49 -0400, John Taylor-Johnston wrote:
I create this cookie, using Javascript
Taylor-Johnston wrote:
I have a directory jammed-packed with images.
I want to read the directory contents /www/usr/htm/images/
and display randomly any *.gif or *.jpg in said directory.
Do-able? Seriously? Ideas? Places to start?
--
John Taylor-Johnston
Anyone have a quick fix for a part of an html page that I do not want to display until
after October 1st, and not after October 31st ?
J
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Jay,
I should have though of that. Thanks.
Jay Blanchard [EMAIL PROTECTED] wrote:
?php
$display_start = 2003-10-01;
$display_end = 2003-10-31;
if((date(Y-m-d) = $display_start) (date(Y-m-d) =
$display_end)){
print($stuff);
}
?
Cesar: Is your server is set up correctly? In your
This is kind of old-fashioned, but I created a counter that prevents hijacking.
district is a partial of the word in the URL. If it does not exist, echoes hijacking
...
snip---
if(stristr($HTTP_REFERER,district))
{
#...
#echo document.write(\$num_rows visitors since August 23, 2003\);;
echo
use of formmail.pl these days would need
updating to protect it from spamming. Anything available?
--
John Taylor-Johnston
-
If it's not open-source, it's Murphy's Law.
' ' ' Collège de Sherbrooke:
ô¿ô http
I don't know if such an animal exists?
I use Windows Wordpad as a text editor. Then I use Microweb from:
http://www.indigostar.com/microweb.htm
You might want to download a newer copy of PHP from http://www.php.net/downloads.php
This is lilkely not what you are looking for, but will do a very nice
I have a form. It has any number of hidden fields, named exercise 1-100. Their names
all start with exercise as in:
input type=hidden name=exercise1
... ?
input type=hidden name=exercise11
any number fo these possible ...
input type=hidden name=exercise71
How can I create one scipt that will
Ok, but the problem is that I will, might have other fields. I need to filter out just
the exerciseN fields. Interesting though thanks,
John
Brad Pauly wrote:
You could just loop over the _POST array.
foreach ($_POST as $field_name = $field_value) {
$content .= $field_name =
Brad. Perfect thanks.
Brad Pauly wrote:
foreach ($_POST as $field_name = $field_value) {
if (stristr($field_name, 'exercise')) {
$content .= $field_name = $field_value\n;
}
}
Tom, Not sure why, but wouldn't work
Tom Rogers wrote:
if(isset($_POST['exercise'])){
to ask, to give them a nudge :) ?
--
John Taylor-Johnston
-
If it's not open-source, it's Murphy's Law.
Université de Sherbrooke:
http://compcanlit.ca/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe
John I'm not sure if you've noticed, ...
Larry, Pete et al.,
Point taken. I won't exacerbate the point, but php.net does point out the lists, and
this general group in particular, are for talking about PHP.
There are a number of mailing lists devoted to talking about PHP and related
projects
Lars,
Thanks. I am getting this error however:
Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING' in
It does not like addslashes() because of the {}? What is a sensible work around? Or do
I even need addslashes??
if ($found)
{
$sql = INSERT INTO $dbtable
Lars, Much thanks. Life saving :)
Ignatius, I like your idea. Thanks to you too.
John
if (isset($var[$key]['Option']))
{
// Flag that we got one this time round.
$found = true;
// Get the translated name from $var.
How do I call this?
http://www.phpclasses.org/browse.html/file/2202.html
calendar; //gives me nothing.
Prints html header and that's it. It's a class and obviously I don't know what I'm
doing :)
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit:
Yawn of frustration.
$dbtable = ccl.ccl_main;
list($db,$table) = explode(.,$dbtable);
echo $dbtable.'br'.$list[$db].'br'.$list[$table].'hr';
echo $dbtable.br.$list[$db].br.$list[$table].hr;
I stumped :)
$list[$db]shows nothing
$list[$table] shows nothing
Ok, newbie time :( What's wrong?
Rasmus,
You probably want just $db and $table
Yes I do. I need to learn a little more about declaring arrays its syntax.
I figured I was declaring an array called list. Then ... :) Copied tinkered from:
http://www.php.net/manual/en/function.explode.php
Thanks!
John
--
John Taylor-Johnston
Rasmus,
If I were going to remanufacture http://www.php.net/manual/en/function.explode.php I
would add/edit:
$data = foo:*:1023:1000::/home/foo:/bin/sh;
list($user,$pass,$uid,$gid,$gecos,$home,$shell) = explode(:,$data);
echo $user.br.$pass.br.$uid.br.$gecos.br.$home.br.$shell;
Thanks again.
://192.168.0.1/bdoi_change/sundar.html
in my internet explorer address bar, it says the page cannot
be displayed.
the file permissions are rw-r-r
thanks in advance,
regards,
diksha.
--
John Taylor-Johnston
-
If it's not open
Ok, someone help him out.
Maybe, just maybe the file belongs to someone else than you. I had that happen to me
once too. CuteFTP can show you that. Is this possible people?
What happened when you checked the permissions? 644? Then CHMOD it 644 again yourself
to see if it makes a difference.
dear john,
i made the CHMOD myself to 644.
but the file is still not opening.
do u have any more ideas?
Sorry no. Tapped out. But I'm not a pro coder myself. Someone will answer. Someone is
awake and coding. Come on guys. Give the lady a break.
and i am not 'he'.i am 'she'.
I stand corrected
the file permissions are rw-r-r
Stupid question -- are you running a webserver?
Charming isn't he?
/*
The fact that 47 PEOPLE are yelling and sweat is cascading down my
SPINAL COLUMN is fairly enjoyable!!
*/
Indeed. Help the colleague out Jason, or get off the channel.
--
PHP General
Hey,
I'm using PHP MySQL to generate a RTF document. I use this header:
header(Content-type: text/rtf);
Of course, the header scares the poor browser. The browser bawks and says, unknown
file type, and instructs the browser to save the file.
It tries to save a file called
Just a hunch:
? echo $subject[0]; ?
Try using ?php instead, as in:
?php echo $subject[0]; ?
Do you have a URL to show us what your page does and doesn't do?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
I didn't know a debugger was available? Then again, I'm no expert. However, as an
aside note, rename your file to *.PHPS
This will display your code in a readable, color-coded fashion, allowing you to
decipher possible problems yourself.
Newbie advice, but helps some.
--
PHP General Mailing
Works great. Thanks,
John
I'm using PHP MySQL to generate a RTF document. I use this header:
header(Content-type: text/rtf);
header(Content-Disposition: attachment; filename=myfile.rtf);
--
John Taylor-Johnston
[i] How or why do researchers adapt technology to their research projects? Should they
adapt their projects to technology? Indeed, how often does the research assistant end
up reinventing the wheel? [/i]
I know most of you are E-Commerce oriented, but I would appreciate your feedback. I
use
!
--
John Taylor-Johnston
-
If it's not open-source, it's Murphy's Law.
Université de Sherbrooke:
http://compcanlit.ca/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
and the
substations just won't work for \r\n [or just \r or just \n] or \015
or \15.
And, I've tried using 10 and 010 and 13 and 013.
And nl2br doesn't work either.
Can anyone help?
Thanks
--
John Taylor-Johnston
http://www.php.net/manual/en/function.mail.php
TEXTAREA NAME=MyText ROWS=10 COLS=26 width =15
input type=checkbox name=checkbox2
Note my changes in your HTML!
mail([EMAIL PROTECTED], Subject: sending results by email, MyText: \n$MyText
\ncheckbox2: $checkbox2);
HTH?
John
form name=form1
input name=add type=checkbox id=add[] value=179
Does id even exist?
HTH
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
I stopped using pconnect. Don't see the sense in it. Why take the chance?
http://www.php.net/manual/en/function.mysql-pconnect.php
blockquoteWarning
Using persistent connections can require a bit of tuning of your
Apache and MySQL configurations to ensure that you do not exceed
the number of
+.
---Matt
-Original Message-
From: John Taylor-Johnston [mailto:[EMAIL PROTECTED]
Sent: Sunday, February 23, 2003 2:42 AM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] Help with Multiple Checkboxes
input name=add type=checkbox id=add[] value=179
Does id even exist?
HTH
--
PHP General
does'.
I am only using PHP/MySQL to let researchers put their work online, and
will use it to let PhD's administrate their own progress, which will be a
big relief for the administration people. So it is university related but
not really research related.
--
John Taylor-Johnston
can I muster up to do this?
--
John Taylor-Johnston
-
If it's not open-source, it's Murphy's Law.
' ' ' Collège de Sherbrooke:
ô¿ô http://www.collegesherbrooke.qc.ca/languesmodernes/
- Université de Sherbrooke
Which variable should I use?
_SERVER[HTTP_HOST]
_SERVER[SERVER_NAME]
HTTP_HOST
Server_NAME
Host
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Jason,
$_SERVER is outdated now isn't it?
John
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Instead of doing this:
?php if ($HTTP_HOST == ccl.flsh.usherbrooke.ca){ ?
Which function am I looking for to see if $HTTP_HOST contains compcanlit?
This is not what I am looking for:
http://www.php.net/manual/en/function.similar-text.php
John
--
PHP General Mailing List
Off topic :) ?
Anyone know how to explode using javascript?
$pieces = explode( , $pizza);
John
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Anyone do MySQLDump using PHP ?
http://www.mysql.com/doc/en/mysqldump.html
My code is:
mysqldump -u ** -p ** -A /home/mybackups/dump_all.sql
I would like to pull it off using PHP, remotely.
$date = date (Ymd);
$to_path = /home/MyBackups/$date/dump_all.sql;
mysqldump -u ** -p
Thanks!
exec(mysqldump -c -q database -u user -ppassword, $sql);
Why is there no space between the -p and password?
-ppassword
Am I wrong?
Thanks,
John
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Stripslashes I think.
Gregory Chagnon wrote:
When I submit a form with a text area containing the test //server/share
and try to echo the variable it echos server//share. Is there any way
to prevent the extra /'s? Thanks!
-Greg
--
John Taylor-Johnston
This works:
exec(mysqldump -u -p -A test.sql);
This doesn't.
exec(mysqldump -u -p -A $filename);
:)
?php
$filename = /home/johj2201/public_html/mysqldump/db_backup_ . date(n-j-y)..sql;
exec(mysqldump -u -p -A $filename);
echo dump completed on $filename ;
?
Scratch that. Had a CHMOD problem.
Sorry.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Assuming MySQL can do this, I need to generate some code that would MOVE a record from
one table to another. Not just a MySQL code problem?
Pseudo code: base.table
select base1.table where id=25
insert result base2.table
delete base1.table where id=25
Can I even do this in MySQL? If so, what
I was wondering about this, but decided to ask first first:
INSERT INTO ccl.ccl_main VALUES (select * from greid.ccl where id=28);
delete * from greid.ccl where id=28;
Both tables would have to have the same structure ?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit:
Found this for anyone interested.
http://www.mysql.com/doc/en/INSERT_SELECT.html
John Taylor-Johnston wrote:
I was wondering about this, but decided to ask first first:
INSERT INTO ccl.ccl_main VALUES (select * from greid.ccl where id=28);
delete * from greid.ccl where id=28;
Both tables
Nothing fancy. Can't get it to echo ¶
textarea cols=30 rows=5 name=testtextareamary
had
a
little
lamb/textarea
if ($testtextarea)
{
$inputresult = str_replace(\n, '¶'.\n, $testtextarea);
echo textarea cols=30 rows=5 name=testtextarea$inputresult/textarea;
}
--
PHP General Mailing List
I have also tried:
$inputresult = str_replace('\n', '¶\n', $testtextarea);
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Jon, Anyone,
Paragraph sign actually. I'm filterting some data for MySQL. I need a field delimiter.
I don't want to use \n. Contents of each field are on a signel line of text.
I have come up with this, unless someone can suggest better:
if ($testtextarea)
{
$inputresult = str_replace(\r, ,
http://www.php.net/manual/en/function.stristr.php
http://www.php.net/manual/en/function.strpos.php
Input from a textarea name=something
I want to scan endless lines of $something. If the First Three characters
of any line begin with au: (case insensitive) I want to filter out that line,
and let
;
}
?
--
John Taylor-Johnston
-
If it's not open-source, it's Murphy's Law.
' ' ' Collège de Sherbrooke:
ô¿ô http://www.collegesherbrooke.qc.ca/languesmodernes/
- Université de Sherbrooke:
http
Can I run a php script in crontab?
Do I echo or print?
Anyone doing it?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Cal, Liam, Jimmy,
Thanks. If this is a serious security hazard, could you show me some code that is more
secure? I am the root. Mind you I've never worked with crontab before. I want to run
/var/www/backup_mysql.php I suppose I should start by putting it somewhere not
publicly accessible?
Sigh :) It all works so much better if I use:
if(eregi('^au: (.*)$',$line,$m)) {
But I want to use a function. But nothing is returned. So what did I do wrong now?
--snip
echo filter_strings(au:);
function filter_strings($tofilter){
echo $tofilter.br;
#
Thanks Keven. Didn't see that.
?php
$line = AU: Tomlinson,-Brian;
$AU = filter_strings(AU: ,$line);
function filter_strings($tofilter,$line){
if(eregi('^'.$tofilter.' (.*)$',$line,$m)) {
$filtered=$m[1];
return $filtered;
}
}
?
--
PHP General Mailing List
#http://www.php.net/manual/en/function.fopen.php
$contents = fopen (/home/pathto/file.txt, r);
if ($contents){echotextarea$contents/textarea;}
else{echo no contents there;}
Questions:
What is the use of @fopen?
Does anyone see a better way?
--
PHP General Mailing List (http://www.php.net/)
Three advantages I like:
1- no more cgiwrap.
2- thus I can work in any directory and am not bound to cgi-bin
3- Sheer ease of coding. A lot easier to learn, it's open-source and newsgroups are
more helpful. Perl groups are less helpful, programmer centred and not newbie-friendly.
Just my 2¢
--
If you switch over, will you be able to port your database?
Does PHP use less system resources than CGI on a server?
I have a bulletin board which is incredibly active, but there is a PHP
sister to it.
Again, when coding for a BB, I appreciate not being bound to work in /cgi-bin/
especially
MatTo get data out of the file that you
Mathave opened, you will need to read() it n.
Mathttp://www.php.net/manual/en/function.fread.php
Ok, how about this? What about error checking if the file contains something as I
include below? Is that enough?
?php
// get contents of a file into a string
http://www.php.net/manual/en/function.fread.php
What about error checking if the file contains something as I include below? Is that
enough? Is this the right way?
?php
$filename = /usr/local/something.txt;
$handle = fopen ($filename, r);
$contents = fread ($handle, filesize ($filename));
Instead of using fread, I want to upload a *.txt file using:
input type=file name=txt_file /
and display it in a textarea. Where do I go now? Specifically, how do I get $contents?
Thanks,
John
?php
$filename = /usr/local/something.txt;
$handle = fopen ($filename, r);
$contents = fread
I need to upoload a local text file into memory using:
input type=\file\ name=\filename\ /
The script below will only work if I am using my localhost.
Any ideas?
John
?php
echo form action=testthis.php method=post\n;
if (!$filename)
{
echo !\$filename input type=\file\ name=\filename\ /\n;
Jason, I've already been looking at:
http://www.php.net/manual/en/function.move-uploaded-file.php
http://www.php.net/manual/en/features.file-upload.common-pitfalls.php
http://www.php.net/manual/en/features.file-upload.php
Indeed: http://ca.google.yahoo.com/bin/query_ca?p=php.net+upload+file
and
You are going to need to start a session.
http://www.php.net/manual/en/ref.session.php
http://www.php.net/manual/en/function.session-start.php
The idea was to see if $variable was in the session. If it was, use the session
variable. I was passing a lot of variables through input type=hidden
201 - 300 of 562 matches
Mail list logo