Jump to content

biscoe916

Members
  • Posts

    17
  • Joined

  • Last visited

    Never

Everything posted by biscoe916

  1. Thanks for the advice, but i already have a column that is set to primary and auto increment. Here is my table: imgid int(11) auto_increment Primary userid int(11) sixfourdata longtext
  2. Ok so i made a little upload image app, and it works great if there isn't already a picture in the database, otherwise it will just keep putting the same picture into the database over and over, regardless of what picture i choose from my harddrive...... For example: The table is empty with no pictures in it, so i upload image1.jpg. My program then encodes it then stores it into the database. Then I upload image2.jpg it seems to work ok but when i check the database there are just two instances of the first image. This keep going on and on no matter how many different pictures i upload... Just copies the first one over and over. Here is my code: <?php include("auth.php"); // uploadimg.php // By Tyler Biscoe // 09 Mar 2008 // Test file for image uploades include("connect.php"); include("include/header.php"); $max_file_size = 786432; $max_kb = $max_file_size/1024; if($_POST["imgsubmit"]) { if($_FILES["file"]["size"] > $max_file_size) { $error = "Error: File size must be under ". $max_kb . " kb."; } if (!($_FILES["file"]["type"] == "image/gif") && !($_FILES["file"]["type"] == "image/jpeg") && !($_FILES["file"]["type"] == "image/pjpeg")) { $error .= "Error: Invalid file type. Use gif or jpg files only."; } if(!$error) { echo "<div id='alertBox'> Image has been successfully uploaded! </div>"; $handle = fopen($_FILES["file"]["tmp_name"],'r'); $file_content = fread($handle,$_FILES["file"]["size"]); fclose($handle); $encoded = chunk_split(base64_encode($file_content)); $id = $_POST["userid"]; echo $_FILES["file"]["tmp_name"]; $default_exist_sql = "SELECT * FROM members WHERE id='".$id."'"; $default_result = mysql_query($default_exist_sql); $results = mysql_fetch_array($default_result); if(!$results["default_image"]) { $insert_sql = "UPDATE members SET default_image = '$encoded' WHERE id='". $id ."'"; mysql_query($insert_sql); } $sql = "INSERT INTO images (userid, sixfourdata) VALUES ('$id','$encoded')"; mysql_query($sql); } else { echo "<div id='alertBox'>". $error . "</div>"; } } ?> <br /> <font class="heading"> Upload images </font> <br /><br /> <form enctype = "multipart/form-data" action = "<?php $_SERVER['PHP_SELF']; ?>" method = "post" name = "uploadImage"> <input type = "hidden" name="userid" value = "<?php echo $_GET["userid"]; ?>" > <input id="stextBox" type="file" name="file" size="35"><br /> <input type="submit" name="imgsubmit" value="Upload"> </form> <?php include("include/footer.php"); ?> So frustrating!!
  3. Problem solved. Thanks alot for the help!
  4. But what if someone actually wanted to put slashes in their post... Would that remove the intentional ones as well?
  5. I have a little message board app. It works ok but for some reason PHP is adding slashes before certain punctuation.... Why? And how do i stop this? So if i were to type this into the form: Hi I'm tired. It would be displayed on the page(and entered into the database) as: Hi I\'m tired. How can i fix this. Is the fact that im using: mysql_real_escape_string(); the problem?
  6. session_start() is called in a seperate file called auth.php which is called on the top of all pages(except logout.php).
  7. Here is my code: <?php // Logout.php // By Tyler Biscoe // 08 Mar 2008 // This file logs the user out... include("include/header.php"); session_destroy(); ?> <div id="alertBox"> Logged out successfully!<br> <a href="index.php"> Redirecting... </a> </div> <meta http-equiv="REFRESH" content="5;url=http://www.tylerbiscoe.com/blackbook/"> <?php include("include/footer.php"); ?> It won't log the user out and i get this error message: Warning: session_destroy() [function.session-destroy]: Trying to destroy uninitialized session in /home/2212/domains/tylerbiscoe.com/html/blackbook/logout.php on line 7 I don't get it, because I know there is a session registered... Why does it say its uninitialized...?
  8. I realized that i forgot to put session_destroy() if the user wasn't activated yet.
  9. I wrote a script to authorize users upon entry to my website. It works perfectly, but i was wondering if you guys could take a look at my code to see if there are any security holes. Code: <?php session_start(); header("Cache-control: private"); include("connect.php"); if(!$_SESSION["username"] && !$_POST["loginsubmit"]) { echo "Please log in"; ?> <form class="memberform" name="login_form" method="post" action="<?php $_SERVER['PHP_SELF']; ?>"> Username: <input id="stextBox" type="text" name="username" /> <br /> Password: <input id="stextBox" type="password" name="password" /> <br /> <input type="submit" name="loginsubmit" value="Submit" /> </form> <?php exit; } if($_POST["loginsubmit"]) { $username = $_POST["username"]; $password = md5($_POST["password"]); $sql = "SELECT * FROM users WHERE username='". $username ."' AND password='". $password ."'"; $result = mysql_query($sql); $num = mysql_num_rows($result); if($num < 1) { session_destroy(); echo "Invalid username and/or password."; exit; } else { session_register("username"); session_register("password"); $records = mysql_fetch_array($result); if($records["active"] != 1) { session_destroy(); echo "Sorry ". $records["fname"]. " you're account hasn't been activated yet."; exit; } } } // if form submitted ?>
  10. Problem solved. The unique id in the database table wasn't set to auto_increment.
  11. I made this simple app that lets users add information on a person, then review it. User enters info in a form, presses submit, then the info is put into the database. It was working perfectly then i made some small changes to things that shouldn't have affected this function in any way... But now it doesn't work.... Here's the code. The form page: <?php //addmem.php //-------------------------------------------- // by ----- // 04 Mar 2008 // This file will handle the adding of members //-------------------------------------------- include("include/header.php"); include("include/classy.php"); ?> <a href="addmem.php"> Add family member </a> | <a href="viewfamily.php">View family members</a><br /><hr /> <?php // If form was submitted execute the following code. if($_POST['submit']) { // This statement checks to make sure the required information was entered into the form. if(!$_POST['fname'] || !$_POST['lname'] || !$_POST['birthmonth'] || !$_POST['birthday'] || !$_POST['birthyear']) { $error = "You didn't enter the required information, please try again."; echo "<div id='alertBox' >".$error."</div>"; } else // Executes if all the required information was, in fact, entered by the user. { // Calls file which connects us to the DB. include("connect.php"); // Turns the information that was entered by the user into variables that mysql and php can work with $fname = mysql_real_escape_string($_POST['fname']); $mname = mysql_real_escape_string($_POST['mname']); $lname = mysql_real_escape_string($_POST['lname']); $suffix = mysql_real_escape_string($_POST['suffix']); $birthmonth = mysql_real_escape_string($_POST['birthmonth']); $birthday = mysql_real_escape_string($_POST['birthday']); $birthyear = mysql_real_escape_string($_POST['birthyear']); $deathmonth = mysql_real_escape_string($_POST['deathmonth']); $deathday = mysql_real_escape_string($_POST['deathday']); $deathyear = mysql_real_escape_string($_POST['deathyear']); $about = mysql_real_escape_string($_POST['about']); // The following code will convert the dates into a specific format which I chose to use for the mysql database. // yyyy-mm-dd // The code for the function used here can be found in: classy.php $birthdate = convertDate($birthmonth, $birthday, $birthyear); $deathate = convertDate($deathmonth, $deathday, $deathyear); addMember($fname,$mname,$lname,$suffix,$birthdate,$deathdate,$about); } // End if(!formelements) { ... } } // End if(Post) { ... } ?> <form action="addmem.php" method="post" name="addmember" class="memberform"> First Name: <input id="stextBox" name="fname" type="text" size="30" maxlength="30"> <br> Middle Name: <input id="stextBox" name="mname" type="text" size="30" maxlength="30"> <br> Last Name: <input id="stextBox" name="lname" type="text" size="30" maxlength="30"> <br> Suffix: <input id="stextBox" name="suffix" type="text" size="10" maxlength="30"> <font class="comment"> (i.e. Jr., Sr., II.)</font> <br> Birth Date: <select id="stextBox" name="birthmonth" > <option></option> <option>Jan.</option> <option>Feb.</option> <option>Mar.</option> <option>Apr.</option> <option>May</option> <option>Jun.</option> <option>Jul.</option> <option>Aug.</option> <option>Sep.</option> <option>Oct.</option> <option>Nov.</option> <option>Dec.</option> </select> <select id="stextBox" name="birthday" > <option></option> <option>01</option> <option>02</option> <option>03</option> <option>04</option> <option>05</option> <option>06</option> <option>07</option> <option>08</option> <option>09</option> <option>10</option> <option>11</option> <option>12</option> <option>13</option> <option>14</option> <option>15</option> <option>16</option> <option>17</option> <option>18</option> <option>19</option> <option>20</option> <option>21</option> <option>22</option> <option>23</option> <option>24</option> <option>25</option> <option>26</option> <option>27</option> <option>28</option> <option>29</option> <option>30</option> <option>31</option> </select> <select id="stextBox" name="birthyear" > <option></option> <option>1801</option> <option>1802</option> <option>1803</option> <option>1804</option> <option>1805</option> <option>1806</option> <option>1807</option> <option>1808</option> <option>1809</option> <option>1810</option> <option>1811</option> <option>1812</option> <option>1813</option> <option>1814</option> <option>1815</option> <option>1816</option> <option>1817</option> <option>1818</option> <option>1819</option> <option>1820</option> <option>1821</option> <option>1822</option> <option>1823</option> <option>1824</option> <option>1825</option> <option>1826</option> <option>1827</option> <option>1828</option> <option>1829</option> <option>1830</option> <option>1831</option> <option>1832</option> <option>1833</option> <option>1834</option> <option>1835</option> <option>1836</option> <option>1837</option> <option>1838</option> <option>1839</option> <option>1840</option> <option>1841</option> <option>1842</option> <option>1843</option> <option>1844</option> <option>1845</option> <option>1846</option> <option>1847</option> <option>1848</option> <option>1849</option> <option>1850</option> <option>1851</option> <option>1852</option> <option>1853</option> <option>1854</option> <option>1855</option> <option>1856</option> <option>1857</option> <option>1858</option> <option>1859</option> <option>1860</option> <option>1861</option> <option>1862</option> <option>1863</option> <option>1864</option> <option>1865</option> <option>1866</option> <option>1867</option> <option>1868</option> <option>1869</option> <option>1870</option> <option>1871</option> <option>1872</option> <option>1873</option> <option>1874</option> <option>1875</option> <option>1876</option> <option>1877</option> <option>1878</option> <option>1879</option> <option>1880</option> <option>1881</option> <option>1882</option> <option>1883</option> <option>1884</option> <option>1885</option> <option>1886</option> <option>1887</option> <option>1888</option> <option>1889</option> <option>1890</option> <option>1891</option> <option>1892</option> <option>1893</option> <option>1894</option> <option>1895</option> <option>1896</option> <option>1897</option> <option>1898</option> <option>1899</option> <option>1901</option> <option>1902</option> <option>1903</option> <option>1904</option> <option>1905</option> <option>1906</option> <option>1907</option> <option>1908</option> <option>1909</option> <option>1910</option> <option>1911</option> <option>1912</option> <option>1913</option> <option>1914</option> <option>1915</option> <option>1916</option> <option>1917</option> <option>1918</option> <option>1919</option> <option>1920</option> <option>1921</option> <option>1922</option> <option>1923</option> <option>1924</option> <option>1925</option> <option>1926</option> <option>1927</option> <option>1928</option> <option>1929</option> <option>1930</option> <option>1931</option> <option>1932</option> <option>1933</option> <option>1934</option> <option>1935</option> <option>1936</option> <option>1937</option> <option>1938</option> <option>1939</option> <option>1940</option> <option>1941</option> <option>1942</option> <option>1943</option> <option>1944</option> <option>1945</option> <option>1946</option> <option>1947</option> <option>1948</option> <option>1949</option> <option>1950</option> <option>1951</option> <option>1952</option> <option>1953</option> <option>1954</option> <option>1955</option> <option>1956</option> <option>1957</option> <option>1958</option> <option>1959</option> <option>1960</option> <option>1961</option> <option>1962</option> <option>1963</option> <option>1964</option> <option>1965</option> <option>1966</option> <option>1967</option> <option>1968</option> <option>1969</option> <option>1970</option> <option>1971</option> <option>1972</option> <option>1973</option> <option>1974</option> <option>1975</option> <option>1976</option> <option>1977</option> <option>1978</option> <option>1979</option> <option>1980</option> <option>1981</option> <option>1982</option> <option>1983</option> <option>1984</option> <option>1985</option> <option>1986</option> <option>1987</option> <option>1988</option> <option>1989</option> <option>1990</option> <option>1991</option> <option>1992</option> <option>1993</option> <option>1994</option> <option>1995</option> <option>1996</option> <option>1997</option> <option>1998</option> <option>1999</option> <option>2000</option> <option>2001</option> <option>2002</option> <option>2003</option> <option>2004</option> <option>2005</option> <option>2006</option> <option>2007</option> <option>2008</option> </select> <br> Date of Death: <select id="stextBox" name="deathmonth" > <option></option> <option>Jan.</option> <option>Feb.</option> <option>Mar.</option> <option>Apr.</option> <option>May</option> <option>Jun.</option> <option>Jul.</option> <option>Aug.</option> <option>Sep.</option> <option>Oct.</option> <option>Nov.</option> <option>Dec.</option> </select> <select id="stextBox" name="deathday" > <option></option> <option>1</option> <option>2</option> <option>3</option> <option>4</option> <option>5</option> <option>6</option> <option>7</option> <option>8</option> <option>9</option> <option>10</option> <option>11</option> <option>12</option> <option>13</option> <option>14</option> <option>15</option> <option>16</option> <option>17</option> <option>18</option> <option>19</option> <option>20</option> <option>21</option> <option>22</option> <option>23</option> <option>24</option> <option>25</option> <option>26</option> <option>27</option> <option>28</option> <option>29</option> <option>30</option> <option>31</option> </select> <select id="stextBox" name="deathyear" > <option selected></option> <option>1801</option> <option>1802</option> <option>1803</option> <option>1804</option> <option>1805</option> <option>1806</option> <option>1807</option> <option>1808</option> <option>1809</option> <option>1810</option> <option>1811</option> <option>1812</option> <option>1813</option> <option>1814</option> <option>1815</option> <option>1816</option> <option>1817</option> <option>1818</option> <option>1819</option> <option>1820</option> <option>1821</option> <option>1822</option> <option>1823</option> <option>1824</option> <option>1825</option> <option>1826</option> <option>1827</option> <option>1828</option> <option>1829</option> <option>1830</option> <option>1831</option> <option>1832</option> <option>1833</option> <option>1834</option> <option>1835</option> <option>1836</option> <option>1837</option> <option>1838</option> <option>1839</option> <option>1840</option> <option>1841</option> <option>1842</option> <option>1843</option> <option>1844</option> <option>1845</option> <option>1846</option> <option>1847</option> <option>1848</option> <option>1849</option> <option>1850</option> <option>1851</option> <option>1852</option> <option>1853</option> <option>1854</option> <option>1855</option> <option>1856</option> <option>1857</option> <option>1858</option> <option>1859</option> <option>1860</option> <option>1861</option> <option>1862</option> <option>1863</option> <option>1864</option> <option>1865</option> <option>1866</option> <option>1867</option> <option>1868</option> <option>1869</option> <option>1870</option> <option>1871</option> <option>1872</option> <option>1873</option> <option>1874</option> <option>1875</option> <option>1876</option> <option>1877</option> <option>1878</option> <option>1879</option> <option>1880</option> <option>1881</option> <option>1882</option> <option>1883</option> <option>1884</option> <option>1885</option> <option>1886</option> <option>1887</option> <option>1888</option> <option>1889</option> <option>1890</option> <option>1891</option> <option>1892</option> <option>1893</option> <option>1894</option> <option>1895</option> <option>1896</option> <option>1897</option> <option>1898</option> <option>1899</option> <option>1901</option> <option>1902</option> <option>1903</option> <option>1904</option> <option>1905</option> <option>1906</option> <option>1907</option> <option>1908</option> <option>1909</option> <option>1910</option> <option>1911</option> <option>1912</option> <option>1913</option> <option>1914</option> <option>1915</option> <option>1916</option> <option>1917</option> <option>1918</option> <option>1919</option> <option>1920</option> <option>1921</option> <option>1922</option> <option>1923</option> <option>1924</option> <option>1925</option> <option>1926</option> <option>1927</option> <option>1928</option> <option>1929</option> <option>1930</option> <option>1931</option> <option>1932</option> <option>1933</option> <option>1934</option> <option>1935</option> <option>1936</option> <option>1937</option> <option>1938</option> <option>1939</option> <option>1940</option> <option>1941</option> <option>1942</option> <option>1943</option> <option>1944</option> <option>1945</option> <option>1946</option> <option>1947</option> <option>1948</option> <option>1949</option> <option>1950</option> <option>1951</option> <option>1952</option> <option>1953</option> <option>1954</option> <option>1955</option> <option>1956</option> <option>1957</option> <option>1958</option> <option>1959</option> <option>1960</option> <option>1961</option> <option>1962</option> <option>1963</option> <option>1964</option> <option>1965</option> <option>1966</option> <option>1967</option> <option>1968</option> <option>1969</option> <option>1970</option> <option>1971</option> <option>1972</option> <option>1973</option> <option>1974</option> <option>1975</option> <option>1976</option> <option>1977</option> <option>1978</option> <option>1979</option> <option>1980</option> <option>1981</option> <option>1982</option> <option>1983</option> <option>1984</option> <option>1985</option> <option>1986</option> <option>1987</option> <option>1988</option> <option>1989</option> <option>1990</option> <option>1991</option> <option>1992</option> <option>1993</option> <option>1994</option> <option>1995</option> <option>1996</option> <option>1997</option> <option>1998</option> <option>1999</option> <option>2000</option> <option>2001</option> <option>2002</option> <option>2003</option> <option>2004</option> <option>2005</option> <option>2006</option> <option>2007</option> <option>2008</option> </select> <font class="comment"> (Note: Leave blank if they are still alive.)</font><br> <br> Tell us a little about Him/Her: <br> <textarea id="stextBox" name="about" cols="65" rows="10"></textarea> <br> <input name="submit" type="submit" value="Submit"> <input name="reset" type="reset" value="Reset"> </form> <?php include("include/footer.php"); ?> The Functions include file: <?php // classy.php // Author: ------ // Date: 02 March 2008 // = Description ============================= // This file houses several classes/functions // that will run ------ // =========================================== // Convertes dates for the mysql database. // $bm = birthmonth, $bd = birthday, $by = birthyear function convertDate($bm, $bd, $by) { switch ($bm) { case "Jan.": $bm = "01"; $birthdate = $by."-".$bm."-".$bd; break; case "Feb.": $bm = "02"; $birthdate = $by."-".$bm."-".$bd; break; case "Mar.": $bm = "03"; $birthdate = $by."-".$bm."-".$bd; break; case "Apr.": $bm = "04"; $birthdate = $by."-".$bm."-".$bd; break; case "May": $bm = "05"; $birthdate = $by."-".$bm."-".$bd; break; case "Jun.": $bm = "06"; $birthdate = $by."-".$bm."-".$bd; break; case "Jul.": $bm = "07"; $birthdate = $by."-".$bm."-".$bd; break; case "Aug.": $bm = "08"; $birthdate = $by."-".$bm."-".$bd; break; case "Sep.": $bm = "09"; $birthdate = $by."-".$bm."-".$bd; break; case "Oct.": $bm = "10"; $birthdate = $by."-".$bm."-".$bd; break; case "Nov.": $bm = "11"; $birthdate = $by."-".$bm."-".$bd; break; case "Dec.": $bm = "12"; $birthdate = $by."-".$bm."-".$bd; break; } // End Switch statement return $birthdate; } // End function convertDate // This function adds members....... function addMember($fn, $mn, $ln, $su, $bd, $dd, $ab) { $query = mysql_query("INSERT INTO members (fname, mname, lname, suffix, birth, death, about) VALUES ('$fn','$mn','$ln','$su','$bd','$dd','$ab')"); echo "<div id='alertBox' > Family Member has been added! </div>"; } ?> When i try it out i know it calls the function cause it prints "Family Member has been added!", but it doesn't get added to the database. I'm thinking that for this reason it must be a problem in the SQL however, i haven't changed it a bit since i got it working the first time.... Thanks
  12. That fixed it, thanks allot! Really appreciate the help.
  13. Ok i added: exit("<PRE>\n\nThe number of lines: ".sizeof(lines)."\n\n</PRE>"); And it returned: 1 Then i switched the loop i was using to the one you suggested. And then i added a script to show which records were being added and which were not. The records in green were successfully added, while the ones in red were not. Please go see for yourself: http://www.tylerbiscoe.com/phptest/feedinject.php Oh and as you can see from the code, i added TRUNCATE TABLE to the end so i wouldnt have to keep deleting the records and starting over.... That will obviously be removed later. Here is the code i am now using. <?php // File name: crzyfeedinject.php // Author: Tyler Biscoe // Date: 05 May 2007 // // Description: // This file loads the crazyforbargains.com datafeed, // and inserts the data into a database. // // Connect to the database and select database echo "Connecting to Database..."; include("include/connect.php"); // Load file and add it to the array $lines echo "Loading File..."; $lines = file('http://www.tylerbiscoe.com/phptest/datafeeds/products.txt'); echo "Done. <br /> <br />"; // Insert the data into the database echo "Inserting Data... <br />"; // Loop through the results and add each items information into the database. foreach ($lines as $line) { $element = explode("|", $line); $vendor = $element[3]; $itemName = $element[1]; $itemNumber = $element[0]; $catergory = $element[21]; $spicture_url = $element[5]; $lpicture_url = $element[6]; $description = $element[11]; $price = $element[14]; $status = $element[18]; $link = $element[4]; $query = mysql_query("INSERT INTO items (id, name , catergory, spicture_url, lpicture_url, description, price, status, vendor, url) VALUES ('$itemNumber','$itemName','$catergory','$spicture_url','$lpicture_url','$description','$price','$status','$vendor','$link')"); if($query) { echo "<font color=#009900>".$line."</font><br /><br />"; } else { echo "<font color=#FF0000>".$line."</font><br /><br />"; } } echo "Done. <br /><br />"; echo "Process completed."; mysql_query("TRUNCATE TABLE items"); ?> Oh and i also got rid of one of the $lines = file('http://www.tylerbiscoe.com/phptest/datafeeds/products.txt'); I cant figure it out. Thanks for the help
  14. I'm having a problem adding records to my database. I have a file called products.txt, here are a few of the records so you guys know what im working with. 453786877|Splish Splash Duckie Pajamas for Girls, Toddlers, and Infants|5181|CrazyforBargains.com|http://www.shareasale.com/m-pr.cfm?merchantID=5181&userID=211655&productID=453786877|http://dts.ystoretools.com/1002/images/100x500/spspdupaforg.jpg|http://dts.ystoretools.com/1002/images/250x1000/spspdupaforg.jpg|12.99||Fashion|Girls|These adorable girl's pajamas feature a rubber duck print. They have short sleeves and button up the front of the top. The fabric is 50% cotton and 50% polyester. They should be worn snug fitting. These are excellent quality pajamas. These pajamas run small. We recommend purchasing one size larger than normal.|Clearance Section||24.00|||2007-03-26 11:45:02.320|instock|CrazyforBargains: Fun Family Sleepwear||Clearance Section|||| 453786879|Rudolph the Red Nosed Reindeer Pajamas for Kids, Toddlers, and Infants|5181|CrazyforBargains.com|http://www.shareasale.com/m-pr.cfm?merchantID=5181&userID=211655&productID=453786879|http://dts.ystoretools.com/1002/images/100x500/rurednorepaf.jpg|http://dts.ystoretools.com/1002/images/250x1000/rurednorepaf.jpg|24.00||Fashion|Girls|These adorable kid's pajamas feature a Rudolph the Red Nosed Reindeer print. They have long sleeves. The fabric is 50% cotton and 50% polyester. They should be worn snug fitting. These are excellent quality pajamas.|Girl's Sleepwear|Christmas Pajamas for Girls|24.00|||2007-03-09 23:38:47.140|instock|CrazyforBargains: Fun Family Sleepwear||Girl's Sleepwear|Christmas Pajamas for Girls||| 453786882|Lone Ranger Cotton Set for Boys, Toddlers, and Infants|5181|CrazyforBargains.com|http://www.shareasale.com/m-pr.cfm?merchantID=5181&userID=211655&productID=453786882|http://dts.ystoretools.com/1002/images/100x500/loracosetfor.gif|http://dts.ystoretools.com/1002/images/250x1000/loracosetfor.gif|21.99||Fashion|Boys|This adorable two-piece set features a Lone Ranger print. It comes complete with a coordinating mask. It has short sleeves and long pants. The fabric is 100% cotton and should be worn snug fitting. The mask should not be worn while the child is sleeping.|Clearance Section||28.00|||2007-03-26 11:45:02.320|instock|CrazyforBargains: Fun Family Sleepwear||Clearance Section|||| 454063058|Fun Boxers Feliz Navidad Christmas Boxer Shorts for Men|5181|CrazyforBargains.com|http://www.shareasale.com/m-pr.cfm?merchantID=5181&userID=211655&productID=454063058|http://dts.ystoretools.com/1002/images/100x500/funbofenachb.gif|http://dts.ystoretools.com/1002/images/250x1000/funbofenachb.gif|9.99||Fashion|Mens|These men's Christmas boxer shorts are Fun Boxers brand. The print features the words Feliz Navidad. The fabric is 100% cotton knit. The waistband is elastic.|Men's Boxer Shorts|Christmas Boxer Shorts|9.99|||2007-03-09 23:38:47.140|instock|CrazyforBargains: Fun Family Sleepwear||Men's Boxer Shorts|Christmas Boxer Shorts||| 454063059|Fun Boxers Have a Cool Yule Christmas Boxer Shorts for Men|5181|CrazyforBargains.com|http://www.shareasale.com/m-pr.cfm?merchantID=5181&userID=211655&productID=454063059|http://dts.ystoretools.com/1002/images/100x500/funbohacoyuc.gif|http://dts.ystoretools.com/1002/images/250x1000/funbohacoyuc.gif|9.99||Fashion|Mens|These men's Christmas boxer shorts are Fun Boxers brand. The print features Santas in sunglasses. The fabric is 100% cotton knit. The waistband is elastic.|Men's Boxer Shorts|Christmas Boxer Shorts|9.99|||2007-03-09 23:38:47.140|instock|CrazyforBargains: Fun Family Sleepwear||Men's Boxer Shorts|Christmas Boxer Shorts||| 454131196|Animal Cotton Toddler Pajamas for Boys|5181|CrazyforBargains.com|http://www.shareasale.com/m-pr.cfm?merchantID=5181&userID=211655&productID=454131196|http://dts.ystoretools.com/1002/images/100x500/ancotopaforb.gif|http://dts.ystoretools.com/1002/images/250x1000/ancotopaforb.gif|13.99||Fashion|Boys|These adorable 100% cotton pajamas are white and feature an animal print. They are meant to be snug fitting. These are excellent quality pajamas.|Toddler Boy Pajamas & Robes|Long Sleeved Cotton Toddler Pajamas|13.99|||2007-03-09 23:38:47.140|instock|CrazyforBargains: Fun Family Sleepwear||Toddler Boy Pajamas & Robes|Long Sleeved Cotton Toddler Pajamas||| 454131197|Ballerina Cotton Toddler Pajamas for Girls|5181|CrazyforBargains.com|http://www.shareasale.com/m-pr.cfm?merchantID=5181&userID=211655&productID=454131197|http://dts.ystoretools.com/1002/images/100x500/bacotopaforg.gif|http://dts.ystoretools.com/1002/images/250x1000/bacotopaforg.gif|13.99||Fashion|Girls|These adorable 100% cotton pajamas are white and feature a ballerina print. They are meant to be snug fitting. These are excellent quality pajamas.|Toddler Pajamas & Robes for Girls|Long Sleeved Cotton Pajamas|13.99|||2007-03-09 23:38:47.140|instock|CrazyforBargains: Fun Family Sleepwear||Toddler Pajamas & Robes for Girls|Long Sleeved Cotton Pajamas||| 454131202|Fish Slippers for Men and Women|5181|CrazyforBargains.com|http://www.shareasale.com/m-pr.cfm?merchantID=5181&userID=211655&productID=454131202|http://dts.ystoretools.com/1002/images/100x500/fislformenan.gif|http://dts.ystoretools.com/1002/images/250x1000/fislformenan.gif|18.99||Fashion|Boys|These adorable colorful fish slippers fit both women and men. These slippers cover the entire foot. The sole is made of one inch thick foam. They are a very fine quality slipper. Sizing: Large fits a women's size 10+ or a men's shoe size 9-11.|Men's Pajamas|Shop by Theme or Character Pajamas for Men|18.99|||2007-04-21 11:45:09.733|instock|CrazyforBargains: Fun Family Sleepwear||Men's Pajamas|Shop by Theme or Character Pajamas for Men||| 454255502|Rocket Cotton Pajamas for Toddler and Boys|5181|CrazyforBargains.com|http://www.shareasale.com/m-pr.cfm?merchantID=5181&userID=211655&productID=454255502|http://dts.ystoretools.com/1002/images/100x500/rocotopaforb.gif|http://dts.ystoretools.com/1002/images/250x1000/rocotopaforb.gif|13.99||Fashion|Boys|These adorable 100% cotton pajamas are blue and feature a rocket print. They are meant to be snug fitting. These are excellent quality pajamas.|Boy's Sleepwear & Pajamas|Long Sleeved Cotton Pajamas|13.99|||2007-03-09 23:38:47.140|instock|CrazyforBargains: Fun Family Sleepwear||Boy's Sleepwear & Pajamas|Long Sleeved Cotton Pajamas||| 454255505|Sports Cotton Pajamas for Toddler and Boys|5181|CrazyforBargains.com|http://www.shareasale.com/m-pr.cfm?merchantID=5181&userID=211655&productID=454255505|http://dts.ystoretools.com/1002/images/100x500/spcotopaforb.gif|http://dts.ystoretools.com/1002/images/250x1000/spcotopaforb.gif|13.99||Fashion|Boys|These adorable 100% cotton pajamas are green and feature a sports print. They are meant to be snug fitting. These are excellent quality pajamas.|Boy's Sleepwear & Pajamas|Long Sleeved Cotton Pajamas|13.99|||2007-03-09 23:38:47.140|instock|CrazyforBargains: Fun Family Sleepwear||Boy's Sleepwear & Pajamas|Long Sleeved Cotton Pajamas||| 454255508|Turtle Slippers for Men and Women|5181|CrazyforBargains.com|http://www.shareasale.com/m-pr.cfm?merchantID=5181&userID=211655&productID=454255508|http://dts.ystoretools.com/1002/images/100x500/tuslformenan.gif|http://dts.ystoretools.com/1002/images/250x1000/tuslformenan.gif|18.99||Fashion|Boys|These adorable turtle slippers fit both women and men. These slippers cover the entire foot. The sole is made of one inch thick foam. They are a very fine quality slipper. Sizing: Medium fits a women's shoe size 7-9 1/2.|Men's Pajamas|Gifts for Men: Bath Robes, Shower Wraps, Pajamas and Slippers|18.99|||2007-03-09 23:38:47.140|instock|CrazyforBargains: Fun Family Sleepwear||Men's Pajamas|Gifts for Men: Bath Robes, Shower Wraps, Pajamas and Slippers||| 454265555|Black Bear Paw Slippers for Men and Women|5181|CrazyforBargains.com|http://www.shareasale.com/m-pr.cfm?merchantID=5181&userID=211655&productID=454265555|http://dts.ystoretools.com/1002/images/100x500/blbepawslfor.gif|http://dts.ystoretools.com/1002/images/250x1000/blbepawslfor.gif|18.99||Fashion|Womens|These adorable black bear paw slippers fit women and men. These slippers cover the entire foot. The sole is made of one inch thick foam. They are a very fine quality slipper. Sizing: Medium fits a women's shoe size 7-9 1/2. Large fits a women's size 10+ or a men's shoe size 9-11. These slippers were seen on Good Morning America!|Our Most Popular Sleepwear||18.99|||2007-03-09 23:38:47.140|instock|CrazyforBargains: Fun Family Sleepwear||Our Most Popular Sleepwear|||| 454265563|Elephant Slippers for Kids, Men and Women|5181|CrazyforBargains.com|http://www.shareasale.com/m-pr.cfm?merchantID=5181&userID=211655&productID=454265563|http://dts.ystoretools.com/1002/images/100x500/elslformenan.gif|http://dts.ystoretools.com/1002/images/250x1000/elslformenan.gif|18.99||Fashion|Womens|These adorable elephant slippers fit both women and men. These slippers cover the entire foot. The sole is made of one inch thick foam. They are a very fine quality slipper. Sizing: Small fits a child age 6-9 or a women's size 4-6 1/2. Medium fits a women's shoe size 7-9 1/2. Large fits a women's size 10+ or a men's shoe size 9-11.|Men's Pajamas|Gifts for Men: Bath Robes, Shower Wraps, Pajamas and Slippers|18.99|||2007-03-09 23:38:47.140|instock|CrazyforBargains: Fun Family Sleepwear||Men's Pajamas|Gifts for Men: Bath Robes, Shower Wraps, Pajamas and Slippers||| 454265572|Hot Air Balloon Pajamas for Toddlers and Girls|5181|CrazyforBargains.com|http://www.shareasale.com/m-pr.cfm?merchantID=5181&userID=211655&productID=454265572|http://dts.ystoretools.com/1002/images/100x500/hotairbatopa.gif|http://dts.ystoretools.com/1002/images/250x1000/hotairbatopa.gif|12.99||Fashion|Girls|These adorable coat-style pajamas feature a hot air balloon print. The fabric is 100% polyester and flame resistant. These pajamas were made for a major upscale department store.|Clearance Section||16.99|||2007-03-26 11:45:02.320|instock|CrazyforBargains: Fun Family Sleepwear||Clearance Section|||| 454265577|Pig Slippers for Men and Women|5181|CrazyforBargains.com|http://www.shareasale.com/m-pr.cfm?merchantID=5181&userID=211655&productID=454265577|http://dts.ystoretools.com/1002/images/100x500/pigslformena.gif|http://dts.ystoretools.com/1002/images/250x1000/pigslformena.gif|18.99||Fashion|Womens|These adorable pig slippers fit both women and men. These slippers cover the entire foot. The sole is made of one inch thick foam. They are a very fine quality slipper. Sizing: Medium fits a women's shoe size 7-9 1/2. Large fits a women's size 10+ or a men's shoe size 9-11.|Men's Pajamas|Gifts for Men: Bath Robes, Shower Wraps, Pajamas and Slippers|18.99|||2007-03-09 23:38:47.140|instock|CrazyforBargains: Fun Family Sleepwear||Men's Pajamas|Gifts for Men: Bath Robes, Shower Wraps, Pajamas and Slippers||| 454265581|Pink Cotton Floral Pajamas for Girls|5181|CrazyforBargains.com|http://www.shareasale.com/m-pr.cfm?merchantID=5181&userID=211655&productID=454265581|http://dts.ystoretools.com/1002/images/100x500/picoflpaforg.gif|http://dts.ystoretools.com/1002/images/250x1000/picoflpaforg.gif|13.99||Fashion|Girls|These adorable 100% cotton pajamas are pink and feature a floral print. They are meant to be snug fitting. These are excellent quality pajamas.|Girl's Sleepwear|Long Sleeved Cotton Pajamas|13.99|||2007-03-21 12:47:59.550|instock|CrazyforBargains: Fun Family Sleepwear||Girl's Sleepwear|Long Sleeved Cotton Pajamas||| 454265582|Pink Flamingo Slippers for Men, Women and Kids|5181|CrazyforBargains.com|http://www.shareasale.com/m-pr.cfm?merchantID=5181&userID=211655&productID=454265582|http://dts.ystoretools.com/1002/images/100x500/piflslformen.gif|http://dts.ystoretools.com/1002/images/250x1000/piflslformen.gif|18.99||Fashion|Womens|These adorable pink flamingo slippers fit both women and men. These slippers cover the entire foot. The sole is made of one inch thick foam. They are a very fine quality slipper. Sizing: Small fits children 6 to 9 years old. Medium fits a women's shoe size 7-9 1/2. Large fits a women's size 10+ or a men's shoe size 9-11.|Men's Pajamas|Gifts for Men: Bath Robes, Shower Wraps, Pajamas and Slippers|18.99|||2007-03-09 23:38:47.140|instock|CrazyforBargains: Fun Family Sleepwear||Men's Pajamas|Gifts for Men: Bath Robes, Shower Wraps, Pajamas and Slippers||| 454265584|Purple Animal Print Panne Pajamas for Girls|5181|CrazyforBargains.com|http://www.shareasale.com/m-pr.cfm?merchantID=5181&userID=211655&productID=454265584|http://dts.ystoretools.com/1002/images/100x500/puanprpapafo.gif|http://dts.ystoretools.com/1002/images/250x1000/puanprpapafo.gif|11.99||Fashion|Girls|These adorable coat-style pajamas feature a lavender animal print. The fabric is 100% polyester panne and flame resistant. These pajamas were made for a major upscale department store.|Girl's Sleepwear|Novelty Print Pajamas|16.99|||2007-03-26 11:45:02.320|instock|CrazyforBargains: Fun Family Sleepwear||Girl's Sleepwear|Novelty Print Pajamas||| 454367516|Keepin' It Reel Fishing Boxer Shorts Gift Set|5181|CrazyforBargains.com|http://www.shareasale.com/m-pr.cfm?merchantID=5181&userID=211655&productID=454367516|http://dts.ystoretools.com/1002/images/100x500/keitrefibosh.gif|http://dts.ystoretools.com/1002/images/250x1000/keitrefibosh.gif|8.99||Fashion|Mens|This adorable gift set includes one pair of cotton knit "Keepin' It Reel" fishing boxer shorts and a fish pen complete in a gift box.|Men's Pajamas|Shop by Theme or Character Pajamas for Men|16.99|||2007-04-21 11:45:09.733|instock|CrazyforBargains: Fun Family Sleepwear||Men's Pajamas|Shop by Theme or Character Pajamas for Men||| As you can see its a datafeed with a list of all the products this company offers. What i attempted to do was write a script that broke the file down, put each records info into an array and then load it into a database. It seems to work ok, except for the fact that it only loads 348 of the 1367 records in the products.txt file. The wierd thing is that the records that make it into the database seem to be random. Its not just the first 348 that are getting entered. Anyway, here is the code, maybe you guys can help shed some light on whats going on, because im confused. <?php // File name: feedinject.php // Author: Tyler Biscoe // Date: 05 May 2007 // // Description: // This file loads the crazyforbargains.com datafeed, // and inserts the data into a database. // // Connect to the database and select database echo "Connecting to Database..."; include("include/connect.php"); // Load file and add it to the array $lines echo "Loading File..."; $lines = file('http://www.tylerbiscoe.com/phptest/datafeeds/products.txt'); echo "Done. <br /> <br />"; // Insert the data into the database echo "Inserting Data..."; $lines = file('http://www.tylerbiscoe.com/phptest/datafeeds/products.txt'); // Loop through the results and add each items information into the database. foreach ($lines as $line_num => $line) { $element[$line_num] = explode("|", $lines[$line_num]); $vendor = $element[$line_num][3]; $itemName = $element[$line_num][1]; $itemNumber = $element[$line_num][0]; $catergory = $element[$line_num][21]; $spicture_url = $element[$line_num][5]; $lpicture_url = $element[$line_num][6]; $description = $element[$line_num][11]; $price = $element[$line_num][14]; $status = $element[$line_num][18]; $link = $element[$line_num][4]; $query = mysql_query("INSERT INTO items (id, name , catergory, spicture_url, lpicture_url, description, price, status, vendor, url) VALUES ('$itemNumber','$itemName','$catergory','$spicture_url','$lpicture_url','$description','$price','$status','$vendor','$link')"); } echo "Done. <br /><br />"; echo "Process completed."; ?> Thanks alot!
×
×
  • 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.