Jump to content

Search the Community

Showing results for tags 'redirect'.

  • 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. Hey guys, i have a .htaccess file that i am trying to modify. apparently i modified this before to remove extensions from being necessary ( i.e .php) then i made a modification to remove the www from the URL so that it would be strictly http://websitenamehere.com this did not work and i tried to remove the code from the .htaccess file, as you will see there is no code now for this. Yet, when go to the site it works and shows its SERP as websitename.com. this is extremely frustrating and looks very amateurish. .HTACCESS FILE RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ /profile.php?username=$1 # ---- Establish a custom 404 ErrorDocument 404 /filenotfound.php # ---- Prevent directory file listing index IndexIgnore * # ---- Make Pages render with no ext Options +Multiviews AuthName "websitename.com" AuthUserFile "/home/websitename/.htpasswds/public_html/passwd" also on a side issue if anyone has any input, how can i remove the .index extension from showing, i want to to a redirect from the .htaccess file, where instead of index.php it would just show the domain.name. Thank a bunch guys, any suggestions or help would be great.
  2. I was just wondering what people think, and what are your reasons why redirecting to a login page, or showing the login page instead of authenticated content is the right way. To be clear, lets say that a site visitor requests a page that requires authentication, and that site visitor is not logged in. 1) Should they be redirected to a login page? 2) Should the login page magically appear without redirect, replacing the content that would have been showed if they were logged in? Does it really matter which way login is handled? I have not been using redirects, and not experienced any problems with showing the login page instead of the authenticated content. It's actually very convenient to do login this way (at least for me). Are there any issues to be concerned with?
  3. Hello, I've been having some troubles in form submitting with HTML and PHP dynamic pages. In this case, the link to register at my site is index.php?p=r Inside this link, I have a form where the user fills and then have a button to submit it: <form class="form-horizontal margin-none" id="registerform" method="_GET" autocomplete="on" action="index.php?p=r"> <!-- Widget --> <div class="widget widget-heading-simple widget-body-gray"> <div class="widget-body"> <h4>Personal Details</h4> <!-- Row --> <div class="row-fluid"> <!-- Column --> <div class="span6"> <!-- Group --> <div class="control-group"> <label class="control-label" for="firstname">First name</label> <div class="controls"><input class="span12" id="firstname" name="firstname" type="text" /></div> </div> <!-- // Group END --> <!-- Group --> <div class="control-group"> <label class="control-label" for="lastname">Last name</label> <div class="controls"><input class="span12" id="lastname" name="lastname" type="text" /></div> </div> <!-- // Group END --> <!-- Group --> <div class="control-group"> <label class="control-label" for="email">E-mail</label> <div class="controls"><input class="span12" id="email" name="email" type="email" /></div> </div> <!-- // Group END --> </div> <!-- // Column END --> <!-- Column --> <div class="span6"> <!-- Group --> <div class="control-group"> <label class="control-label" for="username">Username</label> <div class="controls"><input class="span12" id="username" name="username" type="text" /></div> </div> <!-- // Group END --> <!-- Group --> <div class="control-group"> <label class="control-label" for="password">Password</label> <div class="controls"><input class="span12" id="password" name="password" type="password" /></div> </div> <!-- // Group END --> <!-- Group --> <div class="control-group"> <label class="control-label" for="confirm_password">Confirm password</label> <div class="controls"><input class="span12" id="confirm_password" name="confirm_password" type="password" /></div> </div> <!-- // Group END --> </div> <!-- // Column END --> </div> <!-- // Row END --> <hr class="separator" /> <h4>Billing Details</h4> <!-- Row --> <!-- Alert --> <div class="alert alert-error"> <button type="button" class="close" data-dismiss="alert">x</button> <strong>Why we need your billing details?</strong> We need your billing details because as a seller/buyer, we need to know where to send the cards. So insert that data carefully, otherwhise can happen shipment mistakes. </div> <!-- // Alert END --> <div class="row-fluid"> <!-- Column --> <div class="span6"> <!-- Group --> <div class="control-group"> <label class="control-label" for="address">Address</label> <div class="controls"><input class="span12" id="address" name="address" type="text" /></div> </div> <!-- // Group END --> <!-- Group --> <div class="control-group"> <label class="control-label" for="zipcode">Zip Code</label> <div class="controls"><input class="span12" id="zipcode" name="zipcode" type="text" /></div> </div> <!-- // Group END --> <!-- Group --> <div class="control-group"> <label class="control-label" for="city">City</label> <div class="controls"><input class="span12" id="city" name="city" type="text" /></div> </div> <!-- // Group END --> </div> <!-- // Column END --> <!-- Column --> <div class="span6"> <!-- Group --> <div class="control-group"> <label class="control-label" for="State">State</label> <div class="controls"><input class="span12" id="state" name="state" type="text" /></div> </div> <!-- // Group END --> <!-- Group --> <div class="control-group"> <label class="control-label" for="confirm_password">Country</label> <div class="controls"><input class="span12" id="confirm_password" name="confirm_password" type="text" /></div> </div> <!-- // Group END --> </div> <!-- // Column END --> </div> <!-- // Row END --> <hr class="separator" /> <!-- Row --> <div class="row-fluid uniformjs"> <!-- Column --> <div class="span4"> <h4 style="margin-bottom: 10px;">Policy & Newsletter</h4> <label class="checkbox" for="agree"> <input type="checkbox" class="checkbox" id="agree" name="agree" /> I agree with <a href="#TOS" data-toggle="modal">Terms of Services</a> </label> <label class="checkbox" for="newsletter"> <input type="checkbox" class="checkbox" id="newsletter" name="newsletter" checked="true"/> Receive Newsletter </label> </div> <!-- // Column END --> </div> <!-- // Row END --> <hr class="separator" /> <!-- Form actions --> <div class="form-actions" align="right"> <button type="submit" class="btn btn-icon btn-primary glyphicons circle_ok"><i></i>Register</button> </div> <!-- // Form actions END --> </div> </div> <!-- // Widget END --> </form> <!-- // Form END --> The problems keeps in this part of code: <!-- Form actions --> <div class="form-actions" align="right"> <button type="submit" class="btn btn-icon btn-primary glyphicons circle_ok"><i></i>Register</button> </div> <!-- // Form actions END --> When I click the Register Button, it redirects me to index.php?username......password.... Instead of reloading in the same page (index.php?p=r&username=.... ) I would like too the browser link doesn't show that data ( username, password ). Already tried to change the method to POST but it doesn't work. Can anyone help me please?
  4. Hi I have two button in my page One is 'search' and another is 'print' But i could not re direct and passing date to another page. code is working fine for search. But print I am blur of this. Pls help me how i can redirect the page by using button click. Pls help me Below my code index.php <?php include_once '../inc/connection.inc.php'; ?> <?php try { $stmt = $dbh->prepare('SELECT * FROM MVendorMaster order by MVName'); $stmt->execute(); } catch (PDOException $e) { $output = 'Error fetching main vendor from database!'; include '../errormsg.php'; exit(); } foreach ($stmt as $row) { $mvcode[] = array('MVCode' => $row['MVCode'], 'MVName' => $row['MVName']); } include 'searchform.html.php'; ?> <?php if (isset($_POST['search']) && $_POST['search'] != "" ) { $mvcode = $_POST["mvendor"]; $datefrom=$_POST["datefrom"]; $dateto=$_POST["dateto"]; $stmt = $dbh->query("SELECT * FROM php_vw_InvoiceHead WHERE MVCode='$mvcode' and SODate>='$datefrom' and SODate<='$dateto' ORDER BY MVCode,SODate"); $stmt->setFetchMode(PDO::FETCH_ASSOC); include 'view.html.php'; } if (isset($_POST['print']) && $_POST['print'] != "" ) { $mvcode = $_POST["mvendor"]; $datefrom=$_POST["datefrom"]; $dateto=$_POST["dateto"]; $stmt = $dbh->query("SELECT * FROM php_vw_InvoiceHead WHERE MVCode='$mvcode' and SODate>='$datefrom' and SODate<='$dateto' ORDER BY MVCode,SODate"); $stmt->setFetchMode(PDO::FETCH_ASSOC); include 'print.html.php'; } ?> searchform.html.php <?php include '../templete/header.php'; ?> <div> <h6>Sales Report by Main Vendor</h6> </div> <form action="" method="POST"> <table class="tdtable" id="tdtable"> <tr> <td>Main Vendor Name </td> <td> <select name="mvendor" id="mvcode"><option value="">Mian Vendor</option> <?php foreach ($mvcode as $mvcodes): ?> <option value="<?php htmlout($mvcodes['MVCode']); ?>"> <?php htmlout($mvcodes['MVName']); ?></option> <?php endforeach; ?> </select> </td> </tr> <tr> <td>Date[From]:</td> <td><input type="text" id="datepicker1" name="datefrom" /></td> </tr> <tr> <td>Date[To]:</td> <td><input type="text" id="datepicker2" name="dateto" /></td> </tr> </table> <div> <input type="submit" value="Search" name="search"> <input type="submit" value="Print" name="print"> </div> </form> view.html.php <?php $groupby = ''; $displaySubTotal = FALSE; $subTotal = 0; $grandTotal = 0; $sub_balqty=0; // maideen $grn_balqty=0; // maideen $sub_rtnqty=0; // maideen $grn_rtnqty=0; // maideen $sub_qty=0; // maideen $grn_qty=0; // maideen ?> <table width="100%" align="center" cellpadding="4" cellspacing="1" class=tbl_table"> <tr> <td class="tbl_header">MV CODE</td> <td class="tbl_header">MV NAME</td> <td class="tbl_header">SO Date</td> <td class="tbl_header">SO No</td> <td class="tbl_header">RATE</td> <td class="tbl_header">SUPP.QTY</td> <td class="tbl_header">RTN.QTY</td> <td class="tbl_header">BAL.Qty</td> <td class="tbl_header">SOLD AMT</td> <td class="tbl_header">Actions</td> </tr> <?php if(isset($stmt)) { while($row = $stmt->fetch()): if($groupby!=$row['MVCode']): if($displaySubTotal): ?> <tr><td colspan="10"><hr /></td></tr> <tr> <td colspan="4"> <td class="tbl_subtotal_left" ><b>Sub Total </b></td> <td class="tbl_subtotal_right"><b><?php echo number_format($sub_qty); ?></b></td> <td class="tbl_subtotal_right"><b><?php echo number_format($sub_rtnqty); ?></b></td> <td class="tbl_subtotal_right"><b><?php echo number_format($sub_balqty); ?></b></td> <td class="tbl_subtotal_right"><b><?php echo number_format($subTotal,2); ?></b></td> </tr> <tr><td colspan="10"><hr /></td></tr> <?php $grandTotal += $subTotal; $subTotal = 0; $grn_balqty += $sub_balqty; $sub_balqty=0; $grn_rtnqty += $sub_rtnqty; $sub_rtnqty=0; $grn_qty += $sub_qty; $sub_qty=0; else: $displaySubTotal = TRUE; endif; //$groupby = $row['SODate']; $groupby = $row['MVCode']; endif; ?> <tr> <td class="tbl_content"><?php echo $row['MVCode'];?></td> <td class="tbl_content"><?php echo $row['MVName'];?></td> <td class="tbl_content"><?php echo date("d-m-Y", strtotime($row['SODate']));?></td> <td class="tbl_content"><?php echo $row['SONo'];?></td> <td class="tbl_content_right"><?php echo number_format($row['Rate'],2) ;?></td> <td class="tbl_content_right"><?php echo number_format($row['Qty']) ;?></td> <td class="tbl_content_right"><?php echo number_format($row['RTNQty']) ;?></td> <td class="tbl_content_right"><?php echo number_format($row['BalQty']) ;?></td> <td class="tbl_content_right"><?php echo number_format($row['BalAmt'],2) ;?></td> </td> <?php $subTotal += $row['BalAmt']; $sub_balqty += $row['BalQty']; $sub_rtnqty += $row['RTNQty']; $sub_qty += $row['Qty']; endwhile; $grandTotal += $subTotal; $grn_balqty += $sub_balqty; $grn_rtnqty += $sub_rtnqty; $grn_qty += $sub_qty; ?> <tr><td colspan="10"><hr /></td></tr> <tr> <td colspan="4"> <td class="tbl_subtotal_left" ><b>Sub Total </b></td> <td class="tbl_subtotal_right"><b><?php echo number_format($sub_qty); ?></b></td> <td class="tbl_subtotal_right"><b><?php echo number_format($sub_rtnqty); ?></b></td> <td class="tbl_subtotal_right"><b><?php echo number_format($sub_balqty); ?></b></td> <td class="tbl_subtotal_right"><b><?php echo number_format($subTotal,2); ?></b></td> </tr> <!-- <tr><td colspan="10"><hr /></td></tr> <tr> <td colspan="4"> <td class="tbl_subtotal_left"><b>Grand Total</b></td> <td class="tbl_subtotal_right"><b><?php echo number_format($grn_qty); ?></b></td> <td class="tbl_subtotal_right"><b><?php echo number_format($grn_rtnqty); ?></b></td> <td class="tbl_subtotal_right"><b><?php echo number_format($grn_balqty); ?></b></td> <td class="tbl_subtotal_right"><b><?php echo number_format($grandTotal,2); ?></b></td> </tr> <tr><td colspan="10"><hr /></td></tr> --> <?php }?> </table> <?php unset($dbh); unset($stmt); ?> <?php include '../templete/footer.php'; ?> print.html.php <?php echo "print page"; ?> <script language="javascript" type="text/javascript"> function printFunction(){ window.print(); } </script> <script language="javascript" type="text/javascript"> function PrintGridData() { var prtGrid = document.getElementById('<%=txtDocNo%>'); prtGrid.border = 0; var prtwin = window.open('', 'PrintGridViewData', 'left=100,top=100,width=1000,height=1000,tollbar=0,scrollbars=1,status=0,resizable=1'); prtwin.document.write(prtGrid.outerHTML); prtwin.document.close(); prtwin.focus(); prtwin.print(); prtwin.close(); </script> <?php $groupby = ''; $displaySubTotal = FALSE; $subTotal = 0; $grandTotal = 0; $sub_balqty=0; // maideen $grn_balqty=0; // maideen $sub_rtnqty=0; // maideen $grn_rtnqty=0; // maideen $sub_qty=0; // maideen $grn_qty=0; // maideen ?> <table width="100%" align="center" cellpadding="4" cellspacing="1" class=tbl_table"> <tr> <td class="tbl_header">MV CODE</td> <td class="tbl_header">MV NAME</td> <td class="tbl_header">SO Date</td> <td class="tbl_header">SO No</td> <td class="tbl_header">RATE</td> <td class="tbl_header">SUPP.QTY</td> <td class="tbl_header">RTN.QTY</td> <td class="tbl_header">BAL.Qty</td> <td class="tbl_header">SOLD AMT</td> <td class="tbl_header">Actions</td> </tr> <?php if(isset($stmt)) { while($row = $stmt->fetch()): if($groupby!=$row['MVCode']): if($displaySubTotal): ?> <tr><td colspan="10"><hr /></td></tr> <tr> <td colspan="4"> <td class="tbl_subtotal_left" ><b>Sub Total </b></td> <td class="tbl_subtotal_right"><b><?php echo number_format($sub_qty); ?></b></td> <td class="tbl_subtotal_right"><b><?php echo number_format($sub_rtnqty); ?></b></td> <td class="tbl_subtotal_right"><b><?php echo number_format($sub_balqty); ?></b></td> <td class="tbl_subtotal_right"><b><?php echo number_format($subTotal,2); ?></b></td> </tr> <tr><td colspan="10"><hr /></td></tr> <?php $grandTotal += $subTotal; $subTotal = 0; $grn_balqty += $sub_balqty; $sub_balqty=0; $grn_rtnqty += $sub_rtnqty; $sub_rtnqty=0; $grn_qty += $sub_qty; $sub_qty=0; else: $displaySubTotal = TRUE; endif; //$groupby = $row['SODate']; $groupby = $row['MVCode']; endif; ?> <tr> <td class="tbl_content"><?php echo $row['MVCode'];?></td> <td class="tbl_content"><?php echo $row['MVName'];?></td> <td class="tbl_content"><?php echo date("d-m-Y", strtotime($row['SODate']));?></td> <td class="tbl_content"><?php echo $row['SONo'];?></td> <td class="tbl_content_right"><?php echo number_format($row['Rate'],2) ;?></td> <td class="tbl_content_right"><?php echo number_format($row['Qty']) ;?></td> <td class="tbl_content_right"><?php echo number_format($row['RTNQty']) ;?></td> <td class="tbl_content_right"><?php echo number_format($row['BalQty']) ;?></td> <td class="tbl_content_right"><?php echo number_format($row['BalAmt'],2) ;?></td> </td> <?php $subTotal += $row['BalAmt']; $sub_balqty += $row['BalQty']; $sub_rtnqty += $row['RTNQty']; $sub_qty += $row['Qty']; endwhile; $grandTotal += $subTotal; $grn_balqty += $sub_balqty; $grn_rtnqty += $sub_rtnqty; $grn_qty += $sub_qty; ?> <tr><td colspan="10"><hr /></td></tr> <tr> <td colspan="4"> <td class="tbl_subtotal_left" ><b>Sub Total </b></td> <td class="tbl_subtotal_right"><b><?php echo number_format($sub_qty); ?></b></td> <td class="tbl_subtotal_right"><b><?php echo number_format($sub_rtnqty); ?></b></td> <td class="tbl_subtotal_right"><b><?php echo number_format($sub_balqty); ?></b></td> <td class="tbl_subtotal_right"><b><?php echo number_format($subTotal,2); ?></b></td> </tr> <!-- <tr><td colspan="10"><hr /></td></tr> <tr> <td colspan="4"> <td class="tbl_subtotal_left"><b>Grand Total</b></td> <td class="tbl_subtotal_right"><b><?php echo number_format($grn_qty); ?></b></td> <td class="tbl_subtotal_right"><b><?php echo number_format($grn_rtnqty); ?></b></td> <td class="tbl_subtotal_right"><b><?php echo number_format($grn_balqty); ?></b></td> <td class="tbl_subtotal_right"><b><?php echo number_format($grandTotal,2); ?></b></td> </tr> <tr><td colspan="10"><hr /></td></tr> --> <?php }?> </table> <?php unset($dbh); unset($stmt); ?> <?php include '../templete/footer.php'; ?> Thank you very much Regards Maideen
  5. e.g I have a urls like in this format, so here's one example http://www.mydomain.com/buy-now/this-is-the-product-one/order/1234 Considering an online shop contains alot of products with different product title and product ID right? how am I going to redirect "all URLs from that format", into "this new URL" via htaccess ? http://www.mydomain.com/buy-now/order/this-is-the-product-one/1234 the difference is, the word "order" got transferred beside the "buy-now" what to do?
  6. Hi I put the following code into my functions.php file. Here's what I want: 1. I want the cookie to be set only when the visitor goes to Post 1. 2. When someone visits Post 2, if they have the cookie, they get redirected to Post 3. If they don't have the cookie, nothing happens. Now it seems to be working, but the problem is sometimes, when the cookie isn't set, I get redirected to Page 3 from the home page :s. I have no idea why. I should mention I know nothing about coding. The code below is stuff I got online, mixed and matched it, and did some trial and error with my blog. function set_newuser_cookie() { $currentURL = "http://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; //THE ABOVE GETS THE CURRENT URL if (!isset($_COOKIE['subscriber']) && $currentURL == 'http://mysite.com/post1') { setcookie('subscriber', no, 0, COOKIEPATH, COOKIE_DOMAIN, false); //THE ABOVE SETS A COOKIE IF IT FINDS THE CURRENT URL IS /POST1 } } add_action( 'init', 'set_newuser_cookie'); //I DON'T KNOW WHAT THE ABOVE IS, BUT I HEAR IT'S IMPORTANT $currentURL = "http://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; //THE ABOVE GETS THE URL AGAIN if ( isset( $_COOKIE["subscriber"] ) && $currentURL == 'http://mysite.com/post2' ) : header( "Location: http://mysite.com/post3" ); endif; //THE ABOVE REDIRECTS THE VISITOR TO POST3 ON 2 CONDITIONS: 1. THAT THE COOKIE IS SET, 2. THAT THE CURRENT URL IS /POST2 Please help!
  7. My client has created a QR Code that goes to a specific page on a non-mobile site. The client does have a mobile site, m.customersdomain.com Question is, the QR Code has already been submitted to print for advertising and is going to a regular URL. Is there a way to look for mobile devices that hit this one non-mobile page and redirect them to a specific mobile URL / page? Would this be something in .htaccess file? Basically, I'm looking @ 2 questions: 1. Are you hitting a specific URL (already embedded in the QR Code)? 2. Are you a mobile device? If both are yes >> go to this mobile page
  8. Trying to create a Redirect using PHP , to first check for a valid ID, if valid id is missing to send back to index.php My first code: if( ! is_numeric($id) ) { die('Sorry, you selected an invalid ID'); } This works perfectly fine and when deleting the id from the URL , the die occurs and i get the correct error message. Now , I am trying to create a redirect after the security measure The code i entered was the following: if( ! is_numeric($id) ) { header("Location: index.php"); } Now this code does not seem to do the trick, since when i go to the URL and delete the id to check if anything happens, the page redirect sends me nowhere. Keep in mind the FIRST CODE is being replaced by the SECOND CODE and they are NOT included together Any thoughts or suggestions ?? Thanks
  9. Hi all, I am going bald on this one. I wonder what could be wrong. I could login to my local server but cant login in a live server! thanks all <?php if(isset($_POST['login'])){ $tbl_name="reg_users"; // Define $myusername and $mypassword $username=$_POST['username']; $password=$_POST['password']; // To protect MySQL injection $username = stripslashes($username); $password = stripslashes($password); $username = mysql_real_escape_string($username); $password = mysql_real_escape_string($password); if($username == ''){ echo "<font color='red' size='-2'><b>Pls Enter User ID</b></font>"; } if($password == ''){ echo "<font color='red' size='-2'><b>Pls Enter Password</b></font>"; }else{ $crypt_pass = md5($password); //check for existance of username and password $sql="SELECT * FROM $tbl_name WHERE username='$username' and password='$crypt_pass'"; $result=mysql_query($sql); // Mysql_num_row is counting table row $count=mysql_num_rows($result); // If result matched $myusername and $mypassword, table row must be 1 row if($count==1){ // Register username and password and redirect to login page" $_SESSION['username'] = $username; $_SESSION['password'] = $password; header("location: ../folder/filename.php"); exit(); } else { //if no match found, echo out error message echo "<font color='red' size='2'><b>Invalid User ID or Password</b></font><br>"; } } } ob_end_flush(); ?>
  10. I am finishing up a mobile version of my web site and have run into a bit of a snag with the redirect. I have a test page that i can visit with my phone and it will send me to the mobile version of the site no problem, but only the home page. What I am looking for is if someone comes to my site from google, or any othere site, and is using a mobile device it will redirect them to the same page on the mobile site. So if you come to the page drinktothecredits.com/movies and you are using a phone it will send you to mobi.drinktothecredits.com/movies. I also want tablets it use the full site. I know that I need to be able to some how send the url to the mobile site but I am unsure how to do this. Thank you Here is what I have so far. <?php $useragent=$_SERVER['HTTP_USER_AGENT']; if(preg_match('/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i',$useragent)||preg_match('/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i',substr($useragent,0,4))) header('Location: http://mobi.drinktothecredits.com/'); ?>
  11. Hi, I'm trying to create a script that will redirect to a url from a form input. Basically I have a page: http://mydomain.com/page (no .html or php etc) and I have an input box on my site - I want someone to be able to type in Joe Blogs and I'm looking to simply redirect to: http://mydomain.com/page/Joe%20Blogs How can I do this?
  12. I can NOT figure out why this code won't work. It seems to work fine in the tutorial I followed. I have the code copied the exact same way the tutorial said to. and ive googled my problem and can't figure it out... when I press the "Login!" button on my login.php file, the page does not redirect to admin.php... here is my code.... in my, "if else" statement, the else will echo text, but when i try to make the else redirect to a new session it won't work, it just loads a blank login.php page.... here is my code and the youtube tutorial I followed... http://www.youtube.com/watch?v=IPahfwPjEhI... If you can figure it out email patricktlawler@gmail.com thank you so much!!! login.php <?php mysql_connect("localhost", "FoleyHurley", "******"); mysql_select_db("blog1"); ?> <html> <head> <title>Login</title> </head> <body> <?php if(isset($_POST['submit'])){ $name = $_POST['name']; $pass = $_POST['password']; $result = mysql_query("SELECT * FROM users WHERE name='$name' AND pass='$pass'"); $num = mysql_num_rows($result); if($num == 0) { echo "Bad login go <a href='login.php'>back</a>"; }else{ //I BELIEVE THE PROBLEM HAS SOMETHING TO DO WITH THE FOLLOWING 3 LINES... HELP! session_start(); $_SESSION['name'] = $name; header('Location: admin.php'); } } else{ ?> <form action='login.php' method='post'> Username: <input type='text' name='name' /><br /> Password: <input type='password' name='password' /><br /> <input type='submit' name='submit' value='Login!' /> </form> <?php } ?> </body> </html> login.php
  13. Hello guys, I have a wordpress website wich supplies download links. What i want to do: When a user clicks o a download link (external sources) i want to redirect him to the same page (iframe) but i want to put some ads on top of the window. How can i do that ?
  14. I have successfully created my mod_rewrite rule to change all dynamic URLs on the top level of the site, but now i need to create a rule for a second level, and i think later down the line i might need a second, second level of rewrites. At the moment i have this RewriteEngine on RewriteCond %{SCRIPT_FILENAME} !-d RewriteCond %{SCRIPT_FILENAME} !-f RewriteRule ^(.+)$ index.php?subj=$1 And this helps to change /index.php?subj=home to /home as it does for all other pages such as /contact /about /events and so on. But now I have created sub pages under events and therefore need to change /events.php?event=event-name to events/event-name. But when i add another rule it messes up the whole site. What i tried to do is this RewriteEngine on RewriteCond %{SCRIPT_FILENAME} !-d RewriteCond %{SCRIPT_FILENAME} !-f RewriteRule ^(.+)$ index.php?subj=$1 RewriteRule ^events/(.+)$ event.php?event=$1 I've even tried it with [L] flags after the Rewrite rules, but nothing seems to work, I would really appreciate it if someone can show me the best way to do this as nothing seems to work. Many thanks in advance
  15. I read through the forum to check for possible similar situations. I also dont have a header error. The redirect works when put in a page that has nothing else in it. Ive checked for white space or I thought I did correctly, you may find I over looked something. I am pretty green with php, and have put some things together from some online php tutorials. Just trying to get a grasp and make what I would consider a simple app. Very open to criticism for my lack of knowledge. Would any one be willing to steer me in the right direction? I dont mind reading if you want me to work for it. I would like to get a good understanding of whats going on and not have someone *do the work for me if you know what I mean. Here is a page of code, I have a few that I want redirects on after form submissions. - <?php //allow sessions to be passed so we can see if the user is logged in session_start(); //connect to the database so we can check, edit, or insert data to our users table $con = mysql_connect('localhost', 'root', 'root') or die(mysql_error()); $db = mysql_select_db('tournaments', $con) or die(mysql_error()); //include out functions file giving us access to the protect() function made earlier include "./functions.php"; ?> <html> <head> <title>Login with Users Online Tutorial</title> <link rel="stylesheet" type="text/css" href="style.css" /> </head> <body> <?php //check if the login session does no exist if(!$_SESSION['uid']){ //if it doesn't display an error message echo "<center>You need to be logged in to log out!</center>"; }else{ //if it does continue checking //update to set this users online field to the current time mysql_query("UPDATE `users` SET `online` = '".date('U')."' WHERE `id` = '".$_SESSION['uid']."'"); //destroy all sessions canceling the login session session_destroy(); //display success message echo "<center>You have successfully logged out!</center>"; //redirect them to the usersonline page header('Location: login.php'); die (); } ?> </body> </html>
  16. Okay, so I have a file named tagging.php that links to itself. Sometimes, it needs to pass itself an ID. I wanted a URL like: website/tagging/8 instead of: website/tagging.php?id=8 I'm not sure what's wrong with my rewrite rule: RewriteRule ^tagging/([0-9]+)$ tagging.php?id=41 [NC, L] Any ideas?
  17. I have a page that contains both a login and registration form. I set the actions on the forms to be index.php#login and index.php#register so that if the form failed, the user would be taken down the form they were just working with. The problem I am running into is that a successful form completion either logs the user in or brings them to a screen letting them know that they need to verify their email and the #login or #register anchor is being included in the next page's URL. So a user visits my /login.php page, successfully logs in to the site, and sees the next page of /page.php#login instead of just /page.php I read though the manual for header() but didn't really see anything relevant to anchors being preserved or how to flush URL information. Is this information being stored somewhere by the browser and I can just purge it from memory? I was able to find this thread on StackOverflow, but my issue here is that I'm not listing the anchor (fragment as they call it) in the redirect. So according to one of the answers, it should get discarded. I've tried structuring the redirect in two different ways to see if anything can be done as well: header('Location: http://example.com/page.php'); header('Location: /page.php'); Any ideas here? 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.