Jump to content

davinci

Members
  • Posts

    29
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

davinci's Achievements

Member

Member (2/5)

0

Reputation

  1. [!--quoteo(post=379051:date=Jun 1 2006, 08:54 AM:name=samshel)--][div class=\'quotetop\']QUOTE(samshel @ Jun 1 2006, 08:54 AM) [snapback]379051[/snapback][/div][div class=\'quotemain\'][!--quotec--] check the url u r passing <?=$_GET['url']?> it must be framecontents.php [/quote] The url in the browser is [a href=\"http://mysite.com/visit.php?url=http://othersite.com\" target=\"_blank\"]http://mysite.com/visit.php?url=http://othersite.com[/a] When I click the button it takes me to framecontents.php which is my frame but where I want it to go is to [a href=\"http://othersite.com\" target=\"_blank\"]http://othersite.com[/a]... I'm a newbie but it seems as if its trying to pull the from the framecontents.php. Also, when I check the HTML source after clicking the close frame button, instead of the pulled 'url' value it is blank.
  2. [!--quoteo(post=378989:date=Jun 1 2006, 04:33 AM:name=samshel)--][div class=\'quotetop\']QUOTE(samshel @ Jun 1 2006, 04:33 AM) [snapback]378989[/snapback][/div][div class=\'quotemain\'][!--quotec--] Try TARGET="_parent" [/quote] If you meant: [code] <TD width="1%" valign="center">         <A HREF="<?=$_GET['url']?>" TARGET="_parent"><IMG SRC="close.gif" WIDTH="12" HEIGHT="11" BORDER="0" ALT="Remove Frame"></A> [/code] Still doesn't work. When I click the button, it loads up framecontents.php, instead of othersite.com. Any more ideas?
  3. Hi, I tried putting together some code so that when someone visits a link off my site it opens the visited site with a frame on top of the page that has my little header. For example: someone clicks on [a href=\"http://mysite.com/visit.php?=http://othersite.com\" target=\"_blank\"]http://mysite.com/visit.php?=http://othersite.com[/a] My Problem: When I click the image of the little "x" in my frame in order to close the frame and show the site without a frame, instead of removing the frame, it removes the visited site instead and brings me to mysite.com/framecontents.php. I believe the code that needs to be modified can be viewed below in framecontents.php visit.php looks like this: [code] <?php include 'library/config.php'; include 'library/opendb.php'; $query = "UPDATE plugs SET clicks = (clicks + 1) WHERE url = '$url'"; mysql_query($query) or die('Error, insert query failed'); ?> <title><?=$_GET[title]?> - Brought to you by MySite.com</title> <frameset rows='100,*' border=0 frameborder=0 framespacing=0> <frame scrolling=no noresize src='framecontents.php'> <frame scrolling=yes frameborder=0 src='<?=$_GET[url]?>'> </frameset> <noframes> <body> <p>This page uses frames, but your browser doesn't support them.</p> </body> </noframes>[/code] framecontents.php looks like this: [code] <html> <head> <title>CJ Link Out V1.0</title> <link rel="stylesheet" href="style.css" type="text/css"> </head> <body topmargin="0" leftmargin="0"> <TABLE border="0" cellspacing="0" cellpadding="0" width="100%" height="75">  <TR>   <TD>     <TABLE border="0" cellspacing="2" cellpadding="1" width="100%">       <TR>       <TD width="1%" nowrap>             <TD width="1%" valign="center">         <A HREF="<?=$_GET['url']?>" TARGET="_top"><IMG SRC="close.gif" WIDTH="12" HEIGHT="11" BORDER="0" ALT="Remove Frame"></A>             </TD>             <TD width="99%" valign="center">         <B><? echo ucfirst($show); ?></B>              <A HREF="index.php" TARGET="_top"><IMG SRC="neon.gif" class="nob"></a> </TD>      </TD>      <TD width="99%" nowrap>        <div align="right"><A HREF="index.php" TARGET="_top">Back to MySite.com        </A></div>      </TD>      </TR>     </TABLE>       </TD>   </TR> </TABLE>[/code] Can anyone point out the error? I'm assuming its something wrong with this... Doesn't seem to be pulling the url... [code] <A HREF="<?=$_GET['url']?>" TARGET="_top"><IMG SRC="close.gif" WIDTH="12" HEIGHT="11" BORDER="0" ALT="Remove Frame"></A>[/code] Thanks!
  4. [!--quoteo(post=354279:date=Mar 12 2006, 03:09 PM:name=keeB)--][div class=\'quotetop\']QUOTE(keeB @ Mar 12 2006, 03:09 PM) [snapback]354279[/snapback][/div][div class=\'quotemain\'][!--quotec--] You would add a column to your database called clicks, then, make a referrer PHP file.. something like 'refer.php?to=http://www.google.com' and then, do the necessary checks. [= It seems like you're proficient enough to figure out how to do that, so if you need more help don't hesitate to post! [/quote] I'm not quite as proficient as I wish I was just yet... Mostly put together my scripts from mixing and matching from different scripts. I have this script that I came across, and I use it for trading traffic where it calculates hits in and hits out. Apparently for perm linking you just need to do go.php?j=www.site.com but it doesn't seem to work for sites that aren't already sending traffic to my site: [code]<?php /* * referers.php (c) plebian.com 1999-2004 * * go.php * Jump to a url. */ if(isset($_SERVER['QUERY_STRING'])) {     require_once('config.php');          if(preg_match('!^[0-9]+$!',$_SERVER['QUERY_STRING']))     {         $id=&$_SERVER['QUERY_STRING'];         $c=mysql_query("select id,url from TW_referers where id='{$id}'");     }     elseif(!empty($_GET['j']))     {         $url=addslashes($_GET['j']);         $c=mysql_query("select id,url from TW_referers where url='$url' order by id desc limit 1");     }     else     {         $c=null;     }     $d=mysql_fetch_object($c);     if(is_object($d))     {         mysql_query("update TW_referers set hitsout=hitsout+1 where id='{$d->id}'");         $url=stripslashes($d->url);         if(array_key_exists($url,$jump_url_replace))             $url=$jump_url_replace[$url];     }     else     {         $url=&$_SERVER['SERVER_NAME'];     } } else {     $url=&$_SERVER['SERVER_NAME']; } header("Location: http://$url"); exit; ?>[/code] Also I guess I would need to add to this script to have it add clicks to my links DB, because right now its only adding to the referrers DB that is special for this go.php script. Any suggestions?
  5. Is there an easy way to add clicks to my DB for links that I post that direct users off my site? So far this is what I have, but does not include any counting of any sort: [code]<?php include 'library/config.php'; include 'library/opendb.php'; $id = (isset($_GET['id']) ? $_GET['id'] : ""); if (empty($id)) { $rowsPerPage = 2; $pageNum = 1; if(isset($_GET['page'])) {     $pageNum = $_GET['page']; } $offset = ($pageNum - 1) * $rowsPerPage; $query = "SELECT id, title, url, description, thumbnail, DATE_FORMAT(entry_date, '%M %D %Y') AS date, category FROM plugs ORDER BY id DESC LIMIT $offset, $rowsPerPage"; $result = mysql_query($query) or die('Error, query failed'); ?> <div class="title">Must Visit</div><p>&nbsp<br> <?php while($row = mysql_fetch_array($result)) { ?> <table width="460" border="0" align="center" cellpadding="1" cellspacing="0">   <tr>         <td><table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">         <tr>           <td width="18%" align="center" valign="top"> <div align="center"><a href="<?=$row['url'];?>"><IMG BORDER="0" img src="media/thumbs/<?=$row['thumbnail'];?>" height="80" width="80"></a></font><font face="Arial, Helvetica, sans-serif">               </font></div></td>           <td width="82%" align="center" valign="top"><div align="left">               <table width="100%" border="0" cellspacing="5" cellpadding="0">                 <tr>                   <td><font size="2"><a href="<?=$row['url'];?>"><b><?php echo $row['title'];?></b></a> <br><?php echo $row['description'];?></font></td>                 </tr>                 <tr>                   <td>&nbsp;</td>                 </tr>               </table>             </div></td>         </tr>         <tr>           <td colspan="2" align="center" valign="top"> <div align="left"> <font size="1">Submitted               On: <?php echo $row['date'];?> | xxx | Category: <?=$row['category'];?> | Clicks: 99</div></td></font>         </tr>       </table></td>       </tr>     </table>[/code]
  6. Ok, I'm an idiot. :P I forgot the " ' " marks around '$category' in my query. So sorry to waste your time!
  7. I have form to upload news. Works well but I'm trying to add a drop down box to select the category. I've created a column called category in my news table. For the form I am using this code: [code] <tr><td> <select name="category" style="border: 1px solid #000000"> <option name="Type" option value="Type">Type..</option> <option name="Ad" option value="Ad">Ad</option> <option name="Video" option value="Video">Video</option> <option name="Gallery" option value="Gallery">Gallery</option> <option name="News" option value="News">News</option> <option name="Other" option value="Other">Other</option> </select></td> </tr><br>[/code] But whenever I try to use it I get the error: Error, query failed : Unknown column 'Video' in 'field list' (or instead of video, whichever value I selected). What am I doing wrong here?
  8. [!--quoteo(post=354211:date=Mar 12 2006, 11:18 AM:name=wildteen88)--][div class=\'quotetop\']QUOTE(wildteen88 @ Mar 12 2006, 11:18 AM) [snapback]354211[/snapback][/div][div class=\'quotemain\'][!--quotec--] The message you are recieving isn't an error but a just a message PHP throughs out when something isn't set. No the message is refering to the following: [code]$id = $_GET['id']; if ($id == "") {[/code]Notice where it says [i]$id = $_GET['id'][/i] this is ok but when you run your script and the id variable isn't passed over the url (index.php?id=1) then PHP will through a Notice message as $_GET['id'] isn't set! To get arround this simply change the two lines of code I posted above to the following: [code]$id = (isset($_GET['id']) ? $_GET['id'] : ""); if (empty($id)) {[/code] The new code first checks whether $_GET['id'] is actually set. If it is then it'll assign $id the value of $_GET['id'] otherwise it'll set $id to nothing! The next line of code just checks whether the value of $id is empty [/quote] Ok, I'm going to try this. UPDATE: Works perfectly, thank you!
  9. Hi guys, I have an index.php page and I'm including the following script (called showplugs.php) that I put together for my news postings . I've including paging but I think I've messed up somewhere because I am getting the following error on my frontpage right over where the news articles start: Notice: Undefined index: id in .../public_html/showplugs.php on line 6 The articles are there but so is the error. Here is the script: [code] <?php include 'library/config.php'; include 'library/opendb.php'; $id = $_GET['id']; if ($id == "") { $rowsPerPage = 6; $pageNum = 1; if(isset($_GET['page'])) {     $pageNum = $_GET['page']; } $offset = ($pageNum - 1) * $rowsPerPage; $query = "SELECT id, title, url, description, thumbnail, DATE_FORMAT(entry_date, '%M %D %Y') AS date FROM plugs ORDER BY id DESC LIMIT $offset, $rowsPerPage"; $result = mysql_query($query) or die('Error, query failed'); ?> <div class="title">Must Visit</div><p> <?php while($row = mysql_fetch_array($result)) { ?> .......more code here [/code] Thanks, and any help or comments appreciated! Addition: Also noticed that it is paging my index.php to page=1 but I don't want this. I want it to page within the index is that possible?
  10. [!--quoteo(post=353305:date=Mar 9 2006, 12:00 PM:name=obsidian)--][div class=\'quotetop\']QUOTE(obsidian @ Mar 9 2006, 12:00 PM) [snapback]353305[/snapback][/div][div class=\'quotemain\'][!--quotec--] actually, that's correct syntax. if you're only echoing a variable, you can use the shorthand <?= opening tag instead. as to the question at hand: you're formatting your date in your query, but you're not defining the results as "date", yet you're trying to echo "date" out of the array. i think you should be able to change your query to this and be ok: [!--sql--][div class=\'sqltop\']SQL[/div][div class=\'sqlmain\'][!--sql1--][span style=\'color:blue;font-weight:bold\']SELECT[/span] id, name, path, title, thumbnail, playcount, DATE_FORMAT(entry_date, [color=red]'%M %D %Y'[/color]) [color=green]AS[/color] date [color=green]FROM[/color] [color=orange]upload2[/color] [color=green]ORDER BY[/color] id [color=green]DESC[/color] LIMIT $offset, $rowsPerPage [!--sql2--][/div][!--sql3--] by using the "AS date", you are naming the results 'date' in your array, so you can just <?= $row['date'] ?> where you want it displayed. hope this helps [/quote] You guys rock! Adding the "AS date" did the trick!
  11. I added paging to one of my scripts and now the date doesn't show up. Can someone catch my mistake? At first I had this: [code]<?php include 'header.php' ?> <?php include 'left.php' ?> <?php include 'library/config.php'; include 'library/opendb.php'; $id = $_GET['id']; if ($id == "") { $query = "SELECT id, name, path, title, thumbnail, playcount, DATE_FORMAT(entry_date, '%M %D %Y') FROM upload2 ORDER BY id DESC"; $result = mysql_query($query) or die('Error, query failed'); while(list($id, $name, $path, $title, $thumbnail, $playcount, $date) = mysql_fetch_array($result)) { ?> <div align="center"> <table cellpadding="2" width="100%"  border="0" cellspacing="0" cellpadding="0"><tr> <td width="30%"> <a href="<?php echo $_SERVER['PHP_SELF'] ?>?id=<?= $id; ?>"><IMG BORDER="0" img src="media/thumbs/<?=$thumbnail;?>" height="80" width="80"><p> </a></td> <td width="70%"> <a href="<?php echo $_SERVER['PHP_SELF'] ?>?id=<?= $id; ?>"><b><?php echo $title;?></b></a><br>Added on <?=$date;?> <br>Plays: <?=$playcount;?> </td></tr></table>[/code] Now wherever I put <?=$date;?> I don't get anything... Then I changed it so that it has paging: [code]<?php include 'library/config.php'; include 'library/opendb.php'; $id = $_GET['id']; if ($id == "") { $rowsPerPage = 6; $pageNum = 1; if(isset($_GET['page'])) {     $pageNum = $_GET['page']; } $offset = ($pageNum - 1) * $rowsPerPage; $query = "SELECT id, name, path, title, thumbnail, playcount, DATE_FORMAT(entry_date, '%M %D %Y') FROM upload2 ORDER BY id DESC LIMIT $offset, $rowsPerPage"; $result = mysql_query($query) or die('Error, query failed'); ?> <div class="title">Video Archive</div><p> <?php while($row = mysql_fetch_array($result)) { ?> <div align="center"> <table cellpadding="2" width="75%"  border="0" cellspacing="0" cellpadding="0"><tr> <td width="50%"> <a href="<?php echo $_SERVER['PHP_SELF'] ?>?id=<?= $row['id'];?>"><IMG BORDER="0" img src="media/thumbs/<?=$row['thumbnail'];?>" height="80" width="80"><p> </a></td> <td width="50%"> <a href="<?php echo $_SERVER['PHP_SELF'] ?>?id=<?= $row['id'];?>"><b><?php echo $row['title'];?></b></a> <br>Added on <?=$row['date'];?> <br>Plays: <?=$row['playcount'];?> </td></tr></table><? } ?>[/code] Thank you to whoever can clear me up!
  12. [!--quoteo(post=353112:date=Mar 8 2006, 09:45 PM:name=AndyB)--][div class=\'quotetop\']QUOTE(AndyB @ Mar 8 2006, 09:45 PM) [snapback]353112[/snapback][/div][div class=\'quotemain\'][!--quotec--] Usually means that somewhere there's an unclosed curly bracket ... quite where } belongs isn't evident (so maybe it's in the code that's included) [/quote] Thanks! After knowing what to look for I found that I had left out a } !! I appreciate the help.
  13. Trying to mix and match pieces of code in order to get a way to post news to my site but including uploading a thumbnail. Here's what I came up with. However I get an error: Parse error: parse error, unexpected $ in /xxx/public_html/test/addplug.php on line 160 but don't know why considering I don't have a "$" on that line! Can someone help? [code]<?php // include the database configuration and // open connection to database include 'library/config.php'; include 'library/opendb.php'; $uploadDir = 'media/thumbs/'; // check if the form is submitted if(isset($_POST['upload'])) {     // get the input from $_POST variable     // trim all input to remove extra spaces     $title    = trim($_POST['txtTitle']);     $description   = trim($_POST['txtDescription']);     $url     = trim($_POST['txtUrl']);     $thumbnail = trim($_POST['thumbnailfile']);          // escape the message ( if it's not already escaped )     if(!get_magic_quotes_gpc())     {         $title    = addslashes($title);         $description = addslashes($description);     }          // if the visitor do not enter the url     // set $url to an empty string     if ($url == 'http://')     {         $url = '';     } //adding thumbnail stuff if(isset($_POST['upload'])) {     $fileName = $_FILES['thumbnailfile']['name'];     $filePath = $uploadDir . $fileName;     $result    = move_uploaded_file($tmpName, $filePath);     if (!$result) {         echo "Error uploading file";         exit;     }          // prepare the query string     $query = "INSERT INTO guestbook (title, description, url, thumbnail, entry_date) " .              "VALUES ('$title', '$description', '$url', '$fileName', current_date)";     // execute the query to insert the input to database     // if query fail the script will terminate             mysql_query($query) or die('Error, query failed. ' . mysql_error());          // redirect to current page so if we click the refresh button     // the form won't be resubmitted ( as that would make duplicate entries )     header('Location: ' . $_SERVER['REQUEST_URI']);          // force to quit the script. if we don't call exit the script may     // continue before the page is redirected     exit; } ?> <html> <head> <title>Add a Plug</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <link rel="stylesheet" type="text/css" href="styles/styles.css"> <script language="JavaScript"> /*     This function is called when     the 'Sign Guestbook' button is pressed     Output : true if all input are correct, false otherwise */ function checkForm() {     // the variables below are assigned to each     // form input     var gname, gemail, gurl, gmessage;     with(window.document.guestform)     {         gtitle    = txtTitle;         gdescription   = txtDescription;         gurl     = txtUrl;         gthumbnail = thumbnailfile;     }          // if name is empty alert the visitor     if(trim(gtitle.value) == '')     {         alert('Please enter a title');         gname.focus();         return false;     }     // alert the visitor if email is empty or the format is not correct     else if(trim(gdescription.value) != '' && !isEmail(trim(gdescription.value)))     {         alert('Please enter a description');         gemail.focus();         return false;     }     // alert the visitor if message is empty     else if(trim(gthumbnail.value) == '')     {         alert('Please Add a Thumbnail');         gthumbnail.focus();         return false;     }     else     {         // when all input are correct         // return true so the form will submit                 return true;     } } /* Strip whitespace from the beginning and end of a string Input  : a string Output : the trimmed string */ function trim(str) {     return str.replace(/^\s+|\s+$/g,''); } </script> </head> <body> <form method="post" enctype="multipart/form-data" name="plugs"> <table width="550" border="0" cellpadding="2" cellspacing="1">   <tr>    <td width="100">Title</td> <td>     <input name="txtTitle" type="text" id="txtTitle" size="30" maxlength="30"></td> </tr>   <tr>    <td width="100">Description</td>    <td>     <input name="txtDescription" type="text" id="txtDescription" size="200" maxlength="200"></td> </tr>    <tr>    <td width="100">URL</td>    <td>     <input name="txtUrl" type="text" id="txtUrl" value="http://" size="30" maxlength="50"></td> </tr>    <tr>    <td width="100">Thumbnail</td>     <td>     <input name="thumbnailfile" type="file" class="box" id="thumbnailfile"></td> </tr>   <tr>    <td width="100">&nbsp;</td>    <td>     <input name="upload" type="submit" id="upload" value="Plug" onClick="return checkForm();"></td> </tr> </table> </form>[/code] Thanks again and sorry for the lengthy code... :)
  14. Your way makes more sense! I've changed it to what you told me and now I have a better understanding of why it works the way it does. Thank you very much.
  15. Solved it...! This seemed to do the trick: [code] <?php include 'library/config.php'; include 'library/opendb.php'; $id = $_GET['id']; if ($id == "") { $heading = '<div class="title">Video Archive</div><p>'; $rowsPerPage = 6; $pageNum = 1; if(isset($_GET['page'])) {     $pageNum = $_GET['page']; } $offset = ($pageNum - 1) * $rowsPerPage; echo $heading; $query = "SELECT id, name, path, title, thumbnail, playcount, DATE_FORMAT(entry_date, '%M %D %Y') FROM upload2 ORDER BY id DESC LIMIT $offset, $rowsPerPage"; $result = mysql_query($query) or die('Error, query failed'); while($row = mysql_fetch_array($result)) { ?> [/code]
×
×
  • 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.