Jump to content

QuickOldCar

Staff Alumni
  • Posts

    2,972
  • Joined

  • Last visited

  • Days Won

    28

Everything posted by QuickOldCar

  1. @ points to ip in the a record, that's fine You can add this top of htaccess to handle 404 error file so anything that's 404 would go to main site ErrorDocument 404 / or use a custom 404 page
  2. I use a totally different approach with a page controller,scripts and includes in index.php to replace iframe if(isset($current_page['galeria_url'])){ $include_page = trim($current_page['galeria_url']); include($include_page); //included script runs the query, don't show any output here } galleria.php Your gallery script should query your database and see if is results no html above and query first only if has a result output additional html code and the results,any included scripts and such Am sure you will need a few changes not needing something,adding something or changing paths <?php //work out your requires since this is included on a page require_once ('../includes/session.php'); include ('../includes/setup.php'); require_once ('../includes/functions.php'); $q = "SELECT * FROM imagens WHERE galeria_id = 1"; $r = mysqli_query($dbc, $q); if(mysqli_num_rows($r) > 0){ ?> <!--[if lt IE 9]> <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> <![endif]--> <!-- METATAGS --> <!-- FONTS --> <link href='http://fonts.googlea...talic,400italic' rel='stylesheet' type='text/css'> <!-- FONTS --> <!-- FAVICON --> <link rel="shortcut icon" href="favicon.ico" /> <!-- FAVICON --> <!-- INÍCIO CSS --> <!-- CSS Global --> <link rel="stylesheet" href="css/normalize.css"> <link rel="stylesheet" href="css/main.css"> <link rel="stylesheet" href="css/galeriastyle.css" /> <!-- CSS Global --> <!-- MEDIA QUERIES --> <!-- MEDIA QUERIES --> <!-- CSS imageslider & Galeria de Fotos --> <link rel="stylesheet" href="css/iview.css" /> <!-- CSS imageslider & Galeria de Fotos --> <!-- FIM CSS --> <!-- JS Geral --> <script src="../js/respond.min.js"></script> <script type="text/javascript" src="../js/jquery.js"></script> <script type="text/javascript" src="../js/jquery-1.11.1.min.js"></script> <!-- JS Geral --> <!-- INÍCIO JS --> <!--<script src="js/vendor/modernizr-2.6.2.min.js"></script> <script src="js/respond.min.js"></script> <script type="text/javascript" src="js/jquery.js"></script>--> <!-- Accordion Menu --> <script type="text/javascript" src="../js/accordion_code.js"></script> <!-- Accordion Menu --> <!-- Imageslider & Galeria de Fotos --> <!-- Slideshow JS --> <script src="js/jquery-1.7.1.min.js"></script> <script type="text/javascript" src="js/raphael-min.js"></script> <script type="text/javascript" src="js/jquery.easing.js"></script> <script src="js/iview.js"></script> <script> $(document).ready(function(){ $('#imageslider').iView({ pauseTime: 5000, pauseOnHover: true, directionNavHoverOpacity: 0, timer: "Bar", timerDiameter: "50%", timerPadding: 0, timerStroke: 7, timerBarStroke: 0, timerColor: "#FFF", timerY: 20, timerX: 20, timerPosition: "bottom-right", captionOpacity: 1 }); $('#galeria').iView({ pauseTime: 4000, pauseOnHover: true, directionNav: true, directionNavHide: false, controlNav: true, controlNavNextPrev: false, controlNavTooltip: false, directionNavHoverOpacity: 0, timer: "Pie", timerDiameter: 30, timerPadding: 0, timerStroke: 7, timerBarStroke: 0, timerColor: "#FFF", timerY: 20, timerX: 20, captionOpacity: 1 }); }); </script> <!-- Slideshow JS --> <!-- Imageslider & Galeria de Fotos --> <!-- FIM JS --> <!-- INÍCIO JAVASCRIPT --> <script type="text/javascript"> function MM_swapImgRestore() { //v3.0 var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc; } function MM_preloadImages() { //v3.0 var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array(); var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++) if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}} } function MM_findObj(n, d) { //v4.01 var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) { d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);} if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n]; for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); if(!x && d.getElementById) x=d.getElementById(n); return x; } function MM_swapImage() { //v3.0 var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3) if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];} } </script> <!-- FIM JAVASCRIPT --> <!-- FIM HEAD --> <!-- INÍCIO CENTRAL --> <div id="central"> <div id="conteudo_info"> <div id="cont-galeria"> <div class="container"> <div id="galeria"> <?php while ($artigo = mysqli_fetch_assoc($r)) { ?> <div data-iview:thumbnail="../uploads/galerias/<?=$artigo['imagem']; ?>" data-iview:image="../uploads/galerias/<?=$artigo['imagem']; ?>"></div> <?php } ?> </div> </div> </div> </div> </div> <!-- FIM CENTRAL --> <?php } ?>
  3. And Requinix's solution is fine to always replace spaces to a + if that's what that parameter expects The below code would change the spaces, encoded spaces and spaces to a + A person may or may not encode the + sending data to you $equation = str_replace(array("%2B", "%20", " "), "+", trim($_GET['equation']));
  4. The + needs to be properly encoded in the browser address as %2B A simple test to try $value = "1+2+3"; $array = array("equation"=>$value); $query = http_build_query($array); echo "<a href='?".$query."'>http_build_query</a><br />"; echo "<a href='?equation=".urlencode($value)."'>urlencode</a><br />"; echo "<a href='?equation=".rawurlencode($value)."'>rawurlencode</a><br />"; if(isset($_GET['equation'])){ //if url is already properly encoded in browser echo $equation = $_GET['equation']."<br />"; //yes echo $equation = urldecode($_GET['equation'])."<br />"; //no echo $equation = rawurldecode($_GET['equation'])."<br />"; //yes }
  5. I guess can improve on this with the scheme as well $_SERVER['REQUEST_SCHEME'] also has issues, so will just test for https if (!empty($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == "on") { $scheme = "https"; } else { $scheme = "http"; } $current_url = filter_var($scheme."://" . $_SERVER['HTTP_HOST'] . $_SERVER['SCRIPT_NAME'], FILTER_SANITIZE_STRING); if (!empty($_SERVER['QUERY_STRING'])) { $query_string = filter_var($_SERVER['QUERY_STRING'], FILTER_SANITIZE_STRING); $current_url .= "?" . $query_string; }
  6. $current_url = filter_var("http://" . $_SERVER['HTTP_HOST'] . $_SERVER['SCRIPT_NAME'], FILTER_SANITIZE_STRING); if (!empty($_SERVER['QUERY_STRING'])) { $query_string = filter_var($_SERVER['QUERY_STRING'], FILTER_SANITIZE_STRING); $current_url .= "?" . $query_string; }
  7. Sure, pertains to the problem at hand, although the person helping would need to be a member. There are a few examples of curl and cookies in the forum. http://forums.phpfreaks.com/index.php?app=core&module=search&do=search&fromMainBar=1
  8. Does this other site require a cookie or anything? You see the other site and what happens when logs in, hard to help beyond what I tried.
  9. A lot of people are untrusting to log into a site using another. Am trying to understand why you would iframe another site versus them just visiting the original site.
  10. Note these lines to edit <form action="curl.php" method="post"> $url="http://other-site.com/login.php"; I hope this helps login.php <html> <head> <title></title> <link rel="stylesheet" href="styles/main.css" type="text/css" media="print, projection, screen"> </head> <body> <center> <br><br><br><br><br><br><br><br> <div style="border:1px solid #000000;background:#EEEEEE;padding-top:15px;padding-bottom:5px;width:350px;"> <font size=+2>Sign In Form</font><br> <form action="curl.php" method="post"> <input type="hidden" name="action" value="logon"> <table border=0> <tr> <td>Username:</td> <td><input name="username" type="text" size=30></td> </tr> <tr> <td>Password:</td> <td><input name="password" type="password" size=30></td> </tr> <td></td> <td align="left"><input type=submit value="Sign In"></td> </tr> <tr> <td align="center" colspan=2><font size=-1>Don't have an Account ?</font> <a href="?action=newuser"><font size=-1 color="#0000EE">Sign UP Now !</font></a></td> </tr> </table> </form> </div> <br> </center> </body> </html> curl.php <?php if(isset($_POST['username']) && trim($_POST['username']) !=''){ $username = trim($_POST['username']); } if(isset($_POST['password']) && trim($_POST['password']) !=''){ $password = trim($_POST['password']); } if(isset($_POST['action']) && trim($_POST['action']) !=''){ $action = trim($_POST['action']); } if(isset($username) && isset($password) && isset($action)){ $url="http://other-site.com/login.php"; $postdata = array("username"=>$username, "password"=>$password, "action" => $action); $fields = http_build_query($postdata); //builds the query $ch = curl_init(); curl_setopt ($ch, CURLOPT_URL, $url); curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, FALSE); curl_setopt ($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6"); curl_setopt ($ch, CURLOPT_TIMEOUT, 60); curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt ($ch, CURLOPT_REFERER, $url); curl_setopt($ch, CURLOPT_POST, count($fields)); curl_setopt($ch, CURLOPT_POSTFIELDS,$fields); $result = curl_exec ($ch); //echo $result; curl_close($ch); header('Location: track.html'); } else { die('Parameters missing'); } ?>
  11. make your own login form your site which points to the curl script your site the curl url location would be theirs
  12. You put the username and password in the form, the form sends to your curl script
  13. Point the form to other site where the curl script is With no action posts to same page. <form action="http://www.example.com/index.php" method="post">
  14. Correct, and you are not getting the $_POST values anywhere <?php if(isset($_POST['username']) && trim($_POST['username']) !=''){ $username = trim($_POST['username']); } if(isset($_POST['password']) && trim($_POST['password']) !=''){ $password = trim($_POST['password']); } if(isset($_POST['action']) && trim($_POST['action']) !=''){ $action = trim($_POST['action']); } if(isset($username) && isset($password) && isset($action)){ $url="http://www.example.com/index.php"; $postdata = array("username"=>$username, "password"=>$password, "action" => $action); $fields = http_build_query($postdata); //builds the query $ch = curl_init(); curl_setopt ($ch, CURLOPT_URL, $url); curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, FALSE); curl_setopt ($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6"); curl_setopt ($ch, CURLOPT_TIMEOUT, 60); curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt ($ch, CURLOPT_REFERER, $url); curl_setopt($ch, CURLOPT_POST, count($fields)); curl_setopt($ch, CURLOPT_POSTFIELDS,$fields); $result = curl_exec ($ch); //echo $result; curl_close($ch); header('Location: track.html'); } else { die('Parameters missing'); } ?>
  15. When you send your post form, where does it get the $_POST values in a php script? That's the part not shown.
  16. Show the full form and the php code that checks it
  17. btw, should place the header at the end so curl can close
  18. I don't see the rest of your form, but how about adding the submit or whatever you may be checking for in your script. $postdata = array("username"=>$username, "password"=>$password, 'submit' => "submit");
  19. <?php $username="username"; $password="password"; $url="http://www.example.com/index.php"; $postdata = array("username"=>$username, "password"=>$password); $fields = http_build_query($postdata); //builds the query $ch = curl_init(); curl_setopt ($ch, CURLOPT_URL, $url); curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, FALSE); curl_setopt ($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6"); curl_setopt ($ch, CURLOPT_TIMEOUT, 60); curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt ($ch, CURLOPT_REFERER, $url); curl_setopt($ch, CURLOPT_POST, count($fields)); curl_setopt($ch, CURLOPT_POSTFIELDS,$fields); $result = curl_exec ($ch); header('Location: track.html'); //echo $result; curl_close($ch); ?>
  20. Your site has an issue loading when is www Not working http://www.dn2d8.com/ Working http://dn2d8.com/ At your domain name registrar, you can create a new cname www and point to your servers ip You can edit your htaccess file and redirect them to non www (providing mod_rewrite is enabled on the server) RewriteEngine On RewriteBase / RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC] RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
  21. Trying to save you future headaches, no sense doing all that work for a flawed system.
  22. If the site went down how would anyone add something new? Your host most likely offers a full server backup, can be snapshots of the server os, all your data plus configurations Sure you would lose some every 10 days, unless did something like replication or mirroring which would certainly cost you more money than now. You could manually or write a script to just copy your mysql/data files more often. If you made any file or script changes to the site copy those when you do it. You could focus more on not losing it all for right now if don't have the money. If you wanted to copy your site. You should take note of your hosts traffic usage because when you download it will be using it up. Use FTP for files and either through your panel or directly in phpmyadmin export your database Copy all your files in your http/www folder and save locally Export your database or can copy the mysql/data files directly and save I use filezilla for ftp.
  23. There is a version 2 for that http://css-tricks.com/chat2/ But why even bother since this is a horrible way to do it. Have a look at this link that explains some other methods such as sse (server side event),long polling, html5 websockets http://stackoverflow.com/questions/11077857/what-are-long-polling-websockets-server-sent-events-sse-and-comet Ratchet is a loosely coupled PHP library providing developers with tools to create real time, bi-directional applications between clients and servers over WebSockets. http://socketo.me/
  24. Don't iframe content from your own server, use include() instead Separate coding logic from html in your script Do a check on your result from the query before you output anything If you actually have the data for your gallery then you can output any gallery scripts or html styling along with the data Otherwise you can examine the current url and use either GET parameters or parse_url / preg_match to determine if the divider area will be included/iframed Can use whichever $_SERVER variable you need, here is for a full current url $current_url = filter_var("http://" . $_SERVER['HTTP_HOST'] . $_SERVER['SCRIPT_NAME'], FILTER_SANITIZE_STRING); if (!empty($_SERVER['QUERY_STRING'])) { $query_string = filter_var($_SERVER['QUERY_STRING'], FILTER_SANITIZE_STRING); $current_url .= "?" . $query_string; }
  25. I tried innodb recently and it had different limitations than myisiam did. Thanks for telling me about elasticsearch, I'll try it on my api's and cassandra That was a main reason never strayed from mysql, to get a full feature search Sounds like a winner to me, it makes it sound so easy. supports real time GET requests so good for NoSQL real time search, reindexing is horrible but that may be too intensive depending the amount of data I've used lucene a few times in the past, not bad at all. schema free json works with partitioning multitenancy indices can be divided into shards and does all the delegation,rebalancing and routing faceted and percolated search for filters and mapping
×
×
  • 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.