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).
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
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 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?
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:
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 ?
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".
Comments
In my site i want to put a comments sytem, so a visitor can enter a comment into a form and it will appear at the botoom of my webpage. I know how to do the forim in html, but how would i make the comment appear at the bottom of the page straight after a visitor has posted it?
Poll With Comments
I need php voting script where everybody can add comment. I found many voting scripts, but no has ability to add comment. Can you help me?
PHP Manual With Comments
Is there a current copy of the PHP manual available with user comments? I can't seem to spot one on the doc page.
Why Are Comments Preceeded By // Not Ignored?
Problem occurs only when running php script at the command line. Here is an example: <?php //myscript.php //-should be called from some page. //-sets cookie on visitor's first visit - expires in 2 days (default). //-does this and that (and also the other thing). //records special data in /var/blah.txt (when using another-script.php). //////////files////////// $blah = '/var/blah.txt' ///////////////////////// phpinfo() ?> When I try to run this script at the command line, the comments produce errors: rh9 [/root] # ./myscript.php ../myscript.php: line 1: ?php: No such file or directory ../myscript.php: line 2: //myscript.php: No such file or directory ../myscript.php: line 3: //-should: No such file or directory ../myscript.php: line 8: unexpected EOF while looking for matching `'' ../myscript.php: line 12: syntax error: unexpected end of file Is there something I need to set in php.ini, or am I missing something?
Using Comments In Your Site
almost this way, on this page, how would you make a web page where you will put a comment in one of your page in your site and once sent by the customer, it would allow your administrator to read it and reply to the responant, i think that is the term i want to use, what he or she wants to hear about the question he or she asked. almost the same way as this, would you redirect that page that has a comment to itself and may pass the question to the administrator side in order for the admin to read and reply what the customer wants to know, not showing it was or have been sent how would you make such a thing? and how would you know, if the reply of the administrator has been passed or has given to the customer to read the answered question that the customer wants to know. Do i need to create another web page for the customer LIKE an" e-mail account" web page to one of a given site like Netscape, MSN, YAHOO, AMAZON etc... in order to check if the e-mail reply by the admin has been sent/passed or if email did not received by the customer at all if you know what code to use, please do help me to do such a thing in order for me to know how to make it this in my webpaget that i am doing, if the question is to vague just asked me again what i need to add to make this question to be clear and vice versa.
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??
Submiting Comments To A Database?
i've created a blog-ish site, and i want the users to be able to comment on the articles. i've been looking at forums to figure out how they submit the comment to the php page, but i'm not sure how it does it. it looks like it just submits the form to the php page, but don't spaces cause all kind of problems when you use method="get"?
Do Comments Impose A Performance Hit?
I've got a PHP application that's 2 megs in size. Of that, my guess is 200k-400k is comments. Do they impose a performance hit? I've been postponing any kind of optimization, but at some point I'll have to do it. Is taking out the comments worth it? Of all the optimizations I can do, where should it rank?
XML Parsing And HTML Comments
I find myaelf writing a template system (yeah, I know - but there is a reason I'm not using an existing one). So I'm trying to parse xhtml using the builtin expat parser. Mostly it works fine, however it ignores anything that looks like an HTML comment. This is a bit of a problem as I see a lot of code written like: <script type='text/javascript> <!-- alert("hello world'); // --> </script> <style type="text/css"> <!-- ..style1 { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 9px; } --> </style> Now obviously the browser is seeing the stuff inside '<!--' ...'-->' but expat doesn't. I tried adding a non-parsed handler, but still can't see it.
Php Comments And Speed Effect
just wondering, do comments have any effect on speed of the script? I mean i don't think i use a ton on in code comments but i do keep track of version of classes and function with php doc and just wondering, i imagine it should have almost none.
Filter Links Out Of Comments
last week I posted a link to my site where people can leave comments and some low-life decided to post links on that page. Is there someway to filter out links? I dont really want to use the htmlspecialchars() or the htmlentities() to simply disable them, I want to block them altogether. Maybe some way to filter out "www" or something?
Deleting Comments From Database
i have a message board that enters information to the data base fine, but where i try to create a detele for individual comments, it does not seem to work, any ideas on how to write a delete for this so that it deletes individual messages Code:
Allowing New Lines Within Comments
i have a script where i check the content that the user inputs and works perfect. But ive found when i click enter for a new line it will return false how can allow a new line.
Addslashes To Post Comments?
I have the following code to add a comment to videos on my site, but I can't seem to figure out how to allow ' and " characters to it! I've tried all combination of addslahes commands, but none seem to work. //ADD COMMENT if($_REQUEST[action]=="comment" || $_REQUEST[action]=="addfavour")chk_member_login($_REQUEST['viewkey']); if($_POST[commentpost]!="") { if ...
PHP/ List Authors That Have Posted More Than X Comments
I'm currently trying to implement sort of a "remember me"-addon to a newsposting script I'm using (cutenews, cutephp.com). What I need is to produce an array that contains comment-authors that have posted a set number of comments to my site. If I set this numer to 5, I want all commenter-names that have posted 5+ comments to be in the array this script is to produce. The format of the comments database is this: <unique id>¦<comment-authorname>¦<url>¦<ip>¦<comment-text>¦¦ (where ¦¦ means new comment follows - no seperate line for each comment.) Can anyone give me pointers to where I should start? This problem is really bugging me. 1, I need to search a huge text-file with hundreds of these unique comments, then I need to print a list of the authornames that have posted more than the set minimum number of comments to get listed. I'm going to use this list for a form field where people can select their name...
Comments Php Script Colour Change
i have just got a free php comment script of the net. but the defualt theme is black text on white back ground. Wile on my web site i have a dark back ground and white writing, so after many hours of php code readying and learning i have finaly managed to change most of the text into white exept for the last 3 text pices. 1. the "Name/ tilttle" of the comment/s 2. the "date and time" of when the comment was posted 3. the " comment/ text" which the user posted from what i have found i belive i need to set the colour in this part of the script here but everything i have tryed hasnt worked. 1. $COM_LANG['header'] = "Comments"; 2. $COM_LANG['months'] = array("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"); 3. not sure where the code is for this :| i have just started with php.
PHP/GD/ Freetype : Captcha For A Comments Form
I am trying to create a captcha for a comments form, I do not get any PHP errors but the image showing the captcha does not display. If I right click "View Image" on the image placeholder I get "The requested URL /test/81d8c.gif was not found on this server." I am using PHP v.5.2.4 with GD & freetype enabled. I use an Apache 2...
Arrays + Performance Surprise - Curious For Comments
A ng poster recently questioned their usage/creation of arrays and their correct syntax. I got the idea to performance test from a recent (excellent) PHP Tutorial article that was in Linux Format magazine (which dealt with performance). The original poster had a reply from someone who had said using $testArray[$keyName] was better (and proper) than $testArray["$keyName"] I *had* believed this to be correct... but... against my better judgement, I decided to test the assumption. I did a simple test to confirm - Basically, a loop that performed a conditional 'if' test a large number of times - One used the double quotes around the array key, one went without. Other than that, the rest was the same - the box was almost asleep too during the test with a single user and no cron jobs or other activity. To make sure, I ran the script twice, ten minutes apart.... and the results? Strangely, the test *with* the double quotes took half the time. We're talking about Test 1 taking 85seconds and test 2 taking 152seconds I'm curious on anything anyone can add to this - It got me thinking that if something is faster, is it right/recommended practice? My test script is below.... -- A: Because it messes up the order in which people normally read text. Q: Why is top-posting such a bad thing? A: Top-posting. Q: What is the most annoying thing on usenet? <? // Perform a test $maxLoop number of times, count the number of seconds // it takes to complete the loop - Test 1 has the array element named // inside double quotes, Test 2 excludes the double quotes set_time_limit(250); $testArray=$_ENV; $maxLoop=100000; /////////////////////// Test 1 //////////////////// This took 85seconds to complete $start=time(); for($loopMany=0; $loopMany<$maxLoop; ++$loopMany) { foreach($testArray as $elementName=>$elementValue) { if($testArray["$elementName"]=="HOST") { $thisHost="$elementValue"; } } } $end=time(); $difference=$end-$start; print("<br>Duration 1: $difference<hr>"); set_time_limit(250); $testArray=$_ENV; $maxLoop=100000; /////////////////////// Test 2 //////////////////// This took 151 seconds to complete for($loopMany=0; $loopMany<$maxLoop; ++$loopMany) { foreach($testArray as $elementName=>$elementValue) { if($testArray[$elementName]=="HOST") { $thisHost="$elementValue"; } } } $end=time(); $difference=$end-$start; print("<br>Duration 2: $difference<hr>"); ?> -- A: Because it messes up the order in which people normally read text. Q: Why is top-posting such a bad thing? A: Top-posting. Q: What is the most annoying thing on usenet?
Strip Comments, Tabs And Spaces From Scripts Prior To Deployment
I write a lot of comments in my PHP scripts, and I use tabs to indent different sections for readability and to keep things tidy. Until now, my scripts have been placed in production environments with all comments and "unnecessary blanks" included. PHP works fast when it comes to parsing big scripts, but I imagine that a little script compression would not hurt at all. What I would like to do, is to keep my source in one directory structure, and generate another parallel directory structure with compressed scripts for deployment to production servers. If anyone knows about existing software for this purpose, I would be glad to hear about it. But then again, making a PHP script to do the job does not seem like a difficult thing to do. Here is what I want it to do to my PHP scripts: 1) Remove comments 2) Remove leading and tailing tabs/spaces on each line 3) Remove blank lines If I read a script file into a string ($content), I can use preg_replace() something like this: Code: // Remove comments $content = preg_replace ("/(//|#).*/m", "", $content); // Trim spaces and tabs $content = preg_replace ("/(^[40 ]+)|([40 ]+$)/m", "", $content); // Remove blank lines $content = preg_replace ("/^[40 12 ]+/m", "", $content); So far this seems to work quite well. I know that formatting text with <PRE> in my scripts will be affected by this compact method, as it removes newline/linefeed from the source code. But I hardly ever use <PRE>, so I can live with that. Does anyone have comments on this method? Can these regular expressions do unexpected things to my PHP-code, leading to either parser errors or unpredicted actions/bugs?
PHPmyadmin Access Denied For User 'user'@'localhost'
WinMe machine as server, with Apache 2 installed and working PHP4 installed and working ( had PHP 5.05 installed and working, but i couldnt get the mysql extensions to load - phpinfo() didnt list mysql :(, so i installed PHP4, which now lists mysql when i run phpinfo). MYSQL 4.1 installed and working. I dont know the console commands too well, but i know its working ok, cos I have used a few simple DOS prompt commands to check its alive and I can connect to the database using MyODBC frontend/driver 3.51 and also using Navicat 2004. When i try to connect to the database via PHPmyadmin from another network PC I have an error: #1045 - Access denied for user 'user'@'localhost' (using password: YES) I have played around alot with different settings in the config.inc.php file.... nothing seems to work. This almost appears to be a simple login problem ( probably is too), but I can access the database locally from the Winme machine with the username and password that wont work over the network! I have tried not using 'localhost' as the host name but the IP address of the Winme PC but I get this error: #1130 - Host 'MYSERVERNAME' is not allowed to connect to this MySQL server
Notice: Use Of Undefined Constant User - Assumed 'user'
I have a script for a shopsystem on a Linux. There it works fine. But when I try to run it on my Windows machine, PHP says things like Notice: Use of undefined constant dbname - assumed 'dbname' in c:apachehtdocsaposhop estshopclassesxxx.clas s.php on line 77 On Windows I run PHP 4.3.2 On Linux runs PHP 4.3.1
Authenticating User Common User Names
I want to create a password protected page with PHP and Mysql. I have 2 groups User and Admin. The respective groups have a common user/password. The user/password are stored in a database. I want to authenticate the user through a login form and not through a pop-up ($PHP_AUTH_USER) way. What I want is, if a user logs in and he moves from one page to another, he should not be asked for validity again. Is this possible only with scripting (without session and $PHP_AUTH...). If yes - how do I keep track of an authorised user and unauthorised user, so that he should not be validated again. Does setting the user variable to global in all the pages do the trick.?
User Authentication And PHP Saving As Specific User.
the users of my server had to upload their pages by sftp and only the user who uploaded a page was able to edit itafterwards. I've been asked to make a secure way for users to log on through the web and edit their pages online. However, although using .htaccess to authenticate users, the script saves as user 'nobody' and is not able to edit pages previously uploaded (and saved as user 'john_doe'). What I am trying to do is make the script save using the same username as the user used to log on.
Fill Fields When User Selects User From DB
I have a field with a selectbox which contains a list of client names and several other fields which display information from the DB. I need to be able to make the fields change to the appropriate information when a user is selected from the select box. Can anybody please give me an example of a bit of code that will do this?
Creating XML In Php
I have a website that is hosted on another machine not under my control. i want to be able to use a file to share info between pages. one page inserts into the file and the other reads from the file. i wanted to use XML because there would be a lot of fields and some would variable length or values. i'm looking into the XML functions with PHP however they all seem to read an XML document. is it possible to have one write an XML document?
Creating Dir
I wanted that when users register on my site, automatically a directory would be created, The problem is, when submiting the registration form via HTTP, the user nobody doesnt have the permissions to create this directory. So I tryed ftp_mkdir. And it worked. The problem is... the directory permissions where automatically set to 655. How can this be changed? Chmod will not work here, because the user is nobody.
PHP - Creating DB
i have a form with textbox default value='10', i want to add to database, and changes made on this page will update into database. this is my form field : <input type='text' size='1' name='$i' value='10' /> $i is for loop that prints outs textbox What column do i create in mysql db and how do i assign the each value of textbox ? for example if i create table example... Create example(date date, qty int); how do i insert each textbox value and each day date into database?
Creating PDF
I need to create a pdf on the fly from 6 fields of my database. What my question is, is how can I make sure that the pdf created is in the landscape profile, not the portrait profile? I have never created PDF's on the fly from a db before.
Creating An Image
I am making a links page for my site that takes the links out of the database and displays the name on a button, but the text on each button is different lengths and I was wondering if there was a way I could align them center on the button? This is the button.php code: <?php header ("Content-type: image/png"); $string = $_GET['text']; $im = @imagecreatefrompng ("button1.png"); $text_color = imagecolorallocate ($im, 255, 255, 255); imagettftext($im, 10, 0, 5, 35, $text_color, "c:phpfontsariblk.ttf", "$string"); imagepng ($im); imagedestroy($im); ?>
Creating Directory
I am trying to make my webpage create a file for each person that submits a file, so at first I was using... $myfile=fopen("create/$user.txt","w"); This worked, and it would create the file if it was not there. Then I decided that each user would recieve their own directory, and that the first file to be edited was called options.txt, in their user directory. So, I used this: $myfile=fopen("create/$user/options.txt","w"); But it came back saying that the directory did not exist. Is there a way to create a directory along with the new file that goes into it?
Creating Pdf File
Is it possible to create a pdf file from a HTML form. i want to create a pDF file from HTML form which looks like the scanned copy of HTML form. I hope there must be somebod< who can answer this question.
Help On Creating Images With GD
I'm using a class to easily create plots and charts: 'GRAPH' by Herman Veluwenkamp downloadable from: http://phpclasses.upperdesign.com/ The problem I've found is the following: -When using Win9x-PHP4-Apache all is OK -When using Linux-PHP4-Apache plots appear as viewed in a mirror (both text and numbers) Does anyone give me a clue about what's happening?
Creating Files
I was wondering, if/how do you create a file with PHP, Im making a "network" for my site with PHP, and ran across this problem.
Help In Creating XML File From DB
Hi friends i need to get the details from two tables for creating one XML file.. for that, first i started by defining a DOMXML object $doc = domxml_new_doc(Ƈ.0'); and i have one outertable query as $outer_table = 'main_category' $query = "SELECT * FROM $outer_table"; $resouter = mysql_query($query, $mysql_connect); and when its first row is read its creating elements by $child = $doc->create_element($fieldname); $child = $outer->append_child($child); $value = $doc->create_text_node($fieldvalue); $value = $child->append_child($value); and i need to get some details from second table with its subcategid=maincategid to do this i need to get that particular field that alrady appended to the xml How i can..... i tried get_elements_by_id() but it returns only those elements that comes under it.]
Creating Files
Is there a way to create files such as config.ini thoruhg a form. so they put in all the stuff they want and press submit and then the file is created with their settings in it.
Creating A Schedule
I am building a diet/weight loss website where a customer would subscribe for 1,3,6 or 12 months. I am using Paypal IPN to handle the subscription payments. I would like to create a schedule when the customer first logs on, from the date they signed up to the date when the subscription ends and every 7 days is highlighted as the weigh in day. Basically I would like to generate a list of dates from one date to another with every 7th day highlighted.
Creating Pics On The Web
I am developing a claims input form. part of this form, the original paper version, was to draw a brief picture of the accident. Is there anyway in PHP, or other addied controld to achieve the same result.
|