Hi Brad,
This worked for me:
.. but I'd tend to go for a regex as a solution to what you're after,
which involves less code:
Just my thoughts...
James
"Brad Melendy" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hello,
> Ok, this works:
>
> if (su
The easiest way would be to use strip_tags(), though you could craft your
own regular expression.
http://www.php.net/strip_tags
James
"Gary" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hello All,
> How would I strip all HTML before the info in inserted
Hi Daniel,
Try this:
Should work ok.
James
"Daniel Harik" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> I've tried this code:
>
> $timea = explode(" ",$timepostsed);
> $timea1 = explode("-",$timea[0]);
> $timea2 = explode(":",$timea[1]);
> $timestamp =
>
Hey John,
something like this might work:
", $string);
echo $string;
?>
James
"John A. Grant" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> I'm reading some HTML text from a file and echoing it to
> stdout. The HTML text contains but I would rather
> hav
Hi Joe,
GMT isn't affected by daylight savings (altough in the UK we are using
British Summer Time at the moment, which is GMT +1), so that's the constant
you can work from if you're not experiencing daylight savings schemes where
you are. I have written out an example for you below.
We get the
Hi all,
I'll apologise right away - this is more or less completely off topic,
though it is remotely connected with PHP (so that's my excuse).
At the moment, the company I work for is hosted on a co-located server. We
have one main domain and many sub domains. Here's how they are (roughly set
Hi Matt,
mysql_insert_id();
See the manual for more info.
James
"Garman" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hello:
>
> I'm inserting some information into a MySQL database via a PHP script. A
> handful of various information is put into the dat
Hi Phil,
Print returns a boolean true / false value as functions do, as well as any
output, whereas echo doesn't. Have a look through the archives.. This is
quite a popular question, and it wasn't long ago when it was last asked.
James.
"Phil Latio" <[EMAIL PROTECTED]> wrote in message
[EMAIL
Hi Kok,
use nl2br();
$string = nl2br($string);
echo $string;
See the manual for full details.
James
"Coconut Ming" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> hi..
> Did you feel it is strange alignment when you output the same thing
> again in PHP.
Hi Julian,
personally, I'd take out both tags, using something like:
$str = preg_replace("/<\/?p.*?>/i", "", $str);
Which gets rid of:
Or any case insensitive matches. That's probably just me though ;)
James.
"Julian Simpson" <[EMAIL PROTECTED]> wrote in message
news:20010802214051.BGVV2
Hello Steve,
well, you should have the table set, at the very least, something like this:
UserId - INT, Primary Key, Auto increment
RealFName - varchar(20)
RealLName
UserName - Varchar (20)
PassWord - Varchar (12)
The length of the fields is optional, and you should perform checks on the
userna
Hiya Dan,
If you're expecting new lines, you could do this:
$length = explode("\n", $message);
if (sizeof($length) > 55) {
// error
}
And also limit the number of characters, using strlen()
James
"Dan" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hi
Hi Dan,
try changing:
$tempfile = fopen ("$filedir" . "/" . "$filename" . ".html", "r") or die
To:
$tempfile = fopen ($filedir . "/" . $filename . ".html", "r") or die
for starters ;)
James.
"Dan Krumlauf" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
>
> ne
Hi Christopher,
Why not use nl2br() and trim() ?
$string = trim($string); // Clear any unwanted white space (trailing and
leading);
$string = nl2br($string); // Add line breaks where necessary
echo "$string"; // Voila
James
"Christopher Kaminski" <[EMAIL PROTECTED]> wrote in message
[EMAIL PR
Hi David,
If you know that the first form has been submitted, you could pass the
variables through hidden variables:
";
}
?>
Should work.. And it's often better going through the POST method
rather than the GET method (particularly if you want to restrict the user
from tampering with the
Hi Noah,
if you make the include file a .php file, then the browser will parse the
code as a blank page whether or not they choose to look at the file, or
try to fopen(etc) it. Problem solved ;) At least I think that's
safe-ish...
James.
"Noah Spitzer-Williams" <[EMAIL PROTECTED]>
Thanks for all of your help on this. My host admin have informed me that
php is installed only for the web, and not as a cgi, so that's what was
going wrong (it wasn't down to my own naievity afterall.)
So, it's time to learn perl (or bash).
Thanks again for all your comments and help.
Jam
e a shebang ('#!/usr/bin/php') in
> it? I've found that works well... just put that as the first line, and
> it behaves as a shell script (after you make it executable, of course)
>
> Ben
>
> -Original Message-
> From: James, Yz [mailto:[EMAIL PROT
Hi all,
This is probably going to sound incoherant, but
Do I have to do anything (other than change the permissions of a php file)
to get it to run as part of a cron job? I created an extremely simple file
that should just send a blank email to me (using mail()). I got an email
from the cr
Hi Marc,
This is one for JavaScript, methinks.
Screen detection
Your browser resolution is
Christian,
Those are SSI calls (Server Side Includes, for use with .shtml files).
Try:
include("/path/to/filename");
require("/path/to/filename");
I've never used these, but in PHP4 there are also:
include_once("/path/to/filename");
and
require_once("/path/to/filename");
(double check that I
Hello Diego,
You need to use copy()
If the form input is like this: file:
Send this
Will only let you upload a file of less than 1kb if you program around that
(1024 bytes in a Kb). Setting to 102400 would give you a max upload size of
100 Kb.
So, simply:
You can of course test whether the
Or, try count() in the sql statement..
I think that's faster than:
Can't be sure where I read it, but still :)
Ack! 1.20am. Bedtime.
James.
""Johnson, Kirk"" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> See http://www.php.net/manual/en/function.mysq
Hi There,
James.
""Scream"" <[EMAIL PROTECTED]> wrote in message
9drq8v$ngb$[EMAIL PROTECTED]">news:9drq8v$ngb$[EMAIL PROTECTED]...
> Hi,
>
> I've got a one simple question. How I can check directory exist or not ?
> Plz, help me :) TIA !
>
>
> --
> regards, - scream ->> scream(at)w.pl
>
Hi Fredrik,
Always check whether or not the required variables are there BEFORE querying
the database. And make sure that the negatives are dealt with first.
That's my opinion. I'd probably also check whether the original username /
password is in the database before proceeding. Probably m
Hi Guys,
Does anyone know how to select one field randomnly from a MySQL table
against a weighting column in the same row the field is selected from?
For example, "SELECT id, url, image FROM table ORDER BY rand() LIMIT 1".
And have a column like "weighting" where values between 1 and 100 ar
Hi Nick,
to delete a cookie, simply use set_cookie("cookie_name"); without appending
any values.
Possible solutions for the \t and \n :
For \n to , use:
$string = nl2br($string);
Not sure whether or not there a similar function for \t, though you could
perhaps use some method to replace \t wit
Hi all,
I have seen a few pages that echo the time it's taken to execute an SQL
query, like "The results in the database were returned in 0.3 seconds."
Anyone know if there's a built in function to display this, and if there is,
what it is? My more-than-useless-ISP seems to have taken an aversio
Hi Sandeep,
The tag looks like this in wml:
Have you escaped the doublequotes correctly in your double quoted "echo" 's?
Make sure that the database doesn't contain ampersands, or dollar signs, or
some of the foreign lettering (like é), as they are illegal characters in
wml (well, the dollar
Hiya Martin.
You'd probably be better working around a database solution to your needs,
but I am a bit drunk (and probably can't sensibly attempt to answer your
question properly), but it got me thinking, so I decided to have a play with
date incrementations. If anyone has any comments on this,
Hi George,
Yes. Use nl2br(); which converts line breaks (\n) to html break tags
(). You're better doing it when you pull data out of your database
rather than doing it as it goes in (if you're using a database in the first
place).
Format is as follows
:
$string = nl2br($string);
James.
>
Hi Guys,
Is there a method of extracting rows from a MySQL table Uniquely (as in only
once) ?. For example, when a user performs a search, using two words,
it may return the same row twice if the search is spread over two or more
SQL "selections". An example:
If hypothetical row 129 is a Pu
Hi Guys,
If I wanted to retrieve just one field randomly from a MySQL table, would I
just use something like:
"SELECT RAND(id) FROM table LIMIT 0,1" ?
I suppose the best thing for me to do would be to try it, but I am fast
losing the will to stay awake ;)
Thanks, as always,
James.
--
>> Well, I'm having problems again. This time with string replacement.
>> I'd like people to be able to write notes on one of the site's I'm
>> helping with, and would like them to be able to use Bold, Italic,
>> Underline and tags. I tried using striptags(); but that would
>> strip anything wi
Hello all,
Well, I'm having problems again. This time with string replacement. I'd
like people to be able to write notes on one of the site's I'm helping with,
and would like them to be able to use Bold, Italic, Underline and
tags. I tried using striptags(); but that would strip anything with
OK, using this code:
\n";
echo "\n";
$photocount = 0;
while($row = mysql_fetch_array($result)) {
$smallpic = $row['smallpic'];
echo "$smallpic\n";
if (($photocount % 3) == 2) {
echo "\n\n";
}
$photocount++;
}
echo "\n";
echo "";
?>
And 8 photos in the table, I'm getting
Hi all, This is probably something dumb I'm missing, but I am using the
following code:
echo "\n";
echo "\n";
$photocount = 0;
while($row = mysql_fetch_array($result)) {
$smallpic = $row['smallpic'];
if (($photocount % 3) == 2) {
echo "\n\n";
}
echo "$smallpic\n";
$photocount++
Hi all,
I'm a little concerned as to how many times some of the scripts I've been
working on are querying a database: Some are making up to 4 or 5 queries
each. Should this give me any cause for concern?
I've only ever been unable to connect to the database once (other than
through script erro
I thought that session variables (unless set to cookie as well) WERE
destroyed at the end of a session? As in when the user closes the browser?
Hrms. Maybe not.
Anyway, don't know about when the window is closed, but you could have a
log-out page that uses session_destroy();
James.
> I woul
Hi guys,
I'd like to restrict the characters a client is inputting to a database.
I already have a system that'll exclude certain characters. Alpha Numerics
are permitted, together with the underscore and spaces. Is there a
collective expression for the following characters? :
!",.?@()
Becau
If each of the scrolling lines is separated by something regular, like a
carriage return, or a line break, tab (etc), you could use explode(); and
have the values returned as an array.
James.
> I have a form that contains a scrolling text box. When I display the
> contents of the text box, say
I really wouldn't ask this if I wasn't completely exausted, but the last
thing I feel like doing just now is reading up on this when someone can
probably answer it in a matter of seconds.
OK, I've an error handling page. Basically, I want to split (that might
even be one of the functions I'l
> make the login field BINARY.
Thanks! ;)
James.
--
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]
Hi Guys,
Just a quick question. If I have a user database, with joe_bloggs as a
user, what would I need to do to make sure that his login details matched
the case sensitivity in a MySQL database? Say if he logged in as
JOE_BLOGGS, could I return an error? I'm guessing this is going to turn
int
Hrms. Got a small problem.
I'm now using functions on a regular basis, but I've come to another
sticking point with them: returning multiple variables from the function...
Here's a really quick example (nothing to do with what I intend to use the
functions for):
function CUP ($connection,$use
> Your momma pays full commission!
>
> (sorry, couldn't resist)
It's OK, I get referral fees :)
--
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 PRO
> > Whatever, James.
>
> Also, consider this word :
>
> sue
>
> As well as :
>
> defamation of character
>
> And also :
>
> Libel and Slander
>
> And lastly :
>
> Spoof
>
> All should be considered before posting anything anywhere. Especially a
> public mailing list. It's impor
I've no idea what's wrong with this, and I'm a little tired to try and look
into it, but omit any username / password / server info from anything you
post anywhere that's accessible publicly! ;)
James.
""Marisol Díaz E."" <[EMAIL PROTECTED]> wrote in message
008301c09225$4ce07e80$[EMAIL PROTECTE
> > In addition,
> >
> > (if using .htaccess) They would only be able to read the .htpasswd from
> > public directory if they had first authorised themselves. The browser
will
> > prompt them to identify before it allows files from a protected
directory to
> > be included.
> >
>
> James,
>
> are
// Index.php file.
// Page header
// Page footer
... Difficult to tell what's going wrong with just a url.
James.
> I thought you can pass variables in PHP as in CGI.
>
> http://www.xy.com/index.php?contents=HOME
>
> contents should be available as variable, but it does not seem to work.
Many hackers now go about their business to notify (or even test)
administrators whether or not they've been up to no good. It's possible
that you've mis-construed what he was up to.
Nevertheless, your complaints should really go to the correct authorities
(your server, the "hacker" and if neces
In addition,
(if using .htaccess) They would only be able to read the .htpasswd from
public directory if they had first authorised themselves. The browser will
prompt them to identify before it allows files from a protected directory to
be included.
J.
> Make sure that the .htpasswd file is BE
Make sure that the .htpasswd file is BELOW the public files root. That way,
it can't be accessed through a browser, unless the person who has written
the file to try and read the .htpasswd has uploaded their file to the server
it resides on, and has permission to access that low level directory.
If someone's updating a form, and I want their last settings to appear in a
the correct radio button, I use this:
>
>
So, on a form with a Radio button asking which you prefer, the one that
they've voted for before is the default button to be checked.
Oh, and I know that's probably messy :)
If
> Oops, I forgot to mention the most important part...
> I need to get the MIME-type (or something that can identify the
> file-extension) from a file ALREADY on the server, not posted through a
> form.
> I.e. How do I get the MIME-type of "tobias.zip" in my folder?
>
> I already know how to get t
You're missing something simple, I think.
/* Use these variables in each of the pages you need them, or stick them in
a config include */
$files_above_root = "/home/pages/www";
$files_below_root = "/home/pages";
/* reference includes similar to this method */
include("$files_above_root/somethin
Yes:
Assuming that then input variable for the file is "file":
like:
The returned results would be:
$file = the name of the temporary file on the server.
$file_name = The actual name of the file uploaded (ie pic.jpg)
$file_size = the size of the file, in bytes.
$file_type = the MIME type (y
look up eregi_replace and preg_replace
www.php.net/quickref.php
Gotta run
J
"Jason Bryner" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> I'm making a small script that imports HTML pages and I need to do
> some string replacement. I need to replace add a u
Hi Guys,
Just a quick question. I've been using an sql query like this (using
wildcards):
$sql = "SELECT * FROM table WHERE
$search_criteria LIKE '%$search_input%' ORDER by $search_criteria
ASC";
At the moment, if the search criteria was "First_Name" and the text
($search_criteria) was
This is a good one:
http://www.zend.com/zend/tut/authentication.php
James.
> there was a really good .htaccess tutorial posted to the list a while
> back...anyone remember the address?
>
> ~kurth
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTE
Hi all. This is, what might turn out to be a stupid question But I'll
ask it anyway ;)
Is there any way of automating tasks in php scripts, WITHOUT having them
open? Ie, having some method or other to send out an email automatically,
once a week, as a newsletter, based on data / criteria f
Hi Guys,
Quick question.. I've managed to write a function (thanks to help from
people earlier in the week) which queries an admin table.
There are currently four fields in the table; id, username, password, and
'site', where the 'site' means a subdirectory of my site that the particular
a
I believe http://www.f2s.com allow you to use PHP and provide you with a
MySQL database.
James.
> Can anyone receommend free MySQL hosting with PHP. Or if you can find such
a
> hosting on NT, that would be nice.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAI
In addition to what's been mentioned, check out the :
readfile, fread and fgets functions...
James.
--
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: [EMAI
Hey guys. Can I firstly say, thanks to all of you who helped me out with my
last question about importing MS Access databases into MySQL... It helped
tons!
However, I have another question.
Firstly, I've strayed away from writing many of my own functions, because
they give me the fear. But th
Hi there all,
Very dumb question I just read one of the quickref functions, and the
in-built function is referenced as being :
void function(integer);
What does the void mean? And how would I use the function? I just get a
parse error when I use the function with the "void" in it and the
Hey all,
I heard somewhere (I think) that it's possible to import a Microsoft Access
file (when saved as a delimited text file) into a MySQL table Just
wondering whether or not this is true, and if it is, where I might find a
tutorial / some literature on how I might go about doing it.
Than
Hey all. well, here's (probably) an easy question from me again (surprise
surprise).
Here goes: I'm putting together a photo gallery for some friends of mine
who own a nightclub, and who want to update photos themselves. I know
there are scripts available to do the job, but I'd like to
> And I have one more question, what is the meaning of 'or'?
> e.g.
> $db=mysql_connect("localhost","root","password") or die ("could not
> connect");
One more thing, which is important to me as a newbie (as I most certainly
am), you can make a custom error message for the die error; which is
imp
Have a look at the base64_encode / decode stuff. I stumbled across an
example there just this afternoon.
It's available in the user contributed notes of the Quick Reference section
for those functions at http://www.php.net
James.
""Jason Jacobs"" <[EMAIL PROTECTED]> wrote in message
011501c0
> > Ah, so you can constantiate (right word?) the query?
>
> I don't know what you mean by 'constantiate', but glad to hear it worked
It did, thank you ;)
Someone pointed out where I'd gone wrong with the word privately:
>> Ah, so you can constantiate (right word?) the query?
> concatenate :)
""Johannes Janson"" <[EMAIL PROTECTED]> wrote in message
93vs9u$osj$[EMAIL PROTECTED]">news:93vs9u$osj$[EMAIL PROTECTED]...
> try this:
> $sql = "SELECT * FROM table
> WHERE town LIKE '%$search_data%' ";
>
> if ($reference != "")
> $sql .= "OR whatever";
Ah, so you can constantiate (right w
OK, I got a simple search page working (thanks to all of you who helped me).
Another simple question for you. If I had a search and the data to be
searched needs to be determined by check boxes, How would I write the sql>?
Like this?
$sql = "SELECT * FROM table
WHERE town LIKE '%$search_data
> Here are some queries of the above table with their results
> bases='Ft. Worth' returns record 1
> bases LIKE '%Worth%' returns record 1
> bases LIKE '%Ft.%' returns 1 & 2
> bases LIKE '%' returns all records (in this case, 1 & 2)
>
> See?
That makes perfect sense. Thank you!
--
PHP Ge
Sweet! Thanks ;)
> > I'd like to strip out everything but the link name, so if someone
inputs:
> >
> > http://www.php.net">PHP!
> >
> > It replaces it with:
> >
> > PHP!
> >
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional com
> You've basically got it... the advantage of LIKE is that you can add
> wildcards to specify what can be different...
>
> towns = '$town'
> ...and...
> towns LIKE '$town'
>
> ...are essentially the same without the % wildcard character. Thus,
>
> towns = '$town'
> ...is much different than...
> t
I'd like to be able to trim out some html tags, but only certain ones. I've
used eregi_replace before and have some replacements running on some
scripts...
Some of the help pages and user notes on the quick reference functions have
given me good examples of how to go about it. One thing I'm int
Can anyone tell me what I would use to query a MySQL database in a search?
If the search field, was for example, a variable like "town", would the
results page use something like this? :
$sql = " SELECT * FROM table_name
WHERE towns = \"$town\" ";
I remember seeing someone post somethin
> Then you must 'get' the global variables (like $name):
>
> $name = "mOrP";
>
> function print_name()
> {
> global $name;
> echo $name;
> }
>
> print_name();
>
>
> But it's better to work with the function arguments:
>
> $name = "mOrP"
>
> function print_name($name_arg)
> {
> echo $name_arg;
> }
OK, this will be laughably easy for you guys.
I want to write a function (until now, I have been heavily repeating code,
but it's time to trim everything down.)
The function basically needs to check that username and password have been
entered, and then check them against mysql data. All I am u
80 matches
Mail list logo