Jump to content

alka

Members
  • Posts

    15
  • Joined

  • Last visited

    Never

Everything posted by alka

  1. Hi again, Thanks for your tips .. dont know why I ad double-quotes there, I've now removed them. Your suggestion to add target = '_top' to the url worked nicely as well it seems. So that part is ok for now. I also replaced FORM METHOD LINK with GET, that didnt seem to change anything and I'm not sure where I got LINK from in the first place. Been trying to solve this with the help of google etc. So prolly got it from some tips on a site. They seem to do the same thing? Finally... When I do hit Approve. It does not execute: if ($_GET['action'] == "approve") { $id = $_GET['id']; @mysql_query("UPDATE usersites SET state = Rotating WHERE id = '$id'"); } I also tried replacing the mysql query with your suggested variant below but that did not change anything or show an error: if (! mysql_query("UPDATE usersites SET state = 'Rotating' WHERE id = '$id'")) { echo "Failed, check query"; } I suspect the IF statement is simply failing.... Any tips? Again really appreciate the feedback, help and support so far on this forum.
  2. Hi, Thanks for your replay. I fixed the mysql query by encasing as you described. Anyway. I reloaded it and expected it to atleast approve the ad/page when I hit the approve button, but unfortunately it did not. Regarding page re-load. I simply added a form/button as follows: <?php echo "<FORM METHOD=\"LINK\" ACTION=\"SiteManager.php?action=approve&id=$id\">" ?> <INPUT TYPE="submit" VALUE="Approve"> This form is in the top.php. This file is the first frame in the frameset. So I basically have two problems it seems. First the Approve button does not change the status in mysql then second I'm obviously reloading the page improperly by calling SiteManager.php (the main php/html file described/pasted in the first post). Any tips appreciated . Maybe I'm doing this all wrong?..
  3. Hi, I'm trying to make a simple website approving tool. The websites should be shown within a html frame. I know frames are controversial, but in this case there is no alternative and its a perfect use of frames... So basicallly there is a top frame and a bottom where the website is shown, the top only holds some detaisl about the site/ads with some action buttons. I know my code is faulty but I have no clue as to where/how to continue. Maybe I'm requiring javascript i don't know any tips are welcome and appreciated. So here is the code: Main file: <?php include '../libs/db.php'; $dbconnect = mysql_connect("$dbhost", "$dbuser", "$dbpwd"); mysql_select_db("$dbname"); if ($_GET['action'] == "approve") { $id = $_GET['id']; @mysql_query("UPDATE usersites SET state = Rotating WHERE id = '$id'"); } $query = mysql_query("SELECT id,usrid,url FROM usersites WHERE state = 'unverified' LIMIT 1"); $res = mysql_fetch_array($query); $id = $res['id']; $usrid = $res['usrid']; $url = $res['url']; $query2 = mysql_query("SELECT username,credits FROM users WHERE id = '$usrid'"); $res2 = mysql_fetch_array($query2); $username = $res2['username']; $credits = $res2['credits']; ?> <frameset rows="100,100%"> <frame src="<?php echo 'top.php?username=' . $username . '&url=' . $url . '&id=' . $id ?>" /> <frame src="<?php echo $url; ?>" /> </frameset> <body> </body> </html> Firstframe: "top.php" <?php $id = $_GET['id']; echo "Username:" . $_GET['username']; echo "<br>"; echo "URL: " . $_GET['url']; echo "<br>"; echo "ID: " . $_GET['id']; echo "<FORM METHOD=\"LINK\" ACTION=\"SiteManager.php?action=approve&id=$id\">" ?> <INPUT TYPE="submit" VALUE="Approve"> </FORM> The part that isnt working as intended for now is when I hit the approve button. I have no idea how to re-load the code/frame properly. It does simply not approve the page/ad. In addition it opens up a new frame so the ad is shown twice (one in each frame) Any tips in where to go from here would be appreciated .
  4. omg. I dunno what to say or thing, its like wtf... All this time and I couldnt detect and fix that.. Its been bothering me for months.. lol Thanks. That solved the problem . Now I'll get back to it and try adding the rest of the features.. Reject/Delete etc.
  5. Lets give it a new try, don't know how most of the code got cut away: $bq = mysql_query("SELECT id, usrid, bname, burl, btarget FROM ban_rotator WHERE status = 'Waiting'"); $pb = mysql_num_rows($bq); if ($_GET['ap']) { $bid = $_GET['ap']; mysql_query("UPDATE ban_rotator SET status = 'Active' WHERE id = '$bid'"); } echo "Pending Banners: $pb"; echo "<br><br>"; echo "<br><br>"; for ($i = 0; $i < mysql_num_rows($bq); $i++) { $bid = mysql_result($bq, $i, "id"); $buid = mysql_result($bq, $i, "usrid"); $bname = mysql_result($bq, $i, "bname"); $burl = mysql_result($bq, $i, "burl"); $btarget = mysql_result($bq, $i, "btarget"); $apurl = $_SERVER['PHP_SELF']."?page=".$_GET['page']."&ap=$bid"; echo "Banner ID: $bid by UserID: $buid - Banner Name: $bname"; echo "<br>"; echo "<a href="removed" target=_blank><img src=$burl border=0 width=\"468\" height=\"60\"></a>"; echo "<a href=\"$apurl\">Approve</a>"; echo "<br><br>"; }
  6. Hi, I have a little problem that I can't seem to solve myself. My coding skills are very limited, just wanted to mention that . I have a list of rows, bascially banners that members submit. They have to be manually approved by me before they are put on air. So to quicken up this process I made this little code in my admin panel. $bq = mysql_query("SELECT id, usrid, bname, burl, btarget FROM ban_rotator WHERE status = 'Waiting'"); $pb = mysql_num_rows($bq); if ($_GET['ap']) { $bid = $_GET['ap']; mysql_query("UPDATE ban_rotator SET status = 'Active' WHERE id = '$bid'"); It works perfectly except for one thing. It will always show the banner I just approved in addition to the remaining ones that are waiting. Any tips would be appreciated. I have to add that this code is a part of a fairly large admin panel php file. Just realized i need a bit more explanation. If I hit refresh in the browser the one I just approved will be gone. As I would like it to be after hitting Approve on the banner in question. If I just approve the second banner (after approving the first), the first will be gone from the list of waiting and the second will still show until I either hit approve on the third or hit refresh in the brower. Alka
  7. Ok.. I sat down, took a deep breath and tried to understand the query... Then noticed something I'm not actually specifying properly what I want to delete when I just replace select with delete.. so I did this: DELETE trackers.*, tracked_data.* FROM trackers LEFT JOIN tracked_data ON trackers.id = tracked_data.tid WHERE trackers.uid = Y AND trackers.id = Y It worked.. At least it deleted the proper trackers ID along with tracked data for the correct user.. Now I basically need a confirmation from someone who underrstands what I'm doing better than me.. rofl..
  8. That's a great idea.. thanks for the tips I'm new to all this. .. I thought the php part would be harder, but its the mysql part I'm struggling with.. Anyway... regarding the original issue... I have come this far after learning some join: If I run: SELECT trackers.id, tracked_data.tid FROM trackers LEFT JOIN tracked_data ON trackers.id = tracked_data.tid WHERE trackers.uid = X AND trackers.id =Y Then I get a result and it selects the correct rows. But when I replace SELECT with DELETE like: DELETE trackers.id, tracked_data.tid FROM trackers LEFT JOIN tracked_data ON trackers.id = tracked_data.tid WHERE trackers.uid = X AND trackers.id =Y It says: #1109 - Unknown table 'id' in MULTI DELETE So apparently select and delete can't be interchanges in this situation.. Any tips?
  9. Geez.. okey... Hmm.. yeah thats the thing.. when you start learning PHP and MySQL its like learning two languages.. That query sure got me confused and I'm like , but thats of course because I've not learned it yet. In any case.. Do you care to clarify a little with what parts I need to replace with actual rows in my database? ;-)... Here are some more details. trackers_data contains and id of course for each unique line tracked. Its called 'id' .. The tracker it self is referred to as 'tid' in trackers_data trackers contains and id as well for each unique tracker. Its again called 'id'. Users id is stored as 'uid' in trackers. and finally users just contain users data with each unique user having its own 'id'.. I could not place the proper parts in the proper place, when I tried I got an error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'JOIN trackers t ON t.id=td.tid JOIN users u ON u.id=t.user_id WHERE tid = 18 AND' at line 1 X and Y have been replaced by variables of course and they work with other simpler queries. Hope I'm not asking for too much haha I'm a quick learner though, once I figure out the bits and pieces in this query I'll gain a lot. Thanks
  10. Sorry... Here is how its connected... users contains users data. trackers contains tracker data - It does have a field for users id so they are linked that way tracked_data contains the actual data that the tracker has collected.. it contains the trackers id as 'tid'. Since this one does not contain any link to users I don't know how to "link it all together" and make a query for the purpose I wrote above in the original post .
  11. Hi, I'm in the process of creating a site, for learning purpose but also for my own use and leter on a released service to the public... Its a basic tracker atm.. with 3 tables... users, trackers and tracked_data.. I need to add "Reset" tracker data, but that turned out to be a little challenge... The data I want to reset is in tracked_data.. tracked_data does not link directly to users... so I need to run a query where I make sure the user who is trying to delete this tracker actually owns the tracker.. basically "DELETE FROM tracked_data WHERE tid = X" works ok.. it deleted the tracker with ID X.. HOwever I need to make sure the user owns the tracker.. like WHERE should be tid = X and ID = Y where it fetches the ID from the users table.. I don't know if I managed to explain that well enough.. I hope so
  12. Solved by simply adding the mysql queries within the 'for' statement..... It was in the middle of the night when I realized it.. lol.. had been working too much the previous day I guess and did not see the obvious..
  13. Hi... While still in the leaning process of PHP and MySQL I've started working on something specific.. I just tend to learn faster that way... What I'm trying to do a create a basic tacker.. its more or less useful already.. I have a hard time displaying some stats in the view mode described below. So here is my problem.. I currently list all trackers with the current code: First fetch data from mysql: $query = mysql_query("SELECT * FROM trackers WHERE uid='$uid'"); Then some PHP to display it: for ($i = 0; $i < mysql_num_rows($query); $i++) { $sid = mysql_result($query, $i, "id"); $sname = mysql_result($query,$i, "name"); $surl = mysql_result($query, $i, "url"); echo "$sid | $sname | $surl |"); That works fine, shows all the trackers id, name and url that I'm tracking... I however want to add RAW hits and Unique hits for each url as well.. and I'm clueless to where I add the code.. I'm able to display it for one url at a time, but not using a array displaying all urls using the PHP 'for' The raw and unique should be total for all time (as much data available in mysql) and for the past 24 hours. The mysql queries I use to display for a single selected tracker is: $query = mysql_query("SELECT id, tid, INET_NTOA(rip) as rip, curl, datetime FROM tracked_data WHERE tid='$ttid'"); $query2 = mysql_query("SELECT DISTINCT rip FROM tracked_data WHERE tid='$ttid'"); $days_1 = mysql_num_rows(mysql_query("SELECT * FROM tracked_data WHERE datetime BETWEEN DATE_SUB(NOW(), interval 24 HOUR) AND NOW() AND tid='$ttid'")); $days_1unique = mysql_num_rows(mysql_query("SELECT DISTINCT rip FROM tracked_data WHERE datetime BETWEEN DATE_SUB(NOW(), interval 24 HOUR) AND NOW() AND tid='$ttid'")); The above code works for specific trackers like mentioned on a separate php file.. .. Please advice ..
  14. Ah.. see I knew it was something simply I was missing.. lol.. I tried INET_NTOA(rip), but dont' have enough knowledge yet to know how, why and what as does in this statement... Thanks a bunch for the quick response. I'll go and read on mysql queries.. .
  15. Hi, I'm a newbie to PHP and have just created a script that stores the IP of visitors into the database (mysql)... I used the below query to save the information: mysql_query("INSERT INTO tracked_data (tid,rip) VALUES ('$id', INET_ATON('$ip'))"); So far so good... However now I need to query it from MySQL and im completely lost.. Here is what I have working without using INET_NTOA to convert the IP back. $query = mysql_query("SELECT id, tid, rip, curl, datetime FROM tracked_data WHERE tid='$ttid'"); for ($i = 0; $i < mysql_num_rows($query); $i++) { $sid = mysql_result($query, $i, "id"); $tid = mysql_result($query,$i, "tid"); $rip = mysql_result($query, $i, "rip"); $curl = mysql_result($query, $i, "curl"); $datetime = mysql_result($query, $i, "datetime"); echo "$sid | $tid | $rip | $curl | $timedate"; echo "<br>"; Again the stuff above works like it should, but question is how/where do I add INET_NTOA to convert the IP back.. I'm completely lost.. tested a few things but all generate errors... All help is appreciated .
×
×
  • 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.