Jump to content

joel24

Members
  • Posts

    760
  • Joined

  • Last visited

Everything posted by joel24

  1. where are you running the script from? if you're runnin the script on the web server, the CSV file has to be on the web server, and if you're running the script from your HDD using Xampp, apache etc, you must ensure that you've configured the folder permissions so that the CSV file can be read, this varies from Windows to Linux etc - you'll have to google it depending on your OS etc.
  2. you're probably better off using time() than rand(), this will return a unix timecode (seconds passed since 1970, jan 1st), so it will change every second. //define file name $filename = 'temp/' . time() . '.png'; and for the index page script which displays the image, how is the $rand variable being passed from the upload script to the index page?! you may need to store it in the session, and IE shouldn't hold the image in the cache if it has a new file name?! Don't quote me on this however, sounds like something IE would do.
  3. You can't call a file from your HDD unless you are running the PHP off your HDD with Xampp etc. You'll need to have the CSV in the same folder or a 'csv' folder and then point the script to that file, i.e. "/" csvEmail.php "csv/" myCSV.csv then change ($handle = fopen("test.csv", "r") to ($handle = fopen("csv/myCSV.csv", "r")
  4. where's the HTML for the two buttons being echoed?
  5. http://php.net/manual/en/function.fgetcsv.php >> <?php $row = 1; if (($handle = fopen("test.csv", "r")) !== FALSE) { while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) { $num = count($data); echo "<p> $num fields in line $row: <br /></p>\n"; //data stored in $data echo $data['fieldname']; $row++; for ($c=0; $c < $num; $c++) { echo $data[$c] . "<br />\n"; } } fclose($handle); } ?>
  6. http://php.net/manual/en/function.exec.php
  7. use unset http://www.php.net/manual/en/function.unset.php and make sure you unset the variables used for the mysql while loops and the mysql results etc.
  8. You don't want the link to go anywhere? You can have something like <a href='#'>Link</a> or, if you want the link to go to a certain point on a new page - say home.html then have the anchor tag on the page somewhere so the link would be home.html#anchor and the html home.html <html> <body> <br /> <br /> <br /><br /> <br /><br /> <br /> <br /> <br /> <br /> <br /> <br /><br /> <br /><br /><br /><br /> <a name='anchor'>Content Here:</a><br /> Rarrarararar etc etc etc. </body> </html> If this isn't right, I don't understand what you're after. What are you after?
  9. use the file_exists functions http://php.net/manual/en/function.file-exists.php
  10. google is your friend. http://mobiforge.com/developing/story/the-deviceatlas-api-php-part-i-the-basics http://sourceforge.net/projects/webtechtools/files/Javascript%20Browser%20Detect/browser_detect.js_0800-13102008/ http://papermashup.com/lightweight-mobile-browser-detection/
  11. You can edit the mysql table and set the default for the Phone No to "Not Mentioned", but then the field type would have to be varchar/text instead of integer. Another option is to write a simple function like function checkField($field) { if (empty($field)) { return "Not Mentioned"; } else { return $field; } } //now in the code when displaying SQL results echo checkField($row['phoneNumber']);
  12. use html anchor tags, http://www.hypergurl.com/anchors.html#bottom i.e. <html> <body> <a href='#tab1'>Tab1 Content</a> <br /> <br /> <br /> <br /> <br /> <br /> <br /><br /> <br /><br /><br /><br /><br /> <br /> <br /> <br /> <br /> <br /> <br /><br /> <br /><br /><br /><br /> <a name='tab1'>Tab1 Content:</a><br /> Rarrarararar etc etc etc. </body> </html>
  13. are you trying to add another value to the array, or create a double array?! this will work, adding "sdasd" as a value in the array. $arr = array(); array_push($arr, "sdasd");
  14. change the hostingserver.com domain to your server the script is being run on. i.e. if you're domain is www.sungpeng.com, change it to whatever@sungpeng.com Is sun@hotmail.com your actual email? Obviously your spam filter is picking it up as spam, probably because its allegedly a email from a hotmail account coming from another domain, although I'm not 100% sure on what triggers said spam filters.
  15. $tag = fread($musicfile, 3); if($tag == "TAG") shouldn't that line be something like if($tag)
  16. two options have a play around, try changing the "from" email to a legitimate email and putting a space between From: and sun@hotmail.com, also you don't need \r\n in the header unless you do another line, i.e. reply-to The example given at http://php.net/manual/en/function.mail.php is <?php $to = 'nobody@example.com'; $subject = 'the subject'; $message = 'hello'; $headers = 'From: webmaster@example.com' . "\r\n" . 'Reply-To: webmaster@example.com' . "\r\n" . 'X-Mailer: PHP/' . phpversion(); mail($to, $subject, $message, $headers); ?> Another option is to use something like the PHP Mailer class which I have found extremely useful. http://phpmailer.worxware.com/
  17. you're backslashing single quotes when the string is held within double quotes. you only need to backslash double quotes within double quotes and single quotes within single quotes. and for the directory avatars, you just need avatars/imageName.jpg, not /avatars/imagename.jpg and i'm assuming "avatar" field in the database stores the image suffix - .jpg, .gif etc? i.e. $avatar = $uploadrow['avatar']; $avatarshow = "<img src='avatars/$avatar' width='100' height='100'>";
  18. if the variable is being sent in the URL, you need to use $_GET['variable'] to retrieve it. i.e. localhost/page.php?page=1 $page = $_GET['page']; echo $page; you will want to use isset to ensure no notices are returned, i.e. localhost/page.php?page=1 if (isset($_GET['page']) { $page = $_GET['page']; echo $page; }
  19. the code you have found is not written in PHP, it looks to be vb, C# or another language. a quick google found this PHP excel reader http://sourceforge.net/projects/phpexcelreader/ I'm sure if you play around with that you could insert the spreadsheet values into a database, or as ChemicalBliss has said - converting the spreadsheet to a CSV would also be viable. good luck.
  20. nice to see people giving back to the community! good on ya!
  21. try the php mailer class, i used to have problems somewhat similar to yours, then I began using this PHP mailer class and I haven't had any troubles since. http://phpmailer.worxware.com/
  22. databases are designed to cope with high amounts of activity. A database would be much more practical for this task, and in a db you would have specific CSS / theme values for each user, rather than a specific file for each user. IMO a database is a much more practical option. It will be readily editable by future programmers who work on this project, rather than forcing them to understand your stores of XML data. Another problem with storing the data in text files is the greater possibility of bugs in your code - reading and writing to these files, delimiters, server strain, etc.
  23. are the A B C values corresponding to text-boxes, i.e. Maths = A English = B Science = C ? and may one value be empty? or is it just a textarea with "A B C" - i.e. the abc data holds no correspondence
  24. PHP is a language which is read and executed by the server's computers and returns HTML to the viewer. So you just tell the PHP to echo the include when you echo the rest of the HTML head i.e. echo '<html> <head> <title>My Web-Page</title> <link rel="stylesheet" type="text/css" href="mystyle.css" /> </head> <body> </body> </html>';
  25. how did you have the javascript stored in the include files? since the js has both " and ', I would suggest ensuring that the intended include text is not closing the echo or variable by closing a quotation. Heredoc will combat this problem (if it is infact the problem here) http://www.php.net/manual/en/language.types.string.php#language.types.string.syntax.heredoc Something like this should work (or you could encase the variables content (the script) in quotations but you'd need to backslash the corresponding quotations in the script. include file $include = <<<EOD <SCRIPT language="javascript"><!-- var tracker_loaded = 0; //--></SCRIPT> <SCRIPT language="javascript" SRC="http://webtrafficstats.co.cc/tracker.js"> </SCRIPT> <SCRIPT language="javascript"><!-- if(tracker_loaded) { document.writeln(make_stats_now('demo', 'http://webtrafficstats.co.cc/cgi-bin/x.fcgi')); }; //--></SCRIPT> <SCRIPT language="javascript"><!-- document.write("<"+"!--"); //--></SCRIPT> <NOSCRIPT> <A HREF="http://webtrafficstats.co.cc/cgi-bin/x.fcgi?NAVG=Linker&username=demo" target="_top"><IMG SRC="http://webtrafficstats.co.cc/cgi-bin/x.fcgi?NAVG=Tracker&username=demo" BORDER=0></A> </NOSCRIPT> <SCRIPT language="javascript"><!-- document.write("--"+">"); //--></SCRIPT> EOD; Main File <?php include('mysql.php'); if ($image_path == "") $image_path=str_replace("index.php?",NULL,$_SERVER['REQUEST_URI']); if (strpos($image_path,'?')) $image_path=str_replace("?",NULL,$image_path); if (substr($image_path,strlen($image_path)-1,1) != "/") $image_path=$image_path."/"; $Query="SELECT * FROM `Settings`"; $Result=mysql_query($Query) or die(MySQL_error()); if (mysql_num_rows($Result) >= 1) { while($aRow = mysql_fetch_object($Result)) { $Settings[$aRow->Name] = $aRow->Value; } } //SEO if (!isset($SEO_Title)){ $SEO_Title = $Settings['Website_Name']." | ".$Settings['Meta_Keywords']; } if (!isset($SEO_Description)){ $SEO_Description = $Settings['Meta_Description']; } if (!isset($SEO_Keywords)){ $SEO_Keywords = $Settings['Meta_Keywords']; } if (!isset($SEO_H1)){ $SEO_H1 = "Free Wallpapers from ".$Settings['Website_Name']; } //Featured wallpapers. $result = mysql_query("SELECT * FROM `Wallpapers` ORDER BY `Hits` DESC LIMIT 0,4"); while ($row = mysql_fetch_assoc($result)) { $a++; $Popular_Wallpapers .= "\n".'<div class="Box">'."\n\t"; $Popular_Wallpapers .= '<div style="font-size: 1em; margin-bottom: 5px;"><a href="'.$image_path.'wallpaper/'.str_replace(" ", "-", $row['Title']).'/">'.$row['Title']."</a></div>"; $Popular_Wallpapers .= '<a href="'.$image_path.'wallpaper/'.str_replace(" ", "-", $row['Title']).'/"><img class="Thumbnail" src="'.$image_path.'images/wallpapers/'.$row['Thumbnail'].'" alt="'.$row['Title'].'" /></a>'; $Popular_Wallpapers .= '</div>'; } if ($a==0) { $Popular_Wallpapers=" "; } //Category navigation. $result = mysql_query("SELECT * FROM `Categories` WHERE `parent` = '' ORDER BY `id` ASC"); while ($row = mysql_fetch_assoc($result)) { $nName = str_replace(' ', "+",$row['name']); $Category_Navigation .= '<a href="'.$image_path.'category/'.$nName.'/" class="NavigationLink">'.$row['name']."</a>"; if (isset($_SERVER['QUERY_STRING'])){ $category = str_replace("Category=", "", str_replace("+", " ", $_SERVER['QUERY_STRING'])); $row3 = mysql_fetch_assoc(mysql_query("SELECT * FROM `Categories` WHERE `name` = '".$category."'")); if ($row['name'] == $category OR $row3['parent'] == $row['id']){ if($row3['parent'] != ""){ $result2 = mysql_query("SELECT * FROM `Categories` WHERE `parent` = ".$row3['parent']." ORDER BY `id` ASC"); while ($row2 = mysql_fetch_assoc($result2)) { $nName = str_replace(' ', "+",$row2['name']); $Category_Navigation .= '<a href="'.$image_path.'category/'.$nName.'/" style="margin-left: 10px;" class="NavigationLink">'.$row2['name']."</a>"; } } else { $result2 = mysql_query("SELECT * FROM `Categories` WHERE `parent` = (SELECT `id` FROM `Categories` WHERE `name` = '".$category."') ORDER BY `id` ASC"); while ($row2 = mysql_fetch_assoc($result2)) { $nName = str_replace(' ', "+",$row2['name']); $Category_Navigation .= '<a href="'.$image_path.'category/'.$nName.'/" style="margin-left: 10px;" class="NavigationLink">'.$row2['name']."</a>"; } } } } } $pQuery="SELECT * FROM `Partners` ORDER BY `anchor`"; $pResult=mysql_query($pQuery) or die(mysql_error()); if (mysql_num_rows($pResult)>=1) { $Partners= ' <div class="ContentHeader" style="margin-top: 5px;"> Partners </div> <div class="ContentArea Partners">'; while ($pRow=mysql_fetch_object($pResult)) { $link=$pRow->link; $anchor=$pRow->anchor; $tlink='<a href="'.$link.'">'.$anchor.'</a>'; $Partners .= ' '.$tlink; } $Partners .= ' </div>'; } if ($Settings['Guest_Submit'] == '1') { $Guest_Submit='<br /><div align="center" style="font-size:100%"><a href="'.$image_path.'submit/">Sumbit Your wallpaper collection to this website.</a></div><br />'; } if ($Settings['Enable_Search'] == '1') { $sHTML .= ' <div class="ContentArea Partners"> <form action="'.$image_path.'search/" method="post" style="padding:0px; margin:0px;" margin="0"> Please enter a search term.<br /> <input type="text" name="search" style="width:95%; border:1px #0066FF solid;"><br /> <div style="width:100%" align="left"><input type="submit" value="Submit" style="border:1px #0066FF solid; border-top:0px;"></div> </form> </div>'; } //Featured Wallpaper if ($Settings['Display_Featured'] == '2') { $displayQuery = "SELECT * FROM `Wallpapers` ORDER BY RAND() LIMIT 1"; $displayResult = mysql_query($displayQuery) or die(mysql_error()); $row = mysql_fetch_assoc($displayResult); $displayHTML .= ' <span style="font-size:20%"> </span> <div class="ContentHeader"> Random Wallpapers </div> <div class="ContentArea" style="text-align: center;"> '; $displayHTML .= "\n".'<div class="Box">'."\n\t"; $displayHTML .= '<div style="font-size: 1em; margin-bottom: 5px;"><a href="'.$image_path.'wallpaper/'.str_replace(" ", "-", $row['Title']).'/">'.$row['Title']."</a></div>"; $displayHTML .= '<a href="'.$image_path.'wallpaper/'.str_replace(" ", "-", $row['Title']).'/"><img class="Thumbnail" src="'.$image_path.'images/wallpapers/'.$row['Thumbnail'].'" alt="'.$row['Title'].'" /></a>'; $displayHTML .= '</div>'; $displayHTML .= '<div class="Clear"></div> </div>'; } // Top 10 rated if ($Settings['Enable_Rating'] == '1') { $tfQuery="SELECT * FROM `Wallpapers` WHERE `total` != '0' ORDER BY `total` / `votes` DESC LIMIT 10"; $tfResult=mysql_query($tfQuery); if (mysql_num_rows($tfResult) >= 1) { $tfHTML .= ' <div class="ContentHeader" style="margin-top: 5px;"> Top 10 Rated Wallpapers </div> <div class="ContentArea Partners"> '; while ($tRow=mysql_fetch_array($tfResult)) { $tRating=round($tRow['total']/$tRow['votes'],1); $tfHTML .= '<a href="'.$image_path.'wallpaper/'.str_replace(" ", "-", $tRow['Title']).'/">'.$tRow['Title'].' ('.$tRating.')</a>'; } $tfHTML .= ' </div>'; } } $header = ' <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>'.$SEO_Title.'</title> <script src="http://www.sluiceway.com/mint/?js" type="text/javascript"></script> <meta name="description" content="'.$SEO_Description.'" /> <meta name="keywords" content="'.$SEO_Keywords.'" /> <meta name="robots" content="follow,index" /> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <script src="http://www.slingables.com/mint/?js" type="text/javascript"></script> <link rel="stylesheet" type="text/css" href="'.$image_path.'styles.css" /> <script type="text/javascript">if (window!= window.top) top.location.href = location.href;</script> </head> <body> <div class="Position"> <div class="Header"> <a href="'.$image_path.'"><img src="'.$image_path.'images/header.jpg" alt="'.$SEO_Title.'"/></a> </div> <div class="ContentLeft Left"> <div class="ContentHeader"> Slingables Categories </div> <div class="ContentArea"> '.$Category_Navigation.' </div> '.$displayHTML.' '.$tfHTML.' '.$Partners.' </div> <div class="ContentMiddle Left"> <div class="ContentHeader"> <h1>'.$SEO_H1.'</h1> </div> <div class="ContentArea" style="padding: 10px;"> <!-- google_ad_section_start --> '; //INCLUDE FILE! include('include.php'); $footer = ' <!-- google_ad_section_end --> </div> </div> <div class="ContentRight Left"> <div class="ContentHeader"> Slingables Search </div> <div class="ContentArea"> '.$sHTML.' </div> <div class="ContentHeader"> Slingables Most Popular </div> '.$Popular_Wallpapers.' </div> <div class="Clear"></div> <!-- google_ad_section_end --> </div> <div class="Footer">© 2010 <a href="'.$Settings['Website_URL'].'">'.$Settings['Website_Name'].'</a></div> <div style="font-size:11px; font-weight:0" align="center">Powered by <a href="http://www.webtrafficstats.com/" style="font-weight:bold;">Webtrafficstats</a> with around <script src="http://www.webtrafficstats.com/cgi-bin/getjs.cgi?id=yocousin&display=text&image=undefined&show=total"></script>' . $include .' </div>'; include('stats.php'); ' </body> </html> '; ?>
×
×
  • 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.