3
votes
Pset7 cs50 finance register method not displaying register.html
The post method is only used when you submit a form. Clicking register doesn't count as a post method, therefore you are skipping the entire section of your code in the post conditional, and the code ...
2
votes
Accepted
Pset7 Finance: register.php gives me an error
Do not use chmod 777 views/*. That will probably help you to get your site to load, but it is bad for security, and a terrible habit to get into. It's like taking the front door of your house off of ...
2
votes
Accepted
For register in pset 7 where I am doing wrong?
It looks like this function will always print "Both passwords don't match" and redirect to register.html (unless username or password is blank). In pseudo-C this routine would look like:
if (username ...
2
votes
Accepted
Pset 7 - CS50 Finance: "Quote" keeps redirecting me to a register error
Check your quote.html, especially the URL the form submits to. I assume that's a Guttenbug (bug by copy&paste).
2
votes
Accepted
help ! I am getting an error and I dunno why ...register (pset7)
Two problems with this bit values(username:, password:".
missing close paren
the : goes in front of the bind variable.
( keywords in sqlite are case insensitive)
2
votes
Accepted
The predefined login function does not seem to be working in finance
Try any user with the password password. All users are created with that same password.
This hashp = generate_password_hash("password") treats password as a string literal, because of the ". You ...
2
votes
Accepted
Problem Set 8 / Web Track - Finance (RuntimeError: UNIQUE constraint failed)
A problem is here: if rows == 1:. Remember, execute returns a list of dictionaries, therefore that conditional is never true.
1
vote
Accepted
Finance Register Checking for Duplicate Username Not Working
Iirc the users table in the db was provided for us, so while Cliff's solution would work it's not the issue.
I'm not sure if the SQL in the below function is calling anything, so nothing will be ...
1
vote
Accepted
CS50 Finance Internal Server Error RuntimeError: near "' '": syntax error
Recheck line result = db.execute("INSERT INTO USERS (username, hash) VALUES (:username :hash); the values of an INSERT should be separated with commas a la INSERT INTO table_name (column1, ...
1
vote
Accepted
Finance: Ensuring no duplicate usernames
Move your != 0 outside that parenthesis, len(rows) != 0:
1
vote
flask register, issue with importing cs50 module
Do you have the cs50 flask.py in /usr/lib/python2.7/site-packages/cs50/? Notice, it's importing from "this directory" from . import flask.
And beware: the script is running under python 2.7 as per ...
1
vote
Accepted
Finance check50: /register & /check return "expected status code 200, but got 400"
I suspect error message is coming from this line return render_template("/"). There is no templated named "/". In an earlier version of the code the line was return redirect("/"), which is likely what ...
1
vote
Accepted
Finance pset, register will not insert user data
Have you looked at the flask log (in the console where you flask run). I'd expect it to be giving an error hereabouts:
new_user = db.execute("INSERT INTO users ('username', 'hash') VALUES (:username, ...
1
vote
Accepted
PSet 8, Finance, cannot submit or reset button on register
Make sure to call the form's submit method, the submit button has no such thing.
1
vote
Accepted
Getting an error in register. Can someone help? Better explanation below
I think your INSERT fails because the id is not filled automatically if it is neither PRIMARY KEY nor AUTOINCREMENT. users.id should be PRIMARY KEY, not users.username (maybe create username with a ...
1
vote
Accepted
Pset8 Finance Check error
Needs to be ?username=, not ?user=, in Python and JS. This test is performed without your form, just by doing that specific request.
From the problem statement on /check:
The route should ...
1
vote
Accepted
pset7 finance: index not working after register
There's a problem here session["user_id"] = "id". "id" is a string literal, not users.id from the database.
Remember this Hint from the spec:
If str is an INSERT, and the table into which data ...
1
vote
how do I correct this error? pset7
Per the spec hints:
If str is an INSERT, and the table into which data was inserted contains an autoincrementing PRIMARY KEY, then execute returns the value of the newly inserted row’s primary key.
...
1
vote
Accepted
register function not returning expected apology results
What is the form action attribute in register.html? Sounds like it's calling login instead of register.
1
vote
Accepted
confusion on session["user_id"] = rows[0]["id"] pset7
When a user is registering they do not have a user_id because they are not "in the database" until the user record is inserted.
From the spec:
Finally, notice how login "remembers" that a user is ...
1
vote
help ! I am getting an error and I dunno why ...register (pset7)
On a quick glace maybe:
On the result line: VALUES in capitals and (:username, :password")
1
vote
Accepted
Check50 returning error pset7 register
if request.form.get("username") != True or request.form.get("password") != True or request.form.get("password") != request.form.get("confirmation"):
request.form.get("username") and request.form.get("...
1
vote
After trying to use the register function, nothing happens
Check your code:
elif request.form.get("password") == request.form.get("password_confirm"):
return apology("password must match password confirmation")
This is wrong: whenever the passwords ...
1
vote
Accepted
After trying to use the register function, nothing happens
Assuming your register.html is correct, and you're actually submitting the form.
Executing return instantly leaves the function. Code below won't be executed.
What's the rationale behind the not in ...
1
vote
Pset7 Finance Register - Works fine but error in check50
Your register code gives me all greens when I run check50 with it.
Have you looked at the URL that check50 gives you to see more details about the tests that are failing? It may be a problem with ...
1
vote
Password confirmation not working
As long as password2 is "password" (literally), this will work. Are you sure you want to compare request.form.get("password2") to the string literal "password"
1
vote
Accepted
Strange sudden error in pset7 staff implemented login (key error 'id')
That error from the supplied login means there is no column named id in the users table. It doesn't seem to have anything to do with indexes. Assuming the rest of the table is intact, you might try ...
1
vote
Accepted
pset7 - register.php error, but new user inserted in database
Shouldn't this:
$rows = CS50::query("SELECT LAST_INSERT_ID() AS id)");
be this?
$rows = CS50::query("SELECT LAST_INSERT_ID() AS id");
1
vote
Accepted
PSET7 Register not redirected to index.php
I'd add a debug line like this:
dump($_SESSION);
on line 40.
You might be surprised to find that you are not storing the user's ID in the $_SESSION. Why not?
Because even though SQL statements are ...
1
vote
I am working on pset7. register.php is working fine. But it always give back an error"id is not defined"?
Change the last line of code to $_SESSION["id"] = $id;
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
register × 58finance × 38
pset7 × 35
check50 × 7
pset8 × 7
cs50x × 5
login × 5
python × 3
flask × 3
pset9 × 3
application.py × 3
500internalservererror × 3
check × 2
sql × 2
cs50x2017 × 2
index × 2
web × 2
insert × 2
register.php × 2
error × 1
html × 1
cash × 1
php × 1
fails-check50-but-works × 1
mysql × 1