Jump to content

jscix

Members
  • Posts

    197
  • Joined

  • Last visited

    Never

Posts posted by jscix

  1. if your wanting the file list to update without reloading the page, you'l need to use AJAX.

     

    You setup your script that reads the files to output them in html list format, and print them to the page.

     

    From your form, on submit, or whatever event handler you want -- make an ajax request to that script

  2. "There are alot of other languages where understanding OOP is really not the issue. C#, Java, Python, you are an Object Oriented Programmer weather you know it or not"

     

    Man, Wrong, wrong, wrong!

     

     

    Programming in an OOP Language does NOT equal programming in an OOP Way!

     

    OOP is a methodology which requires alot of practice and thought to do correctly and efficiently.

  3. "OOP is just a bunch of methods (functions) and variables put in a single place.  Think about it like an fishtank or ecosystem of php code."

     

    So, totally, incorrect.

     

    OOP is a methodology for implementing functionality in a conceptual way.  It enables you program in the terms of your problem by separating design and implementation. It also allows for ease of re-use, redesign and distributed development.

     

    One of the best books I've ever read on OOP/OOD is: http://books.google.com/books?id=FnNqkN17kDYC

     

    Totally free online. Enjoy!

  4. <?php
    
    INCLUDE "connect.php";
    
    $host = "host";
    $database = "database";
    $user = "user";
    // I changed these for the post, they're right in my script
    $pass = "pass";
    
    ConnectToDatabase($database, $user, $pass, $host);
    
    $query = "SELECT user, pass FROM users WHERE `user` = '$typed_user'";
    $result = mysql_query($query);
    
    $row = mysql_fetch_array($result);
    
    $database_user == $row['user'];
    echo($database_user);
    print "hello, why don't you login? <br />";
    ?>
    
    <!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>Login</title>
    </head>
    
    <body>
    <form id="login" name="login" method="post" action="login.php">
    <label>
    User
    <input type="text" name="user" id="user" />
    </label>
    <p>
    Password
    <input type="password" name="pass" id = "pass"  />
    </p>
    <input type="submit" id="submit" name="sumbit" />
    </form>
    </body>
    </html>
    
    
    <?php
    if ($typed_user == $database_user) {
        echo('Worked!');
    } else {
        echo(' Didn\'t Work!');
    }
    ?>
    

  5. <?php
    
    $database =  "xxx";
    $dbconnect = mysql_pconnect('localhost','xxx','xxx');
    mysql_select_db($database, $dbconnect);
    $query = "select * FROM `products` WHERE `active`='Yes'";
    $result = mysql_query($query, $dbconnect);
    
    while ($line = mysql_fetch_assoc($result)) {
        $return[] = $line;
    }
    
    $query2 = mysql_query($query);
    $seen = array();
    
    $size2 = sizeof($seen);
    $numberz = $size2;
    
    while ($row = mysql_fetch_array($result)) {
        $cats = explode("|",$row['cats']);
        $main_cat = $cats[$numberz];
        if (!in_array($main_cat,$seen) && !in_array($main_cat,$multiple)) {
            array_push($seen,$main_cat);
        } else {
            array_push($multiple,$main_cat);
            unset($seen[$main_cat]);
        }
    }
    $size = sizeof($seen);
    for ($i=0; $i<=$size; $i++) {
        $product_type = $seen[$i];
    }
    $output = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
    
    <rss version =\"2.0\" xmlns:g=\"http://base.google.com/ns/1.0\">
    <channel>
    <title>GS Wholesale</title>
    <description>Your Consumer Electronics and More Store!</description>
    <link>http://GSWholesale.com</link>";
    
    foreach($return as $line)
    {
        $output .= "<item><title>".htmlentities($line['man'])." ".htmlentities($line['mod'])." ".htmlentities($line['name'])."</title>
    
    <g:brand>".htmlentities($line['mod'])."</g:brand>
    <g:condition>new</g:condition>
    <g:description>".htmlentities($line['specs']).". About the manufacturer ".htmlentities($line['man'])." ".htmlentities($line['full'])."</g:description>
    <g:model_number>".htmlentities($line['mod'])."</g:model_number>
    <g:id>".htmlentities($line['mod'])."</g:id>
    <g:image_link>".htmlentities($line['img_url'])."</g:image_link>
    <g:pickup>true</g:pickup>
    <g:link>http://GSWholesale.com/product.php?id=".htmlentities($line['mod'])."</g:link>
    <g:mpn>".htmlentities($line['mod'])."</g:mpn>
    <g:price>".htmlentities($line['price'])."</g:price>
    <g:product_type>".$product_type."</g:product_type>
    <g:upc>".htmlentities($line['upc'])."</g:upc>
    <g:quantity>1000</g:quantity>
    <g:payment_accepted>Google Checkout</g:payment_accepted>
    <g:payment_accepted>PayPal</g:payment_accepted>
    <g:payment_accepted>Visa</g:payment_accepted>
    <g:payment_accepted>Mastercard</g:payment_accepted>
    <g:payment_accepted>American Express</g:payment_accepted>
    <g:payment_accepted>Discover</g:payment_accepted>
    <g:payment_accepted>Cash</g:payment_accepted>
    <g:payment_accepted>Checks</g:payment_accepted>
    <g:payment_accepted>Cashiers Checks</g:payment_accepted>
    <g:payment_accepted>Money Orders</g:payment_accepted>
    <g:payment_accepted>Wire Transfer</g:payment_accepted>
    </item>";
    }
    $output .= "</channel></rss>";
    header("Content-Type: application/rss+xml");
    echo $output;
    ?>
    

     

     

    you were trying to use mysql_fetch_row, on a query string. not an actual query. I doubt this alone will fix your issue. but good luck.

  6. Your problem is either:

     

    a.) a session value is not getting assigned, you are forgetting to start_session.

     

    b.)

     

    		$row = mysql_fetch_assoc($result);
    		 if($row['rank'] == 1)
    		{
    			//set the session and redirect user
    			$_SESSION['registered'] = TRUE;
    			include('info.php');			
    		}else{
    			//tell the user the account isn't activated if their rank is 0
    			echo "Your account is not activated";
    		}
    

     

    This code right here is not being satisfied correct. Eg: Your db value for 'rank' is not set, or not '1'.

     

    Thus when,

     

    if(isset($_SESSION['registered']) || isset($_SESSION['member']) || isset($_SESSION['moderator']) || isset($_SESSION['admin'])){
    

     

    Is executed, it is going to return false and return the login form.

     

    hope that helps.

  7. I'm curious if anyone knows of any reason why persisting an object in a session could be a bad idea?

     

    Besides memory usage, and if anyone can answer this, how much memory usage would I be looking at by storing an object in a session?

    The object is merely a storehouse for user related data. (name, address, phone#, etc.)

     

    It also contains a few methods for manipulating that data..

     

    Thanks in advance.

  8. I'm curious if anyone knows of any reason why persisting an object in a session could be a bad idea?

     

    Besides memory usage, and if anyone can answer this, how much memory usage would I be looking at by storing an object in a session?

    The object is merely a storehouse for user related data. (name, address, phone#, etc.)

     

    It also contains a few methods for manipulating that data..

     

    Thanks in advance.

  9. Well I have to say, PHP does not have quite the power of C++, or C#/Java or what have you.. but is by no means a 'toy language'..  I actually enjoy coding in multiple languages, because each has it's own uses and strengths/weaknesses.

     

    That guy is obviously a tool.

     

    :)

  10. I've got a spidering script, that indexes a websites contents.. it works beautifully on smaller sites, however when crawling large sites that take a good amount of time.. the script seems to just randomly stop. I've actually seen it complete a full crawl of a large site, but 95% (estimate) of the time, it will stop indexing and just quit.

     

    I have already added,

    set_time_limit(3600);
    ini_set('max_execution_time', 3600);
    

     

    I don't know what else could be causing it. If anyone has some suggestions, I'd be open to hear them.

     

    Thanks  :)

  11. I hope this is for legit purposes  >:(

     

    <?php
    $con = mysql_connect("******","******","******") or die('Could not connect: ' . mysql_error());
    mysql_select_db("login", $con);
    
    $result = mysql_query("SELECT * FROM subscribe");
    
    if (!is_array($result)) { die("Result returned non-array"); }
    while($row = mysql_fetch_array($result))
      {
    $emails .= ($row['email'] . ",");
      }
    
    print ($emails);
    mysql_close($con);
    ?>
    

  12. <?php
    $con = mysql_connect("******","******","******") or die('Could not connect: ' . mysql_error());
    mysql_select_db("login", $con);
    
    $result = mysql_query("SELECT * FROM subscribe");
    
    if (!is_array($result)) { die("Result returned non-array"); }
    while($row = mysql_fetch_array($result))
      {
    print ($row['email'] . "<br>");
      }
    mysql_close($con);
    ?>
    

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