473,396 Members | 1,879 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Facing a Problem,requires Login first Before Contacting Us

I am a beginner programer. And i creating a website.I have a problem, i want a code that help me to make the web. I want when user complete the ContactUs form and click on submit button.It show msg whether the user Login or not.If user Login,the form will successfully submitted.If not it tell the user to register or login first and directly move the control on login page.I will require this in php.Please help me.
Mar 27 '20 #1
1 3524
AjayGohil
83 64KB
Hi,

For that you can use session.If user is logged in then user can submit the contact form otherwise redirect to login page.

Example:


Expand|Select|Wrap|Line Numbers
  1. if(!isset($_SESSION['l_id']))
  2.                   {
  3.                     header("Location:login_lab.php");
  4.                   }

In Login Method You have to create session and assign user_id to session. Above code will check that session is created or not.


For session you can refer below site:


https://www.w3schools.com/php/php_sessions.asp
Apr 15 '20 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: John | last post by:
Internet Facing SQL Server, Login Security? How? I would think that our Project is fairly common. We're stuck on a security question. We have a typical SQL Server 2000, running under Windows...
22
by: Rajshekhar | last post by:
Hi , i am writing a simple prgm to read a .txt file then store the contents into the array... program as follows: -------------------------- #include<stdio.h> int main() { FILE *fp1;
2
by: Gouse | last post by:
Hi, I have a small application which is running in service mode. Its responsible is to provide email configuratio. If it gets a request( eg: Export a file throug email) from the user, first it...
2
by: sheaguevara | last post by:
This is my first post onto the forum. So first off, I'd like to say hello to everyone. I just started working on a login/registration system and I am trying to have a feature where the user will...
1
by: avneesh | last post by:
In fact i am running Smart Card Attendence software there are two exe file one take data from Card reader import it and send in employees database and other exe file manage data base i am facing...
3
by: yassinsearch | last post by:
Hi , I am facing problem text direction.(for HEBREW lanaguage) By default the direction of text field is Left to Rignt. Any SRW methods is available to set the reading direction from Right to...
2
by: apoorva.groups | last post by:
Hi I am facing problem while using regexec function. Ex: String = "abc_def_hig" sub string = "def" regexc if I use regexec the it will find the sub string in string and it will return 0....
0
by: Dhananjay | last post by:
hi all, I am facing problem in programming.Can anybody please let me know how to solve the problem. I have a link, clicking the link opens a page in which there are some data which is coming from...
1
by: sai dev | last post by:
Hi, I am facing problem in following scenario for WinForm Data Grid. Scenario --------- -- DepartNumber DepartmentName + 10 HR + 20 Sales
0
by: arora | last post by:
Facing problem in Append Command. What mistake i did in Append command below, always return bad response ========================================= request: IMAP003 SELECT INBOX \r\n response: *...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.