-
Posts
3,584 -
Joined
-
Last visited
-
Days Won
3
Everything posted by JonnoTheDev
-
How do I change the time of phpmyadmin in my database tables
JonnoTheDev replied to Irresistable's topic in PHP Coding Help
It's on a paid webhosting Then you will not have access to the server. You will have to set the timezone in the code. phpMyadmin is a database admin utility, nothing to do with the server. <?php date_default_timezone_set('Europe/London'); // should print current date / time print date('d-m-Y H:i:s'); ?> http://php.net/manual/en/function.date-default-timezone-set.php -
Login System with redirect to specific user page.
JonnoTheDev replied to fantasticham's topic in PHP Coding Help
<?php // logout.php session_start(); unset($_SESSION['loggedIn']); header('Location:/index.php'); exit(); ?> -
Login System with redirect to specific user page.
JonnoTheDev replied to fantasticham's topic in PHP Coding Help
<?php // pages that require login session_start(); if(!$_SESSION['loggedIn']) { header('Location:/login.php'); exit(); } ?> -
How do I change the time of phpmyadmin in my database tables
JonnoTheDev replied to Irresistable's topic in PHP Coding Help
Is it a linux box? Change the server timezone: http://www.wikihow.com/Change-the-Timezone-in-Linux -
The source file is on the webserver. In a web browser scenario a user may upload a file to the webserver via a submission form. Once the file has been uploaded a script may be called (best as a forked process) that takes the uploaded file and ftp's it to another server (could be for backup).
-
Not needed as a shared object. Just include the PEAR library include('Services/JSON.php');
-
Login System with redirect to specific user page.
JonnoTheDev replied to fantasticham's topic in PHP Coding Help
yes -
I think pear install is yum install php-devel
-
<?php // array of images $images[1] = "promospace2.gif"; $images[2] = "anotherimage.gif"; if(is_numeric($_GET['image']) && array_key_exists($_GET['image'],$images)) { $image = $images[$_GET['image']]; } else { // image does not exist $image = "middle_highlights.gif"; } // display image print "<img src=\"pic/".$image."\" />"; ?>
-
Login System with redirect to specific user page.
JonnoTheDev replied to fantasticham's topic in PHP Coding Help
<?php session_start(); $users['FantasticHam'] = array('password' => 'iop123', 'redirect' => '/fantasticham/upload.php'); $users['JohnDoe'] = array('password' => 'abc123', 'redirect' => '/john/index.php'); if(array_key_exists($_POST['username'],$users)) { if($_POST['password'] == $users[$_POST['username']]['password']) { $_SESSION['loggedIn'] = true; // redirect header('Location:'.$users[$_POST['username']]['redirect']); exit(); } else { // invalid password } } else { // invalid username } ?> <?php // pages that require login if(!$_SESSION['loggedIn']) { header('Location:/login.php'); exit(); } ?> -
You need a C compiler as the error states. yum install gcc
-
This will update all records greater than 10 credits in one go. You do not require any loop (this is your current error, there is no loop. Only one record returned)! UPDATE users_details SET credits = credits-10 WHERE credits > 10
-
You could store the values in a config database table and then load them in via a config.inc.php. Or you could write them to the file config.inc.php I usually set config values as constansts i.e define(UPLOAD_IMAGE_SIZE_W, 300); define(UPLOAD_IMAGE_SIZE_H, 100); so if I save to a database I store the key and the value. Then when it comes to creating the config file: <?php // config.inc.php $result = mysql_query("SELECT configkey, configval FROM config"); while($row = mysql_fetch_object($result)) { define($row->configkey, $row->configval); } ?>
-
There is no free version I am aware of. Single user licence is only $30
-
Download the tool RegexBuddy. It will make life a lot easier. http://www.regexbuddy.com/
-
Here is a basic tutorial to get you started http://www.spoono.com/php/tutorials/tutorial.php?id=12 However do not use this in a live website. This tutorial does not explain how to sanitize (make safe) any user inputted data prior to using in a database query. Here are some pages on this topic: http://www.phpro.org/tutorials/Filtering-Data-with-PHP.html http://uk2.php.net/strip_tags http://uk2.php.net/mysql_real_escape_string
-
This is not an issue. Having indexes on latitude, longitude will be fast. Indexes should also exist for zipcode as there is a join on the field. The returned result set should not be large as you are limiting to a given distance. You should not use code to manipulate data that can be done from an initial query and return the correct data. More code, more parse time and more issues when it comes to updating the program. This is good practice for any language. Geo data is best stored as a float. I have sites running maps using these queries from millions of records without issue. Read up on geocoding with mysql. It is very efficient.
-
Absolutely not. It could be broken in seconds. There are plenty of captchas that are perfectly readable.
-
http://uk.php.net/opendir
-
Of course. There will always be a way, however making things a little bit more difficult will deter some. People who use windows apps for web scraping etc should be put off.
-
Look at my prev post on this page. It has an example
-
absolutely
-
Where you connect to the db run the following query prior to any other mysql_query("SET NAMES UTF8")