2014年06月

I am making a user authentication page using CodeIgniter

The problem is that the query is not retrieving the correct value from the database rather it is not retrieving any value. Whenever I try to print the variable which holds the result, it is blank.
I am attaching a part of the code



This is the code in model



$db = new PDO('mysql:host=localhost;dbname=login;charset=utf8', 'root', 'learningit');
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$stmt = $db->prepare("SELECT id FROM members WHERE userid='$username' AND password='$password'");
$stmt->execute();
$var=$stmt->fetch(PDO::FETCH_ASSOC);

foreach ((array)$var as $row) {
print_r($row);
return $row;


& this is the controller part



public function check()
{

$this->load->model('test_model');

$result=$this->test_model->data_check();

if($result[0]==1)
{
$this->call();
}
else if($result[0]==2)
{
$this->call1();
}
else if($result[0]==3)
{
$this->call2();
}
else
{
echo "Invalid id/password";
}
}


Answers

You might be missing $username and $password declaration in your model



$username = $this->input->post('username'); // change this depends in your input 
$password = $this->input->post('password'); // change this depends in your input




Question

possession charge


how long does a misdemeanor possession charge stay on your record in new hampshire



Answer

Re: possession charge


A criminal conviction will stay on your record forever unless you move for annulment. There are several requirements for annulment, including a 3-year waiting period. In addition, drug convictions often carry other possible penalties such as a license suspension by DMV, and issues with student loans and employment.



WARNING AND DISCLAIMER: This response is provided for general informational purposes only. It is not a substitute for speaking to an attorney qualified and experienced in criminal defense. This response does not establish an attorney-client relationship. Reliance on this information without seeking advice from an attorney could be harmful. Beyond jail and fines, criminal charges often carry unforeseen collateral consequences impacting employment, security clearances, military service, student loans, drivers license, possession of firearms and voting. If you are the subject of a criminal investigation, under no circumstances should you speak to the police without consulting an attorney. Criminal charges are serious, speak to an attorney!






how to deploy Spring MVC project on openshift.com

I wanted to Deploy a simple Spring MVC APP to open shift I googled for this and found spring-mvc-3-on-jboss but there project structure is different I have basic Spring MVC project structure is



that is at this repo, at openshift.com I created Application and configured as :

But I can not see my home.jsp file as welcome file when I goto my app-url I see only the default/traditional welcome page.

Any suggestion how to configure project to work correctly?



Answers

There is one major problem with your pom.xml, I think that makes your app not working on the openshift.com. You should add the following lines to your pom.xml



<profiles>
<profile>
<!-- When built in OpenShift the 'openshift' profile will be used when
invoking mvn. -->
<!-- Use this profile for any OpenShift specific customization your app
will need. -->
<!-- By default that is to put the resulting archive into the 'webapps'
folder. -->
<!-- http://maven.apache.org/guides/mini/guide-building-for-different-environments.html -->
<id>openshift</id>
<build>
<finalName>yourAppName</finalName>
<plugins>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.1.1</version>
<configuration>
<outputDirectory>webapps</outputDirectory>
<warName>ROOT</warName>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>


I haven't tested this code with JBoss Application Server, so change your server to Apache Tomcat 7. that worked for me correctly.



Answers

first you have clone your git repository then automatically created folder in document folder.



then your war file extract and past your clone directory into webapps folder



and create test folder paste your code in folder and also root war file.



then your ulr in your folder name write and enter.



for example



like this.



git clone ssh://5565c850e0b8cd07580001ba@yourdomain.rhcloud.com


paste your extract war file into your clone directory.



then fire git commmand



$ git add .
$ git commit -m "A checkin to my application"
$ git push




AWS CLI for EBS snapshots

I am trying to get AWS CLI going to backup my EC2 instances. I can't see why AWS don't make it easy to schedule this via the console but they don't so I am pushing ahead with CLI.



I installed on one of my instances. Problem 1, it won't work unless I setup a NAT instance as my instance has no public IP. Trying to avoid that so I used a server at a different ISP that does have a public IP. I setup the credentials and profiles using aws configure. I have config and credentials files in .aws directory. All should work. I try:



aws ec2 describe-instances --profile tmpevaluate

Could not connect to the endpoint URL: "https://ec2.us-west-2b.amazonaws.com/"


I tried



nslookup ec2.us-west-2b.amazonaws.com


but it doesn't resolve. Weird as it resolves on my Mac and DNS is working on the server I am trying it from as it can resolve any other domains I can think of. So to debug I installed and configured AWS CLI on my Mac. I know it can resolve ec2.us-west-2b.amazonaws.com. So I tried:



aws ec2 describe-instances --profile tmpevaluate


and get:



HTTPSConnectionPool(host='ec2.us-west-2b.amazonaws.com', port=443): Max retries exceeded with url: / (Caused by ConnectTimeoutError(<botocore.awsrequest.AWSHTTPSConnection object at 0x10c0ac6d0>, 'Connection to ec2.us-west-2b.amazonaws.com timed out. (connect timeout=60)'))


I am at a loss. Something that should be so simple has me totally stumped and no one else seems to be having the same problem.



Ideas?



Answers

Use us-west-2 instead of us-west-2b in your Endpoint URL. Most probably, this would be the value of REGION in your configuration file that was created by running aws configure



us-west-2 is a region
us-west-2b is an availability Zone in that region.



You should be connecting to the Region and not to a specific Availability Zone





Spotify Android SDK - Cant import player library

I am trying to integrate spotify with my android application. I am using their Android SDK with Android Studio. I followed the tutorial on their official developer guide. I can import and use the authentication api (import com.spotify.sdk.android.authentication;) but cant import the player api (import com.spotify.sdk.android.player;)



Anybody faced this problem or any leads?



EDIT:



I added these dependencies in build.gradle file:



// This library handles authentication and authorization
compile 'com.spotify.sdk:spotify-auth:1.0.0-beta10@aar'
// This library handles music playback
compile 'com.spotify.sdk:spotify-player:1.0.0-beta10@aar'


Now I tried to try out the demo code mentioned in the link above. But I am getting error in these imports.



import com.spotify.sdk.android.player.Spotify;
import com.spotify.sdk.android.player.ConnectionStateCallback;
import com.spotify.sdk.android.player.Player;
import com.spotify.sdk.android.player.PlayerNotificationCallback;
import com.spotify.sdk.android.player.PlayerState;


However I can import the authentication related imports.



import com.spotify.sdk.android.authentication.*;


Either the player library is not getting imported properly or the import definitions have changed in 'com.spotify.sdk:spotify-player:1.0.0-beta10@aar' version, since the demo code that has been given is for 'com.spotify.sdk:spotify-player:1.0.0-beta9@aar' version.





↑このページのトップヘ