Jump to content

techiefreak05

Members
  • Posts

    494
  • Joined

  • Last visited

    Never

Everything posted by techiefreak05

  1. Thanks, guys. I'm trying to make it pretty good Any suggestions?
  2. Thanks a lot, but could you elaborate? What do you mean password verification isn't showing up, and you can't check the file? Thanks.
  3. that's what I was afraid of. basically I run a query for all the unique IPs for any give project for the "lifetime stats", and when I get the weekly stats, I run a query for each DAY in the last week, that grabs the unique IPs for each DAY, meaning if a person visits a site each day for a week, his visit count is 7, and the weekly stats will count that as 7, while the lifetime stats sounts him as 1, since it gets the stats for a lifetime, instead of daily.
  4. I'm writing a web analytics script and it's working great, with graphs, detailed stast, etc... but I' having a problem coming up with the query to display the correct number of "visits" or "unique" hits... I can display total page views just fine... on the stats page I show the lifetime unique visits, and the lifetime total page views like so: LIFETIME UNIQUE VISITS: SELECT COUNT(DISTINCT(ip)) as unique_hits FROM tracking WHERE project_id = '2' LIFETIME TOTAL PAGE VIEWS: SELECT COUNT(ip) as total_hits FROM tracking WHERE project_id = '2' Those both work fine... but when I run the stats for the week, the "unique visits" for the week are GREATER than the lifetime unique visits... BECAUSE... I have a function that generates an array of dates in between the start and end parameters, and I loop through the array, and grab the total, and unique for that day.... but if someone visists the site each day, he will counted 7 time, once for each day, since the loop looks for the unique for each day... WEEKLY STATS: <?php //$range is the array of dates. foreach($range as $day=>$xdate){ $sql_Counter = "SELECT COUNT(DISTINCT(ip)) as unique_hits, COUNT(ip) as total_hits, '".$xdate."' as raw_date, date_format(date,'%Y-%m-%d') as date_only , date_format('".$xdate."','%m-%d') as xdate_only FROM tracking WHERE project_id = '".$proj."' AND date_format(date,'%Y-%m-%d') = date_format('".$xdate."','%Y-%m-%d')"; $q_Counter = mysql_query($sql_Counter) or die(mysql_error()); while($r2=mysql_fetch_assoc($q_Counter)){ // add each day's value to the total values for the week... } } ?> How can I update the lifetime unique visits query to count the number of EACH unique ip's and add them together? Thanks a lot.
  5. Well LAST_INSERT_ID() doesn't exist in PHP. Um... echo $name_id and see what happens
  6. I was really bored, wrote this script, and have recently added lots of functionality to it. - password protect links - custom short links - detailed stats page - "link preview" shows you the real URL and the title of the page before proceeding. I'm also expanding the statistics feature quite a bit to the point where it's becoming it's own service. I use the more detailed stats feature on the actual domain itself. If you view the source, you'll see a JS files is included "http://tyny.us/ispy/ispy.js" If anyone is interested, I can setup a project for you, give you a piece of JS code, and the stats page URL so you can give it whirl. Here's a sample stats page: http://tyny.us/project/view/ETjer5j45J Note: You don't need to signup for an account, but if you do, I'll attach the project to your account and it'll appear on your dashboard when you login. Thanks
  7. After some tweaking, I got it. You were correct, it worked as needed. I ended up with this, in case you're curious: SELECT DISTINCT date_format(date,'%Y-%m-%d') as xdate FROM `tracking` WHERE owner_id = '18' AND project_id = '1' AND date_format(date,'%Y-%m-%d') BETWEEN '".$start."' AND '".$end."'
  8. Actually, I think that would work... but it depends. Does the range go THROUGH the "end" date? or to midnight of?
  9. I am building an analytics service, and whenever a page is loaded, it inserts a row into the database with tons of user information. Simple enough. Each row has a DATETIME field (ex, "2010-09-30 11:53:14") and after a while I've been able to count the number of unique visits, and total visits for a particular day. Here's the query that will run for EACH day: SELECT COUNT(DISTINCT(ip)) as unique_hits, COUNT(ip) as total_hits, date as raw_date FROM tracking WHERE date_format(date,'%Y-%m-%d') = '2010-09-30' Basically I want to be able to pick 2 dates from a form, and then loop through each day between them, and run the query above for each day. I hope I made sense... haha. Thanks a ton.
  10. Just as the title says. In cPanel, I have it al configured just fine; the script recieves the email, and I do receieve an email back, but here's where I come into problems. It simply will NOT save the attachments to the server, I've tried loads of different implementations I've found, and nothing's working. pipe script: #!/usr/local/bin/php <?php // Need PEAR installed include('Mail.php'); include('Mail/mime.php'); require_once 'Mail/mimeDecode.php'; // read email using stdin $fx = fopen("php://stdin", "r"); $email = ""; while (!feof($fx)) { $email .= fread($fx,1024); } $params['include_bodies'] = true; $params['decode_bodies'] = true; $params['decode_headers'] = true; $params['input'] = $email; /* $message=new Mail_mimeDecode(); $mailObj=$message->decode($params); */ $mailObj = Mail_mimeDecode::decode($params); // Who is it from $from=$mailObj->headers['from']; // Get Subject $subj=$mailObj->headers['subject']; // Get Message Body $body=$mailObj->parts[0]->body; $gather="From:$from\nSubject:$subj\nBody:$body"; // Get and Save the Attachments foreach($mailObj->parts as $pp){ if ($pp->disposition=='attachment'){ $tmp=$pp->d_parameters['filename']; if($tmp !== ""){ $open = fopen($tmp, 'w'); if($open){ $write = fwrite($open,$pp->body); if(!$write){ $err = "Cannot write to file: '".$tmp."' - var: ".$write; } }else{ $err = "Cannot create/open file: '".$tmp."' - var: ".$open; } } } } $tox = $from; $subjectx = 'Your Photo was Uploaded!'; $messagex = $err; $headersx = 'From: piculo.us Uploader <upload@piculo.us>' . "\r\n" . 'Reply-To: upload@piculo.us' . "\r\n" . 'X-Mailer: PHP/' . phpversion(); mail($tox, $subjectx, $messagex, $headersx); exit; ?> Here's the email I get back: Cannot create/open file: '2879_1150712806251_1180540351_425140_7940412_n.jpg' - var: as you can see, it is aware that an attachment exists, but it won't create the file, and fopen() doesn't say anything. Any ideas??
  11. Looks like wildteen88's solution worked. Pass $xconfig as a parameter.
  12. It's probably something with scopes... But the index.php file directly echoes $xconfig['title']; for debugging, and it says it's empty, but when I do the var_dump($xconfig); on the line JUST ABOVE the echo, the results are what I expect. As far as how the others are used... I have a main functions file, called "func.inc.php" and that holds all the function that build the pages (PageTop(), PageBottom(), etc) each file includes the config file, and "func.inc.php", in that order. and the PageTop() function uses the $xconfig values from config.php, but apparently it's not working. example <?php // config.php: $xconfig['title'] = $r['cfg_site_title']; // func.inc.php: function PageTop(){ echo $xconfig['title']; } // index.php: include"config.php"; include "func.inc.php"; PageTop(); //some stuff PageBottom(); ?>
  13. Hello all, I've run in to a very strange problem that I've never seen before. in my "config.php" file I have something like this... <?php // the URL of the script. NO trailing slash. $xconfig['url'] = $r['cfg_site_url']; // the site name $xconfig['title'] = $r['cfg_site_title']; // the YouTube user name to populate the site with. $xconfig['youtube_user'] = $r['cfg_site_youtube']; // the video to show on the homepage $xconfig['homepage_video'] = $r['cfg_homepage_video']; ?> and in my index.php page, I have <?php include "config.php"; ?> but, also in index.php, I have this <?php echo $xconfig['title'] ; ?> but it won't echo! None of the values in $xconfig[] output anything. I've even done put this in index.php <?php var_dump($xconfig); exit; ?> and that shows the array with the contents I expected. So, why does the array have the correct contents, but will not echo? Thanks a ton!
  14. Where is the number coming from? We need more code to see the whole picture
  15. Thanks! That worked! I just placed mysql_query(...) right before the "return '<a href...." and it works great.
  16. Hello all, it's been years since I've been here, but I've ran into a small issue. I'm making a script where users can "tag" other users in their posts, (ex, "Hello, @staff") If they post that,my code captures the tag, and replaces it with the link to that users website... but is there anyway I can capture every single person they tag, and run a query for every person, and send that person a notification when someone tags them? I have this right now, <?php $text = preg_replace("/(?<=\A|[^A-Za-z0-9_])@([A-Za-z0-9_]+)(?=\Z|[^A-Za-z0-9_])/", "<a href='/user/$1' target='_blank'>$0</a>", $text); ?> Thanks in advance!
  17. Yes.. that is the issue. It now works like a charm. Thanks! Wow, that was quite annoying. Haha
  18. Exactly. I should note though, it's not ONLY the follow placeholder that gets moved. It's the search box, and the posts. Anything that has HTML. Because the username gets converted just fine.
  19. Here's the parsed HTML. I didnt move anything any place. The follow code is the VERY top of html HTML document....the form is the searchbox... <div id='follow'> <a href="#" OnClick="javascript:UnFollowUser(5);" title='Un-follow User'><img alt='Un-follow User' src='/unfollow.png' border='0'></a> </div> <form action="/Home" method="get"> <table cellpadding="0px" cellspacing="0px" align="right"> <tr> <td style="border-style:solid none solid solid;border-color:#4B7B9F;border-width:1px;"> <input type="text" name="q" style="width:100px; border:0px solid; height:17px; padding:0px 3px; position:relative;"> </td> <td style="border-style:solid;border-color:#4B7B9F;border-width:1px;"> <input name="sDo" type="submit" value="" style="border-style: none; background: url('/searchbutton3.gif') no-repeat; width: 24px; height: 20px;"> </td> </tr> </table> </form> <div id=flow> //posts are here. I removed them before posting. </div><html> <head> <title>staff's Profile</title> //same as the template HTML...
  20. Database. The templates are located in the database, and when the profile is loaded, the database looks for template code, gets it, and parses it.
  21. If you look at the HTML code I posted above, you'll see a {=follow] in there. That HTML is an example of what $theme_code holds. So, yes.
  22. No, $theme_code contains all the HTML before the tags are replaced.
  23. I know, didnt you see the bottom of my last post? I know I changed the tags. I said, "Note: I changed the tags to have a "=" before the name." it all WORKS.. just the follow link, the search box, and the posts all get pushed to above the <HTML> tag.
  24. Here's the HTML template... <html> <head> <title>{=username}'s Profile</title> <style> ... </style> </head> <body> <div id='container'> <table cellspacing='2' cellpadding='2' align='center' style='margin:0 auto;' width='100%'> <tr> <td valign='center'> <img src='/logo.png' style='padding:10px;align:left;'> </td> <td valign='center'> <a class='nav' href='/Home'>home</a> <a class='nav' href='/user/{=username}'>profile</a> <a class='nav' href='/do/logout'>logout</a> <a class='nav' href='/notifications'>notifications(0)</a>{=searchbox} </td> </tr> </table> <div id='top'> </div> <div id='box'> <div id='padding'> <h2><a href='/user/{=username}'>{=username}</a>'s Posts</h2> {=follow} <br> {=posts} </div> </div> <div id="bottom"><center>© Copyright</center></div> </div> </body> </html> Note: I changed the tags to have a "=" before the name.
×
×
  • 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.