premiso
Members-
Posts
6,951 -
Joined
-
Last visited
-
Days Won
2
Everything posted by premiso
-
Sounds like you have an unknown column called distance inside of your where clause. So either your table columns are mis-named or you wrote the wrong column name in your where clause.
-
The session requires the use of a cookie. Why people use cookies over sessions? Well leaving the same session hash for a user over time dilutes it, meaning a greater chance for someone to hi-jack their session. You still have to store something in the database to authenticate the user from, so most people opt to store a userid and a hash (a random hash stored in a database) to authenticate people from and they often re-generate this hash each time a user logs in. This way their hash is not diluted, they can be re-authenticated easily and is a bit more secure then leaving the same hash on their system for days on end. That and it is a bit easier to control an actual cookie over control a session cookie, as the session cookie requires editing the php.ini or using ini_set methods to modify and is generally done globally. Where as with cookies you can easily tailor it to user input with a simple change in the expires time. So yea. It all depends on the need.
-
droidus, session would work a bit better in your case. If you want the "remember" me type functionality, you can just set the session to use cookies and you can set their timeout as well. You should be able to do this by editing the php.ini see session for more information.
-
To really answer your question, it is because you were including an associative array inside of the echo. The single quotes mess it up, in cases such as that use braces {} to include the variable. echo ("<form method=\"POST\" action=\"{$_SERVER['PHP_SELF']}\"><center>"); WOuld have solved it.
-
It would make it a ton easier if you pointed out what line is 140.
-
They do not always need it, but since you are having troubles you need to think outside of the box and try some of the other items that setcookie has to offer. And of course the isset check did not work, your cookie is not being set to begin with. So take a look at the setcookie man page and try some of the optional options for it, go one by one or try all of them at once and see if it kicks in. If that still does not work, change the cookie name to not have the braces ( [] ) and see if it works then.
-
You don't put it into a stupid format to begin with? Although, that "should" work, but there can be multiple problems. A: Cookies do not show up till a page reload (if I remember correctly). B: You should set an expire time and path. setcookie("myCloud[loginID]", $value, time()+3600*4, "/"); Shoudl set it to expire in 4 hours valid on the root of the webroot. See if that does you any better.
-
The php.exe is the php executable...it is what runs everything to do with PHP. If you are using Apache as a web server, well Apache calls that executable to execute any php code it has, it just does it behind the scenes so to speak. Without that executable file, well PHP wouldn't work on your server.
-
Ok, so the obvious problem is that you do not have an array. $contentPageIDs = !empty($_POST['contentPageArray']) ? explode(',', $_POST['contentPageArray']) : array(); Should fix your troubles.
-
It doesn't hate them, it just defaults them to off. You can turn them back on in the php.ini file. I generally turn them back on because I like using those tags for my template/view files.
-
Then your post variable coming in is not an array. Do a var_dump($_POST['contentPageArray']); and see what is happening.
-
$contentPageIDs = !empty($_POST['contentPageArray'])?$_POST['contentPageArray']:array(); Should fix your issue. Since POST data is unreliable, it is better to check that you have content you are expecting. If not default it or throw an error to handle it properly.
-
http://php.net/cli Its called the command line interface. Batch file mockup @echo off c:\path\to\php.exe -f c:\path\to\script.php
-
http://www.phpfreaks.com/forums/index.php?topic=37442.0
-
For the clone to work you need to return the object. function __clone() { $this->gas = 0; echo "<br/>hello I am a clone!<br/>"; return $this; } Should clone the object.
-
Impressed that someone admits to homework and actually tried it. Kudos. The answer you are looking for lies in the modulus operator. (The % sign). Example: if ($count % 3 == 0) { echo 'multiple of 3'; }elseif ($count % 2 == 0) { echo 'multiple of 2'; }
-
Use foreach $dd = '<select name="selectnamehere"> foreach ($array as $item) { $dd .= '<option value="' . $item . "'>'. $item . '</option>'; } $dd .= '</select>'; echo $dd; Should get you started.
-
They did say for OOP in PHP, not marketing themselves...
-
I think this is full of win. I would definitely style your resume exactly like this.
-
@Ptsface12: http://www.php.net/manual/en/function.session-is-registered.php Best not to use stuff that has been deprecated. To fix that in your code: <?php session_start(); if (!isset($_SESSION['user'])) { header("location:../index.php"); } ?> Same with the session_register : if($count==1){ // Register username, password and redirect to file "login_success.php" $_SESSION['user'] = $user; $_SESSION['password'] = ''; // this is how you register them now. header("location:your success login.php"); }
-
Or better yet, statically cast it to an int. if (!empty($_GET['id'])) { $id=(int)$_GET['id']; $where = "WHERE id='$id'"; } else { $where = "ORDER BY RAND() LIMIT 0,1"; } $result = mysql_query("SELECT * FROM movie '$genre_string' " . $where) or trigger_error('Query Failed: ' . mysql_error());
-
Easily done with .htaccess and a bootstrap file. The .htaccess takes any request to the admin folder and redirects to say bootstrap.php. The bootstrap will then parse the request, include the proper file and you can have all the code inside that file that needs to be included on all of those files. RewriteEngine On RewriteRule ^admin/(.*).php$ bootstrap.php?page=$1 [L] Is a rough example and may need tweaking, but there you go.
-
Taking an array and inserting the data into a new array
premiso replied to WatsonN's topic in PHP Coding Help
$SongList = array(); foreach ($list as $data) { $SongList[] = 'feed://gdata.youtube.com/feeds/api/videos?q=' . $data . '&orderby=relevance'; } var_dump($SongList); Something like that? -
SELECT ip, date FROM ip GROUP BY ip ORDER BY date DESC LIMIT 10 Should do it.
-
What is the right output? Do you want just the latest date to 1 ip? Do you want multiple dates under the 1 ip? We need to know what your goal / desired output is here.