PHP - Php Popup Redirect
Hi i am looking for a bit of help on a script i am trying to make.
Basically i have a page when onload it opens a popup with a random website pulled from the database Code: [Select] <script language="JavaScript1.1"> <!-- function TheNewWin(url) { var popUp = window.open(url,'popup','height=700,width=700,toolbar=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,left=0,top=200'); if (popUp == null || typeof(popUp)=='undefined') { var a = confirm('Please disable your pop-up blocker and click the "Open" link again.'); if (a){ window.location.href = 'popupwarn.php'; }else{ window.location.href = 'popupwarn.php'; } } else { popUp.focus(); } } //--> </script> <body onload="TheNewWin($website);"> After 10 seconds i have it refresh so the popup changes to a new website Code: [Select] header("refresh: 10; websiteviewcontrol.php?id=$website"); What i want to happen is before it changes the popup to a new website i want it to redirect to some website of my choice for example Facebook. So on the 8th second it would go to Facebook then after the 10 it would just reload and get the random website again. The problem im having is i cant get "Some Website" to open in the popup for a few seconds before the reload. Similar TutorialsI'm trying to put together a script that redirects visitors based on their IP, user agent and/or referral url. Basically I want the script to scan these three factors from the visitor, if any of them turn out to match my redirect-requirement it redirects the user. I know the code is horribly coded, I'm incredibly new to the php-scene and consider myself a complete noob. As you can see I want redirected visitors to go to google.com and un-redirected to msn.com(examples). Really thankful for all the help I can get! Right now nothing works, any suggestions? <?php function redirect($page) { Header( "HTTP/1.1 301 Moved Permanently" ); header('Location: ' . $page); exit; } $referrals=array('pitchingit.org','referral2'); $badAgents = array("useragent1", "useragent2"); $deny = array("78.105.191..*","100.101.103..*"); if (in_array($_SERVER['HTTP_REFERER'], $referrals, FALSE)) { header("Location: http://www.google.com"); } else { header("Location: http://www.msn.com"); } if(in_array($_SERVER['HTTP_USER_AGENT'],$badAgents)) { redirect("http://www.google.com/"); exit(); } $add=$_SERVER['REMOTE_ADDR']; foreach ($deny as $ip) { if (preg_match("^.$add.*^",$ip)) { redirect("http://www.google.com"); } } redirect("http://www.msn.com"); ?> I have search the forum, but i cant find something thats about my problem.. :S Im trying to make a kind of a community website for my friends and others who want to be there.. (Its danish).. I got alot of stuff going in the codes, and now i want some kind of a popup to tell the user when they got a new msg, i trying alot of stuff but i cant find something that works with my codes.. ... I got 2 iframes in the background running to update user status and stuff, i want one of them to create a popup when a new msg is in for the Session user.. This is one of the update pages i got running.. <script> setTimeout("document.location.reload(true);", 60000); </script> <head> <link rel="stylesheet" type="text/css" href="style_blue.css"> </head> <? require_once('#####.php'); //database access require_once('#####.php'); // php functions session_start(); if (isset($_SESSION['user']) AND ($_SESSION['user'] <> '')) { $result = mysql_query("UPDATE users SET time = '".time()."' WHERE id = '$_SESSION[id]'"); } $result2 = mysql_query("SELECT id FROM msg WHERE to = '$_SESSION[id]' AND new = '1'"); $antal2 = ( mysql_num_rows($result2) ); if (($antal2 > '0')) { ## Here i need a code to create a popup telling the user that there is a new msg.. } ?> I really hope someone can help me... :S Btw.. i dont wanna use alert popup cuz then they will stack if a user goes out for a few hours but stays on website.. How can one re-direct a visitor, without using a header re-direct? I'd like a page to show up, then after about 5 seconds I need the visitor sent to another page. How can I do this? i have a div with an iframe in it that when i click on a link it pops up but what i am trying to do is add ?old=$folderName to the link but when i do the popup is blank. so does anyone know something i can try. (i am using facebox to create the popup) Code: [Select] this is the link for the popup <a href='#Rename' rel='facebox'>Rename</a> this is with ?old=$folderName added this displays the blank popup <a href='#Rename?old=$folderName' rel='facebox'>Rename</a> this is the div with iframe Code: [Select] <div id="Rename" style="display:none"><iframe src="form.php?old=<?php echo $old=$_GET['old'] ?>" frameborder="0"> </iframe></div> I've got here a code.. So basically this code is for deleting.. i want to set a Confimation popup box With yes or no.. then' When the user click yes, it will redirect to the next page. and if its a no. it would be at the same page. Here's my code. Code: [Select] <form name="formnew" method="post" action="valdelsec.php"> <?php $host="localhost"; $username="root"; $password=""; $db_name="dbsection"; $tbl_name="sections"; mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); $sql="SELECT * FROM $tbl_name"; $result=mysql_query($sql); $count=mysql_num_rows($result); echo '<select style="position:absolute; top:307px; left:302px; width: 254px; height: 21px; font-size:10px;" name="section" onChange="this.name">'; echo "<option size =30 selected>Select</option>"; if(mysql_num_rows($result)) { while($row = mysql_fetch_assoc($result)) { echo "<option>" .$row['Sname']. "</option>"; } echo "</select>"; } else { echo "<option>No Section Present</option></select>"; } ?> <div id="apDiv11"><input type="image" src="images/delete.png" name="Image9" width="170" height="35" border="0" ></div> </form>.. Hoping for your help.. thanks! Im having a problem in popup box.. i made a checkbox in a loop.. then after a success loop ive set a code for a popupbox. Code: [Select] echo '<script type="text/javascript"> {alert("Rejected!");} </script>'; But when a user checked 2 check boxes.. it would also popup a 2 popup box.. How can i make my code only popup once even if it selects multiple checkboxes? Hi guys. I'm very new to PHP, and I'm trying to create a simple mail script. Mail a friend A user will click an image on the site which will open a pop up box. They input their name and the email of the friend that they want to send the current URL to. The email will send the current URL via email and display a confirmation message once it has sent successfully. The friend will receive an email with a link to the URL. The problem The email part works fine, it's the URL in the message that is the issue. When the user clicks the 'Email a friend' it opens a popup box - which is where the URL is being grabbed from and emailed. Is there a way to grab the URL from the page before the popup? Here is my (rather amateur) code. Also, feel free to let me know if I can make improvements to it if anything seems a bit strange! The popup link: <a onclick="window.open(this.href,'win2','width=400,height=350,menubar=yes,resizable=yes'); return false;" title="E-mail" href="mailform/form.html">Send to a friend</a> The popup form: <html> <body> <form method="post" action="code.php"> Friends Email: <input name="email" type="text" /><br /> Your Name: <input name="name" type="text" /><br /> <input type="submit" /> </form> </body> </html> The PHP code: <?php // Declaring Variables $email = $_REQUEST['email'] ; $name = $_REQUEST['name']; $geturl = "http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']; $message = "Hello. $name has suggested a page for you to view on our website. Please click the following link: $geturl"; // Email Settings mail( $email, "Send page to a friend", $message, "From: Timaru District Council" ); header( "Location: http://www.c4clever.com/sandbox/mailform/sent.html" ); // Confirmation page (Change this to appropriate URL) ?> Feel free to test it out if you want to (http://www.c4clever.com/sandbox) Looking forward to replies, thanks in advance! I am looking for someone that would be willing to provide the code for a message box that will popup after a PHP file upload completes. It will simply display a message stating that the upload is complete. Thank you in advance for your assistance. This topic has been moved to JavaScript Help. http://www.phpfreaks.com/forums/index.php?topic=349353.0 Trying to get popup window to work in php. Keep getting template parse errors. Here's the code I've been using in HTML: Code: [Select] echo ' <a onClick="window.open('annexplayerpop.shtm','popup','height=275,width=425,top=130,left=280,scrollbars=no')" target="popup"><img src="popupbutton-blue-bg.png" title="Popup MP3 Player" border="0" height="45" width="58"></a> '; Hi all, i was wondering how to make a box popup when a new message has appeared in my table i know its javascript for the box but im not sure on how to make popup when theres a new message, any ideas? Hey I 'm new to this but i got this code the links to images in my database and display them to the user but i want the images to pop-up out of the screen like this website : http://pinterest.com/ here when the small images are clicked displaying all the comments from users under it here is the code: and thanks <?php include('models/user.php'); ob_start(); if(isset($_GET['cat'])){ $objCat = new dbConfig(); $sqlCat = $objCat->selectQuery("select * from categories WHERE cat_id = ".$_GET['cat']); $rowCat = mysql_fetch_array($sqlCat); $title = "Blabben - ".$rowCat['cat_name']; } elseif(isset($_GET['category'])){ $objCat = new dbConfig(); $sqlCat = $objCat->selectQuery("select * from categories WHERE cat_id = ".$_GET['category']); $rowCat = mysql_fetch_array($sqlCat); $title = "Blabben - ".$rowCat['cat_name']; } else { $title = "Blabben"; } ?> <?php define('INCLUDE_CHECK',1); require "timeline/functions.php"; require "timeline/connect.php"; // remove blabs older than 1 hour to prevent spam //mysql_query("DELETE FROM blabs WHERE blab_id>1 AND blab_date<SUBTIME(NOW(),'0 1:0:0')"); //fetch the timeline if(isset($_GET['top'])&&!isset($_GET['cat'])){ $q = mysql_query("SELECT * FROM blabs,users WHERE (blabs.user_id = users.user_id) AND (blabs.blab!='0') ORDER BY blabs.blab_id DESC LIMIT 50"); }elseif(isset($_GET['top'])&&isset($_GET['cat'])){ $q = mysql_query("SELECT * FROM blabs,users WHERE (blabs.user_id = users.user_id) AND (blabs.cat_id = ".$_GET['cat'].") AND (blabs.blab!='0') ORDER BY blabs.blab_id DESC LIMIT 50"); }elseif(!isset($_GET['top'])&&isset($_GET['cat'])){ $q = mysql_query("SELECT * FROM blabs,users WHERE (blabs.user_id = users.user_id) AND (blabs.cat_id = ".$_GET['cat'].") AND (blabs.blab!='0') ORDER BY blabs.blab_id DESC LIMIT 50"); } elseif(isset($_GET['points'])){ $q = mysql_query("SELECT * FROM blabs,users,follow WHERE follow.following = blabs.user_id AND blabs.user_id = users.user_id AND (follow.follower = ".$uinfo['user_id'].") AND blabs.blab!='0' ORDER BY users.points DESC LIMIT 50"); } //elseif(isset($_GET['cat'])){ //$q = mysql_query("SELECT * FROM blabs,users,follow WHERE follow.following = blabs.user_id AND blabs.user_id = users.user_id AND blabs.blab!='0' AND (follow.follower = ".$uinfo['user_id'].") AND blabs.cat_id = ".$_GET['cat']." ORDER BY blabs.blab_id DESC LIMIT 50"); //}elseif(isset($_GET['category'])){ //$q = mysql_query("SELECT * FROM blabs,users,follow WHERE follow.following = blabs.user_id AND blabs.user_id = users.user_id AND blabs.blab!='0' AND (follow.follower = ".$uinfo['user_id'].") AND blabs.cat_id = ".$_GET['category']." ORDER BY blabs.blab_id DESC LIMIT 50"); //} else{ $q = mysql_query("SELECT * FROM blabs,users,follow WHERE follow.following = blabs.user_id AND blabs.user_id = users.user_id AND (follow.follower = ".$uinfo['user_id'].") AND blabs.blab!='0' ORDER BY blabs.blab_id DESC LIMIT 50"); } $timeline=''; //$row1=mysql_fetch_assoc($q); //$bd = $row1['blab_date']; //$blab_date = relativeTime($bd,$precision=2); while($row=mysql_fetch_assoc($q)) { $timeline.=formatTweet($row['name'],$row['uname'],$row['state'],$row['picture'],$row['blab'],$row['blab_date'],$row['user_id'],$row['blab_id']); } // fetch the no blab $noblab = ''; //if(isset($_GET['cat'])){ //$blabcount = mysql_num_rows(mysql_query("SELECT * FROM blabs WHERE blab!=0 AND cat_id=".$_GET['cat'])); //} //elseif(isset($_GET['category'])){ //$blabcount = mysql_num_rows(mysql_query("SELECT * FROM blabs WHERE blab!=0 AND cat_id=".$_GET['category'])); //}else{ //$blabcount = mysql_num_rows(mysql_query("SELECT * FROM blabs where `blab`!='0'")); //} //if($blabcount<=0){ $noblab = "<div style='padding:20px 15px; text-align:center;' id='noblab'>No Blab Posted</div>"; } ?> <script> $(document).ready(function(){ $('#noblab').hide(); }); </script> <?php if(isset($_GET['verified'])&& $_GET['verified']=='1'){ ?> <script type="text/javascript"> showNotification({ message: "Congratulations! You have got 250 points for verifying your account", type: "success", autoClose: true, duration: 5 }); </script> <?php } ?> <?php if(isset($_GET['verified'])&& $_GET['verified']=='11'){ ?> <script type="text/javascript"> showNotification({ message: "Your account is already verified.", type: "error", autoClose: true, duration: 5 }); </script> <?php } ?> <?php if(isset($_GET['blab'])&& $_GET['blab']=='added'){ ?> <script type="text/javascript"> showNotification({ message: "Blab has been added successfully.", type: "success", autoClose: true, duration: 5 }); </script> <?php } ?> <?php if((isset($_GET['welcome'])&& $_GET['welcome']=='1')||($uinfo['verified']=='0')){ ?> <script type="text/javascript"> showNotification({ message: "<span style='color:#000;'><strong>Confirm your email address to access all of Blabben's features</strong>. A confirmation message was sent to <strong><?php echo $uinfo['email']; ?></strong><br /><span style='color:#000;'><a style='color:blue; text-decoration:underline; font-weight:normal;' href='models/resend.php'>Resend Confirmation Email</a> | <a style='color:blue; text-decoration:underline; font-weight:normal;' href='account'>Update Email Address</a></span></span>", type: "success", autoClose: false, duration: 5 }); </script> <?php } ?> <?php if(isset($_GET['blab'])&& $_GET['blab']=='deleted'){ ?> <script type="text/javascript"> showNotification({ message: "Blab has been deleted successfully.", type: "success", autoClose: true, duration: 5 }); </script> <?php } ?> <?php if(isset($_GET['b'])&& $_GET['b']=='err'){ ?> <script type="text/javascript"> showNotification({ message: "Sorry! You don't have enough points.", type: "error", autoClose: true, duration: 5 }); </script> <?php } ?> <?php if(isset($_GET['resent'])&& $_GET['resent']=='1'){ ?> <script type="text/javascript"> showNotification({ message: "Confirmation email has been resent on your Email.", type: "success", autoClose: true, duration: 5 }); </script> <?php } ?> <SCRIPT LANGUAGE="JavaScript"> <!-- Limit the number of characters per textarea --> <!-- Begin function textCounter(field,cntfield,maxlimit) { if (field.value.length > maxlimit) // if too long...trim it! field.value = field.value.substring(0, maxlimit); // otherwise, update 'characters left' counter else cntfield.value = maxlimit - field.value.length; } // End --> </script> <!--tabs--> <div id="tabs-con"> <div id="tabs1"> <!--id="nation"--> <div class="tab roundT"><a href="http://www.blabben.com">Blabbing</a><!--<span></span>--> </div> <div class="tab roundT"><a href="upload-picture.php">Upload Picture</a></div> <div class="tab roundT"><a <?php if(isset($_GET['cat'])){ ?>href="home?category=<?php echo $_GET['cat']; ?>" <?php } elseif(isset($_GET['category'])){ ?>href="home?category=<?php echo $_GET['category']; ?>"<?php }elseif(isset($_GET['tp'])){ ?>href="home?alltp"<?php }else{ ?>href="home?all"<?php } ?>> <?php if(isset($_GET['cat'])){ ?><?php echo $rowCat['cat_name']; ?> All Pictures<?php } elseif(isset($_GET['category'])){ ?><strong><?php echo $rowCat['cat_name']; ?> All Pictures</strong><?php } elseif(isset($_GET['alltp'])){ ?><strong>All Recent Pictures</strong><?php } elseif(isset($_GET['all'])){ ?><strong>All Recent Pictures</strong><?php }else{ ?>All Recent Pictures<?php } ?></a></div> <div class="tab roundT"><a <?php if(isset($_GET['cat'])){ ?> href="home?tp&cat=<?php echo $_GET['cat']; ?>" <?php }else{ ?>href="home?tp"<?php } ?>> <?php if(isset($_GET['cat'])){ ?><?php echo $rowCat['cat_name']; ?> Top Pictures<?php } elseif(isset($_GET['tp'])||isset($_GET['alltp'])){ ?><strong>Top Pictures</strong><?php } else{ ?>Blabben Top Pictures<?php } ?></a></div> </div> </div> <!--tabs end--> <!-- <div class="blabnation"> <ul class="user-dropdown"> <li <?php //if(!isset($_GET['nation'])){?>id="selected"<?php //}else{}?>><a href="home">Blab Friends</a></li> <li <?php //if(isset($_GET['nation'])){?>id="selected"<?php //}else{}?>><a href="home?nation">Blab Nation</a></li> </ul> </div> --> <!--content--> <div id="content" class="round1"> <?php if(!isset($_GET['top'])){ $objBP = new dbConfig(); $objBP1 = new dbConfig(); //echo $_GET['cat']; if(isset($_GET['cat'])&&!isset($_GET['tp'])){ $cate = "select * from blabs,users,categories,follow WHERE follow.following = blabs.user_id AND follow.follower = ".$uinfo['user_id']." AND blabs.cat_id = categories.cat_id AND blabs.user_id = users.user_id AND blabs.blab='0' AND blabs.cat_id = ".$_GET['cat']." ORDER BY blab_id DESC LIMIT 8"; $sqlBP = $objBP->selectQuery($cate); } elseif(isset($_GET['category'])){ $sqlBP = $objBP->selectQuery("select * from blabs,users,categories,follow WHERE follow.following = blabs.user_id AND blabs.cat_id = categories.cat_id AND follow.follower = ".$uinfo['user_id']." AND blabs.user_id = users.user_id AND blabs.blab='0' AND blabs.cat_id = ".$_GET['category']." ORDER BY blab_id DESC LIMIT 8"); } elseif(isset($_GET['all'])){ $sqlBP = $objBP->selectQuery("select * from blabs,users,categories,follow WHERE follow.following = blabs.user_id AND blabs.cat_id = categories.cat_id AND follow.follower = ".$uinfo['user_id']." AND blabs.user_id = users.user_id AND blabs.blab='0' ORDER BY blab_id DESC LIMIT 75"); } elseif(isset($_GET['tp'])&&!isset($_GET['cat'])){ $sqlBP = $objBP->selectQuery("select * from blabs,users,categories WHERE blabs.cat_id = categories.cat_id AND blabs.user_id = users.user_id AND blabs.blab='0' ORDER BY blabs.blab_id DESC LIMIT 75"); //$sqlBP = $objBP->selectQuery("select * from likes,blabs,users,categories WHERE likes.blab_id = blabs.blab_id AND blabs.cat_id = categories.cat_id AND likes.show='1' AND blabs.user_id = users.user_id AND blabs.blab='0' ORDER BY likes.liked DESC LIMIT 75"); } elseif(isset($_GET['tp'])&&isset($_GET['cat'])){ $t = "select * from blabs,users,categories WHERE blabs.cat_id = categories.cat_id AND blabs.user_id = users.user_id AND blabs.cat_id = ".$_GET['cat']." AND blabs.blab='0' ORDER BY blabs.blab_id DESC LIMIT 75"; $sqlBP = $objBP->selectQuery($t); } elseif(isset($_GET['alltp'])){ $sqlBP = $objBP->selectQuery("select * from likes,blabs,users,categories,follow WHERE follow.following = blabs.user_id AND (likes.blab_id = blabs.blab_id) AND (follow.follower = ".$uinfo['user_id'].") AND (blabs.cat_id = categories.cat_id) AND (likes.show='1') AND (blabs.user_id = users.user_id) AND (blabs.blab='0') ORDER BY likes.liked DESC"); } elseif(!isset($_GET['tp'])&&isset($_GET['cat'])) { $sqlBP = $objBP->selectQuery("select * from blabs,users,follow,categories WHERE (blabs.cat_id = categories.cat_id) AND (follow.following = blabs.user_id) AND (follow.follower = ".$uinfo['user_id'].") AND (blabs.user_id = users.user_id) AND (blabs.blab='0') AND (blabs.cat_id = ".$_GET['cat'].") ORDER BY blab_id DESC LIMIT 8"); } else { $sqlBP = $objBP->selectQuery("select * from blabs,users,follow,categories WHERE (blabs.cat_id = categories.cat_id) AND (follow.following = blabs.user_id) AND (follow.follower = ".$uinfo['user_id'].") AND (blabs.user_id = users.user_id) AND (blabs.blab='0') ORDER BY blab_id DESC LIMIT 8"); } ?> <script> function deleteblab(blab){ c = confirm("Are you sure you want to delete this?"); if(c==true){location.href = "models/picblab_mdl.php?bid="+blab+"&delete=blab"} } </script> <!--blab--> <div id="blabs-con"> <ul> <?php $c=1; while($rowblab = mysql_fetch_array($sqlBP)){ ?> <?php //count likes $objLike = new dbConfig(); $sqlLike = $objLike->selectQuery("select * from likes WHERE blab_id = ".$rowblab['blab_id']); $countLike = mysql_num_rows($sqlLike); //find if person liked $objLike1 = new dbConfig(); $sqlLike1 = $objLike1->selectQuery("select * from likes WHERE blab_id = ".$rowblab['blab_id']." AND user_id = ".$uinfo['user_id']); $countLike1 = mysql_num_rows($sqlLike1); //get comments $objBs = new dbConfig(); $sqlBs = $objBs->selectQuery("select * from comment WHERE blab_id = ".$rowblab['blab_id']); $countBs = mysql_num_rows($sqlBs); //get repics $objRe = new dbConfig(); $sqlRe = $objRe->selectQuery("select * from blabs WHERE reblab = ".$rowblab['blab_id']); $countRe = mysql_num_rows($sqlRe); ?> <li class="box"> <div class="blabs" fancybox> <!--fancybox srart--> <!-- Add mousewheel plugin (this is optional) --> <script src="../js/jquery-1.7.1.min.js" type="text/javascript"></script> <script type="text/javascript" src="js/jquery.mousewheel-3.0.6.pack.js"></script> <!-- Add fancyBox main JS and CSS files --> <script type="text/javascript" src="js/fancybox/jquery.fancybox.js"></script> <link rel="stylesheet" type="text/css" href="js/fancybox/jquery.fancybox.css" media="screen" /> <!--fancybox end--> <script type="text/javascript"> $(document).ready(function() { $(".fancybox").fancybox({ 'transitionIn' : 'elastic', 'transitionOut' : 'fade', 'width' : 615, 'height' : 'auto', 'type' : 'img' }); }); </script> <script> $(document).ready(function(){ //$('#commentwr<?php //echo $c; ?>').hide(); $('#commentbt<?php echo $c; ?>').click(function(){ //$('#commentwr<?php //echo $c; ?>').slideToggle('slow'); $('#comment<?php echo $c; ?>').focus(); }); }); </script> <?php if($_SESSION['UserInfo'][0]==$rowblab['user_id']) {?> <div class="delete1"><a href="javascript:;" onclick="deleteblab('<?php echo $rowblab['blab_id']; ?>')"><img src="images/delete.png" title="Delete this Picture" alt="Delete" /></a></div> <?php } ?> <div class="blabs-img fancybox"><!--blabs-img start--> <?php if($rowblab['blab_img']==NULL){ ?> <a class="fancybox" href="article.php?blab=<?php echo $rowblab['blab_id']; ?>"><img src="images/avatar.png" width="198" /></a> <?php } else { ?> <a class="fancybox" href="article.php?blab=<?php echo $rowblab['blab_id']; ?>"><img src="pictures/large/<?php echo $rowblab['blab_img']; ?>" width="198" /></a> <?php } ?> <div class="blab-text"><?php echo $rowblab['blab_caption']; ?></div> <div class="blab-text1"><?php echo $countLike; ?> likes</div> <div class="blab-text1"><?php echo $countBs; ?> blabs</div> <div class="blab-text1"><?php echo $countRe; ?> repics</div> </div><!-- blabs-img end--> <div class="like fancybox" ><img id="commentbt<?php echo $c; ?>" style="cursor:pointer;" src="images/Blab.jpg" width="61" height="18" /> <?php if($countLike1<=0){ ?> <a class="fancybox" href="models/likes_mdl.php?action=like&bid=<?php echo $rowblab['blab_id']; ?>&uid=<?php echo $rowblab['user_id']; ?>&page=home"><img src="images/Like.jpg" width="56" height="18" /></a> <?php }?> <?php if($rowblab['user_id']!=$uinfo['user_id']){ ?> <form style="float:right;" name="repic" id="repic" action="models/repic_mdl.php?action=repic" method="post"> <input name="uid" type="hidden" value="<?php echo $rowblab['user_id']; ?>" /> <input name="blab_img" type="hidden" value="<?php echo $rowblab['blab_img']; ?>" /> <input name="blab_id" type="hidden" value="<?php echo $rowblab['blab_id']; ?>" /> <input name="blab_caption" type="hidden" value="<?php echo $rowblab['blab_caption']; ?>" /> <input name="cat_id" type="hidden" value="<?php echo $rowblab['cat_id']; ?>" /> <input type="image" src="images/RePic.png" /> </form> <?php }?> </div> <div class="onto"> <?php if($rowblab['picture']==NULL) { ?> <span><img src="images/avatar.png" width="30" /></span> <?php } else { ?><img src="users_images/small/<?php echo $rowblab['picture']; ?>" width="30" /><?php } ?> <span><strong><a href="./<?php echo $rowblab['uname']; ?>"><?php echo $rowblab['name']; ?></a> @<?php echo $rowblab['uname']; ?></strong> onto <strong><a href="home?cat=<?php echo $rowblab['cat_id']; if(isset($_GET['tp'])){echo "&tp";} ?>"><?php echo $rowblab['cat_name']; ?></a></strong></span></div> <?php $objCom = new dbConfig(); //$coms = "select * from blabs,users,comment WHERE blabs.user_id = comment.user_id AND blabs.blab_id = comment.blab_id AND comment.blab_id = ".$rowblab['blab_id']." ORDER BY comment.com_id DESC LIMIT 2"; $sqlCom = $objCom->selectQuery("select * from comment WHERE blab_id = ".$rowblab['blab_id']." ORDER BY com_id DESC LIMIT 2"); $comCount = mysql_num_rows($sqlCom); if($comCount>=1){ while($comments = mysql_fetch_array($sqlCom)){ ?> <div class="onto1"> <?php $objComU = new dbConfig(); $sqlComU = $objComU->selectQuery("select * from users WHERE user_id = ".$comments['user_id']); $comU = mysql_fetch_array($sqlComU); if($comU['picture']==NULL) { ?> <span><img src="images/avatar.png" width="30" /></span> <?php } else { ?><img src="users_images/small/<?php echo $comU['picture']; ?>" width="30" /><?php } ?> <span><strong><a href="./<?php echo $comU['uname']; ?>"><?php echo $comU['name']; ?></a></strong> <?php echo $comments['comment']; ?></span></div> <?php }} if($countBs>=2){ ?> <div class="onto1" style="text-align:center"> <span><strong><a href="article.php?blab=<?php echo $rowblab['blab_id']; ?>">All <?php echo $countBs; ?> comments...</a></strong></span></div> <?php } ?> <div id="commentwr<?php echo $c; ?>" class="onto1 comments" style="text-align:center"> <span><strong><form action="models/comment_mdl.php?put=blab&uid=<?php echo $rowblab['user_id']; ?>" method="post" name="comment"><input name="blab_id" type="hidden" value="<?php echo $rowblab['blab_id']; ?>" /><textarea name="comment" id="comment<?php echo $c; ?>" placeholder="Blab It Up" maxlength="140" style="max-width:186px; min-width:186px; width:186px; height:24px;max-height:50px;" cols="" rows=""></textarea></strong></span><br /> <input name="" type="image" src="images/Blab.jpg" style="margin-top:6px;" /></form> </div> </div> </li> <?php $c++; } ?> </ul> <?php } ?> </div> <!--blabs end--> <?php if(!isset($_GET['all'])&&!isset($_GET['category'])&&!isset($_GET['alltp'])&&!isset($_GET['tp'])) {?> <!--content 2--> <div id="content2" style="margin-bottom:20px;"> <a id="timeline"></a> <!--content left--> <div id="left"> <!--tabs--> <div id="tabs-inside"> <div class="tab-inside roundT"><a href="home"><?php if(!isset($_GET['top'])&&!isset($_GET['points'])){ ?><strong>Blabbing</strong><?php } else {?>Blabbing<?php } ?></a></div> <div class="tab-inside roundT"> <?php if(isset($_GET['cat'])){ ?><a href="home?top&cat=<?php echo $_GET['cat']; ?>"><?php if(isset($_GET['top'])) {?><strong><?php echo $rowCat['cat_name']; ?> Top Blabs</strong><?php }else { ?><?php echo $rowCat['cat_name']; ?> Top Blabs</a><?php }}else {?><a href="home?top"><?php if(isset($_GET['top'])) {?><strong>Blabben Top Blabs</strong><?php }else { ?>Blabben Top Blabs</a><?php }} ?></div> <!--<div class="tab-inside roundT"><a href="home?points"><?php //if(isset($_GET['points'])){ ?><strong>Points</strong><?php //} else {?>Points<?php //} ?></a></div>--> </div> <!--tabs end--> <div id="leftcon"> <div style="text-align: center;"><?php echo $noblab; ?></div> <ul class="statuses"><?=$timeline?></ul> </div> </div> <!--conetne left end--> <!--content right--> <div id="right"> <!--tabs--> <div id="tabs"> <div class="tab1 roundT">My Blab Profile<span class="catname1"><?php if(isset($_GET['cat'])){ echo $rowCat['cat_name']; } elseif(isset($_GET['category'])){ echo $rowCat['cat_name']; } ?></span></div> </div> <!--tabs end--> <!--profile--> <div id="blab-profile"> <div id="profile"> <?php if($uinfo['picture']==NULL) { ?> <img src="images/avatar.png" width="50" /> <?php } else { ?><img src="users_images/large/<?php echo $uinfo['picture']; ?>" width="50" /><?php } ?><span> </span><?php echo $uinfo['name']; ?><br /> <a href="<?php echo $uinfo['uname']; ?>">View Profile page</a></div> <!--counts--> <div id="counts"> <div id="count-blabs1"> <?php $objBlab = new dbConfig(); $sqlBlab = $objBlab->selectQuery("select * from blabs WHERE user_id = ".$_SESSION['UserInfo'][0]); $countBlab = mysql_num_rows($sqlBlab); $objF = new dbConfig(); $sqlF = $objF->selectQuery("select * from follow WHERE follower = ".$_SESSION['UserInfo'][0]); $following = mysql_num_rows($sqlF); $objF1 = new dbConfig(); $sqlF1 = $objF1->selectQuery("select * from follow WHERE following = ".$_SESSION['UserInfo'][0]); $follower = mysql_num_rows($sqlF1); $objPoints = new dbConfig(); $sqlPoints = $objBlab->selectQuery("select * from users WHERE user_id = ".$_SESSION['UserInfo'][0]); $countPoints = mysql_fetch_array($sqlPoints); ?> <span><?php echo $countBlab; ?></span><br /> <a href="profile">BLABS</a></div> <div id="count-points1"><span><?php echo $countPoints['points']; ?></span><br /> <a href="profile">POINTS</a></div> </div> <!--counts end--> <!--counts--> <div id="counts"> <div id="count-follow1"><span><?php echo $following; ?></span><br /> <a href="profile?following">FOLLOWING</a></div> <div id="count-follower1"><span><?php echo $follower; ?></span><br /> <a href="profile?followers">FOLLOWERS</a></div> </div> <!--counts end--> <?php $objbid = new dbConfig(); $qb = "select * from blabs order by blab_id desc limit 1"; $sqlbid = $objbid->selectQuery($qb); $bid= mysql_fetch_array($sqlbid); $b_id = $bid['blab_id']+1; ?> <div id="blabit-up"> <form id="blabfrm" name="blabfrm" method="post"> <textarea name="blab" id="blab" placeholder="Blab It Up" class="validate[required] text-input" tabindex="1" rows="2" cols="40" onKeyDown="textCounter(document.blabfrm.blab,document.blabfrm.counterb,160)" onKeyUp="textCounter(document.blabfrm.blab,document.document.blabfrm.counterb,160)"><?php if(isset($_GET['cat'])){?>wrote onto <?php echo $rowCat['cat_name'].": "; ?><?php }elseif(isset($_GET['category'])) { ?>wrote onto <?php echo $rowCat['cat_name'].": "; }?></textarea> <input name="name" type="hidden" value="<?php echo $_SESSION['UserInfo'][1]; ?>" /> <input name="state" type="hidden" value="<?php echo $_SESSION['UserInfo'][6]; ?>" /> <input name="city" type="hidden" value="<?php echo $_SESSION['UserInfo'][5]; ?>" /> <input name="picture" type="hidden" value="<?php echo $_SESSION['UserInfo'][10]; ?>" /> <input name="uname" type="hidden" value="<?php echo $_SESSION['UserInfo'][4]; ?>" /> <input name="cat_id" type="hidden" value="<?php if(isset($_GET['cat'])) { echo $_GET['cat']; } elseif(isset($_GET['category'])) { echo $_GET['category']; } else { echo "35"; }?>" /> <input name="blab_id" type="hidden" value="<?php echo $b_id; ?>" /> <span class="catname"><?php if(isset($_GET['cat'])){ echo "<span style='text-transform: capitalize;'>".$rowCat['cat_name']."</span>"; }elseif(isset($_GET['category'])){ echo "<span style='text-transform: capitalize;'>".$rowCat['cat_name']."</span>"; } ?></span> <input name="counterb" class="counter" style="border:none; background:none;margin: 0; width: 50px;" disabled="disabled" value="160" type="text" /> <!--<span style="min-width:100px" class="counter">160</span>--> <input class="submitButton inact" name="submit" type="submit" value=" " disabled="disabled" /> <div class="clear"></div> </form> </div> </div> <!--blab of day--> <div id="tabs"> <div class="tab1 roundT" style="margin-top:10px;">Blab of the day</div> </div> <?php $objday = new dbConfig(); $sqlday = $objday->selectQuery("select * from trending WHERE trending_active = '1' ORDER BY trending_id DESC"); $bofdayn = mysql_num_rows($sqlday); if($bofdayn<=0){ ?> <div class="recent-comments" style="background: none repeat scroll 0 0 #FFFFFF; margin-left: 6px; width: 93%;"> <div class="pinned"><strong>No Blab</strong></div> </div> <?php } else { while($bofday = mysql_fetch_array($sqlday)){ ?> <div class="recent-comments" style="background: none repeat scroll 0 0 #FFFFFF; margin-left: 6px; width: 93%;"> <!-- onclick="document.getElementById('q').value='<?php //echo $bofday['trendings']; ?>'"--> <div class="pinned" style="padding-left:13px;"><a href="search?q=<?php echo $bofday['trendings']; ?>" id="bofday"><?php echo $bofday['trendings']; ?></a></div> </div> <?php }} ?> <!--blab of day end--> </div> <!--profile end--> </div> <!--conetne right end--> </div> <!--content 2 end--> <?php } ?> </div> <!--content end--> </div> <!--wrapper end--> <script src="js/masonry/jquery.masonry.min.js"></script> <script> $(function(){ var $container = $('#blabs-con'); $container.imagesLoaded(function(){ $container.masonry({ itemSelector : '.box', columnWidth : 0 }); }); }); </script> </body> </html> <?php $content = ob_get_contents(); ob_end_clean(); require_once("mainTemplate.php"); ?> This topic has been moved to JavaScript Help. http://www.phpfreaks.com/forums/index.php?topic=352201.0 This topic has been moved to JavaScript Help. http://www.phpfreaks.com/forums/index.php?topic=352864.0 This topic has been moved to Third Party PHP Scripts. http://www.phpfreaks.com/forums/index.php?topic=355561.0 This topic has been moved to JavaScript Help. http://www.phpfreaks.com/forums/index.php?topic=351532.0 Hi, On a website, there are products nicely listed with name, description, product code, price and a thumbnail etc. Now, if you click on a picture thumbnail, a new page called prodwin.php in a new window opens with the product code and for some reason, there is a "no picture available" alt image for every product. The line of code in it: <td colspan="2"><?php if(file_exists("../pics_p/".$HTTP_GET_VARS["PCode"].".jpg")){?><img src="../pics_p/<?php echo $HTTP_GET_VARS["PCode"] ?>.jpg" alt="Product Picture" galleryimg="no"><?php }else{?><img src="../imgz/nopic.jpg" alt="No Picture Available" width="306" height="200" galleryimg="no"><?php }?></td> The URL of that page looks like this: http://www.lock-tech.co.uk/scrptz/prodwin.php?SCode=CHL8K119S&PCode=CHL8K119S&PDescription=+DOOR%20PATIO%20LOCK&KEY%20SATIN&thePrice=%A328.52%20/%20EA On the other hand, when you click on the product name, it loads a different page called g_browse.php and the product image is nicely there. The line of code in it: <td height="366" colspan="2" valign="top"><?php if(file_exists("pics_p/".$array[$getVars["index"]]["PCode"].".jpg")){?><img src="pics_p/<?php echo $array[$getVars["index"]]["PCode"] ?>.jpg" alt="Product Picture" galleryimg="no"><?php }else{?><img src="imgz/nopic.jpg" alt="No Picture Available" width="306" height="200" galleryimg="no"><?php }?></td> Code: [Select] $HTTP_GET_VARS["PCode"].".jpg" - Product code + .jpg will give the image name in pics_p folder. a JavaScript block which might also be relavant: Code: [Select] function prodWindow(SCode, PCode, PDescription, thePrice) { var xPos=(screen.availWidth/2)-490; var yPos=(screen.availHeight/2)-116; var s=",top="+yPos+",left="+xPos; var win=open("scrptz/prodwin.php?SCode="+SCode+"&PCode="+PCode+"&PDescription="+PDescription+"&thePrice="+thePrice,'product', "toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=no,copyhistory=no,scrollbars=no,height=414,width=316"+s); win.focus(); } Hope someone spots the problem. Regards, laanes I have a login modal window which is user for entering the login and password, and check it with the database.If the login and password is not there i nthe database the message shuld be displayed in the popup window itself. But in my case the popup window disapperas if the login details are wrong. how shuld i code for this. My code is pasted below. <div id="cover"></div> <div id="dialog"> <form action='' method='post' name='onlinepay'> <table width="388" border=1><tr><td colspan="4" align="right"></td><td align="right"><a href="index.php" onclick="closePopUp('dialog');"><img src='images/close.jpg' align="right" /></a></td></tr> <tr><td width="11" ></td> <td width="90">Username </td> <td width="57">:</td> <td width="147"><input type='text' name='username' id='username' /></td><td width="59"></td> </tr> <tr><td></td><td>Password</td><td>:</td><td><input type='text' name='password' id='password' /></td><td><input type='submit' name='submit' id='submit' value="Login" /></td></tr><tr><td colspan='5'><?php //connection statements goes here if(isset($_POST['submit'])){ $username=$_POST['username']; $password=$_POST['password']; $sql="select username,password from register where username='$username' and password='$password'"; $result=mysql_query($sql); $row=mysql_fetch_row($result); $row1=mysql_num_rows($result); if(($row['0']==$username) && ($row['1']==$password)){ header ('Location:themes/index.php'); } else{ echo "Username and password doesnot match"; } } ?> </td></tr> <tr><td colspan="5"><hr color="#999999" /></td></tr><tr><td></td><td colspan='2'><a href="javascript:void window.open('themes/forgotpassword.php?fullview=Y','','height=350,width=525,resizable=yes,scrollbars=yes')">Forgot password? </a> </td> <td><a href='register.php'>New User</a></td> <td align='center'> </td> </tr> </table> </form> Hello, I am trying to make the buy product button on all single product pages to open in a popup iframe or simular! I am new to java, php and such and I am looking for how to achieve this?
I have been researching this for over a month and nothing seems to work. I am affiliated with Amazon so I need my woocommerce buy product buttons to open a new smaller popup window in front of my site!
I have already had it set to open as _blank, But I really need all my external product button links to open as a popup! Is this possible? I have tried editing cart.php and I know nothing about java. Please help!!
Thank you in advance,
Dee
I'm making a site where I use a javascript popup, and I want to pass in a php variable to the popup, but I'm not sure what to do. Normally, I would use $_GET but the link points to the javascript code. Basically, I want the popup to display which user was clicked, player 1 or player 2, but I don't know where to start. Sorry if this should be asked in a javascript forum, I wasn't sure who I should ask. If I've asked in the wrong place, let me know. Test.php Code: [Select] <html> <head> <script type="text/javascript" src="script/popup-window.js"></script> </head> <body> <?php $player1 = "abc"; $player2 = "def"; $javacode = "javascript:popup_show('popup', 'popup_drag', 'popup_exit', 'screen-top-left', 1200, 20)"; echo 'Player 1: <a href="'.$javacode.'">'.$player1.'</a><br />'; echo 'Player 2: <a href="'.$javacode.'">'.$player2.'</a><br />'; ?> <div class="sample_popup" id="popup" style="display: none;"> <?php echo "Player selected: "; ?> </div> </body> </html> script/popup-window.js Code: [Select] // Copyright (C) 2005-2008 Ilya S. Lyubinskiy. All rights reserved. // Technical support: http://www.php-development.ru/ // // YOU MAY NOT // (1) Remove or modify this copyright notice. // (2) Re-distribute this code or any part of it. // Instead, you may link to the homepage of this code: // http://www.php-development.ru/javascripts/popup-window.php // // YOU MAY // (1) Use this code on your website. // (2) Use this code as part of another product. // // NO WARRANTY // This code is provided "as is" without warranty of any kind. // You expressly acknowledge and agree that use of this code is at your own risk. // USAGE // // function popup_show(id, drag_id, exit_id, position, x, y, position_id) // // id - id of a popup window; // drag_id - id of an element within popup window intended for dragging it // exit_id - id of an element within popup window intended for hiding it // position - positioning type: // "element", "element-right", "element-bottom", "mouse", // "screen-top-left", "screen-center", "screen-bottom-right" // x, y - offset // position_id - id of an element relative to which popup window will be positioned // ***** Variables ************************************************************* var popup_dragging = false; var popup_target; var popup_mouseX; var popup_mouseY; var popup_mouseposX; var popup_mouseposY; var popup_oldfunction; // ***** popup_mousedown ******************************************************* function popup_mousedown(e) { var ie = navigator.appName == "Microsoft Internet Explorer"; popup_mouseposX = ie ? window.event.clientX : e.clientX; popup_mouseposY = ie ? window.event.clientY : e.clientY; } // ***** popup_mousedown_window ************************************************ function popup_mousedown_window(e) { var ie = navigator.appName == "Microsoft Internet Explorer"; if ( ie && window.event.button != 1) return; if (!ie && e.button != 0) return; popup_dragging = true; popup_target = this['target']; popup_mouseX = ie ? window.event.clientX : e.clientX; popup_mouseY = ie ? window.event.clientY : e.clientY; if (ie) popup_oldfunction = document.onselectstart; else popup_oldfunction = document.onmousedown; if (ie) document.onselectstart = new Function("return false;"); else document.onmousedown = new Function("return false;"); } // ***** popup_mousemove ******************************************************* function popup_mousemove(e) { var ie = navigator.appName == "Microsoft Internet Explorer"; var element = document.getElementById(popup_target); var mouseX = ie ? window.event.clientX : e.clientX; var mouseY = ie ? window.event.clientY : e.clientY; if (!popup_dragging) return; element.style.left = (element.offsetLeft+mouseX-popup_mouseX)+'px'; element.style.top = (element.offsetTop +mouseY-popup_mouseY)+'px'; popup_mouseX = ie ? window.event.clientX : e.clientX; popup_mouseY = ie ? window.event.clientY : e.clientY; } // ***** popup_mouseup ********************************************************* function popup_mouseup(e) { var ie = navigator.appName == "Microsoft Internet Explorer"; var element = document.getElementById(popup_target); if (!popup_dragging) return; popup_dragging = false; if (ie) document.onselectstart = popup_oldfunction; else document.onmousedown = popup_oldfunction; } // ***** popup_exit ************************************************************ function popup_exit(e) { var ie = navigator.appName == "Microsoft Internet Explorer"; var element = document.getElementById(popup_target); popup_mouseup(e); element.style.display = 'none'; } // ***** popup_show ************************************************************ function popup_show(id, drag_id, exit_id, position, x, y, position_id) { var element = document.getElementById(id); var drag_element = document.getElementById(drag_id); var exit_element = document.getElementById(exit_id); var width = window.innerWidth ? window.innerWidth : document.documentElement.clientWidth; var height = window.innerHeight ? window.innerHeight : document.documentElement.clientHeight; element.style.position = "absolute"; element.style.display = "block"; if (position == "element" || position == "element-right" || position == "element-bottom") { var position_element = document.getElementById(position_id); for (var p = position_element; p; p = p.offsetParent) if (p.style.position != 'absolute') { x += p.offsetLeft; y += p.offsetTop; } if (position == "element-right" ) x += position_element.clientWidth; if (position == "element-bottom") y += position_element.clientHeight; element.style.left = x+'px'; element.style.top = y+'px'; } if (position == "mouse") { element.style.left = (document.documentElement.scrollLeft+popup_mouseposX+x)+'px'; element.style.top = (document.documentElement.scrollTop +popup_mouseposY+y)+'px'; } if (position == "screen-top-left") { element.style.left = (document.documentElement.scrollLeft+x)+'px'; element.style.top = (document.documentElement.scrollTop +y)+'px'; } if (position == "screen-center") { element.style.left = (document.documentElement.scrollLeft+(width -element.clientWidth )/2+x)+'px'; element.style.top = (document.documentElement.scrollTop +(height-element.clientHeight)/2+y)+'px'; } if (position == "screen-bottom-right") { element.style.left = (document.documentElement.scrollLeft+(width -element.clientWidth ) +x)+'px'; element.style.top = (document.documentElement.scrollTop +(height-element.clientHeight) +y)+'px'; } drag_element['target'] = id; drag_element.onmousedown = popup_mousedown_window; exit_element.onclick = popup_exit; } // ***** Attach Events ********************************************************* if (navigator.appName == "Microsoft Internet Explorer") document.attachEvent ('onmousedown', popup_mousedown); else document.addEventListener('mousedown', popup_mousedown, false); if (navigator.appName == "Microsoft Internet Explorer") document.attachEvent ('onmousemove', popup_mousemove); else document.addEventListener('mousemove', popup_mousemove, false); if (navigator.appName == "Microsoft Internet Explorer") document.attachEvent ('onmouseup', popup_mouseup); else document.addEventListener('mouseup', popup_mouseup, false); |