Jump to content

dannyb785

Members
  • Posts

    544
  • Joined

  • Last visited

Posts posted by dannyb785

  1. If you want to experiment with the touch and unlink, you'll need to set your folder's properties to writeable by all people(777), which is not really a good idea. So set it to 777 when doing your testing, and then set it back to 711 or lower when you finish.

     

     

    I was hacked multiple times and files were installed on my server without me knowing and I got a call from paypal saying that a phishing scam was using my domain to host its page. Yeah, it's that important. I wasn't in trouble, but actually after the 2nd time being hacked, my hosting provider shut down my server til I could get it cleaned out. If you're not hacked now(with 777 permissions), you will be later... guaranteed

  2. it doesnt matter if you have rights, does the php script know that? The answer is no. You need to connect through ftpconnect() with your username and password. Then chmod the folder to be writeable. Delete or whatever. and then restore the settings to how they were before.

  3. Simple solution: don't use history.back Anytime you go back into a page that processed form data, you are resubmitting the data. You should always redirect from a page that handles post data to a  page that doesn't.

     

     

    EDIT: and I agree with ^ you need to tell us your problem.

  4. If I read your code correctly, if someone put that their email address is "bob@gmail.com" then in your inbox, it would say "From: bob@gmail.com" ?

     

     

    If I am correct in that interpretation, then there's your problem right there. Many(maybe all?) shared hosting servers won't allow email to be sent on behalf of another domain other than itself. It just won't email. UInfortunately, it probably won't return false, as it did try to email, it just failed(because of the server not allowing it to).

     

     

    Solution: change the $sender variable to anything@YOURdomain.com. You can, however, specify a reply-to variable, which alows you to reply back to their email, at the domain they provided. But first get your code to email, then worry about a reply-to.

     

    Also, don't stripslashes... you never added them(that is, unless magic_quotes is enabled)

  5. Did you even try the code I gave you? Don't see why you were complaining about getting no sample code from anyone...

     

    I suffer the same epidemic. People ask for code and when its given, they say "why doesnt anyone help me?" or they try one suggestion of the 5 given and say that it doesnt work and that nobody here knows what theyre talking about.

  6. ^ omfg.

     

     

     

    THIS is why I wish people would be more specific

     

    Christ. I swear, I love helping people for free... but this is ridiculous.

     

     

    Think about it... You're trying to find xxx value in http://www.youtube.com/xxx(or whatever) so would it make sense to search for 'xxx' in 'http://www.youtube.com/xxx' or search for 'http://www.youtube.com/xxx' in 'xxx' ? Because you're looking for 'http://www.youtube.com/xxx' in 'xxx' which obviously would never happen. Had you told us(or me) to begin with that $surl would have the entire url, it would've taken 2 seconds to say "just remove the part in front of the code you're looking for.

     

    Once again. If you have a row in the database that says "bob" and then a variable b that says "bobby". Would it make sense to search for 'bobby' in the database to try and find 'bob' ?

  7. yah

     

    $result = mysql_query($sql) or die('Error connecting to database, Please try later');

    if (mysql_num_rows($result) > 0){

    // further processing here

    }

     

     

     

     

    What's the "further processing" ?

     

    And I didnt realize you needed to search for an exact entry. Don't to the LIKE. Change it to:

    $surl = addslashes($_POST['surl']);
    $sql = "select * from wvideos where vmkey='$surl' ";
    

     

    If this doesn't work, then either your form is not putting the variable into $_POST['surl'] or there is some issue with your database and the values in it or the way it's setup

  8. This is pure js.

     

    Basically, on each input form, you have an onBlur='set_properties(this.value)'

     

    and your set_properties function can do one a few things that will change the properties of the current page.

  9. Cool. In a situation like this, how do i update the last login of a specific user? I have also noted that overwriting a select statement will do  my program no good. How do i solve my problem. Can someone give me a sample code???

     

     

    In my page, to update the user's last login I do this:

     

    <?php
    // once the login has been verified and mysql_fetch_array has been executed
    $id = $row['user_id'];
    $now = strtotime("now");
    $result = mysql_query("UPDATE User SET user_last_login='$now' WHERE user_id='$id' ") or die(mysql_error());
    

     

    that's all you really need

  10. Is all of this in one file? If so, whats the file called? Your form's action goes to NewAssignment3.php so you need to put that php code into a file and name it NewAssignment3.php(if you havent already).

     

    Otherwise, the code looks alright. MAKE SURE in the php file that the <?php is at the very top of the file with nothing in front of it(no new lines or anything) and also make sure config.php isn't outputting anything.

     

    Also, I'd say make exit; into exit(); not sure if that matters, but just play it safe.. it's a function.

     

    One last thing.. after your "header" statement, under it and above the exit(), put a little echo statement that says "did not redirect" that way if it prints that, you know that there was output before the header statement.

     

  11. this is what i have,

    $_SESSION['mycart']= $_POST['mycart'];."item_name|";
    

    so that I understand the session named 'mycart' will be carried from page to page given that I carry this same session on each page using

     

    <?php
    session_start();
    $_SESSION['mycart']= $_POST['mycart'];."item_name|";
        session_write_close();
    ?>

     

    then each product with the the form name="item_name" will line up when each product is submitted again with the same form name="item_name" but with different values.

     

    then at the end when i want to use all the vars collected in the session i use explode.

    thanks for your guidance I hope I didn't sound too confusing.

     

    remove the semi-colon after $_POST['mycart']

     

    and I'm not positive, but did you have another question? or were you just explaining that you understand whats going on?

  12.  

    You can condense a 100 line program into 20 lines of unreadable "super-code" that nobody can decipher.  Doing something like that is counter-productive.

     

     

    yeah, thats when it's not good. If you're giving code to someone who's more fluent in php, it would be better to make the function bc if I dont know what curdate does(nor can find out) then I'd have no way of figuring out how to manipulate it to do other things.

  13. function get_midnight($timestamp)
    {
      $day = date("j", $timestamp);
      $month = date("F", $timestamp);
      $year = date("Y", $timestamp);
    
      $midnight = strtotime("$month $day $year");
    
      return $midnight;
    }

     

    vs.

     

      where `column` >= curdate()
    

     

    Good rule of thumb, the less code you have the easier it is to maintain as long as it's still readable, which it clearly is in this case.

     

     

    were you saying my code wasnt readable?

  14. It's best to leave logic like that within the database; however the OP's code doesn't do it as optimally as it could.

     

    It's always worth checking out the available functions in the documentation for this type of thing:

    http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html#function_curdate

     

    select ... where table.date_column >= CURDATE()

     

    I have to disagree ONLY because if you have the raw date format in the database, it's alot easier to figure out what kind of data you need by using php functions(alot friendlier and not as hard to figure out) and then search the db accordingly. But both ways work. It's driving stick vs driving manual.

  15. How much php do you know? Are you getting paid for this? If so, I think it's sad your company hired someone  and is paying them who doesnt know php basics.

     

    Is that really necessary?

     

    Also, by looking at the OP's posting history, it's pretty obvious that they're a student.

     

    1) yes, it was necessary. Whether he's a student or a professional, getting answers from other people is never a good thing.

     

    2) I dont check posters's history before commenting. If he's in class, he probably should've paid attention better.

     

    3) besides, I gave the solution. I'm allowed to give him a hard time.

×
×
  • 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.