Jump to content

freemancomputer

Members
  • Posts

    66
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

freemancomputer's Achievements

Member

Member (2/5)

0

Reputation

  1. 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/'); ?>
  2. I currently have this code that shows a certain number of images depending on what the rating is 1-5. I know that there has to be a better way of doing this, but i can not think of it. Any pointers would be helpful. if($user_rating_show==1) { echo "<img src='../img/beer_mug_finish-green.jpg' alt='beer_m' name='beer_mug' width='34' height='33'>"; } if($user_rating_show==2) { echo "<img src='../img/beer_mug_finish-green.jpg' alt='beer_m' name='beer_mug' width='34' height='33'>"; echo "<img src='../img/beer_mug_finish-green.jpg' alt='beer_m' name='beer_mug' width='34' height='33'>"; } if($user_rating_show==3) { echo "<img src='../img/beer_mug_finish-green.jpg' alt='beer_m' name='beer_mug' width='34' height='33'>"; echo "<img src='../img/beer_mug_finish-green.jpg' alt='beer_m' name='beer_mug' width='34' height='33'>"; echo "<img src='../img/beer_mug_finish-green.jpg' alt='beer_m' name='beer_mug' width='34' height='33'>"; } if($user_rating_show==4) { echo "<img src='../img/beer_mug_finish-green.jpg' alt='beer_m' name='beer_mug' width='34' height='33'>"; echo "<img src='../img/beer_mug_finish-green.jpg' alt='beer_m' name='beer_mug' width='34' height='33'>"; echo "<img src='../img/beer_mug_finish-green.jpg' alt='beer_m' name='beer_mug' width='34' height='33'>"; echo "<img src='../img/beer_mug_finish-green.jpg' alt='beer_m' name='beer_mug' width='34' height='33'>"; } if($user_rating_show==5) { echo "<img src='../img/beer_mug_finish-green.jpg' alt='beer_m' name='beer_mug' width='34' height='33'>"; echo "<img src='../img/beer_mug_finish-green.jpg' alt='beer_m' name='beer_mug' width='34' height='33'>"; echo "<img src='../img/beer_mug_finish-green.jpg' alt='beer_m' name='beer_mug' width='34' height='33'>"; echo "<img src='../img/beer_mug_finish-green.jpg' alt='beer_m' name='beer_mug' width='34' height='33'>"; echo "<img src='../img/beer_mug_finish-green.jpg' alt='beer_m' name='beer_mug' width='34' height='33'>"; } Thanks
  3. Try changing if(isset($_POST['save'])) To if(isset($_POST['submit']))
  4. I am working on a site redesign and as part of that I want to do an url rewrite. Currently my page looks like /rules.php?title=Ax+men i would like them to look like /Ax-men. Keep in mind that the title will change and can contain letters an numbers I have done this before with numbered pages but am not sure how to adapt it to a variable length and text and numbers. This will also have to work with pagination, and with old back links that might be out there This is what I had on a different site #Options +FollowSymlinks #RewriteEngine on #RewriteRule ^(.*)\.htm$ $1.php [nc] Options +FollowSymlinks RewriteEngine on RewriteRule ^story-([0-9]+)\.html$ story.php?currentpage=$1 Mainly looking for tips and pointers
  5. Thanks for the info. Here's a user account user: phpfreaks pass: freaks123
  6. I just started a new project and wanted some feedback. Its an add on story where users add on one paragraph at a time. http://whatsintheredsuitcase.com/
  7. I have a simple user bio section on my web site. As of right now everything works fine except that the bios are not formatted and I want to remove any html that the user adds. I know that strp_tags is used to remove html but wasn't sure if I could used that along side adding my own html. The html that I am looking to add is <P> and <br> to properly format them. this is the form that I have that <form id="update_profile"> <textarea name="BIO" cols="50" rows="6"><?php echo $bio; ?></textarea><br> <span class="rulemain">Your Favorite drink: </span><br> <input type="text" name="FAV_DRINK" value="<?php echo $fav_drink; ?>" > <br> <input type="radio" name="SHARE_EMAIL" value="1" > <span class="rulesub">Share my email.</span><br> <input type="hidden" name="USER_ID" value="<?php echo $name; ?>"> <input type="submit" value="Update Profile"> </form> Here is what the update string looks like <?php include"scripts/connect.php" ; mysql_connect('localhost',$username,$password); @mysql_select_db($database) or die( "Unable to select database"); $bio= mysql_real_escape_string($_POST['BIO']); $user = mysql_real_escape_string($_POST['USER_ID']); $drink= mysql_real_escape_string($_POST['FAV_DRINK']); $share_email= mysql_real_escape_string($_POST['SHARE_EMAIL]); $error = ''; $userquery = mysql_query("SELECT * FROM user WHERE (username='$user')"); $sql = ("UPDATE user SET bio='$bio', drink='$drink', show_email='$share_email' WHERE username='$user'") or die (mysql_error()); $query = mysql_query($sql);
  8. Thanks for the help and tips, I didn't even think about using echo and i kept passing over the $totalpages. Its all up and running now. Thanks again.
  9. That makes sense and works, but this brings up another problem, it has the arrows at the bottom that are supost to point to the 2nd or 3rd page but after clicking the arrows it stays on the first page, the url says its on page 2. I haven't looked at this yet but ill take any ideas. http://drinktothecredits.com/movies.php
  10. ok the $offset is coming back as -50 because $current_page is coming back as 0. Is $current_page just not being set as 1 for the first page?
  11. Thanks for your help but I am getting this error This is likes 45-47 //Run query to get records for current page $offset = ($current_page - 1) * $rec_per_page; $query = "SELECT title FROM movie WHERE type = 'movie' ORDER BY title LIMIT $offset, $rec_per_page"; $result = mysql_query($query) or trigger_error("SQL", E_USER_ERROR); I been scratching my head on this for about an hour today. Thanks again for your help
  12. I have a web site that is showing a list with pagination. Right now its listing in one column. I would like it to show 50 links on a page in 2 columns. I think I know in theory how this should work but I'm not sure. This is the code that i have now, and this is my site http://www.drinktothecredits.com/movies.php <?php include"scripts/connect.php" ; mysql_connect('localhost',$username,$password); @mysql_select_db($database) or trigger_error("SQL", E_USER_ERROR); $sql = "SELECT COUNT(*) FROM movie WHERE type LIKE 'movie'"; $result = mysql_query($sql) or trigger_error("SQL", E_USER_ERROR); $r = mysql_fetch_row($result); $numrows = $r[0]; $rowsperpage = 25; $totalpages = ceil($numrows / $rowsperpage); if (isset($_GET['currentpage']) && is_numeric($_GET['currentpage'])) { $currentpage = (int) $_GET['currentpage']; } else { $currentpage = 1; } if ($currentpage > $totalpages) { $currentpage = $totalpages; } if ($currentpage < 1) { $currentpage = 1; } $offset = ($currentpage - 1) * $rowsperpage; $sql = "SELECT title FROM movie WHERE type LIKE 'movie' ORDER BY title LIMIT $offset, $rowsperpage" ; $result = mysql_query($sql) or trigger_error("SQL", E_USER_ERROR); ?> <div align="center"><span class="rulemain ">Movies</span></div><br> <?php while ($list = mysql_fetch_assoc($result)) { ?> <li> <a class="nav" href=/rules.php?title=<?php echo urlencode($list['title']); ?>><?php echo $list['title']; ?></a> </li> <?php } $range = 3; if ($currentpage > 1) { echo " <a class='nav' href='movies.php?currentpage=1'><<</a> "; $prevpage = $currentpage - 1; echo " <a class='nav' href='movies.php?currentpage=$prevpage'><</a> "; } for ($x = ($currentpage - $range); $x < (($currentpage + $range) + 1); $x++) { if (($x > 0) && ($x <= $totalpages)) { if ($x == $currentpage) { echo " [<b>$x</b>] "; } else { echo " <a class='nav' href='movies.php?currentpage=$x'>$x</a> "; } } } if ($currentpage != $totalpages) { $nextpage = $currentpage + 1; echo " <a class='nav' href='movies.php?currentpage=$nextpage'>></a> "; echo " <a class='nav' href='movies.php?currentpage=$totalpages'>>></a> "; } ?>
  13. Kevin- Your feed back is just what I have been looking for. When this site first started out it was to be simple, then as all things do it got complex. I'm getting ready to do a overhaul of the whole thing and these are going into my suggestion box, most to be used. Thank you.
×
×
  • 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.