Dynamically Creating URLS Based On User Input !
I am looking to create pages on the fly or dynamically based on user input. For example if i have www.example.com and they visit this and enter 'bob' in a textfield and press submit they create www.example.com/bob.html . How would I go about this ? I am guessing I need to create a folder when submit is pressed in my website directory ?
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Creating URLs
I'm having problems creating urls when taking info from a mySQL table. For example a table with user_id, name, email and description. Then you've set up a template there this information will be displayed. You have this information in the database: user_id: 1 name: myname email: myname@myemail.com description: information about me Now in this template it should create an URL for this info that looks something like: www.myhost.com/page.php3?id=1 when they click on this link, another page will popup by using a second template with the name, email, description etc.
How Do I Retrieve Images Dynamically Based On The Login Username?
I have created a site in Joomla with a login (no self registration, users are provided with username and password by the admin). The users are supposed to login to a specific page where they can see 4 images. I have the following code: <?php // define directory path $dir = "images/user1/"; // iterate through files // look for JPEGs if (is_dir($dir)) { if ($dh = opendir($dir)) { while (($file = readdir($dh)) !== false) { if (preg_match("/.jpg/", $file)) { // read EXIF headers $exif = exif_read_data($file, 0, true); echo "<tr>"; // get thumbnail // link to full image echo "<td valign=top><a href=$dir/$file><imgsrc=thumbnail.php?file=$file></a><td>"; echo "<td valign=top><font size=-1>"; // get file name echo "File: <b>" . $exif['FILE']['FileName'] . "</b><br/>"; // get timestamp echo "Timestamp: " . $exif['IFD0']['DateTime'] . "<br/>"; // get image dimensions echo "Dimensions: " . $exif['COMPUTED']['Height'] . " x " . $exif['COMPUTED']['Height'] . " <br/>"; // get camera make and model echo "Camera: " . $exif['IFD0']['Model']; echo "</font></td>"; echo "</tr>"; } } closedir($dh); } } ?> The question now is how to change the code to dimamically replace the folder name by the login username used. For example....if user2 logs in the images loaded will be only those in the folder images/user2, if user3 logs in it will be from the folder images/user3, etc... I am a little confused as to how to implement that in Joomla but as long as I have the code right I thinkI can just insert the code into the appropriate page using a mambot. If anybody here has any tips on how to accomplish that it would be extremely appreciated.
Dynamically Populating Listboxes Based On Previous Selection
How do I populate the second listbox in this form based on the selection of the first listbox? The first listbox is populated by this query: $year_query = "SELECT distinct year FROM bench_data"; The second listbox should essentially be populated by this: $industry_query = "SELECT distinct comp_desc FROM comp_desc, benc_data where $_POST['year']=bench_data.year and bench_data.comp_key=comp_desc.comp_key"; I know this is alot to ask, but please EXPLAIN the code. I am new and need the explanation elucidated and not just supplied code that will accomplish the goal. Code:
Creating Dynamic URLs
I feel dumb having to ask this question in the first place, but I just can not figure it out. I am wanting to set my site up using dynamic urls (I'm assuming that's what they're called, an example of what I have in mind is index.php?page=[pagename]). However, I can not figure out how to do this. I will eventually want to use SEF urls, but for now I'll be content just to have the dynamic urls. If anyone can tell me how to do this,
Dynamically Creating A Crontab
Is it possibe to dynamically create a crontab. Say i have a form to enter minute, hour, day, etc... and wanted to create a cronjob that ran to those values. Has anyone done this?
Creating .m3u Files Dynamically
Im looking at creating a playlist program for my server. i have alist of files within my database, and i wanted to be able to place these values into a playlist file. the problem is that i dont know how to get the database to create the playlist form its records. ie, if i uploaded a new file to my server and into the database, then i woudl want the script to automatically grab that file ( SQL i know), anbd the nplace it in the m3u file ( i dont know). Coudl someone recommend a simple method to complete this? or point me in teh righ t doirection for a tutorial?
Creating Queries Dynamically
I've been struggling with a problem for a while and I think that the solution lies in the ability to create queries dynamically. On one page I have a number of drop-down menus created dynamically, so the number of menus can vary. Each drop-down represents a try/touchdown scored, and the user would select from the menu who scored it. On the next page I want to take the info entered and send it to the database, automatically creating new entries for each try/touchdown scored. Code:
Dynamically Creating An Image With Imagecreate()
I have a multitude of images that I am trying to bring up dynamically depending on the scenario. These images are different sizes. To complicare things just a little more, I am rewriting a javaScript. Am I heading into the correct direction? Here is the original JS that I am attempting to rewrite: (This is most of the way translated to PHP)
Creating An Article Based Website
i need to create an article based website, what words should i search for in yahoo to find a good strategy? or can someone just give me hints how to create it? the site should do the following-> 1-only administrator can add articles 2-public can only search 3-and of course the search should be optimized and fast.
Creating The Timer For A Turn-based Game
I've been working on creating an online turn-based game where a new turn occurs every hour, and the amount of items such as resources (gold, iron, food, whatever) is changed when the turn changes, regardless of whether a user is online or not. I've played many games like this before (I guess falling under the PBBG genre), so I know this is possible, but I can't figure out how to do it, and I'm obviously searching for the wrong phrases in forums because I can't find a tutorial anywhere.
Creating Empty Variables For Input Data
I am creating a script that will be taking data from a POST and submitting the data to variables which are placed within a hash for string to data association. Then, using HTML::Table and Mail::Sendmail, the data is parsed into an html table and then an email is created and send to a recipient. So, my question is this; How do I take the input from a post form and have the variables pick up the data and process it into a hash? my $name = ; my $instock = ; my describe = ; # Hash to hold inventory data my %table_data = ( model ='$modelnumber', item ='$name', available ='$instock', description ='$describe', ); This is all the code I have written thus far, any pointers or suggestions for this project?
User Input...
I have a form with a field that expects user to input HTML tags. I know I have to use htmlspecialchars for that input but what if the user inputs PHP code? I've looked at the help file and I can only find strip_tags which removes both PHP and HTML tags. If a user wants to crash/corrupt/hack into your site by entering PHP code, what kind of things can he type? Must he include PHP tags to work? If he must use PHP tags, I could just write a function to remove only the PHP tags and not the HTML tags.
User Input?
Is there a way to get user input from a php script that doesn't have to do with html? I would like to ask the user(me) to input a directory(preferably in a gui way such as a folder selection dialog) to do some work with. Is this possible when running the script directly on my comp(not off a server(remote or local))? The script is a management thing that I'd like to create to help generate some html code. Essentially I want it to scan a dir(but don't want to hard code it) and have it generate a list of links for the files in that dir(which are images). Maybe even asking for a description for each. Even if it was a little shell program to change the directory(sorta like dos) would be much better than having to enter in the directory name by hand.
Php User Input
When running PHP as a binary, is there a way to ask for user input?
Creating Hyperlinks From Data Input To Be Display In Table
Ive used search functions and have found relevent thread but the coding does not match. I have a php page the displays records from a form. id name, address, phone, website etc I would like to make the website data to turn into a hyperlink once submitted. Here is my following php code that displays the table Code:
Add To Date Based On User Selection
I have a form with Radio buttons that when selected should add "$howMuch" amount of hours to the current date and time and put the output into a field called "ExpireTime". The code I'm using for the hour adding: PHP Code:
Verifying User Input
I want to be able to search through a string that gets filled into my form. Make sure there are no quotes, semicolons and that kind of thing, that will mess up my database query. PHP Code:
What To Strip From User Input:
I recently suffered massive bot attacks against my contact page. Someone sent me over 350 e-mails from my form in less than a couple of hours. As this form only sends e-mail to an address dedicated for this purpose, this isn't more than an inconvenience. In re-writing it, I decided to write better stripslash and strip_tags functions of my own. I have the function stripping out left and right angle brackets, and forward and back slashes. I replace these with blanks (I am the only one that views these e-mails and I think I can figure out what was meant). That should break most script and malicious html tags. What else should I watch for and strip? I thought it might be wise to replace "=" signs with blanks. Should I worry about words like "query" or "fopen"? Part of my solution to preventing bot attacks against my form is to force manual input by varying the name="" values. I have eighteen different possibilities for each field on the form. I choose which to use randomly. I check each possibility when processing to see if it is set and send posters to a 404 page if they post to the wrong or all possible variables. I also include a random string of 5 digits as an authorization code in a hidden field. I use mysql database to let the processing page know what variables and authorization code to expect, associated with the poster's ip. Use the wrong authorization code and you go to the 404 page. If your ip doesn't show up on in the database, you get a "404 page not found." I delete records from the database after processing, including old, unused entries where someone left without completely filling out the form. Does anyone see any reason that won't work to thwart the bots?
User Input Validation
I am intending to make a form on a page, on pushing submit the forms gets posted onto itself so that it checks for empty fields and prompts user to get all fields filled, BUT the filled value should stay, I did this easily on ASP, but could not figure out in PHP. Code:
User Input Filtering
I have a comments system. In this comment system, people can enter certain strings, and it will break my page layout. Such as repeated characters with no spaces. It will just blow the table way out of proportion and completely ruin my layout. How can I break their input up if such a thing happens? Also, how can you number an array of data that is being withdrawn from the database DESC? Such as.. Quote1. itemnumber1 2. itemnumber2 3. itemnumber3 4. itemnumber4
Checking User Input
I want to check to see if there's only letters and numbers in a field, how would I go about doing this?
Filtering User Input...
I want to take text that a user inputs and store it into a variable. That's the easy part. I have and array of 30 elements that I want to store the inputted text into. So.. here's an example... - I want a user to enter text. - I'll store it into a variable like $inputText. - I want to split the text from $inputText into 30 equal sections and store each section into an element in the variable. - I don't care if the words get separated during the filter, as long as the whitespaces stay where they are. Could anyone give me some tips to help me get started or point me towards a tutorial or something?
Retrieving Database Info Based On User
I'm still quite new to php and mysql but I have been unable to figure this out. I'm attempting to display a specific row and column from a mysql database based on the user. $result = mysql_query("SELECT fbleague FROM users WHERE username = $_SESSION[username]"); fbleague is the column users is the table username is the primary key column $_SESSION[username] is the username variable Then later I try to display it with echo "You are in league $result "; I know $_SESSION[username] is set correctly because I can display that with no problems.
Security With User Input And Sessions
I have two sort of related questions, if anyone would be so kind as to answer: 1. When I do an form for input (into a database) that is used for subsequently displaying on a web page, is there a function written to parse out all dodgy stuff, like putting HTML tags that could break the page, or filter out SQL that could corrupt or invalidate the entry or is there a regular expression that someone has already done to cover all areas? 2. If I am displaying data from a database and using sessions and the like, should I be putting something like this in my code (I found it in the php manual): header ("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // past header ("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); // always modified header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 header ("Pragma: no-cache"); // HTTP/1.0
Cleaning Up User Form Input In Php
Does anyone please know why when trying to clear up user input that has been entered into a form, php only clears up most of it and not all? For example, using stripslashes to remove all slashes from a variable after a user has submitted quotation marks ("") into a form. The quotation marks cause the variable being parsed to contain slashes. e.g. a user enters """""" into a form , the variable returned to php becomes """"" So if I only wanted the quotation marks, I thought the stripslashes function would achieve this. However, it only removes 3 of the 5 slashes leaving 2 unwanted slashes behind.
Calling A Function Through User Input.
So heres yet another question to a problem where I would have no idea where to look for the answer for so I turn to you :) Say my sites administrator wants to write a news update or blog or whatever. Something like this "Added a new gallery from my trip to Phuket, enjoy: [GID=24] If you liked it tell me." I want the [GID=24] to get replaced by my galery loading function (very nifty and handy) so it would turn into something like this echo "Added a new gallery from my trip to Phuket, enjoy: ".galery($GID)." If you liked it tell me."; I chose this [GID=24] because it is similar to burning board code. I would also like to include a command like [PID=45] witch would run my picture function.
Cleaning User Input, Is This Safe Enough?
I've written a small function that cleans up all user input before entering it to the DB. I'm wondering, is this sufficient or am I missing someting? function clean_text($text) { $text = str_replace("<", "<", $text); $text = str_replace(">", ">", $text); $text = strip_tags($text); $text = htmlspecialchars($text, ENT_NOQUOTES); $text = mysql_real_escape_string($text); return $text; }
Checking User Input With Eregi Function
The function below (ExpressionTest.php) is for checking user input. The function is supposed to permit only alphabetical characters, the apostrophe ('), and the dash (-) for the "FirstName" variable. For some reason the script below will permit the dash to be used but gives the message "Please enter a valid first name." message when the FirstName variable includes an apostrophe. I have tried switching places for the dash and the apostrophe. But if I place the apostrophe first in the string and the dash second in the string I still get the same message. PHP Code:
How To Get User Input For A Variable Without Using Forms Or Tables
I have created forms and taken user input from the forms into php variables. When validating the fields, if i find my conditions not satisfied on the php variable, i ignore the database connectivity and display error message and having the user to go back to the page and correct the error. Is there a way i can correct the error without going back to the page, and getting the particular user input without having to create another form or table for input into the php variable.
How Do You Do TCL Exec Command On PHP Script That Uses User Input?
The TCL command I am using will do a command-line action on a PHP script: set cannotRunPHP [catch { eval "exec php -q $root/scripts/info/php/info.php" } errMsg] I have to do it this way as both the TCL script and the PHP script run as CLI. However, "info.php" requires user input to run; this causes the TCL script calling the PHP script to hose up and die. Is there a way I can do this so that the TCL script can call the PHP script without any problems? Is there an alternate way of calling the PHP script other than using exec were that to solve this issue?
Displaying Text Fields On User Input
How would I echo a particular amount of text fields depending on how many the user selects from a drop down menu that I have already created. For example say the user selects 4 or whatever other number from a drop down menu how would I echo 4 or whatever the amount of text fields for a user to input text into? An example would be an airline website were you select how many people are travelling and then it echo fields for those people to enter their names.
User Local Time Diplay In Input Field
I'm wondering how can I have the local time of a user into a input field, it might sound or be stupid but even after my search I couldn't find a code si9mple enough, without any bla bla which each not my need.
Creating A User Login
I want to create a link on a site that prompts a visitor with a login prompt. Once they enter in the code (could be one line or could be username and password) they will be taken to a different webpage within the site. Can this be done? ...and if so, how?
Creating A User-Comments Box
I'm having a bit of trouble creating a user-comments box. Basically, I'm working on a website like YouTube, which offers videos. Next to the videos, I'd like a comments table/box where users can post their comments about the video. There should only be 5 comments, so as not to flood the page. I would like the comments to be picked randomly from a database or sorted by newest first. Up to now I've got: User input through a form -> Data is entered into database (MySQL) However, as I mentioned before, I'm unsure about how this data would be entered into the comments table (and sorted).
Cleaning User Input (Removing HTML/stripping Slashes Etc...)
How can I remove HTML and add slashes to a variable? I know I can add slashes with addslashes($var); but I need to know how to remove all HTML at the same time. Also - Are there any other characters I should strip from the variable (it will be stored in a database and displayed on a web page).
Creating Active Directory User
does anyone already tried to create a user into active directory through php_ldap ? i tried something like this but still don't work :-/ $adduserAD["cn"][0] = "phpldapuser"; $adduserAD["samaccountname"][0] = "guguseli"; $adduserAD["objectclass"][0] = "top"; $adduserAD["objectclass"][1] = "person"; $adduserAD["objectclass"][2] = "organizationalPerson"; $adduserAD["givenname"][0] = "thomas"; $adduserAD["name"][0] = "tester"; $adduserAD["sn"][0] = "btester"; $adduserAD["description"][0] = "TEST-Account ldap"; $adduserAD["title"][0] = "Programm Manager"; ldap_add($ad, "ou=test, dc=my,dc=domain", $adduserAD) or die("error!");
Creating A User Generated Content Website
I'm planning to create a community site (in PHP and MySQL) where people can post some sort of helpful information. I want to include features that would allow people to rate this information and post comments about it. I would also like to make this information searchable, so I want to include tags. To help you understand it better, the website is sort of like digg.com or engadget.com or any other website that have content and comments on it. Sort of like a blog site. I already finished creating the login system. Now I need to work on the content posting system. I already thought about the SQL table to store this content. Here's what I have so far: ContentID, User, Title, ContentText, DatePosted, NumOfComments, Rating, Tags For the comments, I would assume the SQL table would look like this: ContentID, User, CommentNumber, CommentText Now, am I on the right track here? This is my first time creating something like this. Are there free scripts out there that does the same thing?
Dynamically Populate Drop-down List And Dynamically Include Html File
We have a drop down list on a PHP page, with several product names, and when people click one item, we will refresh the same page with the product name as parameter, and in turn we want to include a HTML file into the content area of the same page. I know it is recommended to put everything into database, but we want the web site to be very "portable", so the drop-downlist and the content should both in text files. Let's say the drop-down list will be poplulated from the product.txt file, and there will be a file for each corresponding item in the drop-down list. From the user point of view, if he wants to add a new product, he will just need to open the product.txt file, and add a new line with the product name, "Laptop", then add a new text file named "laptop" in the same folder which contains the HTML fragment to be included in the content area. What is the easiest way to do this?
Creating Dynamic Hyperlinks With User Id's In Php Query
Im dabbling with PHP and trying to write a new search.php file to scan for specic users in my dating website and then display the users along with individual links to their profile. $profile = $row["id"]; -- this field takes profile ID from mysql database The profile field pulls in an ID field from a mysql database for each record. I need to integrate this fields value into the hyperlink when the results are returned so it has a list of all users each with an individual hyperlink to their profile. Then users can click and access the profile of a specific user. Code:
Creating Link To File Or Temp File For User Download
I am designing a document management system (DMS). The files are stored in a directory on the webserver. The filenames for the documents are stored in a MySQL database. The DMS will track revisions from the initial version through the updates. We must have strict permissions set so only authorized personnel can access some documents. All of the documents when uploaded are given totally random names such as "114723fb5422c6bd5ed18f6.doc". Is there a way, without the webserver creating a new file name "document_specs_ver2.doc" to have the file download named "document_specs_ver2.doc". If I must physically create a new file, how do I know when the webserver would be allowed to delete it? Notes: The files will be in several different file formats, not just "doc".
$_POST Behavior From Input=submit Vs Input-type=button
I have been trying to solve an annoying behavior with PHP (I think). Maybe some of you have encountered the same and have some ideas. I have an html form and I use an <input type="button"> element with the onClick event that calls a javascript funtion. Once the script's content has been processed, I execute the form.submit() directive. I would like to combine the html form and the PHP script into one, and use action="<?php echo($PHP_SELF) ?>". When the html form has <input type="button" name="theButton" value="thisisthetrigger" onclick="doThis(this.form)">but PHP cannot 'read' the value of $_POST["theButton"] after form.submit(). If I substitute the <input type="button"> for <input type="submit"> then PHP reads the value just fine. Some may argue to just use the latter option, but that will cost me a trip back to the server to basically do a lot of validation that can be very easily accomplished on the client side.
Creating User Sessions W/out Using Sessions
I'm working on a user management system where I can use the benefits of PHP sessions w/out messing with them. Basically, my idea is to have an entry created into a "sessions table" when the user logs in. The table contains such info as the user's id number and the date/time they logged in. When the user logs out, the entry is deleted. In each page/script, it checks to see if the user is logged in by checking the sessions table for an entry w/their IP address and the date, to make sure it is fairly current (unless anyone can think of a better way to check). Now my delema....obviously, I don't want people that don't properly log out to have a session that could last weeks (depending on when they visit again). I am thinking a script that cleans up entries that are old would do the trick, but obviously I want this script to run say, at least once an hour. Obviously, I am not going to be able to sit at my computer and run this script every hour of every day. I was thinking of using the script and doing a cron job, but I think my host only allows one cron job per day...and only at night. Any thoughts??
|