PHP - Php - Advanced Fetch Of External File?
Hi,
I am looking to fetch the contents of https://bb.kdg.be/webapps/blackboard/content/listContent.jsp?course_id=_98522_1&content_id=_1288143_1 in PHP However, the page works with cookies, javascript redirect, and https. Therefor I cannot manage to make a local copy of the actual contents. I have tried with curl, file_get_contents, file, fopen, and numerous user-written functions online, none of which worked. Please make sure you TEST your answer before posting it, because it is probably not as obvious as it seems! Thanks! Similar TutorialsHello, I need help. I have a file test.txt, and this content in it: Code: [Select] [group 1] immediate=yes links=1,14,12,22 avaliable=no [group 2] immediate=no links=1,4,14,22 Now, I also have a WEB app with database, where I can change both groups, and the only this missing is, that when a change is made in on group, that I write it to the file test.txt. I know how to write to files, but here is the problem (2 examples): If I change on the WEB page below group 1 from immediate=yes to immediate=no -> how can I change this in the file (just for group 1). If I change on the WEB page below group 2 to avaliable=yes -> how can I add this line in the file below group 2 To summarize - I have problems detecting where the group 1 or group 2 starts and end - so I only change for each group. Hallo everyone... here is my following code. i am fetching the picture from the file but unable to fetch it.
kindly help me. error in bold underline...
Thanks
<!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=iso-8859-1" /> <title>Untitled Document</title> </head> <body> <?php session_start(); $uid=''; include("connection.php"); $query=mysql_query("SELECT * FROM users WHERE uid='".$_GET['uid']."'"); $row=mysql_fetch_array($query); $image=$row['images_path']; ?> <form action="edit.php" method="post"> <table border="1px" align="center" width="85%"> <tr> <td colspan="3"><?php include'header.php' ?></td> </tr> <input type="hidden" name="uid" value="<?=$_GET['uid'];?>" /> <tr> <td colspan="3">Welcome <?php echo $_GET['uid']; ?> </td> </tr> <tr height="30px;"> <td width="37%" style="padding-left:250PX;">User Name</td> <td width="63%"> <input type="text" name="uname" value="<?php echo $row['uname']?>" /></td> </tr> <tr height="30px;"> <td width="37%" style="padding-left:250PX;">User Email</td> <td width="63%"> <input type="text" name="email" value="<?php echo $row['email'];?>" /></td> </tr> <tr height="30px;"> <td width="37%" style="padding-left:250PX;">Mobile</td> <td width="63%"> <input type="text" name="mob" value="<?php echo $row['mob'];?>" /></td> </tr> <tr height="30px;"> <td width="37%" style="padding-left:250PX;">Type</td> <td width="63%"> <input type="text" name="type" value="<?php echo $row['type'];?>" /></td> </tr> <tr height="30px;"> <td width="37%" style="padding-left:250PX;">Status</td> <td width="63%"> <input type="text"name="status" value="<?php echo $row['status'];?>" /></td> </tr> <tr height="30px;"> <td width="37%" style="padding-left:250PX;">Picture</td> <td><?php echo "<img border=\"0\" src=\"".$row['images_path']."\" width=\"102\" alt=\"your name\" height=\"91\">"; ?></td> </tr> </tr> <tr height="50px;"> <td colspan="3" style="padding-left:350px;"><input type="submit" name="submit" /> <input type="reset" value="Clear" /></td> </tr> <tr> <td colspan="3"><?php include'footer.php' ?></td> </tr> </table> <div align="left"><a href="home_users.php">Home</a></div> </form> </body> </html> I was just wondering if it was possible to have an external php file that can be included in the head of a web page, like a .js file. If this isn't possible maybe have a .js file containing php code that can be executed regarding the JavaScript around it... when tyring to pass a variable to a extenal javascript file it just shows up as a sting and the variable isnt beening executed
var timezone_offset = <?= $timezone_offset ?>;im guessing its probably down to the fact the variable is being passed from my framework controller... so im wondering how do you send a variable to a external javascript file when using a framework? $this->view->timezone_offset = "test"; // in my controller // passing varibales to template in my view if (preg_match("/\.html$/i", $file_name)) { extract($this->_variables); require_once PRIVATE_DIRECTORY . 'application' . DS . 'views' . DS . $file_name; }thanks guys What is the best way to load a .jsp file on an external sever? My external css file works on everything except for body, however, it works when I include the css on the page itself:
body{ margin-top: 0px; padding-top: 0px; margin-bottom: 0px; padding-bottom: 0px; background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyJpVFh0WE1MOmNvb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iciI/PiSp0pIAAAAySURBVHjaYmBgYOAHYmYGCADR/CDiDxDzQAW5gPgLlM3ACsQKUBqhBYjZkY3CMBMgwACvHQKnyUp+6gAAAABJRU5ErkJggg=="); background-color:#b20a22; -webkit-transition: all 300ms ease-in-out; -moz-transition: all 300ms ease-in-out; -ms-transition: all 300ms ease-in-out; -o-transition: all 300ms ease-in-out; transition: all 300ms ease-in-out; }What could be wrong? Hi! I am trying to use the View Model Design Pattern in my application The problem is that it is the first time I use it and I am a beginner. So, I have the logic in the Model and the "front end" in View. I am talking about a sign up page. In the current Html file I am trying to access an error array from the model file and display it to the user above the input field.
Here is the a snippet from the Model (Signup.php) $account = new Account($con); //the account which takes as param the db connection $error = null; //the array // anything the user writes gets inside this array if (isset($_POST["submitButton"])) { $firstName = UnifyFormInput::unifyUserFLName($_POST["firstName"]); $lastName = UnifyFormInput::unifyUserFLName($_POST["lastName"]); $username = UnifyFormInput::unifyFormUserName($_POST["username"]); $email = UnifyFormInput::unifyFormEmail($_POST["email"]); $password = UnifyFormInput::unifyFormPassword($_POST["password"]); //contain true or false based on the query being successful or not $success = $account->register($firstName, $lastName, $username, $email, $password); if ($success) { $_SESSION["userLoggedIn"] = $username; header("Location:index.php"); }else{ $error = $account->getError(Constants::$registerFailed); } } //compact — creates array containing variables and their values //call render function from View file to show the register page content View::render('register', compact('error')); And here is the view: <?php if (!empty($error)) { echo $account->getError(Constants::$loginFailed); } ?> <input type="text" class="form-control" name="firstName" placeholder= "First Name" value="<?php getInputValue("firstName"); ?>" required>
the strange thing is...I have the exact same script on another part of my page and it works! the only thing that changed are the variable names and the path (which ive checked 27000 times) What this should do is check if you have a signature in the external file and if you do and you fill out the form correctly then it replaces your old signature with your new one. and if you dont have a signature already and filled out the form correctly then it should write your signature to the file...for some reason this isnt working after checking and rechecking...i need a second pair of eyes. Help please! if (isset($_POST['change_submit2'])) { if (($_SESSION['logged_in'] == '1') && ($signature_test != '1') && ($_POST['change_box2'] == 'CHANGE') && ($invalid_character_test != '1') && ($invalid_character_test1 != '1')) { $fh1 = fopen($users_signatures_path, 'r+'); fwrite($fh1, $sig_front); frwrite($fh1, $_POST['signature']); fwrite($fh1, $sig_back); fwrite($fh1, ' '); flose($fh1); echo 'You have succesfully created a signature!'; } elseif (($_SESSION['logged_in'] == '1') && ($signature_test == '1') && ($_POST['change_box2'] == 'CHANGE') && ($invalid_character_test != '1') && ($invalid_character_test1 != '1')) { $users_signatures_path1 = "../../users/users_signatures.txt"; $fh1 = fopen($users_signatures_path1, 'r+'); $read_fh1 = fread($_fh1, filesize($users_signatures_path1)); $the_new_sig = str_replace($mcurrent_sig, $mnew_sig, $read_fh1); fclose($fh1); $fh1 = fopen($users_signatures_path1, 'r+'); fwrite($fh1, $the_new_sig); fclose($fh1); echo $mnew_sig; echo 'Your signature has been succesfully changed!'; } elseif ($_SESSION['logged_in'] != '1') { echo 'You need to be logged in!'; } elseif ($_POST['change_box2'] != 'CHANGE') { echo 'You must fill in the "CHANGE" box!'; } elseif ($invalid_character_test == '1') { echo 'Contains illegal characters!'; } elseif ($invalid_character_test1 == '1') { echo 'Contains illegal characters!'; } } Hi All,
I want to include my terms and conditions in an ebay listing.
The reason for this is to ease the process if and when i need to change the terms.
I stopped using eBay about a year ago and back then is used this code to display my terms withing the eBay lisitng.
<?php include ('http://www.example.com/terms.php'); ?>
NOw when i put that code into the listing it doesnt display.
I tested this out on my own server and it didnt display there either so I now it isnt eBay.
I also tried emoving the brackets without success.
The only way I can get it to display as include on my server is to use a relative path, which isnt the result I need
Has something changed in the past year?
Is there another way to display an external file using an absolute path to an external file?
Many Thanks
This topic has been moved to PHP Regex. http://www.phpfreaks.com/forums/index.php?topic=319963.0 Hi, just a very simple question: I have an array as follows: $langList = array('English', 'French', 'German', 'Dutch'); What's the easiest way to store this array in an external file, so that multiple php scripts can access its contents? And what is then the php line I need to retrieve the array from the external file? Thanks! Hey guys, at the moment I am trying to do an advanced search on events, 4 fields - county, date, title and hoster, so I am not really sure how to go about this but either way I started writing a script to do this, you learn from trying and mistaken right? Now I made sure the radio buttons all worked before I tryed this, checking the values of them on the form (seperate page) and if they get transferred correctly over to this page, basically for every field there are 2 radio boxes yes and No, which means for them to be included in the search or not, this is the code I have so far and if no radio buttons are selected and the fields are empty it comes up with the table and no results, when everything is set to no the page is blank, when everything is set to yes and I put the correct information in the fields then it comes up with the right data, so far it basically only works if all is yes (I will change it to LIKE later so they don't have to put in the exact information for certain fields) so I guess I am on the right way? Where and what am I doing wrong? Code: [Select] <?php session_start(); include 'connect.php'; $username = $_SESSION['username']; if(!isset($_SESSION['username'])) { echo '<div align="center">'; echo 'You have to be a registered member to be able to view events.<br><br> <a href="register.html">Click here to register</a>'; echo '<br><br><br><br>Or if you are already a member, please login to use this area.<br>'; echo ' <form method="POST" action="loginverification.php"> <table border="0"> <tr><td> Username: </td><td><input type="text" name="username" size="15" /></td></tr> <tr><td>Password:</td><td> <input type="password" name="password" size="15" /></td></tr> </table> <div align="center"> <p><input type="submit" value="Login" /></p> </div> </form>'; echo '</div>'; } else{ $theDate = isset($_REQUEST["date1"]) ? $_REQUEST["date1"] : ""; $eventcounty = $_POST['county']; $eventdescriptionheader = $_POST['eventdescriptionheader']; $hoster = $_POST['hoster']; if($_POST['searchcounty'] == "No") { $result = mysql_query("SELECT * FROM Events WHERE eventdate = '$theDate' AND eventdescriptionheader = '$eventdescriptionheader' AND hoster = '$hoster' ORDER BY eventdate ASC")or die(mysql_error()); } elseif($_POST['searchdate'] == "No") { $result = mysql_query("SELECT * FROM Events WHERE eventcounty = '$eventcounty' AND eventdescriptionheader = '$eventdescriptionheader' AND hoster = '$hoster' ORDER BY eventdate ASC")or die(mysql_error()); } elseif($_POST['searchtitle'] == "No") { $result = mysql_query("SELECT * FROM Events WHERE eventcounty = '$eventcounty' AND eventdate = '$theDate' AND hoster = '$hoster' ORDER BY eventdate ASC")or die(mysql_error()); } elseif($_POST['searchhoster'] == "No") { $result = mysql_query("SELECT * FROM Events WHERE eventcounty = '$eventcounty' AND eventdate = '$theDate' AND eventdescriptionheader = '$eventdescriptionheader' ORDER BY eventdate ASC")or die(mysql_error()); } else { $result = mysql_query("SELECT * FROM Events WHERE eventcounty = '$eventcounty' AND eventdate = '$theDate' AND hoster = '$hoster' AND eventdescriptionheader = '$eventdescriptionheader' ORDER BY eventdate ASC")or die(mysql_error()); echo '<br>'; echo "<table border='0'> <tr> <th>Date/Time</th> <th>Event</th> <th>Participants</th> <th>Hoster</th> </tr>"; while($row = mysql_fetch_array($result)) { echo "<tr>"; echo "<td>"; print date('d M Y', strtotime($row['eventdate'])); echo " "; echo $row['starttime'] . "</td>"; echo '<td><a href="showevent.php?eventsID='; echo $row['eventsID']; echo '">'; echo $row['eventdescriptionheader']; echo "</a></td>"; echo "<td>" . $row['currentparticipants'] . "/" . $row['maxparticipants'] . "</td>"; echo "<td>" . $row['hoster'] . "</td>"; echo "</tr>"; } echo '</table>'; $check = mysql_num_rows($result); if ($theDate == "0000-00-00") { echo 'You did not select a date.'; echo '<INPUT TYPE="button" VALUE="Back" onClick="history.go(-1);return true;">'; } elseif ($check == 0) { echo 'No results found.'; echo '<INPUT TYPE="button" VALUE="Back" onClick="history.go(-1);return true;">'; } echo '<br><INPUT TYPE="button" VALUE="Back" onClick="history.go(-1);return true;"> '; } } ?> Good morning, I'm creating a content management system for my game. It's RPG style, so it contains many tasks, however, adding them is a bit complicated process and the system isn't simple. Therefore, simple web form is needed, but there are fields that depend on others. For instance, if quest type is k (which means killing task), a field asking how many different kinds of monsters need to be killed, then there should appear x fields with more specific information. To sum up, i need an example, advice or sth that would help me to create this type of html where new fields appear automatically depending on the chosen ones. Thanks in advance, Karolis Im building an advanced search feature and its mostly going fine. The only problem is that results are displayed more times than they need to be. I have a test post in the database: p_name p_content Testing Advanced Search This is to test the advanced search When i do a search with the keywords "testing advanced search" and set it to match any keywords it does bring up this post as it should do. But it is displaying it 3 times when there is only one instance of it in the database. here is my code: $match = $_POST['match']; // for this example match === any $keywords = $_POST['keywords']; // for this example keywords === testing advanced search $within = $_POST['within']; // for this example within === p_c (post_content only) switch($within) { case 'p_s_c': default: $sql_match = 'p.p_name, p.p_content'; break; case 'p_c': $sql_match = 'p.p_content'; break; case 'p_s': $sql_match = 'p.p_name'; break; case 't_t': $sql_match = 't.t_name'; break; } $match === 'all' ? $keywords = '"'.$keywords.'"' : $keywords = $keywords; $query = $link->query("SELECT p.*, t.* FROM ".TBL_PREFIX."posts as p JOIN ".TBL_PREFIX."topics as t WHERE MATCH ($sql_match) AGAINST('$keywords' IN BOOLEAN MODE)") or die(print_link_error()); while($row = $query->fetch(PDO::FETCH_ASSOC)) { $return = preg_split('|, |', $sql_match); for($i=0; $i<count($return); $i++) { $return[$i] = substr($return[$i], 2); echo '<p>Results: '.$row[$return[$i]].'</p>'; } } And here is the echoed query: SELECT p.*, t.* FROM asf_posts as p JOIN asf_topics as t WHERE MATCH (p.p_content) AGAINST('Testing advanced search' IN BOOLEAN MODE) Any help? ok here is my problem... for example: i have 1000 files with 15 entrys each. but in the last one there is only 8 entrys. (i want to make a pagination) i want to display 15 entrys on each page. also how to calculate from which entry to which should it read. (i have another text file in which is the number of total entrys in all files together) for the first page it should read the first 8 and from thefirst file and the first 7 from the second file to get 15 displayed on the page. i was tryin now for some hours, but i just can't figure it out. :S and i know that i will think how stupid i'm after i will see how it should be done. :S Can someone help me code kind of a "advanced search" form, that will get a URL: Code: [Select] <form method="get"> <input type="checkbox" name="level" value="PreK" /> <input type="checkbox" name="level" value="Elem" /> <input type="checkbox" name="level" value="MS" /> <input type="checkbox" name="level" value="HS" /> <input type="checkbox" name="subject" value="Math" /> <input type="checkbox" name="subject" value="Reading" /> <input type="checkbox" name="level" value="Science" /> <input type="submit" value="submit" /> </form> So... if I ticked PreK, Elem and Math, the resulting link would be: www.mysite.com?level=PreK&Elem&subject=Math The most complicated thing... how would I get place the "&" in between variables? Thank you once again. ~Wayne Hi guys, I have a list of products and I want to create a way to display similar products when a user views a particular product. I am thinking about doing it a certain way but need some advice on how to make it happen. I think I would do it like: Get the name of the existing product explode() the name by space" " e.g (explode(" ",$productname)); place the reuslts in a query that looks like: SELECT * FROM product WHERE name LIKE '%$arrayitem1% OR LIKE '%arrayitem2% OR LIKE '%arrayitem3%'' Im pretty fuzzy on the whole explode() part. Can anyone please give me some advice or point me in the direction of a similar tutorial/piece of code? Thanks heaps! This topic has been moved to Miscellaneous. http://www.phpfreaks.com/forums/index.php?topic=343600.0 Hello guys, I'm trying to solve my hometask . I tried in many different ways to solve the task related with Advanced SQL Syntax. Please check the pic below: The Quiz is asking for make location appear in all uppercase letters, the character associated with a given ASCII value and the table is people. I tried the last one in this way: SELECT CONCAT(name,'is from',strtoupper(location),' The ASCII character of the number ',number,' is ',ASCII(number)) FROM `people` WHERE 1 but it doesn't work. Can someone help me? Thanks |