User Profile

Collapse

Profile Sidebar

Collapse
dgourd
dgourd
Last Activity: Jan 13 '14, 04:26 AM
Joined: Apr 14 '10
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • dgourd
    started a topic FTP vs. HTTP file upload limit
    in PHP

    FTP vs. HTTP file upload limit

    I want to include a file upload script on my website. The FTP max file size is unlimited, but the HTTP max file size is lower than the files I want to upload.

    Would using the PHP FTP functions with a file upload form get around this problem, or will it still use HTTP to upload the file to the temporary directory.
    See more | Go to post

  • dgourd
    replied to PHP and AJAX Session not persisting.
    in PHP
    I solved the problem. I have a header.php file that is included at the top of every page. I did a check to see if one of the sessions was set. If it wasn't, I explicitly set it to NULL.

    Code:
    if (!isset($_SESSION['id'])) {
        $_SESSION['id'] = NULL;
        $_SESSION['f_name'] = NULL;
        $_SESSION['l_name'] = NULL;
        $_SESSION['username'] = NULL;
        $_SESSION['status'] = NULL;
    }
    See more | Go to post

    Leave a comment:


  • What you have to do is include the javascript file, preferably between the <head></head> tags. Then you would set the onclick to the function. For example,
    Code:
    <head>
        <script language="javascript" src="path/to/external.js"></script>
    </head>
    <body>
        <img src="path/to/image.gif" onclick="function_name()" />
    </bo
    ...
    See more | Go to post

    Leave a comment:


  • dgourd
    replied to PHP and AJAX Session not persisting.
    in PHP
    So I used the same php code, modified a little bit to format correctly but basically the same, and took out the AJAX function. The same problem still occurs so I am sure something is wrong with my login.php, but I don't know what.
    See more | Go to post

    Leave a comment:


  • dgourd
    replied to PHP and AJAX Session not persisting.
    in PHP
    Thanks for the response oranoos3000,
    1. I did use session_start() on line 3 of login.php
    2. I dont understand what you mean by 'appropriate part'. I made login.php echo back the html and the AJAX function uses innerHTML to put the response on the page.


    I did do an echo "$_SESSION['username']"; statement before and at the end of the AJAX function, it would return the correct variable, so I know that the session was set....
    See more | Go to post

    Leave a comment:


  • dgourd
    started a topic PHP and AJAX Session not persisting.
    in PHP

    PHP and AJAX Session not persisting.

    I have a a PHP script that does all the logging in and creating session. I also have some javascript that uses AJAX to make a request to the PHP script and return the response. The problem I run into is that the session is being set, but as soon as I go to a different page or refresh, the session data goes away. Here are my scripts:

    login.php:
    Code:
    <?php
    
        session_start();
        
        // Initializing
    ...
    See more | Go to post

  • dgourd
    replied to JavaScript Style.display not working
    Wow. I completely looked that one over. Thanks a lot dude.
    See more | Go to post

    Leave a comment:


  • dgourd
    started a topic JavaScript Style.display not working

    JavaScript Style.display not working

    I cant get the style.display property to work properly. I have this test html page:
    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>Test
    ...
    See more | Go to post

  • dgourd
    replied to MYSQL Update Query Syntax
    in PHP
    I fooled around with it and this finally worked:
    Code:
    $q = "UPDATE debator SET points = '$points', win = '$win', loss = '$loss', aff_win = '$aff_win', aff_loss = '$aff_loss', neg_win = '$neg_win', neg_loss = '$neg_loss', aspeaks = '$aspeaks', aff_aspeaks = '$aff_aspeaks', neg_aspeaks = '$neg_aspeaks' WHERE name = '$name'";
    Thanks for your help dlite. Simplifying it really helped.
    See more | Go to post

    Leave a comment:


  • dgourd
    replied to MYSQL Update Query Syntax
    in PHP
    Thanks for the help. I changed them all to shorter variables and created this query.
    Code:
    $q = "UPDATE debator SET points = $points, win = $win, loss = $loss, aff_win = $aff_win, aff_loss = $aff_loss, neg_win = $neg_win, neg_loss = $neg_loss, aspeaks = $aspeaks, aff_aspeaks = $aff_aspeaks, neg_aspeaks = $neg_aspeaks WHERE name = '$name';";
    I removed the single quotes around everything except for $name since they are all integers....
    See more | Go to post

    Leave a comment:


  • dgourd
    started a topic MYSQL Update Query Syntax
    in PHP

    MYSQL Update Query Syntax

    I am trying to run a really long Update query for my mysql database, but I keep getting a syntax error.
    Code:
    $q = "UPDATE debator SET points = '" . mysqli_real_escape_string($link, $v[$POINTS]) . "', win = '" . mysqli_real_escape_string($link, $v[$WIN]) . "', loss = '" . mysqli_real_escape_string($link, $v[$LOSS]) . "', aff_win = '" .  mysqli_real_escape_string($link, $v[$AFF_WIN]) . "', aff_loss = '"
    ...
    See more | Go to post

  • dgourd
    replied to file_get_contents() not showing new lines
    in PHP
    I am uploading the data through a form. I found by using this:
    Code:
    $data = file($_FILES["file"]["tmp_name"], FILE_USE_INCLUDE_PATH | FILE_IGNORE_NEW_LINES);
    It returns the data as an array with each new line as a separate array entry. Thanks for your help though.
    See more | Go to post

    Leave a comment:


  • dgourd
    started a topic file_get_contents() not showing new lines
    in PHP

    file_get_contents() not showing new lines

    I am trying to parse certain excel sheets. I converted them to csv files to strip out any excess formatting. To parse these files, my system is dependant on new lines ("/n"). I use this code to get the data from the uploaded csv file:

    Code:
    $data = file_get_contents($_FILES["file"]["tmp_name"], FILE_USE_INCLUDE_PATH);
    The problem is that any of the new lines in the csv show up as single spaces...
    See more | Go to post

  • dgourd
    replied to INSERT MySQL query always causing an error.
    in PHP
    Thank you very much. I was putting the single quotes on the column names instead of the values.
    See more | Go to post

    Leave a comment:


  • dgourd
    replied to about session cookies and cookies and session
    in PHP
    Let me just add the differences between cookies, sessions, and session cookie's.

    COOKIES
    Whenever you create a cookie, a file on the person's computer is made to hold all the information and data you want to carryover. This is very useful since it doesn't take up space on your server. Your site can only access the cookies that originated from your site.

    SESSIONS
    Sessions are like cookies in that they hold the...
    See more | Go to post

    Leave a comment:


  • dlite's explanation was very good. Especially his explanation of the differences between Java, Javascript, Ajax, server-side languages, and client-side languages. These are important concepts.

    However, it might be a daunting task for you to have to learn a new language, Javascript, since you stated your problem is urgent. To get around the refreshing problem and having to learn javascript, there is a little trick I picked up a while...
    See more | Go to post

    Leave a comment:


  • Normally to do this you would have to send a header, but headers must always be sent before anything else to the browser or you will get an error. To fix this, I create an output buffer at the beginning of my script and flush the data at the end. This buffer only sends the data to the browser once you flush the data. This allows any headers to be sent before anything and avoid any errors. So you want to do this first:

    Code:
    // Create
    ...
    See more | Go to post

    Leave a comment:


  • dgourd
    started a topic INSERT MySQL query always causing an error.
    in PHP

    INSERT MySQL query always causing an error.

    I am trying to create a registering script, but everytime I try to insert the data into my database i get an error.

    Code:
    $query = "INSERT INTO members (username, pass, email, first_name, last_name) VALUES ($username, $password, $email, $f_name , $l_name);";
    $q = mysqli_real_query($dbc, $query);
    if($q) {
        // My code goes here
    } else {
        // Display an error
    }
    ...
    See more | Go to post

  • dgourd
    replied to Content within a while loop isn't echoing
    in PHP
    Changed that too. When I changed the if to a while I forgot about that. Thanks for pointing it out...
    See more | Go to post

    Leave a comment:


  • dgourd
    replied to Content within a while loop isn't echoing
    in PHP
    I edited my post to reflect the correction. Thanks for pointing it out!...
    See more | Go to post

    Leave a comment:

No activity results to display
Show More
Working...