Jump to content

Chamza

Members
  • Posts

    10
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

Chamza's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hello all, I am trying to make a website like StumbleUpon.com. What I am trying to do is create a website where there are certain categories, and certain webpages will be stored in each category. When a button is clicked, a random page among the list of websites I have stored is generated within the category. Here is the PHP code I have so far, and right now, its functional: //FILE: index.php <?php //Stumbleupon example @$do = $_REQUEST['do']; $urls = array( 'http://www.google.co.uk', 'http://www.hotmail.com' ); //Build a list of urls if(isset($do) or !$do){ //Just so we can reload a site when the stumble button is pressed $max = count($urls); //Count the number of url's we have in our list $stumble = rand(0,$max); //Randomly select a url from the list require("taskbar.php"); //Load the bar at the top of the page and keep it there echo "I picked $urls[$stumble]"; //Just an example to show what was picked. echo "<br /><br /><iframe frameborder='0' noresize='noresize' style='position: absolute; background: transparent; width: 100%; height:100%;' src='$urls[$stumble]' />This Site uses iFrames</iframe>"; //Loads the site contents } ?> ?> As you can see, the code is really primitive, but what I ultimately want to do is have a wide variety of databases that store many many links. Clearly, the php "array" wont cut it once I have more than two links, Im going to need a database of links in mySQL that I can call upon to get a random link. The problem is, however, that I know virtually nothing about mySQL. So what my question eventually boils down to is: 1) How do I create different databases in MySQL that store a bunch of different links? And once I do this, how do I intertwine that with the PHP code I have above? Thank you guys, I appreciate it.
  2. Hey, I've been trying to expand this project I've been working on recently and I'm having difficulty finding where to start. Basically, I have a website like StumbleUpon.com (go check it out to see what im talking about) and right now the entire site is very administrator-driven(all the links on my site are submitted by me). My ultimate goal is to make the entire site user-driven. I want users to be able to register and for them to submit links. I also want them to have a User CP where they can see all the links they have submitted, and/or the sites they have favorited, much like when you log on at stumbleupon. So where do I start? I know this project will require MySQL and PHP, and I have found certain scripts that I think may be useful at http://www.hotscripts.com/category/php/scripts-programs/ , but I still am not sure how to do this. This forum has been incredibly helpful, so I am here asking for any general advice or course of action. Thanks.
  3. Thanks for the quick reply. Haha, sorry for all the assumptions, most notably It is a relief to hear that they cant, that was my primary concern.
  4. Hello everyone, I don't know much about MySQL, but if it is needed for my project I am willing to learn it. I am making a website like StumbleUpon.com, and I have pretty much created the site. Basically, I have thousands of links stored within each category, and when a button is pressed, a random link from the category that is chosen will be displayed. Currently, I have these links in a PHP array, which not only makes it difficult to modify the links, but when the user views the page source, they can see all the links (which i dont want) All i know about MySQL is that its a database, and I was wondering if storing the links within mySQL was possible, and if it is possible, how would I go about doing it? Furthermore, how do i connect it with my php array? Thanks.
  5. Okay, this is all making a lot of sense now. I will look up how to use $_POST shortly, but before I do I have on last question. Assuming I use ignace's PHP code, which i understand quite well: switch ($productType) { case 'jeans': include 'jeans.php'; break; case 'watches': include 'watches.php'; break; default: include 'everything.php'; break; } How would I connect this PHP with my HTML links? Right now I have: <li><a href="#">Jeans</a></li> <li><a href="#2">Shirts</a></li> What should I put within the <a href=""> to make the PHP code connected with the HTML link?
  6. Thank you so much but I still have one more question, how do I define $productType within my HTML? Again, I am very new to php, so please bear with me.
  7. Hi, I have a very simple menu with links in a list. The list are items in a store, like Jeans, Watches, Shirts, etc. Basically, I want it so that one of these links are clicked, specific php file is included in the document based on the selection. Although I know a little coding, I am very new to php, and in programming terms this is how it works: if #jeans is picked, include jeans.php if #watches is picked, include watches.php else everything.php Can someone help me transcribe this type of code in to PHP? It seems rather simple but im having difficulty. Thanks.
  8. First of all, I am very new to PHP and come from a background of designing, aka HTML and CSS. PHP has been blowing my mind these past several weeks and I am truly stuck. Basically, I have a very simple drop-down menu and a submit button made in HTML. What I want to do is so that when I choose something from the drop down menu, the "submit" button will execute a different PHP code depending on my choice. So, for example, if I choose "Everything" in the dropdown menu, the submit button's destination will turn in to everything.php without reloading the page, and if i choose "Jeans" the button will turn in to jeans.php behind the scenes. Here is my html: <form method="post"> <select name="category"> <option value="everything">Everything</option> <option value="jeans">Jeans</option> <option value="watches">Watches</option> </select> <input type="submit" /> </form> I've attempted to add functionality with php and I can post that code but it is completely wrong. So if anyone can give me some pointers or write some of the code themselves to show me, I'd appreciate it. Thanks.
  9. Stuie_b, that was incredibly helpful! Although I don't know much PHP I can decipher most of it through my past programming experiences. Thank you so much, if anyone has anything additional to add I'd be more than grateful.
  10. Hello everyone, I've been lurking these forums for the past several months, and have finally decided to register because I have a question that needs answering. Although I have some experience programming and designing, I am relatively new to PHP and would like to know if creating a website like Stumbleupon.com would be possible using PHP? What I am trying to do is create a website where there are certain categories, and certain webpages will be stored in each category. When a button is clicked, a random page among the list of websites I have stored is generated within the category. Meanwhile, the top of the page remains the same while the bottom goes to an existing website. If this sounds confusing, head on to stumbleupon.com and click the “Stumble” button at the top left and see how it works. Furthermore, would creating a website like StumbleUpon use AJAX? I don't know much about AJAX at all, but I can do research if need be. This sounds do-able to me, but I am also very new to programming and would like some seasoned programmers to chime in with ideas or any helpful tips in creating a website like this. Please guide me in any direction that'll make this project easier, thank you.
×
×
  • 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.