Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    PHP




Disable Coding In Textboxes/Textfields


Is there a way to disable PHP, HTML, and the sort in textboxes and input fields? There are things called SQL Injections which are usually used in an url or input field to steal data from the database.




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Inserting Multiple Textfields Into A Db
i have a thing where u enter how many files and it makes that many textboxes for u to enter stuff each named $files[0] , $files[1] , etc i want to put them in 1 thing so like combind em all and put em in like this

$download_query = "INSERT INTO abc VALUES('$files1')";
$download_result = mysql_query($download_query);

i want all the stuff out of all the different checkboxes to go into like files1 and i like make it take all the text and put it into a variable?

Append Two Textfields Into A Third One With A Space
i dont know if its a stupid question but im so new to php you can forgive  me
well the thing is i have 3 text fields

textfield1
textfield2
textfield3

I want to add textfield 1 with textfield 2 and display it in a hidden textfield3 with a space between the text.

Textfield1(Sam) + Textfield2(Yam) = Textfield3 (Sam Yam)

Populating Dynamically Generated TextFields
If one assigns something to the value iattribute off an input /text field, that value will be displayed when the form is loaded. My problem is, when building a form dynamically, the only way I can get the text to show is by doing the above, however, as this is an update form, when the form POSTS to processUpdate.php,
both the data entered by the user AND the data in the value attribute are inserted/updated.

So, how does one dynamically build a form where the data is displayed in the text fields but value atttribute is not set. PHP Code:

Disable Cookie
I am using cookie to hide a variabe in send.php3 as following:send.php3: PHP Code:

Disable Checkbox
I have a checkbox that I set by php code to be either "checked" or "".
I want to disable the ability of the user to check or uncheck it. I
tried "readonly", but that didn't work.

Can I Disable $PHP_AUTH_PW?
Is there any way I can disable the setting of the environment variable $PHP_AUTH_PW? I'm authenticating via LDAP, and don't need (or want) the password available to PHP. I also don't need $PHP_AUTH_USER; the current authenicated user is available in $LDAP_USER.

Disable (grey Out) A Button.
Experienced programmer but new to PHP. Moreover I'm to use PHP with Xoops on
top (this adds object orientation?).

I don't seem to find a xoops Usenet group?

Whatever the case (and presumably a Xoops property): how does one disable
(grey-out) a button?

Disable Right Click In Opera
In my website there is requirement to disable rightclick.
I am providing the code and it is working in I.E ,Netscape and
Mozilla.But not working in Opera browser.
My code is
<body oncontextmenu='return false;'>
The above single line code is working very fine in the above browsers
not in Opera.

Disable Phpinfo In Php3
In PHP4 there is the posibility to disable the use of phpinfo() by putting "disable_functions = phpinfo" in the php.ini-file. Is this also possible with PHP3 (in php3.ini) or is there another way of disabling this function?

How To Disable PHPSESSID From Posting In URL
I don't want the URL to display this info. I never notcied this being displayed before but all of a sudden it seemed to pop-up. I don't host my own server so any access to the php.ini file is not possible. Any ideas out there?

How To Completely Disable Openbase_dir?
I'm using php 4.3.4 and have an intermitent problem with gallery
(gallery.sourceforge.net) regarding the open_basedir restriction in
php. The error I am getting is:
------
PHP Warning: (null)(): Failed opening
'/home/httpd/vhosts/mydom.com/httpdocs/gallery2/main.php' for inclusion
(include_path='.:/usr/share/pear') in Unknown on line 0, referer:
http://mydom.com/gallery2/main.php
------
I have disabled safemode and open_basedir in php.ini and have verified
through a phpinfo() call that they are disabled. Actually,
open_basedir is reported as being set to "no value" and safemode is
reported as disabled.

The strange thing is that this does not happen every time i access this
page. It is only 1 out of 10 times and usually it is the first time i
access the page for the day(but not always). I have restarted httpd
and the server just in case. I also checked .htaccess but it shouldnt
matter since phpinfo() says it is not set. This is baffling to me! If
I could rip this feature out I would. It was installed by default on
my dedicated server.

How To Disable Controle Keys
In my application I want to disable my controle keys to
save copying and taking screen shots of the my page.

How Do You Disable The Close (x) On A Window
I'm running a PHP script on page1.php that takes a few seconds, once it has run the page then redirects to page2.php automatically sending variables . However, if the user shuts page1.php by pressing the X on the top right of the screen, the redirect doesn't happen!! Does anyone know how to disable the X and stop the page being closed down please?? or another solution??

How Do I Unclock The URL/disable Frameset?
I have a few websites out there and set up alittle script for my friends to auto register subdomains for their affiliate sites. Problem is, some affiliate programs don't allow URL MASKING and I can not figure out HOW to disable it within the script. Could someone take a look at this and help me?

I'm trying to disable the frames in forward.php, along with whatever it gets linked to (i'm very new to this, so i included a link to whole script incase there is more then just forward.php I need to edit). Code:

Disable The Values In Address Bar??
Am trying with a social network site... i want to disable the values in address bar which are passing as string variables, My pages are included in the index page.. and my values are passing like that... by changing the values in address bar my page is changing..

How can i solve this issue... i think anyone can change my site using this address bar.. how could i prevent this???

Disable Right-click On Mouse
Is there a php script that wil disable the right-click on mouse or maybe disable the copy and paste feature of the browser?

because i have a client, wherein he wants to prevent public viewing his website from copying his website content?

Disable Download Image To Disk
Could someone please direct me to a way to preventing people from downloading images from my website.

Disable Command Line Arguments For Php-cli
i have been trying to disable the -n and -c arguments that you can use with php from the command prompt. this is because these features can effectively disable my php.ini which has a whole mess of disabled_functions (that i want to ensure remain disabled).

my best idea for going about doing this so far has been to download the source for the newest php, with hopes to compile my own which will ignore arguments other than a filename. so far the closest i have got is to the the zend_API.c which has the follow function: Code:

Disable .php Handler For A Specific Browser,
I would like to know if there is a way to remove/disable .php handler
when the request come from a specific Browser.

I ask this because I use dreamweaver / webdav to edit my .php files.
But when I try to open the .php file in dreamweaver, what I see if the
result of the .php executions, not the .php source files.

I know that you can create an Alias location "/dav", and disable the
..php handler for this location. It's a solution, but not the best I
think. It would be better if we can disable .php runtime where
dreamweaver Get the files.

Disable Magic_quotes_gpc In A .htaccess File
How do I disable magic quotes via .htaccess?

I put the following file in my webroot, but it does not disable
magic_quotes_gpc (according to phpinfo(), both the local and master value
are still "on")

<IfModule mod_php4.c>
php_value upload_max_filesize 8M
php_value magic_quotes_gpc 0
</IfModule>

The change to upload_max_filesize works (master is 2M, local value is 8M,
according to phpinfo())

Disable Backbutton - When Page Has Expired...
I have this on the page:
<?php
header("Pragma: no-cache");
header("Expires: -1");
?>

but I want it so, that when the user goes back, (s)he might not be
allowed too - say the session has expired.

How can i achive that?


Why Does PHP As Apache Module Disable PHP's Java()?
My site was suddenly running HTTP authentication and was faster.
But if this was a problem from the past, now a entire part of my site does't work because my calls i had to function Java()
now generate this output:

Fatal error: Call to a member function on a non-object
HTTP authentication(PHP as Apache module) versus Java Virtual Machine

what's the relation between them, how can i restore Java() to work properly. Is it on httpd.conf?

why does not PHP call Java extension if it is installed on Apache as a module?

Disable User From Downloading Php3 Web Page.
I would like to allow user only to view php3 page but wants to restrict him from downloading and saving on his hard disk.

Warning: Fsockopen() (how To Disable Debug Messages)
In Win32 PHP you can disable debug messages using the php.ini Can someone tell me how to do that in linux? there is no php.ini in linux Php script running on windows Php script running on linux.

Disable Safe Mode Without Loss Of Security ?
I'm trying to disable safe mode from my php installation. First
because this functionality will be removed in PHP6, and because it's
very restrictive and it's giving me headaches when configuring
frameworks and other applications. Moreover, it's said on the php
website that the safe mode solution is not a good thing... I'm looking
for a tutorial which indicates what to configure on a server in order
to have a secured installation of PHP, but without safe mode. I can't
find it...

Enable/disable Html In Form Processing
I've got a form, where it submits some info and adds it to a txt file. The file is then displayed on the front page of my site; however, there is a security problem i'd like to fix dealing with html. How would you go about disabling the use of html in a form?

PHP Script To Disable/enable Internet Access
We are finally getting DSL again...
but our PC is in the living room... and the youngest has figured out
that if he hits the right keys... he can bring up Internet Explorer.
All is fine and dandy right now, but come next week... that things
wont be so dandy.

I am setting our LInux router/server back up soon, and would like a
quick, easy way to enable and disable our internet access. What I
would like to do is have a simple PHP page that says

(iff network status = inactive)

Your Internet Access is DISABLED
Enter passcode to enable internet access

[TEXTBOX]

Then [OK]

so on clicking "OK" if password = suchandsuch then run script"
"/sbin/network start" or whatever the script is and refresh the page

then

iff network = active

Your Internet Access is ENABLED

[DISABLE]
upon clicking of "DISABLE" run script /sbin/network stop and refresh
the page

Something to that effect.

Disable Passing Arrays In Query String?
Is there any way to stop PHP from turning a query string like this: ?var[] into an array when it is read by $_GET['var']? I have quite a few input validations that are easily screwed up by this strange (and apparently undocumented???) feature...

Disable Submit Button If Text Field Is Empty
I am unsure if this must be done with Ajax, or if it can be done with PHP. I have a simple search page where I want the submit button to be disabled if there is nothing entered in the text field, and once something IS entered, then the search button is enabled.

I was thinking Ajax, because I am looking for it to be real time and I am not sure if its possible with PHP as I am just a novice when it comes to certain things. So the button is always disabled when there is nothing, and enabled when the user enters something.

And lets say the user enters something and removes it, then the button disables again? Is this possible to do with PHP and if so, could someone please help me tackle this . Code:

Pre-coding
I need some advice on feasability etc on using PHP (MySQL backend) for a little project that I have in my mind. I'm new to PHP, but not programming (thank God!) - so barring syntax, logic should be fine (I hope), but I'm unsure if PHP has the ability to do what I need (told you I was a newbie eh?? )

The project ....
Simply put, the idea is for a series of drop down boxes to kinda act as a "filter"for data in the records in a mysql db. Ie, lets say for example that my db contains info about cars, with the columns, Make, Model, CC, Colour etc etc.

Initially the user would see (in the above example), 4 drop down boxes, each with data pulled from the db relevant to their column id. The pulling of data I dont have a problem with - thats sorted. However, in the brief coding exercises I've done, its the ability to have a user choose any of the four drop boxes, and all the other 3 dropdown boxes data be ammended ? Am I explaining this well ?

Lets say that I choose 'Red' from the Colour drop down - then the drop down box for Make should change to only be Makes where colour = red, Model should also change to where colour = red etc etc etc ? With me here ?

At any point the user will have the ability to 'go' their selection - and all the records are displayed for the user. Am I wanting too much here from PHP? I've been told JScript would do what I need (better than PHP?????) but frankly I dont have the time to start learning another lang, so if this can be done in PHP I'd be happy.

Mail() Function Blocks Webpage For Nameserver Lookup ! How Can I Disable It?
When mail() function reaches a wrong email address or a down domain name (which it can not resolve it to its IP address) it blocks PHP page for a while. How can I disable this behaviour?

I was able to disable this in mail clients such as Pine by setting an option that tells "Do not make DNS lookups before ading mail to queue" . Is there anything in PHP for doing this?

Best FTP Client For Coding PHP
I currently use Eclipse for creating the PHP application, which is
great for editing but quite slow when using FTP. But when im testing i
like to use CuteFTP Pro for quicky editing and seeing the results. Im
getting fed up with CuteFTP as its really flakey.

I am looking for a simiar application like CuteFTP that has an inbuilt
editor but can not find one, every one I have looked at uses a
different application to edit.

Can anyone recomend a FTP editor that works well with quickly editing
PHP web applications?

Coding Methods
Im trying to figure out some better coding methods. Maybe you more experienced guys can help me. Right now im working on a new site which is a bit larger than i usually do. Currently i have a main Index.php file which has functions which call functions that display html (footer.php, header.php, main_table.php). And inside these include files, i have php code which call him mysql functions, etc, etc.

But after looking at for awhile, i can see some forseeable problems. What are some good coding methods that can help me code better and make it easy for me to update the code with out having to rewite everything.

Bad PHP Coding Practices?
I'm just wondering what are some bad (inefficient / resource intensive) PHP coding practices. For example, in Visual Basic string concatenation in a loop can really slow things down since a new string is created each time. Object creation has overhead and only so many objects can be created before it bogs down. Any significant problems with $a .= $a + "text" or objects in PHP? Any other bottlenecks?

Removing PHP Coding
I have php coding that is stored in mysql blobs. Now I want to index words in these blobs in an attempt to make some sort of a search engine. Example: How can I use php to make this mysql text:

"Once upon a time there were <?php echo $num_bears ?> bears in a small cage in a zoo in Russia. They had <?php echo $num_relatives ?> relatives that lived there with them."

Change into this: "Once upon a time there were bears in a small cage in a zoo in Russia. They had relatives that lived there with them."

Point is: - remove everything between and including "<?php" and "?>" I'm trying to do some indexing, and I need to remove all my php coding... :)

Coding Convention
Consider the following code (contained in a class method):

switch($sectionType)
{
case 'layout':
return $this->getLayoutSection($sectionName);
break;
case 'content':
return $this->getContentSection($sectionName);
break;
}

Obviously neither break is going to get execute, because the method will
return before it gets to them.

I have gotten into the habit of putting breaks at the end of every case in a
switch, even if it is not necessary (as the above). I have it somewhere in
the back of my head that this is the "proper" way to do things. But now
that I think about it, I have to ask, is this true? Is it consider good
practice to always end case statements with a break, even when not
necessary?

Anyone Use UltraDev For Php Coding?
I'm considering using Dreamweaver for general web design and have seen that UltraDev can be extended to use php. Has anyone had experience of this and if so, what are the good/bad features of this? In particular, I would want to create code that accesses a mysql database. I currently do all this by hand.

Is This Bad Coding Practice?
After recently coming back to php after working in asp for several
years, I want to do things well, so I'm very concerned with learning
good coding practices.

Also I'm trying to seperate logic from presentation as much as I can
through the use of the <?=$variable_output_goes_here?> output. I'll
give you an example.

Instead of putting the body of a for loop (that displays info from an
array in a table), in the html, I'll declare a variable and put
everything in the variable.

<?php

$display_results = '<table>'

for ($i = 0; $i < 3; $i++) {
$display_results .= '<tr><td>' . $info[$i][0] . '</td><td>' .
$info[$i][1] . '</td><td>' . $info[$i][2] . '</td></tr>'
}

$display_results .= '</table>'

?>

Then I'll output into the html like so . . .

<?=$display_results?>

My question is, even though this seems to work, now I'm learning on a
small scale at home. If I take this sort of coding habit to a
production enviornment, is it going to slow down my code if I need to
scale something up? If I'm this interested in logic/presentation
seperation, would I just be better off using smarty?

Standard Coding...
I was wondering if there is a standard when mixing PHP and HTML script on a
page... and if there were any articles on this subject...

i.e. do I make every page a .php page on my website and echo html when I
need to or...

should I make every page html and embed php when I need to..

Obviously this only applies to pages where a mixture of php and html is
required...

for example... which is better or more standard....

<html>
<head>
<title>title text</title>
</head>
<body>
You name is <?php $name?>
</body>
</html>

saved as index.html

or

<?php
echo '<html>'
echo '<head>'
echo '<title>title text</title>'
echo '</head>'
echo '<body>'
echo 'Your name is '.$name;
echo '</body>'
echo '</html>'
?>

saved as index.php

Best Coding Practice
let me say that this question is a rather general programming
question, but the context is PHP, so I figured this group would have
the most relevant insight.

Anyways, this is also more of an opinion based question than one
seeking a definite answer. Recently, while maintaining a rather large
system. I needed to add an array class member to an object. It was
exactly the same as another class member, except that one array stored
regular products, and the other stored free promotional products. As
such, I needed a way to add products to the new, free array. Since all
the logic was the same between the two arrays aside from the price, I
had a few different options to do this. I'm interested in polling
which way some of the group members feel would have been the best.
Naturally these are abbreviated versions of what I envisioned as
possible solutions.
#1.
public function addArrayA($object){
//logic
$a[] = $object;
}

public function addArrayB($object){
//same logic
$b[] = $object;
}

#2. (These next two are arranged as such, because the class using
these functions is included in many script files,
all of which I may not be aware of, so there would have to be some
default value for the array that was always used
before this new array was needed)
public function addArray($object, $free = NULL){
//logic
if(!$free){
$a[] = $object;
}else{
$b[] = $object;
}
}

or

#3
public function addArray($object, $arr = "a"){
//logic
$$arr[] = $object;
}

I ended up going with option number 1, because I felt that despite the
inefficient, redundant code it would later be more readable to other
programmers that might work on the project. Additionally, I didn't
feel wholly comfortable with default variables being the only
difference between a full price product and a free product. Thoughts?

Coding Style...
When i write a script, i tend to seperate the differnt functions with differnt files. For example. When i creat a user management script, i create and add_user.php file and a modify_user.php file, and so on. I also see a lot of people who simply write one big 10 meg php file that includes everything in one. (seperated into functions.)

Is there an advantage to this? Or is it just a matter of personal prefrence? I guess it really doesnt matter that much, i just wanted to know.

Streamline PHP Coding
This script was build to take a ZIP file that has been uploaded to our server, extract the TXT files within (which are always the same) and INSERT the contents of those TXT files into a MySQL DB that we have setup. Is there a way to stream line this coding and help it run faster? One of the TXT files in the ZIP has over 600,000 records and takes nearly two minutes to INSERT into the DB. Code:

Coding Standards For PHP
I've picked up much of my PHP coding from various tutorials scattered about the web. I'm proficient in my coding but believe that my method isn't up to conding standards. Can you refer me to sites which use good coding methods/standards? Or is there a good reference site (other than php.net)?

Coding XHTML
I was wondering what the correct way to integrate xhtml into php? Do you design you your entire site with the xhtml inside of php or only embed the xhtml in php when necessary? For instance would you put your entire xhtml output and php with in a variable and echo it out all at once.  Or does it really depend on the situation?

Highlight_string Coding Problem
Here's my goal. There's a textarea box, where I type text. I created a ubb code, [table] where it shows a brown table. This is where I'll have my PHP code. My goal is, the text between the [table] and [/table], I want the text to be in a highlight_string() function.

Simple Wiki As PHP Coding Example?
I'm currently learning PHP using the ORA "cuckoo" book. I'm looking for
some reasonably interesting sample code to read and thought that a
*simple* Wiki could be ideal. Can anyone recommend a Wiki which
implements the basic functionality only to keep things simple, written
in nice clear PHP code? I'm hoping that a couple of hundred lines or
less of PHP will suffice to get a basic wiki running, without resorting
to obfusticated coding contest tactics...

Coding Standards Without Control?
A recent poll asked if programming standards are used by development
organisations... and if they are controlled.

None: 20%
Yes, but without control: 49%
Yes, with control: 31%

Participants: 369

A majority of the participating organisations have coding standards...
and a majority does not control them ;o) What is the situation at your
location?

Want Php Coding/script For Timing
Any one know about coding/script which can show the different between two time for example the orignal time is 2:00PM and the current time is 2:30PM so the result will be 30 mintues...

Coding/form Problem
I am just in the very early stages of learning Php and just need..

I have a form which includes values. However when I test it, the
values are not added up and carried to the results page. I just
wondered if you can spot whats wrong with it?

This is the form on the page tourprice.php:

<form name="frm_tourprice" id="frm_tourprice" method="post"
action="tourprice_processor.php">
<table width="60%" border="0" cellspacing="0" cellpadding="3">
<tr>
<td>Number of Adults </td>
<td><input name="numAdults" type="text" id="numAdults"
/></td>
</tr>
<tr>
<td>Number of Children </td>
<td><input name="numChildren" type="text" id="numChildren"
/></td>
</tr>
<tr>
<td>Tour Name </td>
<td><select name="tourName" id="tourName">
<option value="500">Highlights of Argentina</option>
<option value="700">Highlights of Western Canada</option>
<option value="900">Egyptian Pyramids and More</option>
</select></td>
</tr>
<tr>
<td>&nbsp;</td>
<td><input type="submit" name="Submit" value="Submit"
/></td>
</tr>
</table>
</form>

On the tourprice_calculator.php page it is supposed to add everything
up depending on what you select and give you the correct cost. I keep
getting a zero returned though.

This is at the top of tourprice_calculator.php

<?php
$numAdult = $_POST['numAdults'];
$numChild = $_POST['numChildren'];
$basePrice = $_POST['tourName'];
$tourPrice = (numAdult * basePrice) + (numChild * basePrice)
?>

Further down on the page I have the following:

Tour Price Calculator </h1>
<p>The estimated cost of your tour is <strong><?php echo
$tourPrice; ?></strong>.</p>
<p>Price includes hotel, accommodation, and travel expenses during
the tour. They do not include airfare to the starting destination.</p>
<p><a href="tourprice.php">Calculate</a> another tour.</p>
<p><a href="contact.php">Contact</a> one of our qualified
agents.</p>


Copyright © 2005-08 www.BigResource.com, All rights reserved