PHP - My Toplist Site
hi, i am developing a toplist site, i have it fully working but... people can register multiple times with the same title, and password not so concerned about password but i dont want 50 of the same titled websites no it here is my code for inserting the data to the mysql database
Code: [Select] <?php include("config.php"); $sql="INSERT INTO sites (title, content, link, password) VALUES ('$_POST[title]','$_POST[content]','$_POST[link]','$_POST[password]')"; if (!mysql_query($sql,$con)) { die('Error: ' . mysql_error()); } echo "Site has been registered. Please check the homepage."; mysql_close($con) ?> and here is the register form code (i dont think you need it though) Code: [Select] <form action="insert.php" method="post"> <table align="center" border="0" bordercolor="" style="background-color:" width="400" cellpadding="3" cellspacing="3"> <tr> <td>Site name:</td> <td><input type="text" name="title" /></td> </tr> <tr> <td>Password:</td> <td><input type="password" name="password" /></td> </tr> <tr> <td>Link to site:</td> <td><input type="text" name="link" /></td> </tr> <tr> <td>Description:</td> <td><textarea name="content" ></textarea></td> </tr> <input type="submit" value="Register" ></input> </table> </form> Similar TutorialsI have several "sites" located in my html directory, and each has a "general" access point and an "administrator" access point:
/var/www/html/site1/index.php /var/www/html/site1/administrator/index.php /var/www/html/site2/index.php /var/www/html/site2/administrator/index.php /var/www/html/site3/index.php /var/www/html/site3/administrator/index.phpAll sites are similar except that data will be specific to site1, site2, or site3, etc. Users who log onto /var/www/html/siteX/index.php are totally unrelated to those who logon to /var/www/html/siteX/administrator/index.php, will have different logon credentials, are stored in different DB tables, and each should have their own session. If a user logs off of either the general or administrator site, it should not effect the other site even if they were previously logged on to both on the same PC (and of course not effect other sites). When a user logs off, I would like to destroy their previous cookie and associated session. Users for either will only use https. I am using Apache to rewrite https://www.mysite.com/ to https://mysite.com/. While I named the administrator site "administrator" above, the administrator user has the ability to change the directory name. I am thinking I need to use session_set_cookie_params to specify where I wish the session cookie to be stored since /var/www/html/siteX/administrator/index.php is a sub-directory to /var/www/html/siteX/index.php, but am not really sure. Sorry for the cryptic post, but I am not very well versed in this subject. How would you recommend setting up cookies/sessions for this scenario? Thank you now i use this code to show where the visitors came from to my site. <?php $referer=$_SERVER['HTTP_REFERER']; echo $referer; ?> now, i want to show the 5 latest vistors referer's site url on my site ? Not sure if I'm trying to achieve something totally crazy here, or if this is something pretty standard. Didn't have much luck with searching as I'm not fully down with all the terms. (A) I have one site providing an RSS feed. (B) I have one site I want to search, once for each of the items in the feed A. (C) I want the results of the search in (B) to be displayed on page (C). So for example, the feed on (A) says; apples bananas oranges cheese I want site (B) to search for each of those terms (by passing the item in the feed (A) to the ?search= part of the URL of that page) and then show the results from THAT search on page C. Bit of a complex one, let me know if you need me to clarify. Thanks for any help! Hi, My first post here is a cry for help I have a Windows 2003 server running IIS6/PHP5, the server hosts multiple web sites. The problem is include files that are for site A are showing on site B (each site having its own includes as part of the site files in its own site folder), though not every time, its very random, sometimes the correct includes show, sometimes ones from another site on the same server. This only occurs where the include files for both sites have the same name, such as 'inc-header.php' for example. I can only assume PHP is caching includes and because they have the same name is showing the wrong one on other sites sometimes, if I rename them to something unique then the problem goes away, but its not a practical solution to rename all include files to unique names so I find myself looking for a 'real' fix. I have a feeling its to do with the include_path in the php.ini, but right now its disabled with a semi-colon, and I don't want to set one as I have no global includes, all includes are site specific. Any help would be very much appreciated! Phil I'm currently running a classified ads site and planning to display my own content from database combined with and external site rss. So here is what i got right now after the db query for the jobs ads (procedural php),
while ($row = mysqli_fetch_array($results, MYSQLI_ASSOC)){ echo '<div class="media margin-none"> <a class="pull-left bg-inverse innerAll text-center" href="#"><img src="'.$foto.'" share_alt="" width="100" height="100"></a> <div class="media-body innerAll"> <h4 class="media-heading innerT"> <a href="' . $row['title'] .'-da' . $row['id_ad'] . '" class="text-inverse">'. $remuneracion .' ' . substr(ucfirst(strtolower($row['title'])), 0, 53) . '</a> <small class="pull-right label label-default"><i class="fa fa-fw fa-calendar-o"></i> ' . $row['date_created'] . '</small></h4> <p>' . substr(ucfirst(strtolower($row['description'])), 0, 80) . ' ...</p>'; echo '</div> </div> <div class="col-separator-h"></div>'; } echo pagination($statement,$per_page,$page, $url_filtros, $filtros); ?>it is the while loop that i use to display ads from my database, what could be the best way to display (in this same loop?) other site's rss feed so i can show my content combined with the external rss? Thanks Transferring data from sub-domain.site.com Reading sub-domain.site.com What is this all about? I'm going to put all .. images into a separate sub-domain eg: images.site.com. This would create a folder inside my public_HTML called "images" Now when sites have that Transferring data, and Reading... is this .. something relating to what I want. Facebook also does it, and they get their images for the site from a sub domain, how is it all done? I'm not sure if its entirely PHP, but I hope someone can help. Thanks Hi I made a new design for my website and I made some changes. I want to use layout for my second site.
I'll like to know if my site is easier to browse through now and if you like the design better?. I test my site on internet explorer, chrome, and firefox. It is best to use site on better browsers like firefox and chrome to get a better experience of site. Thanks.
http://adjade.com
This topic has been moved to mod_rewrite. http://www.phpfreaks.com/forums/index.php?topic=318858.0 How do I only redirect the page when index.php is present? How can i make echo "<b>Site:</b> ".$req_user_info['site']."<br>"; linkable The site raw fron the db contains an site url. Regards hello. i wonder if anyone could help me to solve this puzzle. im trying to create a dynamic navigation using a database but i keep getting stuck. i have 2 database: Navigation with : Quote id navPos pageID level parent url 1 top 1 1 0 page1.php 2 top 2 2 1 page2.php 3 top 3 3 2 page3.php 4 top 4 3 3 page4.php 5 top 5 3 4 page5.php 6 top 6 3 5 page6.php and Pages with: Quote id pageName 1 page1 2 page2 3 page3 4 page4 5 page5 6 page6 now, what i want to happen is on each page i have 3 functions. 1 calling the top nav, 1 calling the side nav and 1 calling the bottom nav. for this each function should have 3 levels. level 1 = main top level level 2 = child to main top level level 3 = child to level 2 so for example. 2 tabs each with 3 levels and 1 page on each level. TOP NAV Quote levels - TAB 1 - TAB 2 LEVEL1 - page1 - page4 LEVEL2 - page2 - page5 LEVEL3 - page3- page6 now for the code. I'LL STICK TO JUST THE TOP NAV FOR NOW. on the page that will display the navigation's i have: I WOULD LIKE THEM TO DROP DOWN BUT THIS CODE WILL NOT DO THAT. just lists for now Code: [Select] <div id="navWrapper"> <?PHP $navPosion = "top"; ?> <div id="LEVEL1" class="LEVEL1"> <ul><?PHP echo Navigation::NavL1($pageID, $navPosion); ?></ul> </div> <div id="LEVEL2" class="LEVEL2"> <ul><?PHP echo Navigation::NavL2($pageID, $navPosion); ?></ul> </div> <div id="LEVEL3" class="LEVEL3"> <ul><?PHP echo Navigation::NavL3($pageID, $navPosion); ?></ul> </div> </div> these is the functions im trying to put together. in the Navigation class i have. Code: [Select] class Navigation extends Pages{-----lots of other code here.... public static function navL1($pageID, $navPosion){ //FIND CURRENT PAGE ID $page = new Pages(); //calling just the Pages class. $CP = $page->find_by_pageID($pageID); $CPid = $CP->id; //GET ALL PAGES FROM THE DB $allP = $page->find_all(); foreach ($allP as $allPs){ $allPname = $allPs->pageName; //GET INFO FROMTHE NAVIGATION TABLE $nav2 = new Navigation(); //calling the navigation extension $Cnav = $nav2->find_all(); foreach ($Cnav as $Cnavs){ $Nid = $Cnavs->id; $Npos = $Cnavs->navPos; $Npid = $Cnavs->pageID; $Nlevel = $Cnavs->level; $Npnt = $Cnavs->parent; $Nurl = $Cnavs->url; $Nord = $Cnavs->order; if($Nlevel = '1'){ //FIND ACTIVE TAB if($CPid == $allPid){ $selected_tab='class="selected"'; }else{ $selected_tab=''; } echo '<li><a '.$selected_tab.' href="'.$allPname.'.php">'.$Nlevel.''.$allPname.'</a></li>'; }// if($Nlevel == $navLevel //} //end Navigation() }//end foreach ($allP as $allPs) } //end getNav($pageID) THEN THE SAME AGAIN FOR : public static function navL2($pageID, $navPosion){ and public static function navL3($pageID, $navPosion){ what this does is list all the pages for example navL1 give me Quote page1 page2 page3 page4 page5 page6 i want it to only list where level is 1 or 2 or 3 in each of the functions i have this but it does not seem to work. Code: [Select] if($Nlevel = "1"){ i tried this but i nothing return. Code: [Select] if($Nlevel == "1"){ if i echo this out in navL1 Code: [Select] echo "<br/>".$Nid = $Cnavs->id; echo "<br/>".$Npos = $Cnavs->navPos; echo "<br/>".$Npid = $Cnavs->pageID; echo "<br/>".$Nlevel = $Cnavs->level; echo "<br/>".$Npnt = $Cnavs->parent; echo "<br/>".$Nurl = $Cnavs->url; it gives me back the last page (page6) 6 time over which is not even level1. its level3 Quote 6 top 6 3 5 page6.php so its missing the rest of the pages in the loop and just out putting the last one. i realise that i need more if's in my function but maybe there is a better way ? for example i need an if($Npos == top) and in navL2 and navL3 i need to only show sub tabs under the correct parent. etc... for now i just want to get what i can working .. any thoughts ???? maybe i can roll all 3 functions into 1 amazing function ???? that would be nice. thanks ricky some guy went on my site and was able to get all the cookies of every user on my site. Its the top thread, he said my site is full of xss, im not sure what that means or how to protect against it the site is www.imgboard.co.uk can you give me some idea of what i done wrong etc Hey Guys I have created a PHP site for my School, It works perfectly with chrome but when I open IE7 (what my school uses), it wont login. It says Errors on Page. When I press the Login Button.. Nothing Happens. Any Suggestions ? I'm new to this blog but need serious help. I want to add a calendar to a Hotel website for the booking part, I did it once but I forgot how to do it. Here is the link to the booking file. http://regencycountryclub.com/QuickReserve.php I just want instead of having to select the day, month and year. I want to add a calendar to select the arrival date and departure date. I would really appreciate the help. Thanks I wasn't sure where to post this, but I thought this would be best as there are most people. I need a script to type in the url from a website and get the favicon as an image. Like if I type in http://www.facebook.com/ I get the facebook favicon displayed as an image. Any ideas how this would be done? im trying to make this kind of a page from this xml link from tvrage. can anyone help? i am newbie and sorry for bad english. xml link Code: [Select] http://services.tvrage.com/feeds/fullschedule.php?country=US this is coding for countdown all tv shows. so this may help to make my thing Code: [Select] <?php // Open Header, include functions and get the showid and cached xml include 'functions.php'; loadheader(); $loc = $_GET['loc']; $cache_time = 3600*24; // 24 hours $cache_file = './cache/countdown.xml'; $timedif = @(time() - filemtime($cache_file)); if (file_exists($cache_file) && $timedif < $cache_time) { $string = file_get_contents($cache_file); } else { $string = file_get_contents('http://services.tvrage.com/feeds/countdown.php'); if (($string) && ($f = @fopen($cache_file, 'w'))) { fwrite ($f, $string, strlen($string)); fclose($f); } } // Cached the file, now lets use it. if (!file_exists($cache_file)) { // Does it exist? If it doesn't there's a problem so lets report it. echo "<center><h2>Cache file issue: Cannot open cached XML poss connection issue?</h2></center>"; break; } $xml = simplexml_load_file($cache_file); echo "<div class=\"showtitle\">Current Countdown List for ".$loc."</div>\n"; echo "<table border=0 width=600px; cellpadding=2>\n"; echo "<tr><th width=30px;>Show:</th><th width=70px;>Episode:</th><th width=80px;>Season<br>Ep#</th><th width=80px;>Air Date</th><th>Relative Time: (From Cache File Creation)</th></tr>\n"; echo "<tr></tr>\n"; foreach($xml->country as $country){ echo "<tr><th colspan=\"5\"><b>Country List of: ".$country['name']."</b></th></tr>\n"; foreach($country->show as $node){ echo "<tr><td><a href=eplist.php?sid=".$node->showid.">".$node->showname."</a></td>\n"; echo "<td><a href=\"".$node->upcomingep->link."\">".make_safe($node->upcomingep->title)."</a></td>\n"; echo "<td>".$node->upcomingep->epnum."</td>\n"; echo "<td>".$node->upcomingep->airdate."</td>\n"; echo "<td>".$node->upcomingep->relativedate."</td></tr>\n"; } }echo "</table>\n"; echo "<p><div align=center>Page generated using a cached feed generated on: ".date ("F d Y H:i:s.", filemtime($cache_file))."</div></p>\n"; loadfooter(); ?> i got that script from here Code: [Select] http://sourceforge.net/projects/tvrageshellsite/ well I was wanting to make scripts to put on my site and then only let a few people use the site by the ip address, what would be the best way to allow only certain people to use the script on the site, based on the ip? Thanks Hi there i was wondering is anyone could help me in creating a page for each site like info.php?site=sitename I've Currently got this but its not really working... Code: [Select] <?php include ("config.php"); $ServerName = $_GET['title']; $server = "SELECT * FROM sites WHERE title='$ServerName'"; $desc = $_GET['content']; $content = "SELECT * FROM sites WHERE content='$desc'"; $url = $_GET['link']; $link = "SELECT * FROM sites WHERE link='$url'"; if ($info== "$server") { echo "<h1>$server</h1>"; echo "<p>$content</p>"; echo "<a href='$link'>Visit Site</a> OR <a href='play.php?server=$server'>Play Now</a>"; } ?>Please relpy ASAP & Thank You in Advance... Hi, i am learning WordPress and have just started, but i have a problem....when i try to access my site i get this: Warning: Cannot modify header information - headers already sent by (output started at /home/smra9/public_html/wp-content/themes/evanescence/functions.php:6) in /home/smra9/public_html/wp-includes/pluggable.php on line 890 when i open pluggable.php and i go to the line 890 it says: header("Location: $location", true, $status); i will also copy a text from line 885 to 890 so maybe you will understand better: if ( $is_IIS ) { header("Refresh: 0;url=$location"); } else { if ( php_sapi_name() != 'cgi-fcgi' ) status_header($status); // This causes problems on IIS and some FastCGI setups header("Location: $location", true, $status); } Can anyone help me, i don't know what to do Good day all , I am in the processes of creating a add buyer page for an auction site. However , the rows are not updating when i add a new buyer. Below is the code i have written .
This is the add buyer form page :
<!doctype html>
<body>
else if ($_GET["buyer"] == "duplicate")
This is the check buyer form page :
<!doctype html>
<body>
if ($conn->connect_error)
$statement = "SELECT * FROM buyer WHERE username=?";
|