Jump to content

Search the Community

Showing results for tags 'url'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (Dreamweaver, Zend, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

Found 13 results

  1. Here is a example link: https://site.com/this_here/page.php?note=W+srchttp:>e+have+some+text+here. That shows up fine like it is supposed to, but when I want a image to show up with in it - in html - it makes the whole page wonky. Example Problem: https://site.com/this_here/page.php?note=We+have+some+text+here.+<img src=imagelink.png> I have it on any page that is now set to show an image link that. I used to not have problems with this and now I do. The 'note' text comes from a $_GET and is not decoded or anything - which you shouldn't do I know. I tested by taking out one "<" thinking that was the problem. And that made it so the page wasnt wonky but then you know just the text appeared. I also tested leaving in both "<>" from the img tag and taking out the "=". That also makes it so the page isnt wonky anymore. Does just the same as taking out a "<>". This seems like a really weird error to me, but maybe there is something I should or shouldn't be doing that I am not thinking of.
  2. Here's the basic premise of the function I am trying to create. 1. User 1 sends a trade request to User 2. 2. User 2 accepts the request. 3. It redirects both users to new page(trade.php). Below is the code where User 2 accepts the request.I am using jquery dialog box for pop windows. The current issue I am having is that "window.location." is not showing the "by=$session_requestById" variable. It appears as NULL if I var_dump on trade.php page. But it is showing the second variable correctly, which is "by=$session_requestToId". It seems like it only happens on trade.php page. Both variables show up fine on request-php.page and in heading when I var_dump. Perhaps you can tell me what's wrong with this ? window.location.href='trade?by=<?php echo $session_requestById; ?>&to=<?php echo $session_requestToId; ?>'; <script> $(function() { $( "#dialog-confirm" ).dialog({ resizable: true, autoOpen: true, modal: true, width: 600, height: 300, buttons: { "Accept Trade": function() { $( this ).dialog( "close" ); $.ajax({ type:"post", url:"request-trade?by=<?php echo $session_requestById; ?>&to=<?php echo $session_requestToId; ?>", data:"action=acceptTrade", success:function(data){ window.location.href='trade?by=<?php echo $session_requestById; ?>&to=<?php echo $session_requestToId; ?>'; } }); }, Cancel: function() { $( this ).dialog( "close" ); $.ajax({ type:"post", url:"request-trade?by=<?php echo $session_requestById; ?>&to=<?php echo $session_requestToId; ?>", data:"action=cancelTrade", success:function(data){ if(data == false) { alert('not cancelled'); } else { alert('cancelled success'); } } }); } } }); }); </script>
  3. I cannot seem to figure this bit out. I'm trying to load data from an xml file depending on what the value of a url parameter is. I have an attribute set in my xml, but cannot seem to figure out how to go about this. I've looked at several examples of getting the attribute so I'm not sure where I am wrong since I haven't come across an example using url parameters to determine what data should be fetched. Here is what I have so far. An example of my xml file. There will be more records of piercing in this file. <piercings> <piercing id="default"> <title>Piercing Not Specified</title> <names>N/A</names> <gauge>0</gauge> <healing>0</healing> <risk>None</risk> <description>You must first choose a specific piercing from the menu to view information.</description> <aftercare>Aftercare tips will be available once you choose a specific piercing from the menu.</aftercare> <avoid>Things you should avoid will be listed once a specific piercing has been chosen.</avoid> <img>http://via.placeholder.com/350/000000/676767?text=Not%20Specified</img> <additionalimgs> <additionalimg>http://via.placeholder.com/350/000000/676767?text=Not%20Specified</additionalimg> </additionalimgs> </piercing> <piercing id="incomplete"> <title>Listing Incomplete</title> <names>N/A</names> <gauge>0</gauge> <healing>0</healing> <risk>None</risk> <description>The listing for this piercing is incomplete. Once completed the data will appear on this page. Please check back later.</description> <aftercare>Aftercare tips will be available once you the listing is complete.</aftercare> <avoid>Things you should avoid will be listed once the listing is complete.</avoid> <img>http://via.placeholder.com/350/000000/676767?text=Incomplete</img> <additionalimgs> <additionalimg>http://via.placeholder.com/350/000000/676767?text=Incomplete</additionalimg> </additionalimgs> </piercing> <piercing id="antieyebrow"> <title>Anti-Eyebrow</title> <names>Anti-Eyebrow, Teardrop</names> <gauge>16</gauge> <healing>6 - 8</healing> <risk>Rejection/Migration, Scarring</risk> <description>The anti-eyebrow piercing is located on the upper side of the cheek bone right below the orbital socket of the eye. This piercing is most commonly pierced using a 16 gauge curved barbell or custom bent jewelry. This piercing may also be referred to as a teardrop piercing.</description> <aftercare>It is recommended with this piercing to clean twice a day using saline solution or antibacterial soap. Do not overclean. Irritation from overcleaning can result in migration of the piercing. </aftercare> <avoid>Using rubbing alchohol as a cleaner. Changing the jewelry for atleast 3 weeks although recommended to wait until the piercing is fully healed. Pools/hot tubs especially those with chemical cleaners in them. Swimming holes, creeks, rivers, etc. due to bacterial exposure risk.</avoid> <img>http://jessetoxik.com/img/display/stock/antieyebrow_default.jpg</img> <additionalimgs> <additionalimg>http://jessetoxik.com/img/thumb/stock/antieyebrow_1.jpg</additionalimg> <additionalimg>http://jessetoxik.com/img/thumb/stock/antieyebrow_2.jpg</additionalimg> <additionalimg>http://jessetoxik.com/img/thumb/stock/antieyebrow_3.jpg</additionalimg> </additionalimgs> </piercing> </piercings> So for this one I am trying to pull all of the data for the piercing with the attribute of id="antieyebrow". Here is what I tried to retrieve that. URL: http://example.com/piercing.php?location=antieyebrow. if (file_exists($_SERVER['DOCUMENT_ROOT'].'/info/piercing/piercings.xml')) { $piercingxml = simplexml_load_file($_SERVER['DOCUMENT_ROOT'].'/info/piercing/piercings.xml'); $location = $_GET['location']; $piercingid = $piercingxml['id']; } else { $piercingxml = simplexml_load_file($_SERVER['DOCUMENT_ROOT'].'/info/piercing/default.xml'); $location = "default"; } And finally to display the data onto the page: echo $piercingxml->$piercingid[$location]->title; So far nothing from the file is being displayed. How do I accomplish this? Any help as to where I went wrong would be greatly appreciated.
  4. Say I have directory setup like this. core/ includes/ snippets/ template.php js/ index.php Say in the index.php file, I have a file path like this " include 'snippets/template.php'; ". It works. Or say If I am in template.php and I have a file path like this " include '../index.php'; ". It works as well. I am wondering if there is a more global method to this so I don't have to worry about when to use "../" or not. It becomes hectic if there are a lot of includes and/or links.
  5. Trying to figure out how, when I press my logout button, do I get my page to go back to it's original page without the ?variable=something at the end: header('Location: '.$_SERVER['PHP_SELF'].'?activationsent=1'); I own this site: http://www.golden-wand.com/phpfreaks.txt
  6. I am using a simple image upload. http://www.w3schools.com/php/php_file_upload.asp It gives me 2 errors like this. Warning: move_uploaded_file(C:/xampp/htdocs/home/upload/images/grandpix 2.jpg): failed to open stream: No such file or directory in C:\xampp\htdocs\home\upload\post.php on line 174 Warning: move_uploaded_file(): Unable to move 'C:\xampp\tmp\phpF915.tmp' to 'C:/xampp/htdocs/home/upload/images/grandpix 2.jpg' in C:\xampp\htdocs\home\upload\post.php on line 174 This is my code. Post.php . I see that it's the "$target_dir" issue. How can I fix it? if(isset($_FILES['fileToUpload'])){ if(!empty($_FILES['fileToUpload']['name'])) { $target_dir = $_SERVER['DOCUMENT_ROOT'].'/home/upload/images/'; $target_file = $target_dir . basename($_FILES["fileToUpload"]["name"]); $uploadOk = 1; $imageFileType = pathinfo($target_file,PATHINFO_EXTENSION); $check = getimagesize($_FILES["fileToUpload"]["tmp_name"]); if($check !== false) { $uploadOk = 1; } else { $errors[] = 'File is not an image.'; $uploadOk = 0; } // Check if file already exists if (file_exists($target_file)) { $errors[] = 'Sorry, file already exists.'; $uploadOk = 0; } // Check file size if ($_FILES["fileToUpload"]["size"] > 500000) { $errors[] = 'Sorry, your file is too large.'; $uploadOk = 0; } // Allow certain file formats if($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg" && $imageFileType != "gif" ) { $errors[] = 'Sorry, only JPG, JPEG, PNG & GIF files are allowed.'; $uploadOk = 0; } // Check if $uploadOk is set to 0 by an error if ($uploadOk == 0) { $errors[] = 'Sorry, your file was not uploaded.'; // if everything is ok, try to upload file } else { if (move_uploaded_file($_FILES["fileToUpload"]["tmp_name"], $target_file)) { echo "The file ". basename( $_FILES["fileToUpload"]["name"]). " has been uploaded."; } else { $errors[] = 'Sorry, there was an error uploading your file.'; } } $insert_image = $db->prepare("INSERT INTO images(user_id, item_id, image_path, date_added) VALUES(:user_id, :item_id, :image_path, :date_added)"); $insert_image->bindParam(':user_id', $userid); $insert_image->bindParam(':item_id', $item_id); $insert_image->bindParam(':image_path', $target_file); $insert_image->bindParam(':date_added', $date_added); if(!$insert_image->execute()) { $errors[] = 'There was a problem uploading the image!'; } else { if(empty($errors)) { $db->commit(); $success = 'Your post has been saved.'; } else { $db->rollBack(); } } } else { $errors[] = 'An image is required!'; } }
  7. Typically when you submit a form, it's in a format like this "collections?type='wheels'&make='acura'&year='2016'&model='mdx' ". Instead of that format, I would like to do something like this " collections/wheels/acura+2016+mdx ". How would I go on about doing that format with jquery submit form? This is my setup so far. <script> // Code goes here $(document).ready(function() { $('#search').on('submit', function() { var type = $('#type').val(); var make = $('#make').val(); var year = $('#year').val(); var model = $('#model').val(); var formAction = $('#search-form').attr('action'); $('#search-form').attr('action', formAction + type + make + year + model); }); </script> <form id="search-form" action="/collections/" method="get"> <select id="type" name="type"> // type list goes here </select> <select id="make" name="make"> // make list goes here </select> <select id="year" name="year"> // year list goes here </select> <select id="model" name="model"> // model list goes here </select> <input type="submit" id="search" value="Search"> </form>
  8. Right now my website url appears like this. http://www.mywebsite.com/index.php I was wondering if there is a way to remove the index.php and just have it show like this when someone goes to the website? http://www.mywebsite.com
  9. I have followed a youtube playlist to build a simple MVC framework based on PHP, here is a link to the playlist I have followed. and here is an image of my application structure image I have connected the application to a MySql database, everything is working fine, but now I am trying to do friendly URLs. Currently, my URLs look like the following: mywebsite.com/public/home/property This is fine as this link is for a static page, but I want the same for dynamic URLs, for example: Current URL: mywebsite.com/public/home/property?id=10 to URL: mywebsite.com/public/home/property/id/10 I have tried a lot of methods in htaccss but the data is not pulled from the database once the URL is re-written and I get only an empty page. current .htaccess code (the one that is located in the public folder): Options -MultiViews RewriteEngine On RewriteBase /public RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.+)$ index.php?url=$1 [QSA,L] I have tried a lot of methods and rules but non have worked. I am not sure if the details I provided are clear enough, I am little confused as I combined a lot of tutorials together to create this app. App.php code: <?php class App{ protected $controller = 'home'; protected $method = 'index'; protected $params = []; public function __construct(){ $url = $this->parseUrl(); if(file_exists('../app/controllers/' . $url[0] . '.php')){ $this->controller = $url[0]; unset($url[0]); } require_once '../app/controllers/' .$this->controller. '.php'; $this->controller = new $this->controller; if(isset($url[1])){ if(method_exists($this->controller, $url[1])){ $this->method = $url[1]; unset($url[1]); } } $this->params = $url ? array_values($url) : []; call_user_func_array([$this->controller, $this->method], $this->params); } public function parseUrl(){ if(isset($_GET['url'])){ return $url = explode('/', filter_var(rtrim($_GET['url'], '/'), FILTER_SANITIZE_URL)); echo $url; } } } ?> controller.php code: <?php class Controller{ public function model($model){ require_once '../app/models/' . $model . '.php'; return new $model(); } public function view($view, $data = []){ require_once '../app/views/' . $view . '.php'; } } ?> controllers code: <?php class home extends Controller{ public function index(){ $this->view('home/index'); } public function listings(){ $this->view('home/listings'); } public function property(){ $this->view('home/property'); } } ?> code for the page that should show data from mysql database: <?php include "includes/head.php"; ?> <?php $property = Property::find_id($_GET['id']); ?> <section id="sub-main"></section> <section id="sub-list"> <div class="container"> <div class="row"> <div class="col-xs-12 col-sm-6"> <div id="listingCarousel" class="carousel slide" data-ride="carousel"> <div class="carousel-inner" role="listbox"> <div class="item active"> <img src="https://placeholdit.imgix.net/~text?txtsize=33&txt=585%C3%97380&w=585&h=380" alt=""> </div> <div class="item"> <img src="https://placeholdit.imgix.net/~text?txtsize=33&txt=585%C3%97380&w=585&h=380" alt=""> </div> <div class="item"> <img src="https://placeholdit.imgix.net/~text?txtsize=33&txt=585%C3%97380&w=585&h=380" alt=""> </div> </div> </div> </div> <div class="col-xs-12 col-sm-6"> <h1><?php echo $property->property_name; ?></h1> <ul class="list-inline"> <li><i class="fa fa-map-signs" aria-hidden="true"></i> <b></b> <?php echo $property->city; ?></li> </ul> </div> </div> <hr> <div id="map"></div> </div> </section> <?php include "includes/subscribe.php"; ?> <?php include "includes/footer.php"; ?> The project is online, I can give full access if someone interested in helping me solve this issue.
  10. Im setting up members on my site i want the profile url to be like www.mywebsite.com/NATHAN but not go to a folder on my server called nathan but instead go to mywebsite.com/?profile=Nathan
  11. Here is what I am trying to do. Get from this http://mysite.com/post.php?id=12&title=postname to this http://mysite.com/post/12/postname/ here’s the rewrite rule. Options +FollowSymLinks RewriteEngine On RewriteRule ^post/([a-zA-Z]+)/([0-9]+)/$ post.php?id=$1&title=$2 This is my html link that links to the post.php page. <a href="post.php?id=12&title=postname"> Click here to see the post! </a> It does not change the url. I have also tried it like below and it gives me an internal error. <a href="post/12/postname"> Click here to see the post! </a> Can you see what I have done wrong? Also if the above method for the linking is correct, how do I get the "id" and "title" using the $_GET?
  12. Say below is my normal html href link. How would you turn this into a pretty URL using .htaccess? Also if I understand it correctly, this link will also have to be changed to match the pretty url. What would the new link look like? <a href="shop.php?type=45&name=belts">Belts</a>
  13. Hello, I have problem with my pagination script, I tried to add tags to it but selecting second page (next page) when tag is working and filter content of the page, gets me back to second page with content without tag. It should look like this: gallery/page/2/?s=&tag=2 instead: gallery/page/2 I just dont know what to do. Can you help me out? My pagination script: <?php foreach ($this->pagesInRange as $page): ?> <?php if ($page != $this->current): ?> <li><a href="<?php echo $this->url($this->route, array('page' => $page ), true); ?>"><?php echo $page; ?></a></li> <?php else: ?> <li class="active"><a href="#"><?php echo $page; ?></a></li> <?php endif; ?> <?php endforeach; ?>
×
×
  • 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.