Jump to content

Brian W

Members
  • Posts

    867
  • Joined

  • Last visited

Posts posted by Brian W

  1. thank you for informing me of that. When I get using this function, I might have started noticing the slow processing but not known why it was happening.

    if I use

    	$str2 = preg_replace("/</", '<', $str1);
    $str3 = preg_replace("/</", '>', $str2);

    Is that safe for when I want code that has been submitted to be displayed?

  2. I am trying to learn how to make functions while meanwhile making some custom sanitizers.

    This is what I have so far for my test page.

    <head>
    <title>Test Functions</title>
    </head>
    <?php
    function clean($str, $type) {
    if(empty($type)){
    	$Restrict = array('/\%/','/\*/','/\_/','/\-/','/\'/','/\"/','/\\\/');
    	$str1 = preg_replace($Restrict, " ", $str);
    	$str2 = stripslashes($str1);
    	$str3 = strip_tags($str2);
    	return $str3;
    }
    if($type == "int") {
    $str1 = intval($str);
    return $str1;
    }
    }
    ?>
    <body>
    <form id="form1" name="form1" method="post" action="?">
      <label>
      <input type="text" name="test" id="test" />
      </label>
      <label>
      <input type="submit" name="button" id="button" value="Submit" />
      </label>
    </form>
    <?php //results
    if(isset($_POST['test'])) {
    echo "plain= ".$_POST['test']."<br>";
    echo "clean= ".clean($_POST['test'])."<br>";
    echo "clean int= ".clean($_POST['test'], int);
    }
    ?>
    </body>
    </html>

    It works, but I get this message right after the use of " clean($_POST['test'])

    Warning: Missing argument 2 for clean() in /homepages/38/d214759723/htdocs/functions.php on line 2

    I found something on Google that leads me to believe I may need to have my $type come first in the argument, but I really don't want it there because I want the function to default if I don't designate what type of clean I want.

    Any input greatly appreciated.

     

  3. On the page for sleep() that was linked on another tread, I found some one using something I don't know how to use.

    $dis=<<<DIS
    <div style="width:200px; background-color:lime;border:1px; text-align:center;text-decoration:blink;">
    $i
    </div>
    DIS;
    echo $dis;

    What is the <<<DIS and then DIS;?

    I saw this on the XSS cheat sheet page also, I can't say I've seen it before.

    What should I look up in the manual to find out about it?

  4. Sorry, my last comment wasn't of any help, you are already past that.

    I have an idea, again, may not be helpful.

    Add an incrementing value that loops with the question. The only use for it is to count how many questions. Then, at the end, have a hidden field that has that value in it so that you can pass it to the next page. then You could use that number in your statement to tell it how many times to loop. but again, I'm not sure if that is even helpful to you.

    If you are having a problem sending the question ID along, have a hidden field for each question that contains the question ID in the value.

    <input name="question<?php echo $i++; ?>" type="hidden" value="<?php echo $dailyrow['id']; ?>" />

     

    btw, how are you resubmitting the values once you have them on the page for review? just interested.

  5. yes.

    I need to store

    questionID

    name

    date

    answer

    So, are u using some kind of statement that is looping your format each time with a different question, right?

    how about something like-

    <?php //your for, while, or whatever you use
    $i = $questionID; echo $question.': <input name="'.$i.'" type="radio" value="1" /><input name="'.$i.'" type="radio" value="0" />'; //close your statment and whatever. ?>

  6. Sorry, will just quote the message I made yesterday.

     

    Still wondering why my attempt #1 was skipping over some directories, or is that a mystery better off forgotten? :-\

    I created this file-tree script for fun, its very interesting to do it in your the root directory.

    File 1 = filelist.php

    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Files</title>
    <style type="text/css">
    <!--
    body li {
    list-style-type: square;
    list-style-position: outside;
    text-indent: 10px;
    }
    -->
    </style>
    </head>
    
    <body><div id="files">
    <?php $dir = 'EPM/';
    if(isset($_GET['dir'])) { $dir = $_GET['dir'] ; } ?>
    <h3>Files in: <?php echo $dir; ?></h3>
    <?php foreach (glob($dir."*", GLOB_MARK) as $filename) {
    if(is_dir($filename)) { $tdir = $filename; echo '<a href="?dir='.$filename.'">>'.$filename.'</a><br>'; include('filelist2.php');} else {
    echo '<li><a href="'.$filename.'">'.$filename.'</a></li>'; }}?>
    </div>
    </body>
    

    File 2 = filelist2.php

    <ul><?php foreach (glob($tdir."*", GLOB_MARK) as $filename) {
    if(is_dir($filename)) { $tdir = $filename; echo '<a href="?dir='.$filename.'">'.$filename.'</a><br>'; include('filelist2.php');} else {
    echo '<li><a href="'.$filename.'">'.$filename.'</a><br></li>'; }}?>></ul>

    to see the root, simply have the url look like this .../filelist.php?dir=/

    Also, you can change the defult folder by changing $dir =

    I hit the stop button after about 30 seconds, little worried about what might happen.

  7. The CaptchaSecurityImages.php creates a session... you check your $_POST['captcha_form'] against the $_SESSION['security_code']...

    Sorry if that is not what you meant.

    if(isset($_POST['captch_form'])) {
    if($_POST['captcha_form'] <> $_SESSION['security_code']) { die('Bad form input, or whatever'); }}

  8. Maq, I told madox to read http://us2.php.net/mail

    It has a great example of what the mail() function should look like.

     

    You should also make the body of your email a string than have the string in the function.

    mail('youremail', $subject, $body, $headers)

    also, html doesn't always go well in emails, many email clients don't accept the tags. please some one inform me of how to change that if there is a way.

    line breaks can be accomplished with \n\r

  9. Besides using the code tags and I'd like to hear what issues are arising, your form itself looks like it would never work...

                                                                        <div class="h"><input type="your_name" value="name" /></div>
                                                                       <div class="h"><input type="your_email" value="e-mail" /></div>
                                                                       <div class="h"><input type="your_phone" value="phone" /></div>
                                                                       <div class="h"><input type="your_address" value="address" /></div>

    "type" isn't what you want to name your input, its the tag for what type of form object to use. try:

    <input type="text" name="your_name" value="name" />

  10. Also, change ALL passwords relating to your site, and start fresh.

    Plesk, mysql,etc.. all passwords, even ones only "you" know.

     

    Even your admin section should have checks and balances.  But like I said, possibly start fresh, checking each page at a time as you reimplement it, or start from scratch.

    He has restricted the IP address to only his he says, thats a decent check isn't it? (only one problem, sometimes your ISP changes your IP)

    For information on strong passwords: http://www.microsoft.com/protect/yourself/password/create.mspx

     

  11. mysql injection is likely it. I'd give you a percentage, but i'd be out my A$$, but its a really high percentage of php related hacking is mysql injection. You need to make sure that ANYWHERE that people can input info that even touches your database (likely 100% of your forms) you have the stings being stripped of anything potentially bad; namely double and single quotes. " '

    look into the manual about magic quotes

    Some one else may be of more help to you, but thats my 2 cents.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.