« first day (973 days earlier)      last day (3975 days later) » 

8:00 PM
ohh sorry lol.You wrtten it bellow
 
@bwoebi bllh
 
@ircmaxell hllb
 
eloh
 
@Wes it worked.is there any alternate solution to keep that database data come from the form without using json.Like class properties
 
strrev(): hole
@ircmaxell fall into it!
 
8:03 PM
@Wes in joomla configuration is using that .I know.class properties setting outside of.Do you how to do that ?
 
user652649
@Samithaఠ_ఠ can you change the json's content? take a look at php.net/list
 
Well ... @PeeHaa埽 , you can try to watch the fist episode of Perception. It will give you an adequate impression of the series. Whether you like it or not most likely will depend on how flawed you like you characters.
 
user652649
@PeeHaa埽 ita 1-0 ned
 
@Samithaఠ_ఠ , you might need to invest some time in improving your english. As it stands now, it is quite painful to read.
 
yes thanks to that.I'm living in SRILANKA.it is an Asian Country.This is my second language
 
8:09 PM
@tereško hmmm going to check it out. tnx
 
@Wes i written it
$file = __DIR__ ."/config.json";

$array = file_get_contents($file);
$dbConfig=json_decode($array);
list($host, $db, $user, $pass) = $dbConfig;

$pardConfig=new PDO('mysql:host='.$host.';'.'dbname='.$db,$user,$pass);
 
@PeeHaa埽 my impression was: interesting concept, not my cup of tea
 
@Wes is that sound right ?
 
a bit too much deus ex machina in my opinion
 
user652649
@Samithaఠ_ఠ yeah, better
 
8:11 PM
@Wes I want to store data without using a json file like a php class file.
 
@Samithaఠ_ఠ why cannot you have the DSN already formed in the configuration ?
 
user652649
didn't you say that json can't be changed?
 
also ... "english is my second language" sounds to me like whining, since it is my 4th language
 
i don't want to use it .i want to create a php class file with (already created class with) like bellow
class Config{
public $db ="";
public host ="";
etc
like joomla configuration file
 
that's not a class ... it's a glorified array
 
all glory to array!
 
those class properties set dynamically in joomla configuration file isn't it ?????
 
FYI, it is a bad practice to have public parameter in a class. It's breaking the encapsulation of the object.
 
@tereško if so why it using joomla ? am i correct
 
8:18 PM
because joomla is filled with bad practices
 
hmmmmmmm
 
... and it is pointless to turn configuration into a class just for that sake of it being a class. Just make it an array.
in your case you would be using said configuration only in the bootstrap stage of the application
for example: while creating the PDO instance
 
Hey guys how do I access another object method inside an object method. So I've got object2 with method(){$object1->atestmethod()} How do I get access to that object1 method inside object2 so I can call $object2->method()? Do I have to pass the entire object1 into object 2's contructor and set it as a local variable in object2?
 
after that, the DB configuration parameters have no value to you .. instead you just inject the PDO instance where it is required
 
@billmalarky Either pass it into the constructor or directly into the method
 
8:20 PM
375
Q: What is dependency injection?

AR.There have been several questions already posted with specific questions about dependency injection, such as when to use it, what frameworks are there for it. However, here's the newbie question: What is dependency injection and when/why should or shouldn't it be used? Edit: While external link...

 
@PeeHaa埽 So I could make the call like so: $object2->method($object1)
 
@billmalarky yes
 
@tereško i want to enter hostname,db,user,pass when user enter from the install directory form.How would i stote it.I was using a JSON file.As i see it is bad practice
@PeeHaa埽 please read my question also
 
$dbh = new PDO( $config['dsn'], $config['user'], $config['pass']);
$user = new User($dbh);
$document = new Document($dbh);
// now both user and document instance shares THE SAME pdo object
 
Hey guys. Why wouldn't this work? It doesn't connect properly to either database:

switch ($db_selection)
{
case "id1":
$dbhost = '***';
$dbuser = '***';
$dbpass = '***';
$dbname = '***';
$conn = mysql_connect($dbhost, $dbuser, $dbpass);
mysql_select_db('$dbname);
break;
case "id2":
$dbhost = '***';
$dbuser = '***';
$dbpass = '***';
$dbname = '***';
$conn = mysql_connect($dbhost, $dbuser, $dbpass);
mysql_select_db('$dbname);
break;
}
 
8:22 PM
Feel free to post my video as an answer to that DI question
and later, I am out again
 
@Samithaఠ_ఠ it has nothing to do with json
 
90
Q: PHP and MySQL - how to avoid password in source code?

Horst WalterI have a small PHP application storing data in a MySQL database. Currently username / password are hard-coded in the PHP code. A situation I do not really like, for example, since the code is also available in a repository. The best idea I have is to move the data from the code to a configuratio...

 
@tereško i want to keep that file in my config folder to later use with PDO object.So what is the way ?
 
What does P&S mean??
Well, maybe I am noob or maybe this site is Q&A and not just P&S — EASI 1 min ago
 
@JustinHetrick mysql_error() is your friend
 
8:24 PM
Porn & sodomy?
 
bingo
 
@Samithaఠ_ఠ waaaaait ... i think you are just missing the second parameter for json_decode()
 
@MikeB hehe
 
@MikeB the mysql_error() says that the connection could not be made and no data was selected.....so why don't separate sql connections work inside if or switch statements?
 
@Samithaఠ_ఠ one way is to use .ini file, php.net/manual/en/function.parse-ini-file.php
 
8:25 PM
@MikeB But if I put one of them outside of an if it works perfectly.
 
@JustinHetrick is it possible neither case is being triggered?
 
@tereško what 2nd parametet ????????
 
Hey guys another quick question, what is the best quick and easy built in password hashing system built into php like sha1 or md5 etc. I don't need bcrypt for this because I'm just building an example auth system.
 
@billmalarky wrong. you need bcrypt
 
8:27 PM
^ what he said
 
354
A: Secure hash and salt for PHP passwords

Robert KTL;DR Don'ts Don't limit what characters users can enter for passwords. Only idiots do this. Don't limit the length of a password. If your users want a sentence with supercalifragilisticexpialidocious in it, don't prevent them from using it. Never store your user's password in plain-text. Neve...

 
@tereško , true ???
 
jsfiddle.net/45zsW … wtf a jsfiddle with php in it xDDDD
 
@bwoebi lol
@tereško is that php.ini is good ?
instead of json ? secure ?
 
8:31 PM
@MikeB no, because I placed an echo statement at the bottom of each case and it displays that, but the connects aren't going through
 
@JustinHetrick You have extra quotes in these lines: mysql_select_db('$dbname);
 
ini is not secure
 
@PeeHaa埽 u there?
 
yes
 
@PeeHaa埽 do you have any idea bout storing data from installation form of my application to later use with secure ?
json is not sure
ini isn't
is there any method ?
 
8:37 PM
Did you read that question I posted?
 
and its dupe
 
ok thanks
That's the thing i searched in whole this month lol
 
@Samithaఠ_ఠ securing data of installation has nothing to do with the form how you store it
it is about the locations
the configuration should be stored outside of DOCUMENT_ROOT
 
8:50 PM
@MikeB took the quotes out still no go. Can you name different $dbuser and $dbpass inside a switch or if statement
 
@JustinHetrick Why do you have all that in a switch statement?
 
@PeeHaa埽 because I am trying to query data from different databases dependent on a user selection. And the databases all have different usernames and passwords
 
@PeeHaa埽 echo 'My username is ' .$_ENV["user_name"] ; isn't working but there is a active session $_SESSION['user_name']
@tereško
echo $_SESSION['user_name']; will echo the username .
 
@PeeHaa埽 Thanks. I'll give that a try.
 
9:02 PM
WUT?!?!?! :D
you say sqli vulnerability, but you're not using mysqli, youre using mysql...but besides that....whats the question? — KyleK 1 min ago
 
Could I get an answer on mod_rewrite here? Didn't find any more appropriate for it.
 
@Akxe You can, when you made sure it hasn't already been asked on the main site :)
 
I get this:
student.sps-prosek dot cz/~eisead11it/PGM/?page=
Form this:
student.sps-prosek dot cz/~eisead11it/PGM/
Using:
RewriteRule ^(.*?)(/?[^/]+)$ index.php?page=$1 [L]
 
And what are you trying to do?
 
student.sps-prosek dot cz/~eisead11it/index.php?page=PGM
#In directory index
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^(.*?)(/?[^/]+)$ index.php?page=$1 [L]

#File 404
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{DOCUMENT_ROOT}/$1/ -d
RewriteRule ^(.+)/([^/]+)$ index.php?page=$1&err=f [L,QSA]

#Directory 404
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*?)(/?[^/]+)$ index.php?page=$1&err=d [L]

But some odd reason the directory redirect works :D
 
9:11 PM
@Akxe Have you tested the regex pattern?
 
@PeeHaa埽 yes and failed, but why the directory works and the base don't?
@PeeHaa埽 Foder PGM/ exist but folder PGM/A/ don't, but if I type wrong folder it is redirected...
 
@tereško u there?
 
@Akxe You should really consider stopping with adding those rules in your apache config and start looking into doing the routing in php
 
@PeeHaa埽 I can't I have to be able use the folder tree as it is now since the school wants it...
 
@igorw if there is, it's hiding well because I don't know it ;-)
 
9:29 PM
What this mean? ^(.*?)
 
@Bracketworks ^
 
lol
^^ check it, and look to the right @igorw
@Akxe It means:
Assert position at the beginning of the string «^»
Match the regular expression below and capture its match into backreference number 1 «(.*?)»
   Match any single character that is not a line break character «.*?»
      Between zero and unlimited times, as few times as possible, expanding as needed (lazy) «*?»
I guess it was sort of an xkcd reference :)
 
@Bracketworks Could you help me understanding this: ^(.*?)(/?[^/]+) ?
 
Ok, last one cause I feel like I'm spamming
Assert position at the beginning of the string «^»
Match the regular expression below and capture its match into backreference number 1 «(.*?)»
   Match any single character that is not a line break character «.*?»
      Between zero and unlimited times, as few times as possible, expanding as needed (lazy) «*?»
Match the regular expression below and capture its match into backreference number 2 «(/?[^/]+)»
   Match the character “/” literally «/?»
      Between zero and one times, as many times as possible, giving back as needed (greedy) «?»
 
@Bracketworks What does "capture its match into backreference number"?
 
9:43 PM
It means everything in the group (between the parentheses) is matched, and provided the language you're doing this in (presumable PHP with preg_match, which does) supports capturing groups, it'll be available at offset 1
Such that preg_match('^(.*?)(/?[^/]+)', $subject, $matches) will yield whatever was capture by (.*?) in $matches[1]
 
thanks heled a lot
 
I'm going to recommend that you check out regular-expressions.info
And, as well, consider obtaining a copy of regexbuddy.com (authored by the same guy as the aforementioned site)
 
I'll do that thanks
 
^^ Those descriptions were just copy pasted from RegexBuddy
 
@Akxe this is great also.
You can also download an air version for the desktop: gskinner.com/RegExr/desktop
 
9:47 PM
Oh yea, tons of pretty solid online tools/solutions too; that's definitely a good one.
I always recommend RegexBuddy though, given everything it supports; freaking awesome.
 
It is but I don't know the basic and couldn't find any well structured tutorials
 
@Akxe regexr is really hard to learn by tutorial; you just need to play around with it.
 
@Nile Well had problems with "playing" with it
 
@Akxe the tools we linked to tell you what designated symbols in regex do
If you paste an expression into gskinner.com/RegExr, it'll tell you what each individual thing does
 
I found it allready, but can't figgure it out in a bigger string
Is it possible that a mod_rewrite give the querry string to the url and not to the file that it is redirected to?
 
@PeeHaa埽 :D
 
10:32 PM
str_replace is returning me NULL?
why is that so?
 
code?
 
one sec
 
@PeeHaa埽 Help pls Everything after in regexr?
 
$datacheckresultx = strpos($datacheck,'<a href="http://www.google.com/category/google-blog" title="View all posts in google Blog">');
if($datacheckresultx != FALSE){
$datacheck = preg_replace('<a href="http://www.google.com/category/google-blog" title="View all posts in google Blog">','<a href="http://www.google.com/blog" title="View all posts in google Blog">',$datacheck);
}
var_dump($datacheck);
}
and the var_dump says NULL
any idea why?
 
no variable here <- preg_replace('<a href="http://www.google.com/category/google-blog" title="View all posts in google Blog">','<a href="http://www.google.com/blog" title="View all posts in google Blog">',$datacheck);
hope it work ;)
 
10:36 PM
ah?
are you just telling me to try or do you know whats wrong in the code
I tried both str_replace and preg_replace. no luck
 
@Kishor per the docs for preg_replace() returns NULL if an error occurred
your regex is wrong
also no need for regex, just use str_replace()
Also, you need to use strict comparison when checking the return value of strpos()
 
Woot! rm -rf lib/smarty/*
 
@Danack hardcoded path! =oD
 
Er....I did that on a command line.
 
@crypticツ - strict comparison?
 
Hello, i am having trouble with postgis..
I am trying to make a query..
Anyone there who can help?
 
@crypticツ - Done! Thanks :)
 
(╯°□°)╯︵ ┻━┻
 
SELECT p.gid,a."ΘΕΑΤΡΟ",ST_Union(a.geom, p.geom) FROM periphereies AS p JOIN archaia_theatra AS a ON
ST_Contains(p.geom,a.geom)

The above query works perfect..

But when i am trying to select count(p.per) or count(p.gid) for following error oqqurs:
ERROR: column "p.gid" must appear in the GROUP BY clause or be used in an aggregate function
LINE 2: SELECT p.gid,a."ΘΕΑΤΡΟ",ST_Union(a.geom, p.geom),COUNT(a.geo...
^

********** Error **********

ERROR: column "p.gid" must appear in the GROUP BY clause or be used in an aggregate function
SQL state: 42803
Character: 58
 
$template variable is empty. how to know which version of smarty i have? — alhoseany 36 mins ago
 
10:59 PM
@Danack OP should find a new profession if he doesn't even know what version he is using...
 
phpinfo() should help
 
@ChrisPappas huh?
 
you are trying to name the version of stacky library?
 
@ChrisPappas Smarty
 
yeap
 
11:03 PM
@ChrisPappas It's not part of PHP, but rather a 3rd party software package so it would not show up whatsoever in phpinfo()
 
ahh, it's not a *.so file?
 
@ChrisPappas no
 
@ChrisPappas When some text is followed by a name and +x time ago , it's a quote of someone else one the site. The link is to the quote - I realise it would be clearer if StackOverflow added quote marks by default to the comment.
 
@crypticツ have you checked this? smarty.net/forums/viewtopic.php?p=27726
 
lol
 
11:07 PM
@ChrisPappas first off, it's not my question, and second @Danack already pointed out how to look for it in the original post
 
Ok, i thing time to go for sleep
 
always a good idea.
 
but, i have work to end
Anyone which has experience with postgresql?
It's gonna crazy me
1.


CREATE OR REPLACE VIEW per_max_theatra AS
SELECT count(p.per) FROM periphereies AS p JOIN archaia_theatra AS a ON
ST_Contains(p.geom, a.geom) ORDER BY count(p.per) DESC LIMIT 1

2.
SELECT p.gid,a."ΘΕΑΤΡΟ",ST_Union(a.geom, p.geom) FROM periphereies AS p JOIN archaia_theatra AS a ON
ST_Contains(p.geom,a.geom)

3.
SELECT p.gid,a."ΘΕΑΤΡΟ",ST_Union(a.geom, p.geom),COUNT(p.per) FROM periphereies AS p JOIN archaia_theatra AS a ON
ST_Contains(p.geom,a.geom)
2 works
1 works with not the expected return
3 error
 
aaargh PHP compilation keeps freezing when it gets to the sqlite3 extension =o(
downloads/php-5.5.0RC3/ext/sqlite3/libsqlite/sqlite3.c:13553: warning: unused variable 'mutex'
downloads/php-5.5.0RC3/ext/sqlite3/libsqlite/sqlite3.c: In function 'porter_stemmer':
downloads/php-5.5.0RC3/ext/sqlite3/libsqlite/sqlite3.c:118659: warning: value computed is not used
downloads/php-5.5.0RC3/ext/sqlite3/libsqlite/sqlite3.c:118663: warning: value computed is not used
downloads/php-5.5.0RC3/ext/sqlite3/libsqlite/sqlite3.c:118676: warning: value computed is not used
downloads/php-5.5.0RC3/ext/sqlite3/libsqlite/sqlite3.c:118681: warning: value computed is not used
 
@crypticツ Just disable the thing :)
 
11:16 PM
@PeeHaa埽 but I might need it =oP
 
--without-sqlite3 right?
 
yesz
uuhhm no
--disable-
 
doh
 
--yes-have-no-bananas
 
11:20 PM
no I was right --without-sqlite3 php.net/manual/en/sqlite3.installation.php
stupid inconsistent naming
 
aaah
 
I'm going to miss Sqlite3 =o( the last time I used it was back in 2006 =oP
 
I don't think I have ever used it server side :P
 
@PeeHaa埽 I had to use it in college for my student org's website since IT did not allow MySQL for student websites only Sqlite2 was allowed, so actually I never used Sqlite3, I had made a wrapper at the time to use the v3 functions through v2. After I left they decided to upgrade PHP to support v3.
I was ahead of my time =oP
 
Hey, I could use some help with PHP / Ajax.. I am not sure why this code does not work, any input would be greatly appreciated :) pastebin.com/5XLD1S9T
 
11:30 PM
@JesperJacobsen The problem appears to be that you are using jQuery
 
is jQuery bad? ;P
And i got this to work (almost exact same script) on another page
Should i just use javascript or a plugin etc? ^^
@crypticツ is there a way to make that work without excessive reconfigurations?
 
jQuery - in an email?
...
 
no, wait what? Ajax to send the email..
If anybody know where i mad the mistake I'd be glad ^^
 
@crypticツ lol you had to patent the shit
@JesperJacobsen You should really cache the jquery objects
 
I am not that familliar with jQuery yet, could you explain what you mean? :)
 
11:42 PM
Also: your script is vulnerable to header injection
 
okay, i can take care of that later ^^ I just want to send an email right now :P
 
var $error = $(".well .error");
$error = .hide();
@JesperJacobsen right... sure...
 
@JesperJacobsen that's usually a different way of saying "I don't know what you are talking about, but I'll say I do and I will fix it but in actuality ignore you..."
 
No :P I really want to learn it... it does not help if you just get everything handed
then theres no point in trying it out first...
@PeeHaa埽 Well that is giving me syntax errors :P
 
errr $error.hide();
 
11:48 PM
that works :D
but it should work most of it... it gets all the way down to the $.post call, and it calls the right document (seen in firefox console)... so the mistake is happening in that document and i cannot find it..
 
@PeeHaa埽 How would i create dynamic menu .main menu -> sub menu - sub child menu -> etc .I want to do it with php,javascipt ? is there good tutorial ?
 
oh well thanks :) I will figure out something to do ^^bye
 

« first day (973 days earlier)      last day (3975 days later) »