Jump to content

Search the Community

Showing results for tags 'url'.

  • 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 (PhpStorm, VS Code, 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

  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. 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>
  3. 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>
  4. 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!'; } }
  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. 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; ?>
  7. 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>
  8. 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
  9. 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
  10. 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?
  11. I'm trying to get an equation from a user that types it in the url, ex) 1+2+3. I can get the 1,2,3 fine, but the + operator is no longer in the string. Same with the * and / operators. Is there a way to keep them as a string using $_GET?
  12. I am taking a form that has been created and now trying to incorporate it into WP. The form is filled out multiple times per session. The form when filled out will generate an ID that is used to track the form submissions until completed. The problem that I'm running into is that the code is using a URL structure that breaks on the install. I'm not sure what to tell the code to look for as the URL. I hope I'm making sense. This is my first dive into WP dev. Thanks for the help. <?php /* Template Name: Form */ ?> <?php /** * The template for displaying all pages * * This is the template that displays all pages by default. * Please note that this is the WordPress construct of pages and that * other 'pages' on your WordPress site will use a different template. * * @package WordPress * @subpackage Twenty_Thirteen * @since Twenty Thirteen 1.0 */ get_header(); ?> <div id="main-content" class="main-content"> <div id="headertitle"> <h1>Steam Trap Form Input</h1> </div> <div id="formtable"> <form class="form-horizontal" role="form" action="/test/FormHandler.php" method="post"> <fieldset> <div class="form-group"> <label for="dateSurvey" class="col-sm-2 control-label">Survey Date</label> <div class="col-sm-6"> <input type="text"<? echo (isset($sd['date']) ? ' value="'.format_date($sd['date']).'"' : '') ?> class="form-control col-sm-6 input-append date" id="dp1" name="dateSurvey" data-date="02-12-2014" data-date-format="mm-dd-yyyy"> </div> </div> <div class="form-group"> <label for="plantName" class="col-sm-2 control-label">Plant Name</label> <div class="col-sm-6"> <input type="text" class="form-control col-sm-6" name="plantName"<? echo (isset($sd['plant_name']) ? ' value="'.$sd['plant_name'].'"' : '') ?>> </div> </div> <div class="form-group"> <label for="plantLoc" class="col-sm-2 control-label">Plant Location</label> <div class="col-sm-6"> <input type="text" class="form-control col-sm-6" name="plantLoc"<? echo (isset($sd['plant_location']) ? ' value="'.$sd['plant_location'].'"' : '') ?>> </div> </div> <div class="form-group"> <label for="plantContact" class="col-sm-2 control-label">Plant Contact Name</label> <div class="col-sm-6"> <input type="text" class="form-control col-sm-6" name="plantContact"<? echo (isset($sd['plant_contact_name']) ? ' value="'.$sd['plant_contact_name'].'"' : '') ?>> </div> </div> <div class="form-group"> <label for="pph" class="col-sm-2 control-label">Pound Per Hour</label> <div class="col-sm-6"> <input type="text" class="form-control col-sm-6" name="pph" placeholder="XX.XX"<? echo (isset($sd['pph']) ? ' value="'.$sd['pph'].'"' : '') ?>> </div> </div> <div class="form-group"> <label for="area" class="col-sm-2 control-label">Area</label> <div class="col-sm-6"> <input type="text" class="form-control col-sm-6" name="area" placeholder="Boiler Room"<? echo (isset($sd['area']) ? ' value="'.$sd['area'].'"' : '') ?>> </div> </div> <hr> <div class="form-group"> <label for="testDate" class="col-sm-2 control-label">Tested Date</label> <div class="col-sm-6"> <input type="text" class="form-control col-sm-6 input-append date" id="dp2" name="testDate" data-date="02-12-2014" data-date-format="mm-dd-yyyy"> </div> </div> <!-- <div class="form-group"> <label for="direction" class="col-sm-2 control-label">Direction</label> <div class="col-sm-6"> <select class="form-control col-sm-6" name="direction"> <option value="N">N</option> <option value="NE">NE</option> <option value="NW">NW</option> <option value="S">S</option> <option value="SE">SE</option> <option value="SW">SW</option> <option value="E">E</option> <option value="W">W</option> </select> </div> </div> --> <div class="form-group"> <label for="location" class="col-sm-2 control-label">Location</label> <div class="col-sm-6"> <input type="text" class="form-control col-sm-6" name="location" placeholder=" 'Detailed as possible'"> </div> </div> <div class="form-group"> <label for="flrLevel" class="col-sm-2 control-label">Floor Level</label> <div class="col-sm-6"> <select class="form-control col-sm-6" name="flrLevel"> <option value="GROUND">Ground</option> <option value="1st">1st</option> <option value="2nd">2nd</option> <option value="3rd">3rd</option> <option value="4th">4th</option> <option value="5th">5th</option> <option value="6th">6th</option> <option value="7th">7th</option> <option value="8th">8th</option> <option value="9th">9th</option> <option value="10th">10th</option> <option value="11th">11th</option> <option value="12th">12th</option> <option value="13th">13th</option> <option value="14th">14th</option> <option value="15th">15th</option> </select> </div> </div> <div class="form-group"> <label for="elevation" class="col-sm-2 control-label">Elevation</label> <div class="col-sm-6"> <input type="number" class="form-control col-sm-6" name="elevation" placeholder="in feet"> </div> </div> <div class="form-group"> <label for="tagNum" class="col-sm-2 control-label">Tag Number</label> <div class="col-sm-6"> <input type="text" class="form-control col-sm-6" name="tagNum"> </div> </div> <div class="form-group"> <label for="manufacturer" class="col-sm-2 control-label">Manufacturer</label> <? /* <input type="text" name="mmn" size="30"> */ ?> <div class="col-sm-6"> <select name="manufacturer" class="depend col-sm-6 form-control" id="manufacturer"> <option value="" selected="selected" disabled="disabled">Select Manufacturer</option> </select> </div> <div id="status"></div> </div> <div class="form-group"> <label for="model" class="col-sm-2 control-label">Model Number</label> <div class="col-sm-6"> <select name="model" class="depend col-sm-6 form-control" id="model"> <option value="" selected="selected">Select value</option> </select> </div> </div> <div class="form-group"> <label for="size" class="col-sm-2 control-label">Size</label> <div class="col-sm-6"> <select name="size" class="depend col-sm-6 form-control" id="size"> <option value="" selected="selected">Select value</option> </select> </div> </div> <div class="form-group"> <label for="pressure" class="col-sm-2 control-label">Pressure</label> <div class="col-sm-6"> <select name="pressure" id="pressure" class="col-sm-6 form-control"> <option value="" selected="selected">Select value</option> </select> </div> </div> <div class="form-group"> <label for="service" class="col-sm-2 control-label">Service</label> <div class="col-sm-6"> <select class="form-control col-sm-6" name="service" name="service"> <option value="TRACER">TRACER</option> <option value="HEATER">HEATER</option> <option value="PROCESS">PROCESS</option> <option value="DRIP">DRIP</option> </select> </div> </div> <div class="form-group"> <label for="trapCond" class="col-sm-2 control-label">Trap Conditions</label> <div class="col-sm-6"> <select class="form-control col-sm-6" name="trapCond"> <option value="OK">OK</option> <option value="BT">BT</option> <option value="CP">CP</option> <option value="VO">VO</option> <option value="RCL">RCL</option> </select> </div> </div> <p></p> <div class="form-group"> <div class="col-sm-offset-2 col-sm-6"> <? if(isset($surveyID)) { echo '<input type="hidden" name="surveyID" value="'.intval($_GET['survey']).'">'; } ?> <!-- <? if(isset($areaID)) { echo '<input type="hidden" name="areaID" value="'.intval($_GET['area']).'">'; } ?> --> <button class="btn btn-default btn-lg" type="submit" name="submit" value="add">Add Trap</button> <button class="btn btn-primary btn-lg" type="submit" name="submit" value="add_area">Submit Area</button> <button class="btn btn-danger btn-lg" type="submit" name="submit" value="submit">Submit Survey</button> </div> </div> </fieldset> </form> </div> <!-- jQuery (necessary for Bootstrap's JavaScript plugins) --> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <!-- Include all compiled plugins (below), or include individual files as needed --> <script src="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script> <!-- <script src="../script/js/script.js"></script> --> <script src="../script/js/live.js"></script> <script src="../script/js/bootstrap-datepicker.js"></script> <script type="text/javascript"> jQuery(document).ready(function() { jQuery('#dp1').datepicker({ dateFormat : 'dd-mm-yy' }); }); jQuery(document).ready(function() { jQuery('#dp2').datepicker({ dateFormat : 'dd-mm-yy' }); }); </script> </body> </html> <!-- #content --> </div><!-- #primary --> <?php get_sidebar( 'content' ); ?> </div><!-- #main-content --> <?php get_sidebar(); get_footer(); ?> <?php require("../test/base.php"); if(isset($_POST['submit'])) { $url = '../test/form'; // path to form.php if(!isset($_POST['manufacturer'])) { $_POST['manufacturer'] = NULL; } if(!isset($_POST['model_number'])) { $_POST['model_number'] = NULL; } if(!isset($_POST['size'])) { $_POST['size'] = NULL; } if(!isset($_POST['pressure'])) { $_POST['pressure'] = NULL; } $data = prep($_POST); if($data['submit'] == 'add') { if(!isset($data['surveyID'])) { $surveyID = save_survey($data); } else { $surveyID = $data['surveyID']; } save_survey_details($surveyID, $data); if($surveyID) { header('Location: '.$url.'?survey='.$surveyID); } } if($data['submit'] == 'add_area') { if(!isset($data['areaID'])) { $areaID = save_survey($data); } else { $areaID = $data['areaID']; } save_survey_details($areaID, $data); if($areaID) { header('Location: '.$url.'?survey='.$areaID); } } elseif($data['submit'] == 'submit') { if(isset($data['surveyID'])) { save_survey_details($data['surveyID'], $data); } else { $surveyID = save_survey($data); save_survey_details($surveyID, $data); } header('Location: '.$url); } } function prep($input) { $data = array(); if(is_array($input)) { foreach ($input as $key => $val) { $data[$key] = mysql_real_escape_string($val); } } return $data; } function format_date($date = '') { if(isset($date) && $date) { $tmp = explode('-', $date); $d = $tmp[2].'-'.$tmp[0].'-'.$tmp[1]; } else { $d = NULL; } return $d; } function save_survey($data) { $result = mysql_query("INSERT INTO surveys (date, plant_name, plant_location, plant_contact_name, pph, area) VALUES('".format_date($data['dateSurvey'])."','".$data['plantName']."','".$data['plantLoc']."','".$data['plantContact']."','".$data['pph']."','".$data['area']."')") or die('Error: ' . mysql_error()); $result = mysql_query("INSERT INTO area (date, plant_name, plant_location, plant_contact_name, pph, area) VALUES('".format_date($data['dateSurvey'])."','".$data['plantName']."','".$data['plantLoc']."','".$data['plantContact']."','".$data['pph']."','".$data['area']."')") or die('Error: ' . mysql_error()); return mysql_insert_id(); } function save_survey_details($surveyID, $data) { $result = mysql_query("INSERT INTO survey_details (survey_id, tested_date, direction, location, floor_level, elevation, tag_number, manufacturer, model_number, size, pressure, service, trap_conditions) VALUES($surveyID, '".format_date($data['testDate'])."','".$data['direction']."','".$data['location']."','".$data['flrLevel']."','".$data['elevation']."','".$data['tagNum']."','".$data['manufacturer']."','".$data['model']."','".$data['size']."','".$data['pressure']."','".$data['service']."','".$data['trapCond']."')"); $result = mysql_query("INSERT INTO area_details (survey_id, tested_date, direction, location, floor_level, elevation, tag_number, manufacturer, model_number, size, pressure, service, trap_conditions) VALUES($surveyID, '".format_date($data['testDate'])."','".$data['direction']."','".$data['location']."','".$data['flrLevel']."','".$data['elevation']."','".$data['tagNum']."','".$data['manufacturer']."','".$data['model']."','".$data['size']."','".$data['pressure']."','".$data['service']."','".$data['trapCond']."')"); //or die('Error: ' . mysql_error()); } ?>
  13. I am new to website development. I can't figure out how to open a new tab for the following javasript. I went through related questions but nothing worked for me. I want the browser to open a new tab when someone clicks on the link (example.com) below. The code target="_blank doesn't work here... What code should I add and where should I place that code? My html code is here - <section id="work-grid" class="site-inner"> <div class="work-item" data-groups='["all", "webdesign"]' data-url="http://example.com"> <figure class="image-container"><img src="images/work/web-one.jpg" /></figure> </div> Thanks in advance.
  14. Hi Everyone.. I am not sure if I should post this question here. I would like to fix this problem using PHP rather than HTML. I am new to PHP. This code is part of an old PHP gallery file. I am trying to validate my site but the site's links have some characters that makes the link throw errors in W3C Validator. So I tried to replace the characters with HTML characters for example ? are now replaced by ? so my original link before using valid HTML characters looked like www.awebsite.com/viewgallery.php?cname=Colorado-Fall&pcaption=Lost-In-The-art And now it looks like this ... www.awebsite.com/viewgallery.php?cname=Colorado-Fall&pcaption=Lost-In-The-art But now W3C Validator shows an error like this The ? for replacing ? seems to be the problem.The & is highlighted in red. What am I doing wrong? How can I validate this link? I tried to use single or double quotes around HTML characters but that breaks my links and they won't work after that. Any tips will be appreciated...
  15. Hello - hoping to find some direction with this. I think this is fairly simple for more experienced php coders but I'm having trouble with it. It's a php grep text string search that results in a list of files that contain the string. Hoping to split the $results value (list of file names) into separate links to open the file. I was able to convert into a link for the first file listed, but it links to that same file for all the entries in the list. I assume that maybe an array of $results needs to be created first rather than try and work with $results at the end? <?php /** * E.Yekta * cafewebmaster.com */ define("SLASH", stristr($_SERVER[SERVER_SOFTWARE], "win") ? "\\" : "/"); $path = ($_POST[path]) ? $_POST[path] : dirname(__FILE__) ; $q = $_POST[q]; function php_grep($q, $path){ $fp = opendir($path); while($f = readdir($fp)){ if( preg_match("#^\.+$#", $f) ) continue; // ignore symbolic links $file_full_path = $path.SLASH.$f; if(is_dir($file_full_path)) { $ret .= php_grep($q, $file_full_path); } else if( stristr(file_get_contents($file_full_path), $q) ) { $ret .= "$file_full_path\n"; } } return $ret; } if($q){ $results = php_grep($q, $path); } echo <<<HRD <pre > <form method=post> <input name=path size=100 value="$path" /> Path <input name=q size=100 value="$q" /> Query <input type=submit> </form> $results </pre > HRD; ?> php_grep.php
  16. Hello, I want to know how they keep the same url when page is changing, if you dont know what i mean try the link and check the browser when you wat happens when you click in a other link in the website. ( Website Link ( Normal Content ) ) http://geedmo.com/?item=LushSlider Thanks in advance.
  17. Hi all, So im trying to improve on my PHP as my knowledge isn't that great. lets say for argument sake my ip is: 192.168.0.1 im trying to set a external variable to set this as the url. so on each page i use, for each link instead of typing out the ip address i can simply type: <a href="{url}/index.php">Home</a> and then if it is possible, to do something like this: <link rel="stylesheet" href="{url}/main.css" type="text/css"> all in one file so in my php pages i can simple include 1 php file and it will have all of the relevant stylesheets ect linked to it.
  18. hi, im trying to create a website and only now started thinking about the security part(noob mistake). say for example i have home.php page and an index.php page. index.php is where users would sign up/log in. the login and sign up processes are all done but i was thinking of creating a unique id of some sort for when the user logs in. or something like this site (forum.phpfreaks) when we sign in, you are signed but the url stays the same = forums.phpfreaks.com. like if we were signed out we will be permanantly signed out and typing in forums.phpfreaks.com would just land us at the main page where we need to sign in. right now ,my home.php can be accessed with or without logging in even with sessions. hope im making sense, thanks in advanced! **haha that rhymed. i tried adding: <?php echo $_SERVER[php_SELF] . '?name=' . $userData['name'];?> in the index.php: <?php ob_start(); session_start(); if(isset($_POST['login'])) { $email = $_POST['email']; $password = $_POST['pass']; require "connection.php"; $emails = mysqli_real_escape_string($con, $email); $query = "SELECT id, name, email, password, salt FROM users WHERE email = '$emails';"; $result = mysqli_query($con, $query); if(mysqli_num_rows($result) == 0) // User not found. So, redirect to login_form again. { echo "<script>alert(\"User does not exist!\")</script>"; } $userData = mysqli_fetch_array($result, MYSQLI_ASSOC); $hash = hash('sha256', $userData['salt'] . hash('sha256', $password) ); if($hash != $userData['password']) { echo "<script>alert(\"Incorrect Password!\")</script>"; }else{ session_regenerate_id(); $_SESSION['sess_user_id'] = $userData['id']; $_SESSION['sess_name'] = $userData['name']; session_write_close(); header('Location: home.php?user='); } } ob_flush(); ?> <!DOCTYPE html> <form name="login" method="post" action="<?php echo $_SERVER[PHP_SELF] . '?name=' . $userData['name'];?>"> but i got access forbidden!
  19. I didn't notice this until know. Say I have a url like this. http://www.yoursite.com?category_id=3&category_name= Grocers & Shoppers When I get the the category name using $_GET, it'll only echo 'Grocers' and not the full word 'Grocers & Shoppers'. Anyone can tell me what's happening?
  20. I am trying to set variables with $_GET from the url... caption.php?image=53348b3068f36.jpg&topcaption=sdfas&bottomcaption=asdfadf if (isset($_GET['image'])){ $picture = $_GET['image']; $topcaption = $_GET['topcaption']; $bottomcaption = $_GET['bottomcaption'];
  21. I have a problem when I share a link of my website, that remains "static". I mean: when I share an article (link www.mysite.net/?guid=VALUE) in social networks, the post text is normal, but when I click in the article picture or title, the link that opens is the "normal" of my website (www.mysite.net). The title and description not change too. Code: <META ITEMPROP="name" CONTENT="text/html; charset=utf-8"> <?php include("login/db_connect_open.php") ; ?> <?php if (isset($_REQUEST["guid"])) { $guid = mysql_real_escape_string($_REQUEST["guid"]); // sanitize the guid $query = "SELECT * FROM news WHERE news_guid='".$guid."'"; $result = mysql_query($query); $row = mysql_fetch_array($result); ?> <div class="twelve columns"> <div class="row"><h3 class="n3"><?php echo $row["news_title"]; ?></h3> </div> </div> <div class="row"><!-- Row interior--> <div class="twelve columns"> <div class="panel"> <p id="data"><?php echo $row["news_date"]; ?>, <?php echo $row["hour"];?> GMT</p> <p><?php echo $row["news_post"]; ?></p> </div></div></div> <?php } else ?> <div class="twelve columns"> <div class="row"><h3 class="n3">Destaques</h3> </div> <div class="row"> <?php { $query = "SELECT * FROM news WHERE destaque='Sim' and publicado='sim' ORDER BY news_id DESC LIMIT 4"; $result = mysql_query($query); while ($row = mysql_fetch_array($result)) { echo "<div class='three columns'>"; echo "<a href='?guid=".$row["news_guid"]."' class='div-link'>"; echo "<div class='desc-new'>"; //imagem echo "<div class='img-block'><img src='".$row['news_image']."' title='".$row["news_title"]."' alt='".$row["news_title"]."'/></div>"; //texto echo "<h4 class='new-title' onmouseover='none'>".$row["news_title"]."</h4>"; echo "<h4 class='new-subtitle' onmouseover='none'>".$row["news_subtitle"]."</h4>"; echo "<aside><p>".$row["news_desc"]."</p><p class='datapeq'>".$row["news_date"].", ".$row["hour"]."</p></aside>"; echo "</div>"; echo "</a>"; echo "</div>"; } } ?> </div></div> <!-- Fim de row interior --> <?php include("login/db_connect_close.php") ; ?>
  22. Hey, I have looked around everywhere possible to find a way of doing this and just cant seem to do it. So.. i have 1 Page with holds 4 extentions e.g ?table1=show to ?table4=show. Im wondering how i get one of my tables to have a & aswell so like ?table4=show&id=1.. but when im clicking the word to add the & to URL its just taking th table out and going to ?content=show. To make a & is $_GET anygood or should that be used for ? only? Thanks in advance and sorry if this is hard to understand.
  23. I have question regarding the setup of url for multiple pages. For eg. How does one have a setup like this? http://www.groupon.ca/deals/gatineau_en/Antirouille-Metropolitain/35853918 The setup I have is like this. //Page 1 with posts shown in a specific catagory. www.mysite.ca/posts_cat.php?catagoryId=1 //Page 2 with a single post shown. www.mysite.ca/posts.php?title=this is my post As you can see, my url setup is quite different than Groupon's. I am not sure if it's the correct way to do it; but it does work. The reason I have two different pages for posts are because I have two different css designs. I suppose my question is, is my method ok? And how do I make it so it looks like Groupon's way?
  24. Hello , I have two fields in database (ID , CITYNAME ) like below ID | CITYNAME ---------------------- 123 | DELHI ---------------------- 124 | MAHARASHTRA ---------------------- 125 | PUNJAB ---------------------- I am trying to display records based on id number in a file called viewrecords.php. where i am passing ID parameter (http://www.example.com/viewrecords.php?ID=123) and display the record in viewrecords.php file. It simply displays the records where the corresponding id is matches. Now I have a requirement where i need to display a city field ( for example http://www.example.com/cityname-ID.php that is http://www.example.com/delhi-123.php) in the addressbar instead of viewrecords.php. any help appreciated.
  25. Hi, I am fetching content from url & causing problem. EX. URL: http://localhost/pb-customer-portal/forms/service_call_report1.php?customer_name=Rajesh%20Kumar&customer_address=229%20house%20no%20&%20gali%20no%2034,%20harsh%20vihar&customer_address1=undefined&call_no=122451&machine_model_no=854221144&machine_serial_no=963258 when i am fetching by using $customer_address=$_REQUEST["customer_address"]; i should get address= 229 house no & gali no 34, harsh vihar, But i only getting 229 house no. (not getting after Bold & in URL) Can anyone suggest how to tackle this problem. Thanks
×
×
  • 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.