Submit Restrictions - Is there anyway to bypass this on my localhost?

Pages: 1, 2, 3
free web hosting
Free Web Hosting, No Ads > CONTRIBUTE > Computers > Programming Languages > PHP Programming

Submit Restrictions - Is there anyway to bypass this on my localhost?

Spectre
Just try adding some simple checking of each element:

CODE
$rad1 = !empty($_POST['rad1']) ? $_POST['rad1'] : '';
$_1stNumber = !empty($_POST['txt1stNumber']) ? $_POST['txt1stNumber'] : 0;
$_2ndNumber = !empty($_POST['txt2ndNumber']) ? $_POST['txt2ndNumber'] : 0;
if( $rad1 == 'Divide' ) {
  if( $_2ndNumber == 0 ) {
     echo('<font color="#FF0000">Cannot divide by 0.</font>');
     $rad1 = '';
  }
}
$result = "";

if ($rad1 != null){

Reply

darran
I am pretty new to testing php pages on a live server. Can you give me a guide as to which security changes must be made? And can all these be done on the CPanel? I believe my first php page is more or less completed with the exception of some minor glitches and also the security regarding XAMPP.

PS: Changing the value of $result to 0 did not reset the value when I clicked the reset button.

Reply

jlhaslip
Three rules of Security on php pages are as follows:
  • Never trust user input
  • Never trust user input
  • Never trust user input

A common method is to set the variables using the following techique:
CODE

... code to input the value from the User ...

$my_variable = stripslashes(trim($_POST['user_input']));

... rest of code uses $myvariable ...


trim() removes white-space before or after the data in $_POST['user_input']
and stripslashes() removes any backslashes found in $_POST['user_input']


Reply

darran
Is that the security issue you are talking about? I thought it had something to do with Apache or on the server side.

Another PHP question from me, I want to create a button to handle the clearing of values, but from my understanding, only javascript is able to do this but what if it was disabled by the user, how am I to interact with the button in a php page?

How about the reset button? It does not reset the value to 0.

Reply

Spectre
When you're just dealing with numeric values, you don't need to do any form of sanitization outside of is_numeric() - if the value is not numeric, then cancel. Additonally, unless you are passing the value to something outside of PHP, evaluating it as code, or treating it as a filename (as well as a few other exceptions), there isn't really a lot that can be manipulated by user input. The worst that could happen in this particular case is the operation failing, resulting in an error being displayed and revealing path information etc.

darran, set the initial value of the input fields to '0' and the reset action should result in them reverting to this (ie. <input type="text" name="field" value="0">).

Reply

darran
As for the validation, I am only checking for the numeric numbers using is_numeric() but also I need to validate whether a radio button is selected and whether the user has entered anything. All that is fine with the exception of the reset button not doing what it should. Resetting the result to 0 or empty

I did as you said, setting the initital value of input fields to '0' but when I clicked the reset button, my $result variable value did not reset along with the form entered by the user.

Reply

jlhaslip
I can't see where you are re-setting the txt1stnumber or the txt2ndnumber variables, so they are probably producing the result and the result is being echo'd out each time.

Maybe re-post the current code here.

Reply

darran
Here is the code

CODE
<?php
function calculate() {
$result = 0;
$_1stNumber = 0;
$_2ndNumber = 0;

if (isset($_POST['submitted'])){
$_1stNumber = stripslashes(trim($_POST['txt1stNumber']));
$_2ndNumber = stripslashes(trim($_POST['txt2ndNumber']));

if (!is_numeric($_1stNumber) || !is_numeric($_2ndNumber)) {
exit("<font color=#FF0000>Enter a number in the textbox</font>");
}

if (isset($_POST['rad1'])){
$rad1 = $_POST['rad1'];
switch($rad1){
case "Add": $result = $_1stNumber + $_2ndNumber;
break;
case "Subtract": $result = $_1stNumber - $_2ndNumber;
break;
case "Multiply": $result = $_1stNumber * $_2ndNumber;
break;
case "Divide": $result = $_1stNumber / $_2ndNumber;
break;
}
echo("<font color=#FF0000>$result</font>");
} else {
exit("<font color=#FF0000>Select an operation</font>");
}
}
}
?>


However I feel this is not the right way, this is just setting the starting value of the 2 variables $_1stNumber and $_2ndNumber to 0. And clicking on the reset button does not help in changing this value back to 0. Is there a way to check when the reset button is pressed so that I can reset the value of the result there?

On a general question, is there anyway to handle button clicks other than using javascript because not everyone would have javascript enabled.

 

 

 


Reply

Spectre
I'm not quite sure what you're asking, but if you mean how do you reset the variables within PHP when the Reset button is pressed... the value is only going to be sent to the server when the user clicks 'Submit'. The Reset button is handled only on the client-side, so clicking it doesn't interact with the server at all. The variables are going to contain the value they were initially assigned (in this case, the integer value '0') each time the script is executed, and the values will not be 'remembered'.

And no, the only way to handle button clicks (and most other client-side events outside of the standard markup) is via JavaScript. Most people have it enabled.

Reply

darran
My question was a way to reset the values by pressing a button, it is a default reset button but I want it to be able to reset my values to the original ones I defined.

In other words, I can reset the value of the variable using javascript? Something along the lines of

CODE
<script language="javascript" for="btnReset" event="onclick">
<? php $result = 0; ?>
</script>


Please correct me on this? But lets say a person decides to disable javascript for whatever wierd reason, is there a way to handle button clicks in a web-based environment?

Reply



Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

(Maximum characters: 10,000)
You have characters left.
Confirm Code:

Pages: 1, 2, 3
Similar Topics

Keywords : submit, restrictions, bypass, localhost

  1. Destination Address For "submit" Button
    Adding a destination email address to a "Submit" button (5)
  2. Ips Installer Database Details [resolved]
    It wont accept localhost... (6)
    CODE Access denied for user 'skyed211_central'@'localhost' to database
    'skyed211_centralgaming' I get this error message when trying to install my IPB. It will
    not accept localhost, nor mysql. Can I get any help please? I've tried many times to get past
    this part, but it's not happening /sad.gif" style="vertical-align:middle" emoid=":(" border="0"
    alt="sad.gif" />....
  3. How To Make Image Buttons Act As Submit Button
    (8)
    Hi guys I m making a personal website .... I asked in the forum how to create and use images as
    buttons...thanks for your help.. I can make them work as links....give some hovering effects
    etc...they work very well..untill I use them in forms and use them as SUBMIT or RESET button...when
    I do this nothing happens on clicking the image button... the code I use is like but there
    is problem in making them act as SUBMIT or RESET button. I have tried very hard to make it work, but
    didn't succeed .... I know html and CSS quite well but , don't know....Javascr....
  4. On Line Proxies!
    Bypass your limited settings... (11)
    Hey, I found one working online proxy that will be useful for everyone those internet settings are
    limited, like the ones who are at school, university or some more educational places. Go to:
    www.canhide.info. I checked it today, it works perfect. Some people assert that it can be used to
    download files from rapidshare server, I mean you do not need to wait for a long time, to download
    the file itself.....
  5. Frontpage Problem
    Strange message when press Submit (0)
    Trying to set up a "skeleton" form generated with Frontpage 2000. After installing Frontpage
    Extensions, when I hit Submit on the form I get this response: *-*-* :-| :^| :-/ :-( 8-( *-*-*
    * status=1 * osstatus=0 * msg=FrontPage security violation. * osmsg= I'm new at
    this, and don't understand any of the above response. Please explain the above stuff and suggest
    how to fix it. Thanks, Jack Here's the brief code: <!--webbot
    bot="SaveResults" S-Label-Fields="TRUE" B-Reverse-Chronology="FALSE" S-Email-Format="TEXT/CS....
  6. List Of Free Directories To Submit Your Websites
    (7)
    Hi: Submission in free directories is a world-known way to increase ranking and traffic. But most
    of you don't know a good source of that list of directories. Here is a great source of free
    directories list . Just start submission in those directories in your free time, and see you
    ranking.......
  7. Restrictions On Php & Forms?
    $_GET/POST/REQUEST? (2)
    alright, so heres me again (theres probably a contact page on the website but I figure somebody
    has/will have this question and they'll want to know it so why not ask and share the love &
    knowladge (minus the love)) so I've been working on a two part contact page. contact.php
    CODE <p><img src="images/sig.gif" align="left" width="37"
    height="69" style="margin-right: 5px;" alt="B/S Signature"/>
    <font   class="head">Contact!</font><br/> <form action=&#....
  8. What Is Mysql Host Address?
    Not localhost (6)
    Dear All I want to know what is my mySQL databade host adress, not "localhost" because I want to
    connect to mySQL externally, thank you very much /smile.gif" style="vertical-align:middle"
    emoid=":)" border="0" alt="smile.gif" />....
  9. Submit Your Site To Google
    How to make google find your site (14)
    How to submit website to google? Is there any fast and guaranteed way to do it?....
  10. Question About Restrictions If Any
    (1)
    I was wondering if there are any cpu load restrictions.. are scripts set to timeout in 60secs(like
    powweb) or anything like that? also are they any file size/type restrictions?? Can you customize the
    php.ini?? if you can't what is the file size limit on uploads using php? Are there any
    limitations or restrictions should I know about before hand?? Can webmail be installed on the
    server or is there one included? I am not sure which plan I am going to be getting yet I still have
    to decide between Plan 7s, 9s, or Freedom Finally witht he 7s and 9s plans do you have to....
  11. Stop Double Post/submit
    (10)
    Hi Whats the best way of stopping a double post from occurring? Re-directs? I was hoping that
    there was another way because I am using smarty and with the current setup of my site implementing
    redirects would be a right pain. Thanks for any help. ....
  12. Getting Information From Submit Button
    I need to grab information from a submit button. (1)
    I basically have an array that uses characters as keys and has an integer value to it. I have a
    loop that outputs the list in that array. For each entry I want a a button to remove it. The button
    will submit the form to another page which contains the script to be able to remove it from the
    array. The infomation for the keys name is used for the buttons name value. Im not sure how you go
    about grabbing this information once on the submitted page. heres my code CODE
    echo("<form name='jobs' action='remove_job.php'>"); foreach....
  13. <?php ?> Get Search Results To Your Localhost
    Simple way to get 100 results without allowing cookies (2)
    Ultimately simple script that allows you getting google search results to your localhost. This is
    the first part of the Crawler script i'm developing, and if you are interested in developing the
    script with me, IM me @icq328866661@msn/evil_matak/ a \hotmail-com. Here's the form
    part... QUOTE search.php QUOTE if (@$_POST ==""){ echo "What are you
    doing?"; } else{ $query =
    file_get_contents("http://www.google.com/search?q=".urlencode($_POST
    )."&num=100&hl=en&ie=UTF-8&filter=2"); //needs to be added with more queries �....
  14. Regis Philbin Goes In For Bypass Surgery This Week.
    Wish him well and luck. (1)
    I am sure everyone was surprised like I was when I heard the news yesterday that everyone's
    favourite. Daytime talk show host of "Live With Regis and Kelly" will be going for a bypass. Open
    heart surgery this week. I was really surprised when I heard the news. But knowing Regis they'll
    have to give him alot of stuff to put him to sleep for his operation. Or else I bet his operation
    will be a very loud experience for the Doctors that will have to work on him. lol Well let's all
    hope he pulls through his operation. And that he gets back to his show soon so that....
  15. Submit Multiple Forms At Once
    (5)
    Is there a way I can submit multiple forms at once? For e.g. I click on a dropdownlist to generate
    6 forms (I have done this) using Javascript, but I am not sure how I can define each form with a
    name and their action. Is it possible to do this and if so, can you enlighten me further?....
  16. I Need A Free Way To Submit My Website To The Search Engines
    (6)
    the title say's everything i want to kown but i will repeat it. I need a way to submit my
    website to the search engines. I apresiate any good sugestion. Thank in advance....
  17. Form Dosn't Submit In Opera
    Works in IE and FireFox (1)
    My form dosn't submit, it works in IE and FF, its validated HTML 4.01 and all, Code:
    /**********************************/ /** Post Topic :: EvilBoard **/
    /**********************************/ /* Session Start */ session_start(); /* Start Submit Script */
    if ( isset($_POST )) { header("Refresh: 0; redirect.php?posttopic");
    define("RELOADED","YES"); } /* End Submit Script */ /* Include File::Header.php */
    include("include/header.php"); echo " "; /* If Script can't find SESSION user_name */ if (
    !$_SESSION ) { /* Echo :: Forbiden */ echo '....
  18. Un-filtered Browsing
    How can I create a proxy on my website to bypass my schools internet f (0)
    My highschools internet is all filtered from accessing webistes such as games porn etc. In the past
    i have managed to overcome this by accessing a proxy on numerous websites. This involves going to
    this website then entering the desired blocked website into a input box. Then that website transfers
    me to the blocked website via this webiste. At least this is how i think it works.... How can I add
    something similar to this on a website of my own?....
  19. Preventing A Form To Submit If A Field Is Empty?
    (7)
    Well, I've just started learning Javascript, so I'm no wiz yet... Anyways, I have a form
    where I want to show an error message when the user has not filled out the "name" field. My code
    looks like this: CODE <script type="text/javascript"
    language="JavaScript"> function nameempty() {     if (
    document.form.name.value == '' )     {         alert('No name was
    entered!')         return false;     } } </script> <form
    action="submit.php" method="post" name="form....
  20. Yahoo Submission Feed Generator
    For Site Submit in yahoo, need url feed. (5)
    For submitting a site on Yahoo! search engine for FREE, we have to submit a feed which explains
    our site in detail. Is there any Yahoo! Search Submit Free Feed Generator sites available? If
    you are familier with any, please mention them in here. Hopping that a positive response will get
    from others.....
  21. What You Think Of My Localhost Site?
    (11)
    well, after overwriting my original localhost website, i decided to build a new one. I began this
    two nights ago, and liked the end result, check it out:
    http://www.unkieconstruction.com/digital-ink/local/ if any of you want this on your computer, i
    would be more then happy to give this to you. All you need is PHP5 and MySql installed and running.
    comment!....
  22. How Do I Script A Tutorial Submit Site
    (3)
    I am very interested in learning how to create or start my own tutorial submitt site. What do I
    need to learn ? What do I need to have. Is there a script that can be made up or a software? What
    I would like to do is start my own tutorial submit site. something similar to good-tutorials and or
    pixel2life except those sites are really big and cover many tutoriasl for many different programs.
    Id like to just cover tutorials for maybe a total of 3 to 4 different programs. Im sure I need
    hosting a domain a site and some good forums to get something good going. But t....
  23. Smallbusiness Application: From Web Submit To Fax Machine
    sending order confirmation to regular fax via website (0)
    I am looking for a service or a script that will send online form submitted to my regular land-line
    fax machine. I have been searching for a while and the keywords "email to fax" returns few services
    but I have never heard of them. So here is what I'm thinking. I'm assuming email to fax is
    the best option since that's the only think I can think of. I do not know any other application
    that can be eaisly transferable to a fax machine. But I can be narrow in vision that I may be
    missing something. Please advise me if you know of better way. Secondly, these are....
  24. About Submit Form Box
    (8)
    I make the form tags like this: CODE <form action="check.php"
    method="post"> <table>   <tr>    <td>Username:</td>
       <td><input type="text" name="user"></td> </tr>
      <tr>    <td><input type="submit" value="set"></td>
    </tr> </table> </form> my question: in the tags above, it will produce
    a submit box, right? I want to make just text: "set" that one can click it, then link it to the fo....
  25. Request: Php Submit Script With Save In Host
    Get Picture form url (13)
    Hi all i want make one form whit php , when users submit there urls , then my site give one picture
    form url and save on my host ! how can do that ? thanks....
  26. Php Mail Restrictions And Phpbb
    (0)
    Let me start by saying I have several domains hosted by computing host and had some problems with
    their consistency in the beginning. Lately however, they seem to have really turned things around,
    and their uptime has been very good. I appreciate that they were diligent enough to work out their
    problems. Anyway here's my prob: It seems that when using the php mail(), I'm only able to
    send to my hosted domain. I can send to me@myhosteddomain.com and not
    you@yourdomainhostedsomewhereelse.com if you know what I mean. I understand why this is being done
    and I&#....
  27. Free Links Directory
    submit your links for free in the Central Directory (0)
    Central Directory is a free directory of qualiy links no reciprocal links
    needed.Featured listings is available for only 2.25$ per 6 months.The directory is growing very
    well. If you need any categories to be added request here.....
  28. Multiple Drop Down Menus W/ Submit Button
    (6)
    I am building a page that will have 2 drop down menus and a submit button. The first menu will have
    one set of options, say colors (red, blue, green, yellow). The second menu will have another set of
    options, say sizes (small, medium, large). What I want to be able do is select a color and a size,
    click submit and have it go to the page for those options. So if a user picks 'Red' and
    'Small' and clicks submit they will be linked to page1.html. If they pick 'Blue' and
    'Large', they will be linked to page2.html, and so on. Any ideas how to ....
  29. How To Submit Website To Search Engines
    (2)
    can any one tell me how to submit the website to the search engines using the built-in script
    function in the trap17 hosting.I submitted 2 days ago , to all search engines using that script but
    today google is saying that no any page of my domain is indexed there.how i can know if my website
    is submitted to search engine or not ? my site url is http://pakdir.com thanks....
  30. Yahoo Page Search Submit
    How to get free Yahoo! Search? (3)
    Hello, I have an question if any one here knows where to go. I need free Yahoo! Search. What I
    mean when other people search Yahoo! They can see my website. Where can I get one please. I
    don't mean Yahoo! Search HTML. I mean Search. Thank you, Webviper2005 /dry.gif'
    border='0' style='vertical-align:middle' alt='dry.gif' /> Edited topic title. ....

    1. Looking for submit, restrictions, bypass, localhost

*RANDOM STUFF*





*SIMILAR VIDEOS*
Searching Video's for submit, restrictions, bypass, localhost

*MORE FROM TRAP17.COM*
Similar
Destination Address For "submit" Button - Adding a destination email address to a "Submit" button
Ips Installer Database Details [resolved] - It wont accept localhost...
How To Make Image Buttons Act As Submit Button
On Line Proxies! - Bypass your limited settings...
Frontpage Problem - Strange message when press Submit
List Of Free Directories To Submit Your Websites
Restrictions On Php & Forms? - $_GET/POST/REQUEST?
What Is Mysql Host Address? - Not localhost
Submit Your Site To Google - How to make google find your site
Question About Restrictions If Any
Stop Double Post/submit
Getting Information From Submit Button - I need to grab information from a submit button.
<?php ?> Get Search Results To Your Localhost - Simple way to get 100 results without allowing cookies
Regis Philbin Goes In For Bypass Surgery This Week. - Wish him well and luck.
Submit Multiple Forms At Once
I Need A Free Way To Submit My Website To The Search Engines
Form Dosn't Submit In Opera - Works in IE and FireFox
Un-filtered Browsing - How can I create a proxy on my website to bypass my schools internet f
Preventing A Form To Submit If A Field Is Empty?
Yahoo Submission Feed Generator - For Site Submit in yahoo, need url feed.
What You Think Of My Localhost Site?
How Do I Script A Tutorial Submit Site
Smallbusiness Application: From Web Submit To Fax Machine - sending order confirmation to regular fax via website
About Submit Form Box
Request: Php Submit Script With Save In Host - Get Picture form url
Php Mail Restrictions And Phpbb
Free Links Directory - submit your links for free in the Central Directory
Multiple Drop Down Menus W/ Submit Button
How To Submit Website To Search Engines
Yahoo Page Search Submit - How to get free Yahoo! Search?
advertisement



Submit Restrictions - Is there anyway to bypass this on my localhost?



 

 

 

 

ADD REPLY / Got an Opinion! a humble request :-) RAPID SEARCH! Free Hosting [X]
Express your Opinions, Thoughts or Contribute more info. to help others.
Ask your Doubts & Queries to get answers, So that "Together We can help others!"
Register FREE for AD-FREE forum, Create your own topics, Ask Questions, track topics, setup subscriptions & notifications and Get a Free Website w/ Email and FTP.
500MB Space *No Ads*, CPanel, FTP, PHP, MySQL, EMails - 100% FREE