PHP - Simple Single Use File Sharing?
Hello. I want to make a simple website, where I can upload a zip file and download it from a URL with just HTTP GET request. When I download the file, the file will then be deleted on the server. Can't find any examples. Maybe, I've searched wrong. Has somebody some written project links or some tips for me how can I achieve this?
Similar Tutorials during lesson time we're developing php systems and our topic is virtual storage like dropbox, google drive etc. My teacher has now set the task to enable the ability to share files within the server but also restrict access within the server folder. I'm being taught MySQL however I've read a lot about PDO being better and decided to use this method to try and get a higher grade for my project although I'm having difficulty understanding how to go about it what i want to achieve is:
creating file sharing capability (i.e. students can share group projects)
restricting users (only those working on a particular document can view it)
don't worry this is not for my own benefit I'm just trying to get a grade here, I mainly just want advice on what I need I've read quite a bit but unfortunately I'm more of a visual learner.
Hello, all: been trying to convert this little single-file upload to multiple by naming each file form-field as "userfile[]" as it's supposed to automatically treat them as an array.. but no luck! Can you guide me as to what am I doing wrong?? appreciate the help! Code: [Select] <?php if (!isset($_REQUEST["seenform"])) { ?> <form enctype="multipart/form-data" action="#" method="post"> Upload file: <input name="userfile[]" type="file" id="userfile[]"> Upload file: <input name="userfile[]" type="file" id="userfile[]"> <input type="submit" value="Upload"> <input type="hidden" name="seenform"> </form> <?php } else { // upload begins $userfiles = array($_FILES['userfile']); foreach ($userfiles as $userfile) { // foreach begins $uploaded_dir = "uploads/"; $userfile = $_FILES['userfile']["name"]; $path = $uploaded_dir . $userfile; if (move_uploaded_file($_FILES['userfile']["tmp_name"], $path)) { print "$userfile file moved"; // do something with the file here } else { print "Move failed"; } } // foreach ends } // upload ends ?> How do I Upload Multiple Files using a PHP form and script? 10 files at one time would be great. Ultimately I need a photo upload and management script. Here is my current single file upload form: <form action="upload.php" method="post" enctype="multipart/form-data"> <label for="file">Upload a Photo:</label> <input type="file" name="file" id="file" /> <br /> <input type="submit" name="submit" value="Submit" /> </form> </body> </html> Here is the Php Script: <?php if ((($_FILES["file"]["type"] == "image/gif") || ($_FILES["file"]["type"] == "image/jpeg") || ($_FILES["file"]["type"] == "image/pjpeg")) && ($_FILES["file"]["size"] < 200000)) { if ($_FILES["file"]["error"] > 0) { echo "Return Code: " . $_FILES["file"]["error"] . "<br />"; } else { echo "Upload: " . $_FILES["file"]["name"] . "<br />"; echo "Type: " . $_FILES["file"]["type"] . "<br />"; echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb<br />"; echo "Temp file: " . $_FILES["file"]["tmp_name"] . "<br />"; if (file_exists("upload/" . $_FILES["file"]["name"])) { echo $_FILES["file"]["name"] . " already exists. "; } else { move_uploaded_file($_FILES["file"]["tmp_name"], "uploads/" . $_FILES["file"]["name"]); echo "Stored in: " . "uploads/" . $_FILES["file"]["name"]; } } } else { echo "Invalid file"; } ?> I'm so sorry for this question but I not really know how to play with single and double quote. If I have a query like this: Code: [Select] mysql_query('UPDATE table SET Status=1,Sending=Done WHERE ID IN ('.implode(',', $done).')'); And I wish to add Code: [Select] SentAt='$date' in the query as well , and I try this: Code: [Select] mysql_query('UPDATE table SET Status=1,Sending=Done,SentAt='$date' WHERE ID IN ('.implode(',', $done).')'); Not working...how should I write it? Thank you. I was talking to some friends, who are just as new as me in programming, and they think it would be better to use a single navigation file for every link in a web site. Something like this: Code: [Select] <a href="nav.php?id=home&otherparams" >Home</a> <a href="nav.php?id=products&otherparams" >Products</a> <a href="nav.php?id=contact&otherparams" >Contact</a> I told them I think this might be easier to maintain, but also might take up on loading time, as the site viewer will have to go through an extra node to get where he wants. Is this single navigation file a good practice or should it be avoided? Thanks for any comments... This topic has been moved to Third Party PHP Scripts. http://www.phpfreaks.com/forums/index.php?topic=358810.0 Hi everyone! Nice to meet/see/read you. This is my first post and it will probably be a lame one so apologies. I'm a pretty good frontend designer and I've always struggled to learn PHP and my new job is forcing it on me so I'm happy in a "throw me in the deep end" kinda way. I am really stuck! I have a single page that is using jquery to scroll my content left and right via the menu (example attached). What I am trying to do is when on the homepage, don't show the "main logo". When on any other link, show it. I immediately thought of an if/else statement but realised I don't know what or how exactly to target since everything is on the same page and the URL doesn't change. Could I target the image title that is the only image on the homepage? So, something like: <?PHP $image_title = 'home'; if (XXXXX($image_title)) { echo "IMAGE"; } else { echo "NO IMAGE"; } ?> I know that's wrong, I put XXX where I feel like something possibly helpful should go. Heh. I'm not asking for someone to write code for me, I'm happy to learn but but I would be very grateful if someone could just guide me to what I need to do and off to Google I will go. I haven't been able to find anything that is like: "if image title equals". Hmm... I hope I can do this with PHP. Thanks again, Linda I have created a css menu for the top of my site that is included on each page with a php include. What I am wanting to do now is create the side menu options for each page from the one file. Each page will have different links side links based on what section of the site you are in however I want to administer them all from one php file if that is possible. I'm quite new to php and am not sure if I can even do this. Any ideas on how this can be done? I'm ok with PHP but probably not half as good as some of you guys on here. I am basically trying to find a way to grab a line from a huge and I mean huge text file.... its basically a list of keywords I want to call by line number but without preferably going through them all before I get to that line.....otherwise couldmcrash my server obviously. At the moment im using this Code: [Select] $lines = file('http://www.mysite.com/keywords.txt'); // Loop through our array, show HTML source as HTML source; and line numbers too. foreach ($lines as $line_num => $line) { echo "$line_num"; } This works but im sure theres gotta be a better way of doing to save on usuage because this is putting the whole file into the memory and if I can simply say to php give me line number 97, would umm RULE.... Hope you guys can come up with a solution as your much smarter than me ty I know it needs a for loop, but i don't know where in the code i should be putting it? Code: [Select] function check_input($value) { // Stripslashes if (get_magic_quotes_gpc()) { $value = stripslashes($value); } // Quote if not a number if (!is_numeric($value)) { $value = "'" . mysql_real_escape_string($value) . "'"; } return $value; } $_POST = array_map('check_input', $_POST); $sql="INSERT INTO testimonials (CustomerName, Town, Testimonial, SortOrder, Images) VALUES ({$_POST['customername']}, {$_POST['town']}, {$_POST['testimonial']}, {$_POST['sort_order']}, '$imgname' )"; } if (!mysql_query($sql,$con)) { die("<br>Query: $sql<br>Error: " . mysql_error() . '<br>'); } echo "<p align=center><b>1 testimonial added</b></p>"; mysql_close($con); Thanks in Advance, Steve Hey all, I am building a simple cms. I have a posts table and I have an images table. A post has many images and images has a foreign key to the posts table. So when a user edits, updates, creates, and deletes a post, they affect the images related to the post. Sometimes a post can have more than one image, like three images. Hence I rendered this in the view (note that I am using a datamapper that converts tables to objects and fields to key/value pairs): Code: [Select] foreach($records as $post){ echo form_open_multipart("homes/update/$post->id"); //File uploads require a multipart form. Default form handling uses the application/x-www-form-urlencoded content type. Multipart forms use the multipart/form-data encoding. //this is critical to pass the id as part of the action attribute of the form, so we can use our params hash to target the id to update the specific record echo label('Update Title'); echo form_input('title',$post->title); echo label('Update Body'); echo form_textarea('body',$post->body); $images = $post->images->include_join_fields()->get(); if(!is_null($images->image_file_name)){ echo label('Update Images'); foreach($images as $image){ echo form_upload('image_file_name',$image->image_file_name); } } } echo form_submit('submit','Update'); The above line of code will render a few input file types. The problem occurs during posting to my update method. It is looking for one parameter from the input file field and so if I upload three different images, it will only look for one and write only one to database: Code: [Select] $field_name = 'image_file_name'; if ( ! $this->upload->do_upload($field_name)){ $error = array('error' => $this->upload->display_errors()); echo $error['error']; // redirect('homes/edit'); } else { $data = array('upload_data' => $this->upload->data()); $image_file_name = $data['upload_data']['file_name']; Is it possible to do wht I am trying to do? Should I only have on input file type per form submission or is that I need to fix the code to accomodate for multiple submissions by creating an array of sorts? Thanks for response. I'm running a site where people can post confessions, there's an option to share confession to twitter but it doesn't work properly.
When you click on twitter icon there is a window opening, you need to log in to twitter and then you have your tweet you want to share which looks like this:
Confessions.ie - Irish Anonymous Confessions Confession: I did it! http://www.confessio...e.php?page=view
problem is that url, "http://www.confessio...e.php?page=view" - it doesn't correspond to actual post, then when clicked it shows "-1" and that's it.
normal post url's would be something like this:
http://www.confessio...w&confession=18
http://www.confessio...w&confession=15
http://www.confessio...w&confession=12
Website is: confessions dot ie
and here's the code that I think contains error somewhe
<?php $confId = $_GET['confession']; $viewIp = $_SERVER['REMOTE_ADDR']; // Get the Full Page URL $pageURL = (isset($_SERVER['HTTPS']) ? "https" : "http")."//".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']; $count = 0; $hasViewed = ''; $msgBox = ''; // Get the File Uploads Folder from the Site Settings $uploadsDir = $set['uploadPath']; // Check if Moderation is On $moderated = $set['moderation']; // Check if Profanity Filter is On $filterProfanity = $set['useFilter']; $chkViews = mysqli_query($mysqli,"SELECT 'X' FROM views WHERE confessId = ".$confId." AND viewIp = '".$viewIp."' LIMIT 1"); $hasView = mysqli_num_rows($chkViews); if ($hasView == 0) { $hasViewed = '0'; } $viewDate = date("Y-m-d H:i:s"); if ($hasViewed == '0') { $stmt = $mysqli->prepare(" INSERT INTO views( confessId, viewIp, viewDate ) VALUES ( ?, ?, ? ) "); $stmt->bind_param('sss', $confId, $viewIp, $viewDate ); $stmt->execute(); } // Add New Comment if (isset($_POST['submit']) && $_POST['submit'] == 'addComment') { // Validation if($_POST['commentText'] == "") { $msgBox = alertBox($commentsReq, "<i class='fa fa-times-circle'></i>", "danger"); } else if($_POST['answer'] == "") { $msgBox = alertBox($captchaCodeReq, "<i class='fa fa-times-circle'></i>", "danger"); } else if ($_POST['hole'] != '') { $msgBox = alertBox($commentsErrorMsg, "<i class='fa fa-times-circle'></i>", "danger"); $_POST['firstName'] = $_POST['commentText'] = $_POST['answer'] = ''; } else { $commentText = htmlentities($_POST['commentText']); $usersId = $mysqli->real_escape_string($_POST['usersId']); if ($_POST['firstName'] == '') { $firstName = null; } else { $firstName = $mysqli->real_escape_string($_POST['firstName']); } $commentDate = date("Y-m-d H:i:s"); // Moderation Check if ($moderated == '1') { $isActive = '0'; } else { $isActive = '1'; } // Check if the poster is a logged in user if (isset($_SESSION['userId'])) { $user = $_SESSION['userId']; } else { $user = '0'; } if(strtolower($_POST['answer']) == $_SESSION['thecode']) { $stmt = $mysqli->prepare(" INSERT INTO comments( confessId, userId, firstName, comments, commentDate, isActive, commentIp ) VALUES ( ?, ?, ?, ?, ?, ?, ? ) "); $stmt->bind_param('sssssss', $confId, $user, $firstName, $commentText, $commentDate, $isActive, $viewIp ); $stmt->execute(); if ($moderated == '1') { $msgBox = alertBox($commentsSavedMsg1, "<i class='fa fa-check-square'></i>", "success"); } else { $msgBox = alertBox($commentsSavedMsg2, "<i class='fa fa-check-square'></i>", "success"); } // Clear the Form of values $_POST['firstName'] = $_POST['commentText'] = $_POST['answer'] = ''; $stmt->close(); } else { $msgBox = alertBox($captchaErrorMsg, "<i class='fa fa-warning'></i>", "warning"); } // If the confession is posted by a user if ($usersId != '0') { $uemail = "SELECT userEmail, recEmails FROM users WHERE userId = ".$usersId; $remail = mysqli_query($mysqli, $uemail) or die('-1' . mysqli_error()); $e = mysqli_fetch_assoc($remail); $userEmail = $e['userEmail']; $recEmails = $e['recEmails']; // If the users has opted in to receive notifications if ($recEmails == '1') { // Send out the email in HTML $installUrl = $set['installUrl']; $siteName = $set['siteName']; $siteEmail = $set['siteEmail']; $subject = $newCommentEmailSubject; $message = '<html><body>'; $message .= '<h3>'.$subject.'</h3>'; $message .= '<hr>'; $message .= '<p>'.nl2br($commentText).'</p>'; $message .= '<hr>'; $message .= '<p>'.$newCommentEmail1.' '.$pageURL.'</p>'; $message .= '<p>'.$subscribeEmail3.'<br>'.$siteName.'</p>'; $message .= '</body></html>'; $headers = "From: ".$siteName." <".$siteEmail.">\r\n"; $headers .= "Reply-To: ".$siteEmail."\r\n"; $headers .= "MIME-Version: 1.0\r\n"; $headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n"; mail($userEmail, $subject, $message, $headers); } } } } // Get Confession $select = "SELECT confessId, userId, (IFNULL(firstName, '')) AS firstName, confessText, DATE_FORMAT(postDate,'%b %d %Y %h:%i %p') AS postDate, hasImage, isActive, (SELECT COUNT(*) FROM views WHERE views.confessId = confessions.confessId ) as totalViews, (SELECT COUNT(*) FROM likes WHERE likes.confessId = confessions.confessId ) as totalLikes, (SELECT COUNT(*) FROM dislikes WHERE dislikes.confessId = confessions.confessId ) as totalDislikes FROM confessions WHERE confessId = ".$confId; $res = mysqli_query($mysqli, $select) or die('-1' . mysqli_error()); $row = mysqli_fetch_assoc($res); if ($row['totalViews'] == '1') { $viewText = $singleViewText; } else { $viewText = $multipleViewsText; } $shareURL = $set['installUrl'].'page.php?page=view&confession='.$row['confessId']; $googleURL = $set['installUrl']; // Get Comments $qry = "SELECT commentId, confessId, (IFNULL(firstName, '')) AS fName, comments, DATE_FORMAT(commentDate,'%b %d %Y %h:%i %p') AS commentDate, isActive FROM comments WHERE confessId = ".$confId." AND isActive = 1 ORDER BY commentId DESC"; $results = mysqli_query($mysqli, $qry) or die('-2'.mysqli_error()); include('includes/header.php'); ?> <section id="main-container"> <div class="container"> <?php if ($msgBox) { echo $msgBox; } ?> <div class="confessbox"> <div class="confession"> <?php if ($row['hasImage'] == '1') { // Get Image $sqlStmt = "SELECT uploadId, confessId, uploadUrl FROM uploads WHERE confessId = ".$confId; $sqlres = mysqli_query($mysqli, $sqlStmt) or die('-2'.mysqli_error()); $col = mysqli_fetch_assoc($sqlres); //Get File Extension $ext = substr(strrchr($col['uploadUrl'],'.'), 1); $imgExts = array('gif', 'GIF', 'jpg', 'JPG', 'jpeg', 'JPEG', 'png', 'PNG', 'tiff', 'TIFF', 'tif', 'TIF', 'bmp', 'BMP'); if (in_array($ext, $imgExts)) { echo '<p class="mb-20"><img alt="'.$confImageAlt.'" src="'.$uploadsDir.$col['uploadUrl'].'" class="img-responsive" /></p>'; } } ?> <p> <i class="fa fa-quote-left"></i> <?php if ($filterProfanity == '1') { echo nl2br(clean(filterwords($row['confessText']))); } else { echo nl2br(clean($row['confessText'])); } ?> <i class="fa fa-quote-right"></i> </p> <input type="hidden" id="confessId" name="confessId_<?php echo $count; ?>" value="<?php echo $row['confessId']; ?>" /> <div class="confession-footer"> <div class="likes"> <span class="label label-confess first liked"> <a href="" id="likeIt<?php echo $row['confessId']; ?>" class="likeIt_<?php echo $count; ?> text-success"> <i class="fa fa-smile-o"></i> <span id="likesVal_<?php echo $count; ?>"><?php echo $row['totalLikes']; ?></span> </a> </span> </div> <div class="dislikes"> <span class="label label-confess disliked"> <a href="" id="dislikeIt<?php echo $row['confessId']; ?>" class="dislike_<?php echo $count; ?> text-danger"> <span id="dislikesVal_<?php echo $count; ?>"><?php echo $row['totalDislikes']; ?></span> <i class="fa fa-frown-o"></i> </a> </span> </div> <span class="label label-confess"><?php echo timeago($row['postDate']); ?></span> <span class="label label-confess last"><?php echo $row['totalViews'].' '.$viewText; ?></span> <a href="https://twitter.com/intent/tweet?text=<?php echo $set['siteName']; ?>%20Confession:%20<?php echo ellipsis($row['confessText'],65); ?>%20&url=<?php echo $shareURL; ?>" class="btn btn-tw btn-sm" target="_blank" data-toggle="tooltip" data-placement="top" title="<?php echo $twitterShareTooltip; ?>"> <i class="fa fa-twitter"></i> </a> <a href="https://plus.google.com/share?url=<?php echo $googleURL; ?>" class="btn btn-gp btn-sm" target="_blank" data-toggle="tooltip" data-placement="top" title="<?php echo $googleShareTooltip; ?>"> <i class="fa fa-google-plus"></i> </a> <span class="label label-confess last hasVoted text-danger"><strong><?php echo $onlyVoteOnceText; ?></strong></span> <div class="comments"> <?php if ($row['firstName'] != '') { ?> <span class="label label-confess last"><?php echo $postedByText.' '.clean($row['firstName']); ?></span> <?php } else { ?> <span class="label label-confess last"><?php echo $postedByAnon; ?></span> <?php } ?> </div> </div> <div class="clearfix"></div> </div> </div> <?php if(mysqli_num_rows($results) > 0) { ?> <hr /> <div class="commentbox"> <?php while ($rows = mysqli_fetch_assoc($results)) { ?> <div class="comment"> <p> <?php if ($filterProfanity == '1') { echo nl2br(clean(filterwords($rows['comments']))); } else { echo nl2br(clean($rows['comments'])); } ?> </p> <?php if ($rows['fName'] != '') { ?> <span class="label label-comments"><?php echo clean($rows['fName']).' '.$commentedText.' '.timeago($rows['commentDate']); ?></span> <?php } else { ?> <span class="label label-comments"><?php echo $anonCommented.' '.timeago($rows['commentDate']); ?></span> <?php } ?> </div> <?php } ?> </div> <?php } ?> <hr /> <form action="" method="post" class="comment-form mt-30"> <div class="form-group"> <textarea class="form-control" name="commentText" id="commentText" rows="4" required="" placeholder="<?php echo $addCommentsField; ?>"><?php echo isset($_POST['commentText']) ? $_POST['commentText'] : ''; ?></textarea> </div> <div class="row"> <div class="col-md-4"> <div class="form-group"> <input type="text" class="form-control" name="firstName" placeholder="<?php echo $firstNamePlaceholder; ?>" value="<?php echo isset($_POST['firstName']) ? $_POST['firstName'] : ''; ?>"> </div> </div> <div class="col-md-4"></div> <div class="col-md-4"> <div class="row"> <div class="col-md-4"> <img src="includes/captcha.php" id="captcha" data-toggle="tooltip" data-placement="left" class="pull-right" title="<?php echo $captchaCodeTooltip; ?>" /> </div> <div class="col-md-8"> <div class="form-group"> <input type="text" class="form-control" name="answer" required="" maxlength="6" placeholder="<?php echo $captchaCodeTooltip; ?>"> </div> </div> </div> </div> </div> <div class="row"> <div class="col-md-8"> <p><?php echo $commentsQuip1; ?><strong><?php echo $isOn; ?></strong>. <?php echo $commentsQuip2; ?> <strong><?php echo $filtered; ?></strong>.</p> </div> <div class="col-md-4"> <input type="hidden" name="hole" id="hole" /> <input type="hidden" name="usersId" value="<?php echo $row['userId']; ?>" /> <button type="input" name="submit" value="addComment" class="btn btn-fessup btn-lg pull-right btn-icon"><i class="fa fa-check-square-o"></i> <?php echo $saveCommentsBtn; ?></button> </div> </div> </form> </div> </section> Sorry, but I forget how to do this, mostly because I don't do it often. To keep things simple lets say I have 3 classes: Main, A, B class Main{ public $classA, $classB; public $shared; public function init(){ // Do some stuff return $this; } } class A{ public function aMethod(){ $me = $this->shared; // Same value as from B::bMethod() // Do some stuff return $this; } } class B{ public function bMethod(){ $me = $this->shared; // Same value as from A::aMethod() // Do some stuff return $this; } } $main = new Main(); $main->classA->aMethod(); $main->classB->bMethod(); I really want to be able to call the main class, then tell it what subclass to use and be able to use $this->shared in any class and it will be the same. If changed in any class the other classes should see the change as well. Does that make sense? PHP script return 20 UL LIST values like, < ul >
A < /ul > How to display UL LIST into row wise 5 columns like
A B C D I'm looking for a secure way to share session data across two different domains (not subdomains) on the same server. I've looked at passing the session id through a GET var to the other domain. It works but it looks to open the possibility of session hijacking and I don't really like having the session id in the URL string. Any way to make this secure? The other option I'm looking at is using cURL to load a script on the other domain that sets a cookie with the session id. When the person loads the other domain, check for the cookie, get the session id, connect to session then delete the cookie. Can anyone see anything wrong with this? Thanks. Hi. How to implement twitter like real-time sharing system? So that is like, if my friend(following person) write a message, it also appear on my wall(page). 1. Is it hard? 2. What language used for it? PHP? 3. Is there any source about it? Thanks. Hi, I've been scratching my head for a while now about how to do this, I'm relatively new to php and mysql and perhaps foolishly taking on creating a user area for a website. I have everything else working, all of my register account functions and confirmations and all of the login scripts etc. I have created a profile page which returns various information to the user (this bit works fine) and I've got some nice show/hide toggles running with some javascript/css but my intention is to allow the user to change thier information (e-mail address, contact phone number and also whether they are subscribed to the e-mail list), it also displays any support tickets or messages. So after the long intro, here's what I'm struggling with... I have a form in a visibility toggled <div> which submits a 'change_email' script, so a user wants to change their e-mail, clicks on change, the <div> appears, they bang in the new e-mail and hit submit. My php script appears to work (because it doesn't throw up any errors), until you realise that actually it's not updated the record in the db... I'm using mysql_query("UPDATE users SET email='$new_email' WHERE username='$user'"); Do I need to setup variables for all of the information in the db (name, username, password, email, contno etc etc) and include them in the command to get it to work or should that just pick the correct record and then update it? If that is the case is there a way I can include 'blank' variables so I don't have to set them all up... e.g. mysql_query("UPDATE users SET user='',password='',email='$new_email', etc WHERE username='$user'"); Many thanks in anticipation Hello - First time poster and pretty new to PHP. I have tried to research this before posting but I couldn't find any tutorials with this exact scenario. I am trying to create a PHP file that reads an XML file with the following layout: <Root> - <Vehicle="Red"> <Trip>1108</Trip> <Platform>123RFIES</Platform> <InformationType>Slow</InformationType> </Red> - <Vehicle="Red"> <Trip>1108</Trip> <Platform>123RSHAS</Platform> <InformationType>Fast</InformationType> </Red> I am using the following PHP: <?php $file = "Vehicle.xml"; function contents($parser, $data){ echo $data; } function startTag($parser, $data){ echo "<b>"; } function endTag($parser, $data){ echo "</b><br />"; } $xml_parser = xml_parser_create(); xml_set_element_handler($xml_parser, "startTag", "endTag"); xml_set_character_data_handler($xml_parser, "contents"); $fp = fopen($file, "r"); $data = fread($fp, 80000); if(!(xml_parse($xml_parser, $data, feof($fp)))){ die("Error on line " . xml_get_current_line_number($xml_parser)); } xml_parser_free($xml_parser); fclose($fp); ?> Using this code I can read the entire XML and display it on the webpage. What I am trying to do is filter it so it only displays when InformationType = Fast and only display the Trip and the InformationType. Where do I add this filter logic? Thank you in advance! -Adam Hi, i'm kind of new with php. i need to make some easy script, that get link of XML file and another "number". and reload the XML file "number" of times. i need to do it with $_GET function. if someone will help me it`ll be greate. Thanks, Or. Hi, I have some code which displays my blog post in a foreach loop, and I want to add some social sharing code(FB like button, share on Twitter etc.), but the problem is the way I have my code now, creates 3 instances of the sharing buttons, but if you like one post, all three are liked and any thing you do affects all of the blog post. How can I fix this? <?php include ("includes/includes.php"); $blogPosts = GetBlogPosts(); foreach ($blogPosts as $post) { echo "<div class='post'>"; echo "<h2>" . $post->title . "</h2>"; echo "<p class='postnote'>" . $post->post . "</p"; echo "<span class='footer'>Posted By: " . $post->author . "</span>"; echo "<span class='footer'>Posted On: " . $post->datePosted . "</span>"; echo "<span class='footer'>Tags: " . $post->tags . "</span>"; echo ' <div class="addthis_toolbox addthis_default_style "> <a class="addthis_button_facebook_like" fb:like:layout="button_count"></a> <a class="addthis_button_tweet"></a> <a class="addthis_counter addthis_pill_style"></a> </div> <script type="text/javascript">var addthis_config = {"data_track_clickback":true};</script> <script type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js#username=webguync"></script>'; echo "</div>"; } ?> |