wildteen88
Staff Alumni-
Posts
10,480 -
Joined
-
Last visited
Never
Everything posted by wildteen88
-
This: [code]<? if(!$_POST['submit']) {[/code] should be: [code]<? if(isset($_POST['submit'])) {[/code] ALso I highly suggest you chnage this: [code]$uname = $_POST['uname']; $password = $_POST['password'];[/code] to the following: [code]$uname = mysql_real_escape_string(trim($_POST['uname'])); $password = mysql_real_escape_string(trim($_POST['password']));[/code]
-
Horizontal and Vertical Scrolls For FireFox
wildteen88 replied to scheols's topic in PHPFreaks.com Website Feedback
This is a bug with the forum and/or firefox I belive there is no fix in place for this. You can still scroll to the left or right if you scroll all the way down to the bottom of the page and you'll see that the horizontal scroll bar will appear. The will only happen if there has been a large picture posted or a long line of code/text has been entered into the post. -
Validate a textbox for alphabetic character only
wildteen88 replied to Terfanda's topic in PHP Coding Help
Strange it works for me!:[code]<?php function check_Name($Name, $FamName) { if ((!eregi("^[a-z]+$",$Name)) || (!eregi("^[a-z]+$",$FamName))) { $ans = FALSE; } else { $ans = TRUE; } return $ans; } if(check_Name('j0hn', 'w3lls')) { echo "valid!"; } else { echo "invalid!"; } ?>[/code] With numbers it echos invalid, without - john wells - its valid. How are you checking whether the function returns true or false? -
I have explained what this operator does in the [a href=\"http://www.phpfreaks.com/forums/index.php?showtopic=95867\" target=\"_blank\"]FAQ/Code Respository[/a]. Its after I explain the -> operator.
-
Yeah that was only suggestion. Any here is what I came up with: [a href=\"http://homepage.ntlworld.com/cshepwood/businessman/test.html\" target=\"_blank\"]http://homepage.ntlworld.com/cshepwood/businessman/test.html[/a] The green boxes are the images and the blue boxes contain the text. Also this method can be used for your menu items too. Just put the books into a container than postion that one container div!
-
You can use this query which should select most recent 3 news posts: [!--sql--][div class=\'sqltop\']SQL[/div][div class=\'sqlmain\'][!--sql1--][span style=\'color:blue;font-weight:bold\']SELECT[/span] * [color=green]FROM[/color] [color=orange]news_table[/color] [color=green]ORDER BY[/color] news_id [color=green]DESC[/color] LIMIT 3 [!--sql2--][/div][!--sql3--] Obviously you'll need to change [b]news_table[/b] to the table that stores your news entries and [b]news_id[/b] to the news_id column name.
-
Abouty your question. PHP will not include include_test.php or include_test2.php by defualt, Unless 'do' is set to either 'test' or 'test2' in the address bar. As thats what the if statment does. it will only execute what is between the curly braces {} if the condition is true. Also you might want to look into switch/case statements: [code]if(isset($_GET['do'])) { switch($_GET['do']) { case 'test': include 'include_test.php'; break; case 'test2': include 'include_test2.php'; break; } }[/code]
-
Yes you need a webserver envrioment to be setup in order for your php scripts to work. PHP is server-side and is parsed by the server. Whereas HTML is client-side and is parsed by the web browser. Thats why you can run HTML scripts on your PC but not PHP scripts! All you need is a webserver which thorpe has suggested and copy of PHP! [a href=\"http://www.php.net/manual/en/install.windows.apache2.php\" target=\"_blank\"]Windows installation instructions[/a] Additonally you can install a pre-packaged version of Apache, PHP and MySQL + a few other little bits and pieces by installing WAMP5
-
Change this: mysql_select_db($database_cirpeduc, $cirpeduc); to: mysql_select_db($database_cirpeduc, $cirpeduc) or die("Unable to select database: " . mysql_error());
-
If your file is 450Kb it wont be taking any bandwidth as it isnt acutlly sending that 450Kb file to the client. The thing that uses the bandwidth is the ouput, For example if you had a php script which is 1MB in size and all it did was return a simple hello world message which will come to less than 1K. It'll only take 1K out of your alloted bandwidth. The only problem that will happen is the amount of time it'll take PHP to parse the 1MB file.
-
From looking at what the error is returning it looks like your site is running on a non windows box which is running *nix/mac and you're using fopen to fetch a file from your hard drive. This is not possible. PHP runs on the server and cant access a clients computer to fetch data.
-
I wouldn't go about postioning each individual photo/text on the page. You should group them, such a when you are postioning the first row phots1, 2 and 3. You should wap them in a div and give it an id/class of row1, and have the following css: [code]#row1 { width: 800px; /* set the total width of the row */ /* now you only need to positon this to move all the other images into place! */ }[/code] then inside that div you place 5 divs, and give them all the same class, such as row1-cell. Now when when goto style the five divs you do this: [code].row1-cell { width: 20%; /* Style each div so it consumes 20% of the overal width of #row1 */ } .row1-cell img { text-align: center /* center the images inside each cell */ }[/code] Now you do the same thing for the rows2, 3 and 4! This is the most easiest way of doing what you are trying to do. Addtionally what you can do is prehaps use tables for positioning the images/text into place instead. But use divs/css to positon intro text and the menu. Hope that helps.
-
It should change the background image when you mouseover the link with that code. Make sure the the path to blah.png is correct, or use an absulote path: [a href=\"http://www.mysite.com/blah.png\" target=\"_blank\"]http://www.mysite.com/blah.png[/a]
-
Because if you dont specify the secound parameter as the the type you want the result to be return as mysql_fetch_array will retun both number indicies and associative arrays. I wont make it return the result faster, well it will but you wont be able to notice as its very small.
-
I think this: if(!isset($_POST['BeenSubmitted'])) should be: if(isset($_POST['BeenSubmitted'])) As currently it is validating form input when the form hasn't been submitted yet! Thats why you are getting the undefind index notices.
-
Yes as the mysql_fetch_array returns an array with both associative and number indices if you want to use numbers for the array keys use this: mysql_fetch_array(mysql_query("SELECT a, b FROM `table`"), MYSQL_NUM) But if you want letters for the array keys use this: mysql_fetch_array(mysql_query("SELECT a, b FROM `table`"), MYSQL_ASSOC)
-
What do you by the same day? To get the times stamp of a future date do this: echo strtotime("+1 day"); echo strtotime("+1 week"); Or echo strtotime("25 December 2006");
-
Surely you would of read something up about return when you learnt how to create functions?
-
Well what you'll need to do is change where it delcares the function: [code]function fputcsv(...)[/code] to something else, like f_put_csv. But your next problem will be going through your script and change any instance of fputcsv to your newly name function, f_put_csv
-
If its hardcoded into the script itself then it should be secure, but make sure you change the password once or twice a week, just incase. I only gave you the database as an example.
-
can't you do [code]echo $row1[0]['TEK_PART_NUMBER'][/code] instead, if $row1 is a 2D array.
-
According to [url=http://uk.php.net/manual/en/tokens.php]this page[/url] (2/3 down the page) its called the Object operator. When I type the following: $this->method(); I basically say call internal function method();
-
It depends on how you are storing your users details. Such as if you are storing your user details in a database then an experienced cracker can use SQL injection to login to your site as any user. It is only safe if you validate user input and escape user input. Never use raw data being sent in from a form straight into an SQL query like so: [code]SELECT * FROM users WHERE name='$_POST['name']' AND pass='$_POST['pass']'[/code] Becuase if you do that then that is prone to SQL injection attacks. So a cracker can enter this into your username field: [code]' OR 1=1 --[/code] Now what will happen is rather than SQL checking whether the username and password match a user in the database, it'll select the first entry in the database. The chances are that the first person in the users table is an admin!
-
Probably want to look into [a href=\"http://uk2.php.net/manual/en/function.in-array.php\" target=\"_blank\"]in_array[/a]
-
For textarea you do this: [code]<textarea name="name"><?=$_POST['name'];?></textarea>[/code]