Jump to content

Josh

Members
  • Posts

    5
  • Joined

  • Last visited

Everything posted by Josh

  1. @justsomeguy Thank you very much for the IDEA and the Response! I had a friend looking at it and he found many vurnaubilities in my script, and not only the files I have attached! I think I am going to re-build it all and adding your IDEA in it by letting users use a Password and a Username! I created a on Open HelpDesk Ticket system, and I think I can use that to change it exactly as I want! Thank you very much for the Idea, else I wouldnt have thought of it! God bless!
  2. Hi everyone. I wanna start saying that I have been posting 4 Times on different sites and also twice on StackOverFlow, but didnt get some help as I am very new to php and mysql! But I really hope I can get some help fixing this script that I have tried to fix for a week now. So in this script I am using the TEXTAREA that creates a table based on what users type in the textarea! So if user types "mike", then he will be assigned to a new URL called www.website.com/mike, and then a table will be created for that users so only HE is able to track and see his Visitors! Right now the table is set to ""visitor_tracking" which makes everyone to see all the other users Info. Not fair! I decided to create another script and let users choose their own FOLDER NAME using the textarea, and that way enter the backend of their script. The textarea that I am using is assigned to a variable called $name, and the variable $name gets the texts from tghe textarea ID gname. Thats how I managed to fix the first php file. And then came the surprise.. I found 2 more php file that also includes the sql table "visitor_tracking" table and text. I desperately tried for 5 days to change it to $name, or somehow I did everything to use the text typed in the TEXTAREA to appear in the Database, and some how to make it affect other 2 php files too. But I failed. So all I need help for is to change the "visitor_tracking" and make the php files to read from the Textarea Variable $name.. I will attach all 3 php files, and the first is my main phpfile which is already fixed and done... I tried to use the $Session method, but failed! Now for 5 days I am totally lost.. This is the first and main php file which WORKS Great. "visitor_tracking" is changed to the variable $name, so you wont see the visitor_tracking in the first file... <form action="" method="post" ><table width="400" border="0" cellspacing="0" cellpadding="5"> <tr> <td>Name </td> <td><input type="text" name="gname" id="text" value=""></td> </tr> <tr> <td colspan="3" align="center"><input type="submit" name="submit" id="submit" value="Submit"></td> </tr></table></form><?PHPif (isset($_POST['submit'])) {$name = $_POST['gname'];mkdir("$name", 0777, true);chmod("$name", 0777);echo " ";echo "Conguradulations. Your new URL is sucessfully created.!";echo " ";echo " ";echo "Your new URL name is www.WEBSITE.com/$name"; }$dbhost = 'HOSTNAME';$dbuser = 'USERNAME';$dbpass = 'PASSWORD';$conn = mysql_connect($dbhost, $dbuser, $dbpass);if(! $conn ){ die('Could not connect: ' . mysql_error());}echo 'Connected successfully';$sql = 'CREATE TABLE ' . $name . '('. 'entry_id int(11) NOT NULL AUTO_INCREMENT, '. 'visitor_id int(11) default NULL, '. 'ip_address varchar(15) NOT NULL, '. 'page_name text, '. 'query_string text, '. 'timestamp timestamp NOT NULL default CURRENT_TIMESTAMP, '. 'PRIMARY KEY ( entry_id ), '. 'KEY visitor_id ( visitor_id , timestamp )) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=22 ;';mysql_select_db('DATABASENAME');$retval = mysql_query( $sql, $conn );if(! $retval ){ die('Could not create table: ' . mysql_error());}mysql_query($sql,$conn);?> As you can see above in the SQL query I am using $name for the textarea with the ID gname And I need to change the rest of the files like the first one, but I dont know how to make it READ from the first FILE. The code below is what I added in the first php file to make it work and read from $name: if (isset($_POST['submit'])) {$name = $_POST['gname']; And I also changed the TABLE 'visitor_tracking' To: CREATE TABLE ' . $name . '('. Now here comes the other 2 php files, and I simply dont know how to read textarea from the first php files, or how to make the TEXT typed in TEXTAREA to be assigned to the Here we go: This is the 2nd Php file called "ip_tracker.php". (Need to change "visitor_tracking" table to variable $name used in my first php file: <?php//define our "maximum idle period" to be 30 minutes$mins = 30;//set the time limit before a session expiresini_set ("session.gc_maxlifetime", $mins * 60);session_start();$ip_address = $_SERVER["REMOTE_ADDR"];$page_name = $_SERVER["SCRIPT_NAME"];$query_string = $_SERVER["QUERY_STRING"];$current_page = $page_name."?".$query_string;//connect to the database using your database settingsinclude("db_connect.php"); if($_SESSION["current_page"] != $current_page) { $sql = "INSERT INTO visitor_tracking (ip_address, page_name, query_string, visitor_id) VALUES ('$ip_address', '$page_name', '$query_string', '$visitor_id')"; if(!mysql_query($sql)){ echo "Failed to update visitor log"; } $_SESSION["current_page"] = $current_page; }} And this is the 3rd Php file called "ip_report.php". ( Also want to change the "visitor_tracking" to variable $name used in my first php file: <?phpinclude("db_connect.php");if($view == "all"){ //show all recent visitors $sql = "SELECT visitor_id, GROUP_CONCAT(DISTINCT ip_address) as ip_address_list, COUNT(DISTINCT ip_address) as ip_total, COUNT(visitor_id) as page_count, MIN(timestamp) as start_time, MAX(timestamp) as end_time FROM visitor_tracking GROUP BY visitor_id"; $result = mysql_query($sql); if($result==false){ $view = "error"; $error = "Could not retrieve values"; }} else { //show pages for a specific visitor $visitor_id = $_GET['id']; //rung $visitor_id through filter_var to check it's not an invalid //value, or a hack attempt if(!filter_var($visitor_id, FILTER_VALIDATE_INT, 0)){ $error = "Invalid ID specified"; $view = "error"; } else { $sql = "SELECT timestamp, page_name, query_string, ip_address FROM visitor_tracking WHERE visitor_id = '$visitor_id'"; $result = mysql_query($sql); } }function display_date($time){ return date("F j, Y, g:i a", $time); }?> I have also tried to use the $_SESSION method and Session_Start, but Dont know why I cant make it work! Thats all, I really hope that my post is understandable! Thank you very much in advance, God bless, by Miguel!
  3. I finally fixed it, i used an IFRAME to show the full link! Finally done! And thank you for your reply!
  4. Hey everyone, Yesterday I installed a full Country and IP database to get the location of our guests on our forum!There are so many IP and COUNTRY FLAG scripts out there, and I wanted something like the one below!I simply cant run the PHP inside the HTML ! So how can I make this IP and FLAG to show on my frontpage which is a HTML Template! And the FILE & SCRIPT is in PHP! The strange thing is, that I made this work on an OLD template 2 years ago, but I have forgot how. And please notice I dont want it to be inside an IFRAME, which I know can also be used to add a web page inside another! But how to add it the clean way, not using an iframe.. ========================= Below is all the Info I found online, BUT non of them worked ========================= So I found out that I ihad to add a few lines on my HTACCESS file, below is only ONE of the examples I used:I did changed my HTACCESS like as many tutorials out there telling about how to use a PHP Script inside HTML, I tried Everything, and I am a HTML freak, but still did not work! Below you will see an example I added in my HTACCESSAddType application/x-httpd-php .html .htm And please notice, this is only one of the examples, I think I tried them all! Code I used to show PHP in HTML: <html><title>HTML with PHP</title><body><h1>My Example</h1> <?php//your php code here?> <b>Here is some more HTML</b> <?php//more php code?> </body></html> I trully hope that someone could help me to add this simple line or script to work on my HTML Template,THANK YOU VERY MUCH, In advance!
  5. Hi everyone, Finally I made it... I am Josh and I was waiting for my account to be confirmed! I am trully greatfull to finally get the chance to join the forum!I am a web developer, and making mods and addons on vBulletin too! Thanks for having me, and this forum was trully needed.
×
×
  • Create New...