 |
 |
Index ‹ php-general
|
- Previous
- 1
- About the longest thread ever posted in a newsgroupHey everybody, let's make the longest newsgroup thread ever made.
Find the posting "Any girls?" in this newsgroup and add a posting. The name
of the thread is a great name for a programming newsgroup, but i wish the
content was better than it currently is, so write some good stuff!! and
let's make a record. The thread is already really long.
Nick
- 2
- php 4.3.8 image manipulation helpI'm trying to copy a jpg binary file stored as a blob in a mysql database to
an html document inside an img tag so I can place the jpg file anywhere on
the html page I choose. I can copy the binary file from the database and
send it to the browser using the code:
<?php
include("dataconnect.php"); // database connection routine
$DB = "main";
$SQL = "select body, itype from pictures where username='$username'"; //
blob file is stored in column 'body'. itype is image/gif
$result = mysql_db_query($DB,$SQL,$dblink);
while($row = mysql_fetch_object($result))
{
$itype = $row->itype;
Header("Content-type: $itype");
$body = $row->body;
echo $body;
flush();
}
?>
This of course sends the file to the browser, not in an IMG tag, and I can
send only one picture per browser page.
Any help is appreciated.
- 2
- #40891 [NEW]: mysqli_stmt_bind_param should accept array of parameters to bindFrom: john dot navratil at sbcglobal dot net
Operating system: Fedora Core 5
PHP version: 5.2.1
PHP Bug Type: Feature/Change Request
Bug description: mysqli_stmt_bind_param should accept array of parameters to bind
Description:
------------
I've read bug #31096 and this is a variant of the same bug, but I beseech
you to reconsider.
The C API to mysql defines my_bool mysql_stmt_bind_param(MYSQL_STMT *stmt,
MYSQL_BIND *bind) to accept an array of parameters to bind to a prepared
statement. PHP 5.2.1 does not and requires the number of parameters to
match both the number of characters in the type string (essentially an
array of types) and the number of parameters in the prepared statement.
This works well for static statements but makes dynamic statements
impossible to prepare unless one resorts to something like:
$arr = <array-of-values-to-be-bound>
array_unshift($arr, $typeString);
call_user_func_array(array(& $mysqli, "stmt_bind_param"), $arr);
array_shift($arr);
One can argue that this is sufficient (a point which I will concede), but
the beauty of PHP is not in its sufficiency (machine code is sufficient,
ultimately) but in its expressivity. The foregoing is not very expressive,
is tightly bound to the mysqli_stmt_bind_result signature, and does not
mirror the underlying API (which is another PHP strong point).
Would you please consider a variant which accepts two arguments with the
second being an array of values to bind to the prepared statement?
Thanks!
--
Edit bug report at http://bugs.php.net/?id=40891&edit=1
--
Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=40891&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=40891&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=40891&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=40891&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=40891&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=40891&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=40891&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=40891&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=40891&r=support
Expected behavior: http://bugs.php.net/fix.php?id=40891&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=40891&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=40891&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=40891&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=40891&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=40891&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=40891&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=40891&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=40891&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=40891&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=40891&r=mysqlcfg
- 5
- MDB2 simple testMark,
this is my main_includes.php file :
<?php
$path = 'pear';
set_include_path(get_include_path() . PATH_SEPARATOR . $path);
require_once "Structures/DataGrid.php";
require_once 'MDB2.php';
?>
and in my file where i try to use MDB2.php, it's included like that :
<?php
include_once('includes/main_include.php');
?>
at the beginning of my file before all META
Articles table exists in my database, i've checked also if i did not make
some mistakes in the user name, password or dbnane in my dsn,
but as i do not have any error raised from the database connection. I guess
that everything is correct.
Al.
On 11/11/06, Mark Wiesemann <email***@***.com> wrote:
>
> Alain Roger wrote:
> > I have a main_includes.php which include_once/require_once all needed
> > things like
> > MDB2.php or setpath for /pear folder
>
> Okay, but remember that the PEAR dir needs to in the include_path.
> Otherwise, e.g. MDB2 won't find its own files and might not work as
> expected.
>
> > Anyway, you are right.
> > issue is on the Query command.
> > Here is the error message :
> > MDB2 Error: unknown error
> > _doQuery: [Error message: Could not execute statement] [Last executed
> > query: SELECT * FROM articles]
> > but it does not help me so much this error.
>
> Is this the output of getMessage() and getDebugInfo(). If it isn't,
> getDebugInfo() should give you more information.
>
> Anyway: Does the articles table exist in your database?
>
> Regards,
> Mark
>
- 5
- OT : ads on phpclasses.org"Manuel Lemos" <email***@***.com> wrote...
: Maybe that is a better idea as it would only require few lines of code.
: I am just finishing caching the content of some not ye cached pages to
: reduce the overload caused by many simultaneous users, including search
: engine crawlers, and later I can remove the background as I agree that
: probably nobody will miss it, as you said.
Manuel, don't get me wrong: I love your site. I visit it several times a
week. I'm also a user who will click a sponsored link if it looks
interesting (for example: a new O'Reilly book, a php IDE, ...).
I don't even care that I have to register to be able to view the classes. I
guess in the long run you are planning to add more personalized features.
(Like being able to see which classes I've already downloaded?). The only
thing that really bugs me is that when I'm trying to view something, I'm
being put in a "we'll be right back after the break"-situation. That kind of
advertising belongs on prime time tv, IMO.
.soma
- 6
- Simple guestbook? Still getting a errorHi again
First of all, thanks for all the reply on my post, it have been great
help. But it still does not work.
I get the error:
You have an error in your SQL syntax. Check the manual that corresponds
to your MySQL server version for the right syntax to use near '())' at
line 1
--- gboook.php ---
<?php
if($_POST['submit'])
{
$db = mysql_connect('localhost','user','pass')
or die(mysql_errno().' : '.mysql_error());
mysql_select_db('database')
or die(mysql_errno().' : '.mysql_error());
/*
* Check POST variables exist using isset().
* If they do, then trim leading and trailing whitespace using trim().
* If not, set to empty string, i.e. ""
*/
$name = isset($_POST["name"]) ? trim($_POST["name"]) : "";
$country = isset($_POST["country"]) ? trim($_POST["country"]) : "";
$website = isset($_POST["website"]) ? trim($_POST["website"]) : "";
$message = isset($_POST["message"]) ? trim($_POST["message"]) : "";
/*
* Now perform MySQL query, making sure all string variables are
* pre-processed with mysql_real_escape_string()
*/
mysql_query("INSERT INTO guestbook "
. "(name, country, website, message, date) "
. "VALUES ("
. "'" . mysql_real_escape_string($name) . "', "
. "'" . mysql_real_escape_string($country) . "', "
. "'" . mysql_real_escape_string($website) . "', "
. "'" . mysql_real_escape_string($message) . "', "
. "DATE())")
or die(mysql_error());
}
?>
Oli Filth wrote:
> Sebastian walker wrote:
>
>> Oli Filth wrote:
>>
>>> You're missing a closing bracket in the MySQL query string.
>>>
>> could you please explain with code example, i'm a little bit newbie
>
>
> Your query string should be:
>
> INSERT INTO guestbook (name, country, website, message, date)
> VALUES
> ('$_POST[name]','$_POST[country]','$_POST[website]','$_POST[message]',DATE())
>
>
> Note the extra bracket at the end.
>
> Also, you should never put $_POST variables directly into the MySQL string.
>
> Firstly, there's a chance that something screwed up when the HTML form
> was sent, and some POST variables don't get set. In this case, your PHP
> script would crash out with an error. To remedy this, use isset().
>
> Secondly, and more importantly, the POST variables could contain
> reserved characters, which would cause MySQL to give an error.
> Alternatively, a malicious user could send strings which would do bad
> things to your database (this is called "SQL injection"). Imagine they'd
> written their message as so:
>
> ', DATE()); DELETE FROM guestbook; ... etc ...
>
> Clearly you'd lose everything in your guestbook table. To prevent this,
> use mysql_real_escape_string(), which converts quotes and other
> characters to special escape sequences.
>
> So, a more robust version of this bit of your PHP code would be (untested):
>
> ====== START PHP CODE ======
>
> /*
> * Check POST variables exist using isset().
> * If they do, then trim leading and trailing whitespace using trim().
> * If not, set to empty string, i.e. ""
> */
> $name = isset($_POST["name"]) ? trim($_POST["name"]) : "";
> $country = isset($_POST["country"]) ? trim($_POST["country"]) : "";
> $website = isset($_POST["website"]) ? trim($_POST["website"]) : "";
> $message = isset($_POST["message"]) ? trim($_POST["message"]) : "";
>
> /*
> * Now perform MySQL query, making sure all string variables are
> * pre-processed with mysql_real_escape_string()
> */
> mysql_query("INSERT INTO guestbook "
> . "(name, country, website, message, date) "
> . "VALUES ("
> . "'" . mysql_real_escape_string($name) . "', "
> . "'" . mysql_real_escape_string($country) . "', "
> . "'" . mysql_real_escape_string($website) . "', "
> . "'" . mysql_real_escape_string($message) . "', "
> . "DATE())")
> or die(mysql_error());
>
> ======= END PHP CODE =======
>
> Obviously, you may want to do some further checking on the values of
> $name, $country, etc. to make sure they're sensible. But at least
> there's no chance that a malicious user could do naughty things now.
>
- 6
- EZ array problem - What's wrong with my brain?var_dump() gives me this:
array(1) {
["1.2"]=>
array(2) {
["code"]=>
array(1) {
[0]=>
string(3) "111"
}
["status"]=>
array(1) {
[0]=>
string(3) "new"
}
}
}
I'm trying to set a variable to that "1.2". Shouldn't I be able to
get it with $var = $arr[0][0]?
- 7
- constants, define() and defined()I have problems with using constants, which should be persistent across
pages (superglobals). I've built two pages for testing:
testConst_1: contains a form in which I can set the constant - or omit to do
so; Next comes an echo statement to check the value within this page. And a
link to the 2nd page
testConst_1: cheks if the constant is defined and echoes accordingly
It fails however to work. The 2nd page always reports as if the constant
wasn't defined. What am I missing ?
testConst_1:
<html>
<body>
<?
if(!isset($_POST["send"])){
ECHO "<form method='POST' action='testConst_1.php'>";
ECHO "<input type='submit' value='Send' name='send'></form>";}
else {
define("A_CONST","SAT");}
ECHO A_CONST."<BR>";
?>
<a href="testConst_2.php">page 2</a>
</body>
</html>
testConst_2
<html>
<body>
<?
if (defined("A_CONST")) {
ECHO "SAT";}
else {
ECHO "NOT SAT";}
?>
<BR><a href="testConst_1.php">page 1</a>
</body>
</html>
- 7
- Posting to multiple formsI am trying to post to a form that is located on an external site (not
my own). This works fine.
What I want to do is to log or record the data that is submitted
before it is posted to the external site. Any ideas on how to do this?
- 14
- Send Pics to Cell PhonesMy newest site can be seen here
http://www.picmonkey.com
CLick on a pic on the front page, and you will see the pic in full
size. You will see a box with HTML code, and underneath the box you
will see three boxes.
One says send to email. This is working fine, but when I try to send
to an email address belonging to a cell phone, it will not work. When
i try to send a pic from GMAIL to a cell phone. It works fine. I know
this is possible, it has something to do with the headers, etc. There
are two files involved. If anyone can help me out, please let me know.
If you need to see some code, I will show it to you. But i have a
feeling this is just a line somewhere that I am not doing right. What
makes sending a pic to a cell phone differnt from a regular email?
- 14
- Strange IF behaviour$nst is definitely set to 4, as the echo $nst; gives 4.
However, with:
echo $nst;
echo "<br>";
if ($nst= 1) {
$fulls = "Full status for 1";
} elseif ($nst = 2) {
$fulls = "Full status for 2";
} elseif ($nst= 4) {
$fulls = "Full status for 4";
}
echo "Status: " . $fulls;
$fulls is *always* the first one "Full status for 1", even when $nst is 4.
What am I doing wrong?
Thanks,
Ben
- 14
- Re[2]: [PHP] Control Structure problemHi,
Wednesday, September 17, 2003, 11:47:45 AM, you wrote:
EL> On Wed, Sep 17, 2003 at 12:49:03AM +0000, Curt Zirzow wrote:
EL> :
EL> : switch ($var) {
EL> : case 'TEST-1': case 'TEST-2': case 'TEST-2':
EL> : do something
EL> : }
EL> The switch statement doesn't do an equivalency test, does it? So while
EL> this switch statement can be rewritten as:
EL> if (($var == 'TEST-1') || ($var == 'TEST-1') || ($var == 'TEST-1'))
EL> {
EL> do something
EL> }
EL> it doesn't do:
EL> if (($var === 'TEST-1') || ($var === 'TEST-1') || ($var === 'TEST-1'))
EL> {
EL> do something
EL> }
You can do it this way I think :)
switch (true) {
case ($var === 'TEST-1')?true:false:
case ($var === 'TEST-2')?true:false:
case ($var === 'TEST-2')?true:false:
do something
}
--
regards,
Tom
- 16
- Current month changeHello,
Total n00b here who needs help. I have a list of weblog (blog) entries in a
database which are being retrieved by index.php with a string of $mid=9
where'9' is the current month. Is there a way of automatically retrieving
the entries depending on what month we are in, so that when users go to my
website they automatically see the current months entries which
automatically changes as the month changes?
Many thanks.
sipz
- 16
- Mulitple Table Query HelpI'm not sure the follow multiple table query is the right way to do
what I need to do although it seems to be working:
$php_SQL = "SELECT * ".
"FROM basics, personal, photos ".
"WHERE basics.member_name = personal.member_name ".
"AND basics.member_name = photos.member_name ".
"AND basics.account_creation_date >= DATE_SUB(NOW(),
INTERVAL 30 DAY)";
I primarily need to return a resultset for all member_names (they are
index key and unique) filtered for the last 30 days on the
basics.account_creation_date - this 30 day thing is working fine.
I need to access various other table fields and display this data on
the web page - member_name is the common key for all tables - this all
seems to be working fine as I have 8 test records and can manually
track and see that it is working - the problem is that I need to add a
4th table and in doing so, the resultset breaks and returns just one
record - I am adding an online table with a field called is_online
which is set to 'yes' if the member is online but the following query
returns just the one record of the online member:
$php_SQL = "SELECT * ".
"FROM basics, personal, photos, online ".
"WHERE basics.member_name = personal.member_name ".
"AND basics.member_name = photos.member_name ".
"AND basics.member_name = online.member_name ".
"AND basics.account_creation_date >= DATE_SUB(NOW(),
INTERVAL 30 DAY)";
It seems to me this should be an easy thing to just add the 4th table
but since this breaks the query now I'm wondering if this query
structure is even built right?
Any help would be greatly appreciated...
- 16
- Q: Algorithm/Solution for finding words in non delimited stringI'd like to be able to take a string and search within it for all words
(of the longest length possible) that are possibly contained within it
(in sequence, we're not re-ordering the letters in the string).
Obviously the brute force approach (which may be the only solution) is
to iterate through a dictionary file searching for occurances of each
entry within the string.
If anyone has done anything similar to this, were there any other
methods used to reduce the number of iterations required like using a
list of common words that are not generally elements of other words
that can be quickly broken out from the string? Or are there libraries
that may be of use in efficiently processing this type of search?
e.g. given the string "themeether", possible solutions might be
{'the','meet','her'} or {'theme','ether'}
|
| Author |
Message |
ceo

|
Posted: 2007-5-8 7:22:20 |
Top |
php-general, [PHP] PHP4 and SQLite
On Mon, May 7, 2007 5:29 pm, Suhas Pharkute wrote:
> Can someone please point me to a tutorial for PHP4.x.x and SQLite
> installation on Windows with Apache web server?
>
> I searched in Google and PHP mailing list but nothing useful. It seems
> like
> I am missing php_pdo.dll for 4.1.1 version.
First, make sure PDO was available for 4.1.1 at:
http://php.net/pdo
Even if it *was* it may not have made it into the Windows version...
Upgrade?
The instructions mostly consist of "find the php_pdo.dll" in your zip
file and "put it in the right place" where http://php.net/phpinfo says
is your extension_dir
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?
|
| |
|
| |
 |
psuhas

|
Posted: 2007-5-8 9:44:00 |
Top |
php-general >> [PHP] PHP4 and SQLite
Yep, PDO was one more question that I had and could not find dll for it.
Upgrade is an option but there are some custom dlls that we developed for
4.1.1 and do not want to spend time in checking it for higher version. But
if it is not possible then I guess we will do that
Thx
SUhas
On 5/7/07, Richard Lynch <email***@***.com> wrote:
>
> On Mon, May 7, 2007 5:29 pm, Suhas Pharkute wrote:
> > Can someone please point me to a tutorial for PHP4.x.x and SQLite
> > installation on Windows with Apache web server?
> >
> > I searched in Google and PHP mailing list but nothing useful. It seems
> > like
> > I am missing php_pdo.dll for 4.1.1 version.
>
> First, make sure PDO was available for 4.1.1 at:
> http://php.net/pdo
>
> Even if it *was* it may not have made it into the Windows version...
>
> Upgrade?
>
> The instructions mostly consist of "find the php_pdo.dll" in your zip
> file and "put it in the right place" where http://php.net/phpinfo says
> is your extension_dir
>
> --
> Some people have a "gift" link here.
> Know what I want?
> I want you to buy a CD from some indie artist.
> http://cdbaby.com/browse/from/lynch
> Yeah, I get a buck. So?
>
>
|
| |
|
| |
 |
| |
 |
Index ‹ php-general |
- Next
- 1
- need tutorial and good siteI Need Update one table of a company
This system is all in Excel with table of
clients and prices of products.
I like to develop a site with database in a language php-sql,
however i need a tutorial and site for learn it.
- 2
- SoapServer::setPersistenceHi there,
Has anyone run into the problem of persistence not working when using
classes & SOAP server lately?
There was a thread last year with the same issue:
http://groups.google.com.au/group/comp.lang.php/browse_thread/thread/5df2e0e714b207f5/78d16d5e7bf4b8c5?hl=en#78d16d5e7bf4b8c5
The suggestion was to use SoapServer::setPersistence. I have tried that
but still can't pass objects between functions in the class (only
objects that were created in the __constructor are availble across the
functions). The class works perfectly when not plugged into a
SoapServer
I am using PHP 5.1.6 (didn't work on 5.1.4 either) on a Windows 2003
environment.
Are there any known isues with this?
Thanks
- 3
- #45505 [Opn->Bgs]: DirectoryIterator default sorting error ID: 45505
Updated by: email***@***.com
Reported By: jcknight at gmail dot com
-Status: Open
+Status: Bogus
Bug Type: SPL related
Operating System: Linux
PHP Version: 5.2.6
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php
There is no sorting guaranteed and the files are returned in the order
the operating system provides.
Previous Comments:
------------------------------------------------------------------------
[2008-07-13 23:25:25] jcknight at gmail dot com
Description:
------------
The DirectoryIterator class does not iterate the directory how it is
organized on the file system.
Reproduce code:
---------------
<?php
$dir = new DirectoryIterator(".");
foreach($dir as $file) {
echo $file->current() ."\n";
}
?>
Expected result:
----------------
.
..
enter_L.gif
enter_R.gif
mad_L.gif
mad_R.gif
Actual result:
--------------
.
..
enter_L.gif
mad_L.gif
enter_R.gif
mad_R.gif
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=45505&edit=1
- 4
- [PHP] Problems processing UNIX timestamps in events directoryDave Goodchild wrote:
> I have converted the user-friendly date output to timestamps to check and
> sure enough, when the user selects a start date before March 26 2007,
> March
> 26 2007 is output as:
>
> 1174863600
>
> ...after that it becomes:
>
> 1174860000
>
> ...a difference of 3600
>
> Is this anything to do with leap seconds or any other clock drift
> phenomenon
> anyone has seen before? Much hair being torn out at present!
>
That certainly looks like the end of DST (daylight saving time).
HTH,
Arpad
- 5
- if else VS switchHi,
The behavior between if else and switch is not different in PHP.
However is there difference for the performance (I know in C it's
different) while interpreting the script?
Thanks in advance
Don
- 6
- 7
- php mail() not sending to mail Clients (ie, Outlook, Apple Mail, thunderbird, etc..)I have a send mail script on my site that.
The emails are recieved by gmail, and yahoo, but not to mail clients
like Outlook, Mail, etc...)
Is this a problem with the script, or is it something I must change in
php ini file?
Thanks in advance for any help.
here is the code. (im using it in conjunction with javascript for some
AJAX stuff)
if(!isset($_GET['action']))
{
die("You must not access this page directly!"); //Just to stop people
from visiting contact.php normally
}
/* Now lets trim up the input before sending it */
$name = trim($_GET['name']); //The senders name
$to = trim($_GET['maily']); //The senders email address
$place = trim($_GET['place']); //The senders email address
$subject = "you have recieved mail";
$headers = "From:$name";
$message = "{$name} deemed you worthy of receiving the following
information/exchange from Trumpet.\n\n Follow This Link {$place}";
mail($to, $subject, $message,$headers); //a very simple send
echo 'contactarea|<p class="sent">Article Sent!</p>'; //now lets
update the "contactarea" div on the contact.html page. The
contactarea| tell's the javascript which div to update.
?>
- 8
- validating data from formsI have a set of function that work beautifully the first time that the form
is processed, but the second time that I hit the submit button if any field
contains data the form by passes all of my carefully planned validation and
dumps the data into the DB.
Have to tell you this is very disconcerting. I Have Been working with this
for a couple of days now. And...
Can you take a look at my logic and tell me if I over looked anything
obvious?
I should clue you in to what I am attempting to do.
Nothing complicated, I just make several function calls and if their is
output from the calls then I have an error somewhere.
It should call my JS window.location function to redirect to the same page
so that they can make corrections.
However, for some reason the validation functions do exactly what they are
supposed to do the first time around, but like I said above, the second time
if any fields are loaded with data it completely by passes my validation
proceedures. :-(
code:
--------------------------------------
// looking at some function calls here, nothing special...
if ($userNameErr = userNameCheck(trimWhiteSpace($_POST['username']))){
$_SESSION['SES_userNameErr'] = $userNameErr;
}
if($userPassErr = userPassCheck(trimWhiteSpace($_POST['pass']),
trimWhiteSpace($_POST['pass2']))){
$_SESSION['SES_userPassErr'] = $userPassErr;
}
if($nameErr = nameCheck(trimWhiteSpace($_POST['fName']),
trimWhiteSpace($_POST['lName']))){
$_SESSION['SES_nameErr'] = $nameErr;
}
if($passHintErr = passHintCheck(trimWhiteSpace($_POST['passHint']))){
$_SESSION['SES_passHintErr'] = $passHintErr;
}
if($emailErr = emailCheck(trimWhiteSpace($_POST['email']))){
$_SESSION['SES_emailErr'] = $emailErr;
}
// my err check statement that only works on the first pass
if($emailErr | $passHintErr | $nameErr | $userPassErr | $userNameErr){
?>
<script language="javascript">
window.location = "register.php";
</script>
<?php
}else{
//
****************************************************************************
**************
//
// here we encrypt the password and add slashes if needed
//
//
****************************************************************************
**************
$_POST['pass'] = md5($_POST['pass']);
if (!get_magic_quotes_gpc()) {
$_POST['pass'] = addslashes($_POST['pass']);
$_POST['username'] = addslashes($_POST['username']);
$_POST['fName'] = addslashes($_POST['fName']);
$_POST['lName'] = addslashes($_POST['lName']);
$_POST['passHint'] = addslashes($_POST['passHint']);
$_POST['email'] = addslashes($_POST['email']);
}
//
****************************************************************************
**************
//
//if there are no errors in data validation load the data into the database
// now we insert it into the database
//
//
****************************************************************************
**************
$insert = "INSERT INTO user (username, password, fName, lName, passHint,
email, bMonth)
VALUES ('".$_POST['username']."',
'".$_POST['pass']."','".$_POST['fName']."','".$_POST['lName']."','".$_POST['
passHint']."','".$_POST['email']."','".$_POST['bMonth']."')";
$add_member = mysql_query($insert);
?>
<p>Thank you, <?php $fName = $_POST['fName']; $lName = $_POST['lName'];
print "$fName $lName" ?> you have registered - you may now <a
href="login.php">login</a>.</p>
<?php
}// end if error
insight would be greatly appreciated
thank you
Kevin
- 9
- Global variables"Charles O'Flynn" <email***@***.com> wrote in message
news:email***@***.com...
|
| "Oli Filth" <email***@***.com> wrote in message
| news:fEiSg.32264$email***@***.com...
|| Jerry Stuckle said the following on 26/09/2006 22:07:
|| > Charles O'Flynn wrote:
|| >> Thanks for the quick reply, Johnny, but I've been looking at the page
| you
|| >> refer to all afternoon and it doesn't seem to work for me. For
| instance,
|| >> (and I'm only illustrating the specific problem I seem to have
|| >> hereunder)...
|| >> ------------------------------------
|| >> $variable;
|| >>
|| >> function printsomething()
|| >> {
|| >> global $variable;
|| >>
|| >> $variable = 'Test'.<b />;
|| >> echo $variable;
|| >> }
|| >>
|| >> printsomething();
|| >> echo $variable;
|| >> ------------------------------------
|| >>
|| >> ...only prints one line of 'Test' - I'd have thought it should print
|| >> out two
|| >> copies. BTW, I'm running under PHP 4.1.2 (and it's not mine to
|| >> change/upgrade!)
|| >
|| > You're close. But you have to use the global keyword in the global
|| > context, also. Not just in the function.
||
|| Umm, no you don't!
||
|
http://uk.php.net/manual/en/language.variables.scope.php#language.variables.scope.global
||
|| >
|| > global $variable;
|| >
|| > function printsomething()
|| > {
|| > global $variable;
|| >
|| > $variable = 'Test'.<b />;
|| > echo $variable;
|| > }
|| >
|| > printsomething();
|| > echo $variable;
|| >
||
||
|| --
|| Oli
|
|
| Thanks, Oli
| I'm getting the feeling, (although noone's spelling it out either here or
in
| any of the myriad books I've looked at for inspiration), that declaring a
| variable as global inside a function will make it accessible outside the
| function at the global scope; in other words, what I've done above is
| declare two independent variables, the one outside the function
over-riding
| the effect of the one inside the function.. OK - I can test this very
| quickly. But if so, how on earth do I get to access it within another
| function, or does this automatically make it visible everywhere?
| Of course, I could store the data within MySQL, thereby making it
| persistent, but this seems like overkill. How does PHP make variables
| accessible with 'real' global scope, not just 'global, except inside
| functions', which for an old 'C' programmer like me, is not global at all?
| I know, in theory about superglobals but again, this seems like overkill.
| Or am I being silly?
| Thanks,
| Charles
|
Problem now solved (from the point of view of this specific query). Thanks
to Oli, Norm and Johnny for taking the trouble to reply.
Regards,
Charles
- 10
- Testing PHP and MySQLHello,
I'm working in FC8 and I like to use MySQL with PHP.
I have installed:
[gastonv@telenetPC ~]$ yum list installed | grep php
php.i386 5.2.4-3 installed
php-cli.i386 5.2.4-3 installed
php-common.i386 5.2.4-3 installed
[gastonv@telenetPC ~]$ yum list installed | grep mysql
mysql.i386 5.0.45-6.fc8 installed
mysql-libs.i386 5.0.45-6.fc8 installed
mysql-server.i386 5.0.45-6.fc8 installed
I can run separately PHP and MySQL, but not together.
For that, I have to do first:
[gastonv@telenetPC ~]$ sudo /etc/init.d/mysqld start
Starten van MySQL: [ OK ]
[gastonv@telenetPC ~]$ sudo /etc/init.d/httpd start
Starten van httpd:
And then I can start MySQL:
[gastonv@telenetPC Mysql]$ mysql -u gastonv -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 6
Server version: 5.0.45 Source distribution
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> SHOW DATABASES;
+--------------------+
| Database |
+--------------------+
| information_schema |
| test |
+--------------------+
2 rows in set (0.06 sec)
mysql> exit
Bye
To test working together, I have done 2 tests:
1. Testing PHP with test.php with the command phpinfo():
My working directory:
[gastonv@telenetPC public_html]$ ls mysql_up.php
mysql_up.php
[gastonv@telenetPC ~]$ firefox http://localhost/~gastonv/test.php
It shows a table with PHP Information:
PHP Version 5.2.4
...
Here, I have to see a Section for MySQL, indicating that MySQL support
is On.
But I don't see that section.
2. Testing MySQL with a well known program called mysql_up.php.
My working directorie for MySQL:
[gastonv@telenetPC public_html]$ firefox
http://localhost/~gastonv/mysql_up.php
The result should be a table with a long list of variable names and values.
And I read, if no error or warning messages are displayed, MySQL is
working fine.
But Firefox opens a blanco empty white window with the correct title,
and doesn't show any error message.
Please, is this correct, or do I have to configure more?
Thanks in advance for helping tips,
Gaston Verhulst.
- 11
- execution to the end?
If a user hit stop button on his/her browser after a php has started,
will the php script be continued to the end?
--
iTech Consulting Co., Ltd.
Expert of ePOS solutions
Website: http://www.itech.com.hk (IE only)
Tel: (852)2325 3883 Fax: (852)2325 8288
- 12
- Error catchingI want a php script to report the error.
the error is generetad by mysql when inserting a duplicate entry.
Now the scripts ends and does nothing elde.
The user who wants to insert a record in database must be notified of the
excisting problem.
i want to use this on an webpage
- 13
- re:FLASH MXHey there! What do you need help for? I presume PHP sience you are i
the php forum
Regard
http://www.devplug.com
- 14
- domain name pointing to a pageMy clients would like to have their own domain name but pointing at a
webpage.
if somebody clicks www.clientsite.com
the site should point to
www.mysite.com?client=455
It is possible ? how ?
Bob
- 15
- Help please with $_FILESI have searched and have not gotten an understanding of $_FILES. I am
trying to do an upload to a directory "tmpdir" on the server. I have a
field defined as:
File name: <input name="filename" type="file" id="filename">
In my PHP code I have (with diagnostics):
echo "Will try to upload a file <br>";
echo "Tmp_Name: ".$_FILES['filename']['tmp_name']."<br>";
echo "Name: ".$_FILES['filename']['name']."<br>";
echo "Size: ".$_FILES['filename']['size']."<br>";
echo "Type: ".$_FILES['filename']['type']."<br>";
if ($_FILES['filename']['type'] == "mid/wav"){
echo "File of proper type <br>";
copy ($_FILES['filename']['tmp_name'],
"tmpdir/".$_FILES['filename']['name'])
or die ("Could not copy");
echo "";
echo "Name: ".$_FILES['filename']['name']."<br>";
echo "Size: ".$_FILES['filename']['size']."<br>";
echo "Type: ".$_FILES['filename']['type']."<br>";
echo "Copy Done....";
}
There are two problems.
1 - It doesn't enter to do the copy even though the file is a .mid file.
2 - The $_FILES['filename'] is empty.
I run the "browse" button and select that a file. Why is the $_FILES
superglobal empty?
If I comment out the "if" line and closing "}", the copy fails with a "Could
not copy", as expected since the filenames are empty.
Can someone please help me? (I have only been at this for a short while).
Shelly
|
|
|