Jump to content

Lyricsride

Members
  • Posts

    32
  • Joined

  • Last visited

    Never

Everything posted by Lyricsride

  1. Thanks for the explanation Destruction, I've solved the issue by changing the design of the site, but thanks for telling me this, i never knew! Cheers
  2. the concept of having sticky forms, with values that remember the previous input if authentication fails. the usual way of echoing data into the value attribute of html does not work with file fields.
  3. I know that it's not straight forward as in "echo value into value attribute". But is there a function or SOMETHING to solve this issue? Is it utterely impossible? Thanks
  4. After several forums and people suggesting my idea was a little "out there" i finally got it (with a few suggestions from the OZZU forums) thanks for all your help guys. [code]$boxHeight = 247; while($stuffResult = mysqli_fetch_assoc($stuffGet)) { //(A) The # of characters in the entire blurb $charCount = strlen($stuffResult['text']); //(B) Divide (A) by 48, this tells us how many lines there are $lineCount = $charCount / 48; //(C) Round (B) up to get the actual # of lines (can't be a float!) $lineCount = ceil($lineCount); //(D) Multiply (C) by 13 b/c each line is 13px high $lineHeight = ($lineCount * 13); //(E) Substract the total box height by the line height of the blurb, the while loop slowly eats away at the box space until it is full! $boxHeight = $boxHeight - $lineHeight; //the the blurb is NOT the last one, take an additonal 26px off the box height, to account for spacing the posts apart if($boxHeight > 25) { //subtract 26px b/c this blurb has space at the bottom $boxHeight = ($boxHeight - 26); } if($boxHeight > 0) { //echo 'box px: '.$boxHeight.'<br />'; //echo 'blurb px'.$lineHeight.'<br />'; //echo 'blurb line'.$lineCount; //the actual blurb being displayed to the user echo '<div style="float:left;">'.$stuffResult['date'].'</div> <p style="margin-left:119px;margin-bottom:26px;">'.$stuffResult['text'].'</p> '; } }[/code]
  5. Thanks fert, that's something else i was thinking. The annoying problem with that is, there could be blurbs as little as one line. Each blurb would require margins on the top and bottom, of course. That means the worst-case scenario the box must be able to handle is the amount of characters that would be outputted if each post was only one line long. The chances of this are slim but can't be ignored to function properly. It ends up being a very crude and static measurement. I'm wondering if there can be a way to solve the problem using the GD library - albeit a convoluted one....
  6. The box will be a set size. I guess that helps a little, i'll be able to tell PHP exactly what size it should be limited to. At least i think that should make it easier.... ha. The current height in pixles is 285px. So that's the max size. I'm going to be using MySQL for databasing. I have access to GD 2.x. Big thanks for the help. I'll try to reply faster! :) edit: the width is also statically set at 355px. It's probably a given but just in case...
  7. Thanks a lot for the reply Little Guy. I considered something similar to your suggestion, but the problem is that 5 posts (LIMIT 5) may not fit into the box. If one of those 5 "blurbs" is considerably long, it would push others outside the box. On the flip side, if all 5 "blurbs" are considerably short, they won't fill the box. I do not want to use scrollbars either. Somehow PHP needs to dynamically detect how many "Blurbs" can really fit into the box, based on the size of those blurbs versus the size of the box. Am i making sense?
  8. hey folks, I have would like to implement a simple blurb sytstem. The only part confusing me is how i should have php detect when the box of news has been filled. http://codes.concordia.ca/help.png the image basically explains the concept. What php code/concepts/tutorials should i be looking for? Thanks for pointing me in the right direction!
  9. Thanks guys this is great! Is it better to use php or SQL to do this? I suppose it depends, in my case i probably want to go with speed right? So which should be faster?
  10. Hey there, this is a simple question but i can't seem to find the answer. Probably b/c i don't know what to specifically search for the answer. I want to query a subset of a text field. In my newsposts i want the "preview" of the text to be shown on an index page with all news posts. I'd rather do this than have to text fields (text_short, text_long). The concept would be: SELECT <field> FROM <table> WHERE <only first 30 words of the field> Simple, i think, what concept should i be searching out here? Thanks guys, really appreciate it.
  11. thank you very much for your reply. I have some screenshots of your test: The selection >> http://codes.concordia.ca/codes/assets/img/temp/problem/7.png The result >> http://codes.concordia.ca/codes/assets/img/temp/problem/8.png As you can see, the array SEEMS to be building correctly. Now, what do i do with it?! I need to take that data, and stick it into a database. The solution is some sort of loop that inserts each record? Thanks PS: also, how in gods name do i get those additional selections when they spawn to do so not at the bottom of the forum below even the submit button?!
  12. Hey everyone, i'm trying to create a form which allows a user to state which projects he is workin on in an association, and what his position is in the selected project. Then i want his selections to be recorded into MySQL for later retrieval. Here is my form CURRENTLY [url=http://codes.concordia.ca/codes/assets/img/temp/problem/1.png]http://codes.concordia.ca/codes/assets/img/temp/problem/1.png[/url] I have the first page working, no problems. [url=http://codes.concordia.ca/codes/assets/img/temp/problem/2.png] http://codes.concordia.ca/codes/assets/img/temp/problem/2.png[/url] Second page as you can see has recorded the first page data fine. [url=http://codes.concordia.ca/codes/assets/img/temp/problem/3.png]http://codes.concordia.ca/codes/assets/img/temp/problem/3.png[/url] Just an example of the user selecting multiple projects. I have no experience with javascript so do not know how to control it well. My duplicated project fields spawn below the submit button no matter what i do. they are currently spawned by by pressing the text "add extra project" [url=http://codes.concordia.ca/codes/assets/img/temp/problem/4.png]http://codes.concordia.ca/codes/assets/img/temp/problem/4.png[/url] As we move on to the third page i've tried to put the project/position selection into arrays. i failed. they do not print out and i am quite stumped as to how to work it. I am only a beginner and complicated form-related arrays that must be put into MySQL still cause me difficulty. [url=http://codes.concordia.ca/codes/assets/img/temp/problem/5.png]http://codes.concordia.ca/codes/assets/img/temp/problem/5.png[/url] The fourth page works fine, expcet for the second page data, again All of this takes place on one single page. Here is the code, i know it's a bit much so i will answer questions as best i can. The code was too much for this forum to upload so i've put it here [url=http://codes.concordia.ca/codes/assets/img/temp/problem/6.png]http://codes.concordia.ca/codes/assets/img/temp/problem/6.png[/url] instead. Thank you all for your help, i know that somehow i must use PHP arrays, and javascript, but i just can't seem to crack this. And i've found NO tutorials or issues exact enough to solve my problem. Thank you!
  13. Hey everyone, i'm trying to create a form which allows a user to state which projects he is workin on in an association, and what his position is in the selected project. Then i want his selections to be recorded into MySQL for later retrieval. Here is my form CURRENTLY [url=http://codes.concordia.ca/codes/assets/img/temp/problem/1.png]http://codes.concordia.ca/codes/assets/img/temp/problem/1.png[/url] I have the first page working, no problems. [url=http://codes.concordia.ca/codes/assets/img/temp/problem/2.png] http://codes.concordia.ca/codes/assets/img/temp/problem/2.png[/url] Second page as you can see has recorded the first page data fine. [url=http://codes.concordia.ca/codes/assets/img/temp/problem/3.png]http://codes.concordia.ca/codes/assets/img/temp/problem/3.png[/url] Just an example of the user selecting multiple projects. I have no experience with javascript so do not know how to control it well. My duplicated project fields spawn below the submit button no matter what i do. they are currently spawned by by pressing the text "add extra project" [url=http://codes.concordia.ca/codes/assets/img/temp/problem/4.png]http://codes.concordia.ca/codes/assets/img/temp/problem/4.png[/url] As we move on to the third page i've tried to put the project/position selection into arrays. i failed. they do not print out and i am quite stumped as to how to work it. I am only a beginner and complicated form-related arrays that must be put into MySQL still cause me difficulty. [url=http://codes.concordia.ca/codes/assets/img/temp/problem/5.png]http://codes.concordia.ca/codes/assets/img/temp/problem/5.png[/url] The fourth page works fine, expcet for the second page data, again All of this takes place on one single page. Here is the code, i know it's a bit much so i will answer questions as best i can. The code was too much for this forum to upload so i've put it here [url=http://codes.concordia.ca/codes/assets/img/temp/problem/6.png]http://codes.concordia.ca/codes/assets/img/temp/problem/6.png[/url] instead. Thank you all for your help, i know that somehow i must use PHP arrays, and javascript, but i just can't seem to crack this. And i've found NO tutorials or issues exact enough to solve my problem. Thank you!
  14. I've never used chmod until now and am not clear on it's implementation. Other than it's presence near the top of uploadFile.php i have't done anything with it.
  15. uploadFile.php [code] <?php /* #####################################################################                                                                                    #  S  ## PHP5 For Dummies script page 242                          #                                                                                    #####################################################################                                                                                    + Title: Basic Uploading Form                                                                                                                          + Date: August 16th 2006                                                                                                                                + Type: Tutorial                                                                                                                                        + Source: PHP for Dummies 2004, page 242                                                                                                                + Description: upload a file into a form, conduct basic validation, and display a confirmation to the user after                                        */ ##################################################################### #  1.a ## No Form posted? Then display empty form to user          # ##################################################################### chmod("C:\\Documents and Settings\\Lyricsride\\Mes documents\\Mes images\\".$_FILES['pix']['tmp_name'], 0777); if(!isset($_POST['upload'])) { require_once('form_upload.inc'); } ##################################################################### #  2.a ## Form posted? Then validate                                # ##################################################################### else { if($_FILES['pix']['tmp_name'] == 'none') { echo "We're sorry, the file was greater than 500kb. Please try uploading a reduced filesize. Thank-you.<br />"; require_once('form_upload.inc'); exit(); } if(!ereg('image',$_FILES['pix']['type'])) { "We're sorry, the file is not an image. Please try uploading an image. Thank-you.<br />"; require_once('form_upload.inc'); exit(); } else { $destination = 'C:\Documents and Settings\Lyricsride\Mes documents\Mes images'; $tempFile = $_FILES['pix']['tmp_name']; move_uploaded_file($tempFile,$destination); echo "Your image $tempFile has been successfully uploaded to $desination"; } } ?> [/code] form_upload.inc [code] <html> <head> <title> Upload Your Image </title> </head> <body> <ol> <li> Enter the name of the picture you want to upload to our picture archive or use the browse button to navigate to the picture file. </li> <li> When the path to the picture file shows in the text field, click the Upload Picture button. </li> </ol> <div align="center"><hr /> <form enctype="multipart/form-data" action="uploadFile.php" method="post"> <input type="hidden" name="MAX_FILE_SIZE" value="500000" /> <input type="file" name="pix" size="60" /> <input type="submit" name="upload" value="Upload" /> </form> </body> </html> [/code] I'm trying to get this working locally to learn, but when I upload into the forum the following error displays: "Warning: move_uploaded_file(C:\Documents and Settings\Lyricsride\Mes documents\Mes images) [function.move-uploaded-file]: failed to open stream: Permission denied in c:\server\Apache2.2\htdocs\learn_php_test\form_upload\uploadFile.php on line 42" To get the permission i have to use chmod right? So i tried it, played around with it, but can't seemt to get it to work. This is probably a quick syntax fix or something, thanks for the help everyone.
  16. Thanks ronverdonk. When you say "needs one param only" i assume you mean also "will only take one"!  8) Thanks for clearing that up, although i find it a little illogical personally, i'm not going to argue with the code! Thanks a lot bud, cheers.
  17. heya folks. An issue here regarding includes. I'm implementing include-security which i have basically done successfully i believe. But there is something i do not understand. Here are my three versions of the code: First Version That Doesn't Work [color=orange][b]config.php[/b][/color] [color=red][b]--------------------------[/b][/color] <?php //security measure if ( //a matching constant must be defined [above] in a script that calls this include [color=red]!defined('include_constant','I Exist')[/color] ) //otherwise the include will die, assuming someone is trying to directly access this include file die("ERROR:Why are you trying to access a restricted include file! Please stop, thank-you. =]"); $vpv4_host = "localhost"; $vpv4_db = "vpv4" ; $vpv4_usr = "root" ; $vpv4_pw = "314314" ; $vpv4_connect = mysql_pconnect($vpv4_host, $vpv4_usr, $vpv4_pw) or trigger_error(mysql_error(),E_USER_ERROR); ?> [b][color=red]--------------------------[/color][/b] [color=orange][b]index.php[/b][/color] [b][color=red]--------------------------[/color][/b] <?php //needed constant for include permissions define('include_constant','I Exist'); require_once($_SERVER['DOCUMENT_ROOT'].'/vpv4/includes/config.php'); ?> Hello World! [b][color=red]--------------------------[/color][/b] RESULTING ERROR: "[color=red]Warning: Wrong parameter count for defined() in c:\server\Apache2.2\htdocs\vpv4\includes\config.php on line 6 ERROR:Why are you trying to access a restricted include file! Please stop, thank-you. =][/color]" Second Version That Doesn't Work [color=orange][b]config.php[/b][/color] [color=red][b]--------------------------[/b][/color] <?php //security measure if ( //a matching constant must be defined [above] in a script that calls this include !defined('include_constant') ) //otherwise the include will die, assuming someone is trying to directly access this include file die("ERROR:Why are you trying to access a restricted include file! Please stop, thank-you. =]"); $vpv4_host = "localhost"; $vpv4_db = "vpv4" ; $vpv4_usr = "root" ; $vpv4_pw = "314314" ; $vpv4_connect = mysql_pconnect($vpv4_host, $vpv4_usr, $vpv4_pw) or trigger_error(mysql_error(),E_USER_ERROR); ?> [color=red][b]--------------------------[/b][/color] [color=orange][b]index.php[/b][/color] [b][color=red]--------------------------[/color][/b] <?php //needed constant for include permissions [color=red]define('include_constant');[/color] require_once($_SERVER['DOCUMENT_ROOT'].'/vpv4/includes/config.php'); ?> Hello World! [b][color=red]--------------------------[/color][/b] RESULTING ERROR: "[color=red]Warning: Wrong parameter count for define() in c:\server\Apache2.2\htdocs\vpv4\index.php on line 4 ERROR:Why are you trying to access a restricted include file! Please stop, thank-you. =][/color]" First Version That Does Work [color=orange][b]config.php[/b][/color] [color=red][b]--------------------------[/b][/color] <?php //security measure if ( //a matching constant must be defined [above] in a script that calls this include !defined('include_constant') ) //otherwise the include will die, assuming someone is trying to directly access this include file die("ERROR:Why are you trying to access a restricted include file! Please stop, thank-you. =]"); $vpv4_host = "localhost"; $vpv4_db = "vpv4" ; $vpv4_usr = "root" ; $vpv4_pw = "314314" ; $vpv4_connect = mysql_pconnect($vpv4_host, $vpv4_usr, $vpv4_pw) or trigger_error(mysql_error(),E_USER_ERROR); ?> [color=red][b]--------------------------[/b][/color] [color=orange][b]index.php[/b][/color] [b][color=red]--------------------------[/color][/b] <?php //needed constant for include permissions define('include_constant','I Exist'); require_once($_SERVER['DOCUMENT_ROOT'].'/vpv4/includes/config.php'); ?> Hello World! [b][color=red]--------------------------[/color][/b] RESULTING SUCCESS: "[color=red]Hello World![/color]" This confuses me. It seems logically that the second version should work becasue it has all constant arguments defined? The third works yet it doesn't [have all arguments defined] while the first doesn't work yet it's similar to the third. What is PHP thinking here? I feel it's important for me to know... =) Anyway i could improve this by the way? Thanks!
  18. Hitman... wow. Well first off. lol, you were spot on. I'm just shocked becasue i could of sworn i went over that query a million times, and was sure it was perfect. When you pointed out the error i immediatly thought to myself "OH CHRIST OF COURSE?!@$!%R FASD FAFASDA GFA >:(>:(>:(>:(" haha... well thanks -a lot- Hitman and the rest of you who posted replys. I think i learnt something today about paying attention more carefully to my code....  :-\
×
×
  • 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.