You can use .htaccess:
order deny,allow
deny from all
put this file inside the folder to protect and no one can access from the web. Source: http://httpd.apache.org/docs/2.2/howto/access.html
bye :)
You can use .htaccess:
order deny,allow
deny from all
put this file inside the folder to protect and no one can access from the web. Source: http://httpd.apache.org/docs/2.2/howto/access.html
bye :)
I don't see the form tag but I assume you are using post method:
$loan = str_replace('PHP ','',$_POST['loan']);
if($_POST['CO'] == 'Yes')
{
# 5% computation
$interest = $loan * 0.05;
}
else
{
# 10% computation
$interest = $loan * 0.1;
}
echo 'loan: '. $loan;
echo 'interest: '. $interest;
Side note, you can reduce the conditional statement to this:
$interest = ($_POST['CO'] == 'Yes') ? $loan * 0.05 : $loan * 0.1;
bye :)
The only way for PHP to get form data is to use GET or POST. In PHP you can use PHP DOM* to get an element by id, but it will retrieve the page and analyze it, this page will not contain the data inserted in the form, because is not a value already present but is related only to the client session. In other words your textarea will be empty.
If you have different textarea tags then use different names:
<textarea name="t1"></textarea>
<textarea name="t2"></textarea>
<textarea name="t3"></textarea>
<textarea name="t4"></textarea>
* http://www.php.net/manual/en/domdocument.getelementbyid.php
Send an echo from functions.php just to be sure is including fine. You should also get some notices from PHP because $_POST variables aren't there until you send the form.
A question: max_of_3.php and Maxof3.php are the same file? On the form tag you send data to the second.
Run this function, is part of your code:
<?php
function unique_salt() {
return substr(sha1(mt_rand()),0,22);
}
echo unique_salt() . "<br />";
echo unique_salt() . "<br />";
?>
You will get something like this:
32f2b4c6e1c81629fa6c02
fdbfe19bbbec167eb4c040
This are salt values, and if you refresh you will get more different values. If you store only the password hash on the database then you can't get the right match, you need to store also the salt.
So, for example, if the hash stored is:
$2a$10$ea04e8df85241ceb9157auxKBW3YKOyHa6XDAZkindtKLZ/GiUcdO
in order to work, your script needs the password sent by the form, $algo, $cost variables and the salt generated when the password was registered, so you need to retrieve this last value from the database.
Right now your script is going to generate a new salt value to compare the password, value that's different from the original used for the hash generation. I hope is more clear now, English is not my main language.
You need to extract them before you can work on it. Use imagemagick:
convert multi.tif file%d.tif
When you finish you can merge them with this command:
convert file0.tif file1.tif file2.tif -adjoin multi.tif
On PHP there's a library for that, IMagick: http://php.net/manual/en/book.imagick.php but I prefer to work directly with ImageMagick, it spends less memory. Bye :)
You're using curly quotes on all php code, change them to single quotes, so do not use ‘ ’
but ' '
. And do the same for double curly quotes. This should solve the problem.
A question: which editor are you using?
On ezImage() you are specifing an url, maybe you need to set an absolute path, like: /var/www/your_website/system/images/logo.jpg
bye :)
When you use hashing::hash()
you're going to output a new unique_salt() each time, so when the user registers to the website, this value has to be saved to the database, if you don't store it then your script won't be able to get the right match.
Yes, dl() is disabled because is not stable with some SAPI, that's the interface between PHP and the servers and is still enabled on CLI and CGI. In PHP you can load extension in two ways: one is through dl() function; the other method is to edit php.ini file and add extension=ffmpeg.so
Try to increase memory_limit on php.ini, default should be 128M. Hope it works because I haven't other ideas. Bye :)
The errors are always the same, that page is using rel values not registered. Check the link I gave you. Is not difficult to solve, just search why you are receiving those errors. On html5 you have to use target="new"
an not target="_new"
. If you read the errors you get a solution.
Warning Line 8, Column 10297: The border attribute is obsolete. Consider specifying img { border: 0; } in CSS instead.
The above, for example, is self-explanatory.
try mysql -uroot
bye :)
Search for Remove rel=EditURI and rel=wlwmanifest links on search engine.
From what I read that's needed only if you plan to write to Wordpress with windows Live Writer. If you don't need it you can remove it.
You get the error because for W3C there are only these rel values:
http://www.w3.org/TR/html5/links.html#linkTypes
bye :)
If Student will contain a field from another table, for example tbl_students then write:
"SELECT concat(s.firstname,' ',s.lastname) as student, c.class FROM tbl_students s, tbl_class c WHERE s.id = c.studnum and (" . $where . ")"
bye :)
Hi! Try to increase Timeout on apache config file, default value is 300.
Then on php.ini change:
max_execution_time = 600
max_input_time = 600
upload_max_filesize = 20M
Side note: on PHP 5.3 dl() is disabled by default, but for testing you can enable it on php.ini enable_dl = On
Did you read documentation that I linked to you? Did you tried to load the extension with dl()?
<?php
$extension = "ffmpeg";
$extension_soname = $extension . "." . PHP_SHLIB_SUFFIX;
$extension_fullname = PHP_EXTENSION_DIR . "/" . $extension_soname;
// load extension
if(!extension_loaded($extension)) {
dl($extension_soname) or die("Can't load extension $extension_fullname\n");
}
?>
What happens if you run this code?
You can write: $name,$field1,$field2
without quotes. Bye :)
Maybe is not the best solution but here's an example:
<?php
$arr = array('1','2','3','4'); # simple array
function sql_where($a)
{
$b = "";
$n = count($a) -1;
for($i = 0; $i <= $n; $i++)
{
$b .= ($i == $n) ? "`studnum` = '$a[$i]' " : "`studnum` = '$a[$i]' OR ";
}
return $b;
}
$where = sql_where($arr);
include('con.php'); # include connection
$query = mysql_query("SELECT class FROM tbl_class WHERE " . $where) or die(mysql_error());
while($row = mysql_fetch_assoc($query))
{
echo $row['class'] . "\n";
}
?>
sql_where() will output something like:
`studnum` = '1' OR `studnum` = '2' OR `studnum` = '3' OR `studnum` = '4'
You're welcome, bye :)
The fields you want to add are already on the database table?
If no, use alter command from mysql client to add it, an example:
alter table `xeon_users` add `phone` varchar(50) not null;
alter table `xeon_users` add `bankName` varchar(255) not null;
alter table `xeon_users` add `address` varchar(255) not null;
Then just add input fields to your html form and update the insert and update queries. For example:
1) on line 143 add: $MYSQL['phone'] = $_POST['phone'];
2) on line 166, add a comma, go to new line an write: `phone`
3) on line 188 do the same, add a comma, and write: '{MYSQL['phone']}'
Remember to backup your database, or at least the interested table, before performing changes. And work always on a copy of your script.
First of all, congrats! :)
You don't need to write different versions of the same page. Sometimes you need to apply some little adjustments, just grab a CSS tutorial/book and learn from there.
Pixels are always the same on each computer, if you set a page at 900px it will look the same on each computer. But if you want an adaptive design, then use % or em. Search for tabless/fluid design.
The connection string can be saved into another file, you can use include() or require() to use it. Usually php page are processed by the server and only the output (echo, print...) is sent to the browser.
You are using relative links, it's better to use absolute paths, if you put your images/ directory into the root of your web server than remove the dots from the link <a href="/images/whatever.jpg">
will work.
$a = 20;
$b = 30;
echo $a+$b;
bye :)
So, if you write $_POST['order_of_products_by_values']
you don't get anything? if you select Pret crescator you should get 1.
Ops, I see that form and select are using the same id and name. Each element can use only a unique id per page, each form element can share the same name only if they are grouping, like radio buttons, so change the name and the id of your form.
I can't help you much on this.
For what I know you need to register your domain in association with the server IP address to a DNS server. In your case the IP is the public router IP.
Most of the times the Domain Registrar gives you the possibility to use their DNS, so you just need to login to their service and setup the right IP address.
I hope someone else can help you better. Bye :)
Your GD script is fine, I tested and works and so it seems your first script. In my opinion is an hosting issue.
Use $_SESSION, session_register() is deprecated.
For the second problem you should report the error that you get. But try to run:
echo extension_loaded('gd');
1 equals to true, so gd is loaded and working, 0 to false.
You're welcome :)
If the user register to the website you can ask for the timezone location, at that point your script becomes:
<?php
date_default_timezone_set('Europe/London'); # or America/New_York
echo gmdate('c') . "\n";
echo date('c') . "\n";
?>
- http://www.php.net/manual/en/function.date-default-timezone-set.php
- http://www.php.net/manual/en/timezones.php
You can also use javascript to get the datetime, send it to your server through ajax and try to figure the timezone. Probably you can also use IP Geolocation but I can't help you on this.
I don't know your database structure, so here's an example:
# tables structure
mysql> explain users;
+---------+-------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+---------+-------------+------+-----+---------+----------------+
| id | int(9) | NO | PRI | NULL | auto_increment |
| fname | varchar(50) | NO | | NULL | |
| lname | varchar(50) | NO | | NULL | |
| userid | varchar(50) | NO | | NULL | |
| referer | varchar(50) | NO | | NULL | |
+---------+-------------+------+-----+---------+----------------+
5 rows in set (0.00 sec)
mysql> explain blog;
+---------+-------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+---------+-------------+------+-----+---------+----------------+
| id | int(9) | NO | PRI | NULL | auto_increment |
| title | varchar(50) | YES | | NULL | |
| user_id | int(9) | NO | | NULL | |
+---------+-------------+------+-----+---------+----------------+
3 rows in set (0.00 sec)
mysql> explain comments;
+---------+--------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+---------+--------+------+-----+---------+----------------+
| id | int(9) | NO | PRI | NULL | auto_increment |
| message | text | YES | | NULL | |
| user_id | int(9) | NO | | NULL | |
| blog_id | int(9) | NO | | NULL | |
+---------+--------+------+-----+---------+----------------+
4 rows in set (0.00 sec)
# queries to see what is inside:
mysql> select * from users; select * from blog; select * from comments;
+----+-------+-------+------------+---------+
| id | …
Together with chrishea suggestion use .htaccess:
order allow,deny
deny from all
Save this in the same directory that contains mysql connection data. This will avoid direct access through the browser.
On Windows you can use cacls, it's a command line tool: http://technet.microsoft.com/en-us/library/bb490872.aspx
Unless is specified by localtime(), time_zone cookies and so on, PHP works with the server time, not with client time, if you want to use GMT then use gmdate():
<?php
echo gmdate('c');
echo date('c');
?>
You need a form, get data from the form and send it to the database, you can use odbc_exec(): http://www.php.net/manual/en/function.odbc-exec.php
After that you just need to display result. Bye :)
The best option it to get an hosting with the same features you need. So the bandwidth won't be limited by your connection speed.
If you want to run your website from home, you need to check if your IP is static or dynamic. If dynamic, then you need to use a system like dyndns or freedns, where you register an account, you setup with your domain and update your IP each time you connect to internet. Some routers can connect automatically with those services, so you're always online. There are also client programs used to update the IP.
If you have a static IP address, then you need to setup your IP on the domain control panel.
Then you need to setup the VirtualHost on your apache config for your website, and write the domain you choosed, the port used by the server and so on. Check here: http://httpd.apache.org/docs/2.0/vhosts/examples.html
exec() won't give you TRUE or FALSE on the command executed, will simply return an output, and only if you add a second parameter. For example:
<?php
echo exec('ls',&$ot) . "\n";
print_r($ot) . "\n";
?>
So, you need to see what is going on during the conversion. Try to use system(), you will get all the output.
I agree with ardav and I think this thread should be moved to the AJAX forum. At this point your request is not related to PHP. Bye :)
Where is the form? And why you wrote this:
<td><a href='tcninja_update.php?ID=".$rows['ID']."'>submit</a></td>
This will generate a GET, to read ID you need to write $_GET, but you won't get Status, to get that you need to add it to the link &Status=value
To submit a form like yours you need the proper tag, so you need to write:
<form method="post" action="tcninja_update.php"> <!-- this goes at the top of the form -->
<!-- select goes here... -->
<!-- before </form> add this: -->
<input type="hidden" name="ID" value="<?php echo $rows['ID']; ?>" />
<input type="submit" name="submit" value="send" />
Useful documentation: http://www.ffmpeg.org/ffmpeg.html
You can increase upload timeout in your php.ini, check it.
The only way to get those values is to send them through a form, or through ajax. After that, your receiving script can do an insert query to set values into the database.
Hi cereal
I am looking at sha1() function definition on http://php.net/manual/en/function.sha1.php which says:
string sha1(string $str [, bool $raw_output = false ])
Is it possible to use sha1() with salt?
Yes is possibile, between SALT and $password there is a period, not a comma, if you write sha1(SALT,$password)
then you will get an error, but with a period you extend the password: "secret_stringyour_password"
You can improve it adding a salt to your hashing password. Create salt.php:
<?php
define('SALT','secret string',true);
?>
Then create a directory where you save salt.php and where you also create an .htaccess file:
order allow,deny
deny from all
And then include it in your main script:
include($_SERVER['DOCUMENT_ROOT'].'/safe_path/salt.php');
$hpassword = sha1(SALT.$password);
This way the defined SALT is not clearly readable in the main script and it can't be accessed directly. Bye :)
The same problem pritaeas wrote affects also $like_box_xfbml = "
You're welcome :)
Explain better. You need to connect to the same page consecutively?
You need double quotes, otherwise $x won't be processed. An alternative is this:
'SELECT * FROM ...WHERE field="blah blah" HAVING field2<'.$x
Yes, but your question is too generic to make an example. You should explain better your problem.
I don't understand. You need to create a view between two databaes tables or you just need to display different data from the same database table? Can you provide more information?
For each group of radio buttons you need to set the same name, they are alternatives so the scripts will get one of those options. The id, instead, is unique, so:
# question 1
<ul>
<li><input type="radio" name="q1" value="1" id="ans1A" />Answer 1</li>
<li><input type="radio" name="q1" value="2" id="ans1B" />Answer 2</li>
<li><input type="radio" name="q1" value="3" id="ans1C" />Answer 3</li>
</ul>
#question 2
<ul>
<li><input type="radio" name="q2" value="1" id="ans2A" />Answer 1</li>
<li><input type="radio" name="q2" value="2" id="ans2B" />Answer 2</li>
<li><input type="radio" name="q2" value="3" id="ans2C" />Answer 3</li>
</ul>
#question 3
<ul>
<li><input type="radio" name="q3" value="1" id="ans3A" />Answer 1</li>
<li><input type="radio" name="q3" value="2" id="ans3B" />Answer 2</li>
<li><input type="radio" name="q3" value="3" id="ans3C" />Answer 3</li>
</ul>
Once you have chosen the options, just submit the form, if you are using POST method then, use $_POST, $_POST and $_POST to get the values.
I'm sorry, I gave you wrong suggestion, I was tired x_x
Use single quotes instead:
<?php
$fn = 'connect.inc.php';
$string = '<?php
$mysql_host = "localhost";
$mysql_user = "root";
$mysql_password = "";
$mysql_database = "main";
@mysql_connect($mysql_host, $mysql_user, $mysql_password) or die("There was an error connecting to the server");
@mysql_select_db($mysql_database) or die("There was an error connecting to the table");
?>';
if ($handle = fopen($fn, 'w')){
if (!fwrite($handle, $string)){
die("Couldn't write to file");
echo "Writing success";
}
}
?>
Writing:
<?php
$fruit = 'apples';
echo "oranges, cherries, $fruit"; # will display apples
echo 'oranges, cherries, $fruit'; # will display $fruit
?>
Yes, it happens because the document is not written well.
Just add @ to load function: @$dom->loadHTML($f);