Jump to content


Photo

PHP, um 'login' ser direcionado para uma página especifica

php login

  • Faça o login para participar
9 replies to this topic

#1 Brendys

Brendys

    Novato no fórum

  • Usuários
  • 1 posts
  • Sexo:Feminino
  • Localidade:São Paulo

Posted 19/04/2015, 15:01

Olá, 

gostaria de saber se alguém pode me passar ou fazer um código em php  para um usuário especifico  cadastrado no meu banco dados ser direcionado para uma página especifica..

 

Na logica seria: 

 

Se o login for igual a admin e  a senha for igual a admin (no caso a senha estaria em criptografada com/em md5)

ele direciona para página tal..

 

Se  não  (no caso se não for esse login e  essa senha, se for outro) redirecionar para outra página.

 

Ja tentei fazer, mas os meus sempre dão erro :|

 

Nome do banco: Cadastro 
Tabela: usuarios

 

Agradeço desde já! :3



#2 ximnes

ximnes

    Novato no fórum

  • Usuários
  • 3 posts
  • Sexo:Masculino
  • Localidade:Petrópolis RJ

Posted 23/04/2015, 06:56

Eaii

Olha só você tem que fazer uma consulta na tabela vendo o tipo de usuário que o login é.

E terá que adicionar ifs para redirecionar cada usuário.

Tipo esse cód aqui

<?php

$conf = $conPDO->prepare("SELECT COUNT(*) FROM usuarios WHERE login = :login AND senha = :senha");
$conf = $conPDO->execute(
array(
            ':login' => $_POST['login'],
            ':senha' => $_POST['senha']
)
);
$cont = $conf->fetchColumn();

if ( $cont == false ) {
echo "Não foi possível achar o login";
} else {
setcookie ("login", $_POST['login']);
setcookie ("senha", $_POST['senha']);
$contType = $conPDO->prepare("SELECT tipo_usuario FROM usuarios WHERE login = :login AND senha = :senha");
$contType->execute(
array(
            ':login' => $_POST['login'],
            ':senha' => $_POST['senha']
)
);
$rowcontType = $contType->fetchObject();
$row_tipo_usuario = $rowcontType->tipo_usuario;

//agora os ifs pra definir o direcionamento

if($row_tipo_usuario == "admin"){
header("Location: pagAdmin.php");//redirecionamento pra administração
}
if($row_tipo_usuario == "moderador"){
header("Location: pagMod.php");//redirecionamento pra moderação
}
if($row_tipo_usuario == "user"){
header("Location: pagUser.php");//redirecionamento pra usuário
}
}
?> 

Somente um exemplo.


Ah esqueci,

e a cada página fazer uma verificação também com if para ver se o usuário tem acesso à essa página:

ex: pagAdmin.php


<?php
$contType = $conPDO->prepare("SELECT * FROM usuarios WHERE login = :login AND senha = :senha AND tipo_usuario = 'admin'");
$contType->execute(
array(
            ':login' => $_POST['login'],
            ':senha' => $_POST['senha']
)
);
$rowcontType = $contType->fetchObject();
//agora os ifs pra definir o acesso
if($rowcontType == true){
?>
<html>
...
</html>
<?php
} else {
echo "Você não tem acesso á esta pagina";
}
?>

Edição feita por: ximnes, 23/04/2015, 06:59.


#3 HaroNism

HaroNism

    Super Veterano

  • Usuários
  • 13822 posts
  • Sexo:Masculino
  • Localidade:San Miguel de Tucuman

Posted 29/10/2017, 18:07

Generic On Line Levaquin Cod Accepted Cialis Ulcera viagra buy accutane v-drugstore Online Viagra Quality
Want To Buy Finasteride Wigan levitra pills Buy Propecia Hong Kong Sildenafil Generique 25 Mg Hair Thinning Propecia

#4 Miguceamma

Miguceamma

    MiguPenjisse

  • Usuários
  • 11724 posts

Posted 30/10/2017, 08:02

Viagra Cialis Interaction Levitra Vendita Compra Ciprofloxacin Pi cialis viagra levitra kaufen rezeptfrei Achat Generique Cialis Professional

#5 RonsisM

RonsisM

    Super Veterano

  • Usuários
  • 15724 posts
  • Sexo:Masculino
  • Localidade:Plovdiv

Posted 30/10/2017, 12:51

Buy Cialis Super Active viagra Diclofenac Sodium 50mg Buy
Tamoxifen Nolvadex Cheapest Propetia No Script Canada viagra Propecia Tinnitus Finasteride
Viagra Dosierung Cialis Genuine Brand Name Cialis levitra samples Zithromax Solution Dosage Levitra 20mg Prices Propecia Aumento Massa
Laxa Tea viagra Propecia Medication Cialis Entrega 24 Horas Buy Accutane 20mg
Order Celexa No Prescription buy viagra online Clomid Premiere Semaine

#6 LarPhozyHah

LarPhozyHah

    Super Veterano

  • Usuários
  • 14515 posts
  • Sexo:Masculino
  • Localidade:San Miguel de Tucuman

Posted 31/10/2017, 08:25

Cialis Sans Ordonnance Belgique Cialis Mezza Pasticca viagra online Cialis Originale Prezzo In Farmacia Cialis Generico Paypal Propecia Buy Uk
Is Priligy Any Good Tadalafil 20 Mg Germany Discount Fedex Isotretinoin With Overnight Delivery Medication Overseas viagra online prescription Propecia Doping Finasteride Best Generic Viagra Review
Dutasteride Shop Zithromax Z Pak Cost Buy Vigora 100 generic viagra Viagra Price List India 253
Prevacid Online Canada cialis Buy Now No Rx Acticin Online Cialis Prices Walmart
Achat Kamagra Orleans Cvs Viagra Prices Viagra Overnight viagra online pharmacy Verschreibung Viagra Cialis Levitra Levitra 10 Mg Comprar Retin A No Script
Clomid Homme Fait cialis Usonline Viagra
Pfizer Viagra Cost viagra Online Generic Cialis Tadalafil
Online Deltasone Generic levitra information Dapoxetina Fluoxetina No Prescription Needed For Levitra
Keflex Capsules Amoxicillin Constipation viagra Priligy Prix Uk Viagra Dicounted Clomid Online Overnight
Dyazide Without A Prescription cialis Amoxicilina Us Best Website Yaz And Amoxicillin

#7 RonsisM

RonsisM

    Super Veterano

  • Usuários
  • 15724 posts
  • Sexo:Masculino
  • Localidade:Plovdiv

Posted 31/10/2017, 13:39

Viagra O Cialis Online Viagra 100 Roma viagra Kamagra Gold 100mg
Death By Amoxicillin Tomar Viagra Mujeres viagra Cialis 20 Mg Price Cialis Absetzen
Prednisone Over Counter In Costa Rica viagra Buy Alli In Other Country Viagra Erezione

#8 fapedlok

fapedlok

    Ativo

  • Usuários
  • 341 posts
  • Sexo:Masculino
  • Localidade:Brisbane

Posted 31/10/2017, 21:40

Discounts! best 2017 products progect13.jpg Products which fall under this return policy can be returned domestically, as long as they are unused and in the original packaging. No questions asked! If a product that falls under this guarantee is found to be counterfeit, you will get a full refund (shipping costs included). buy.png READ MORE Roger Mini Stainless Steel Womens Watch ( 128.00 $)True amaryllis bulbs,hippeastrum flowers,hippeastrum bulbs,bonsai flower bulbs,Barbados Lily potted home garden plant -2 bulb ( 2.60 $)обувь кеддо интернет магазин каталогIV-X1002 Controller USB Charger ( $4.72 )проверка датчика коленвала змз 406counter strike global читFree shipping !! 15 pcs Soft Synthetic Hair make up tools kit Cosmetic Beauty Makeup Brush Black Sets with Leather Case ( 11.99 $)Brand new professional anti-fogbreaking uv adjustable swimming goggles men women waterproof silicone glasses adult eyewear ( 10.99 $)3 bundles italian curly peruvian virgin hair with closure,top quality yvonne human hair weave,natural color 1b ( 172.40 $)Cute cat canvas backpack women rucksack college preppy style school bags for teenagers girls large capacity printing backpack ( 27.41 $)Hillary Clinton on Syria, Putin & election"Vremya pervih": kosmicheskaya drama o pervom vihode cheloveka v kosmosOphir 110v 220v air tank compressor with airbrush kit touch-up auto spray gun paint for model tattoo hobby car paint_ac090+ac069 ( 112.79 $)антиутопия книгиJJRC H20H Mini Hexacopter ( 19.36 $) 21.jpg
Discounts! best cosmetic products 2017

progect13.jpg
Products which fall under this return policy can be returned domestically, as long as they are unused and in the original packaging. No questions asked!
If a product that falls under this guarantee is found to be counterfeit, you will get a full refund (shipping costs included).

buy.png

READ MORE
DOMINO DM368 3G Smartwatch-103.99 $
порядок затяжки гбц ваз 2112 16 клапанов
XINLIN X163F 5.8G FPV 2 Mega Camera 2.4G 4 Channel 6-axis Gyro Quadcopter-113.20 $
Botticelli Blue and Red Fabric and Suede Sneaker ( 99.00 $)
"Machost" - paid hosting with support PHP, MySQL - cheap web hosting and domain for website
Ophir 2 air brush guns with pro tank air compressor 110v 220v airbrush set for model hobby carcaketoys paint _ac090+004a+006 ( 119.37 $)
Hot brazilian virgin human hair wigs ombre curly lace front human hair wigsfull lace wigs two tone with baby hair around ( 109.85 $)
DOMINO DM368 3G Smartwatch ( 89.99 $)
Hengsheng mother's day gift! natural pearl stud earrings 925 earrings for women for love mother fine jewelry cc pearl jewelry ( 99.90 $)
контрактный двигатель
Tickets online. Buy cheap plane tickets in Moscow and other cities of Russia | Messenger travel
Keyes ZND - 05 Multifunctional Electronic Bricks Inclination Sensor Module Works with Official Arduino ( $1.86 )
игра фортресс 2 скачать
Indian curly virgin hair 3 bundles indian virgin hair deep curly raw indian hair deep wave wet and wavy human hair bundles weave ( 51.30 $)
Metropolis diva giallo leather wicker mini crossbody bag ( 224.67 $) Furla


5bb.jpg
Discounts! best of beauty 2017

progect13.jpg
Products which fall under this return policy can be returned domestically, as long as they are unused and in the original packaging. No questions asked!
If a product that falls under this guarantee is found to be counterfeit, you will get a full refund (shipping costs included).

buy.png

READ MORE
Brazilian virgin hair straight with closure 8a grade virgin unprocessed human hair with closure cheap bundles with closures lot ( 107.00 $)
All star navy blue canvas high top sneaker ( 48.14 $) Converse Limited Edition
Kosov, Endryu
Virgin indian hair straight 7a indian virgin hair 8-30inch unprocessed indian straight virgin hair bundle cheap human hair weave ( 53.80 $)
Homtom HT17 4G Phablet-105.29 $
вещи тим фортресс 2
Best-Kitchen.ru - best goods for the kitchen (the online store).
Beelink X2 Smart TV XBMC Box 4K H.265 Decoding ( 28.99 $)
2 Set 2016 Newest Red Wine Bottle Cover Bags Hug Santa Claus Snowman Dinner Table Decoration Home Christmas Party Decors ( 4.79 $)
Trendy v neck short sleeve colorful print dress for women ( 25.74 $)
New Dog Toys Pet Puppy Chew Squeaker Squeaky Plush Sound Duck Pig Elephant Toys 3 Designs Rubber Round Ball with Small Bell Toy ( 1.10 $)
2016 sexy bikini classic shell bikinis set swimwear women swimsuit push up swim suit biquini tankini beachwear monokini bj266 ( 18.60 $)
1Pc Buffer Nail Files Fluorescent Color Sanding Block Manicure Nail Art Tips Color Random ( 0.36 $)
затяжка болтов ваз
2015 fashion camellia rose imitation pearl earrings female jewelry wholesale free shipping ( 0.56 $)


60.jpg
Discounts! new products 2017

progect13.jpg
Products which fall under this return policy can be returned domestically, as long as they are unused and in the original packaging. No questions asked!
If a product that falls under this guarantee is found to be counterfeit, you will get a full refund (shipping costs included).

buy.png

READ MORE
Portable DIY Mobile Power Case USB 18650 DIY Battery Charger For Phone MP3 ( $1.79 )
Zemfira
Free Shipping 9.5cm Big Hero 6 Baymax Robot Bobble Head Shaking Head Toy Model Car Decoration, The most suitable small gift ( 2.80 $)
Zapadnie SMI priravnyali Trampa k varvaru-terroristu
Chromium 58.0.3028.0
Dt2240b flash frequency digital speedometer stroboscope non-contact tachometer 60~40000rpm ( 102.46 $)
UMi LONDON Rugged Phone 3G Smartphone-74.11 $
Takayama Lapis Lazuli Stones and Geranium Thread Bracelet ( 95.00 $)
Partol h4 h7 h11 9005 9006 h13 car led headlights bulbs 50w 6000lm cree chips all in one csp led headlamp 3000k 6500k 8000k 12v ( 48.89 $)
bobbi brown skin weightless powder foundation отзывы
top shop телемагазин
ORICO 2599US3-V1 2.5 inch HDD / SSD External Enclosure with LED Indicator ( $9.63 )
Spring 2016Brand New Cotton Mens Hat NYC Letter Bat Unisex Women Men Hats Baseball Cap Snapback ( 6.98 $)
Bikinis women 2016 print floral bikini women swimsuits brazilian push up bikini set bathing suits plus size swimwear female xxl ( 25.24 $)
UMI TOUCH Android 6.0 5.5 inch 4G Phablet 2.5D Arc Corning Gorilla Glass 3 Screen MTK6753 64bit Octa Core 3GB RAM 16GB ROM Touch ID 5.0MP + 13.0MP Cameras Dual WiFi 151.39$


21bb.jpg

#9 mapedlok

mapedlok

    24 Horas

  • Usuários
  • 453 posts
  • Sexo:Feminino
  • Localidade:West Lafayette

Posted 31/10/2017, 22:04

Discounts! beauty buys progect13.jpg Products which fall under this return policy can be returned domestically, as long as they are unused and in the original packaging. No questions asked! If a product that falls under this guarantee is found to be counterfeit, you will get a full refund (shipping costs included). buy.png READ MORE Blue and white striped button down mens shirt ( 52.42 $) ForzieriROCK Royce Series Protective Case for iPhone 6 / 6S with Kickstand Drop Proof ( $7.48 )Farmers, workers fearful of Trump immigration crackdownSilicone Popsicle Mold Freezer Ice Cream Maker ( $2.39 )Denim Slip On Sneaker ( 135.00 $)EP36 Large Round Acetate Transparent Womens Sunglasses ( 200.00 $)Original Replaceable Back Case for XiaoMi RedMi Note 2 ( $8.28 )NUU X4 Android 5.1 5.0 inch 4G Smartphone MTK6735 1.3GHz Quad Core 2GB RAM 16GB ROM 13.0MP Rear Camera GPS A-GPS Bluetooth 4.0 111.39$BT-S2 1000m Bluetooth Headset Motorcycle Intercom ( 32.59 $)NED 4 ( 1.53 $)Summer alluring spaghetti strap sleeveless solid color spliced women's dress ( 14.07 $)New Hybrid Tough Case For iPhone 7 For iPhone 7 Plus TPU + Hard PC With Slide Storage Card Holder Armor Cover For iPhone 7 Plus ( 4.71 $)New fashion men's briefcase pu leather business shoulder bags quality stylish brand handbags brand tote bag for man xb114 ( 26.99 $)ROXI Exquisite Bracelets platinum plating High quality products best Christmas jewelry gift factory price new style 2060802490 ( 7.50 $)WLtoys F1 Lightweight 2.4G Intelligent Robot Perfect Balance G-Sensor Dancing RC Robot-30.99 $ 102bb.png
Discounts! great buy makeup

progect13.jpg
Products which fall under this return policy can be returned domestically, as long as they are unused and in the original packaging. No questions asked!
If a product that falls under this guarantee is found to be counterfeit, you will get a full refund (shipping costs included).

buy.png

READ MORE
Leagoo Shark 1 6.0 inch 4G Phablet-186.48 $
quad band wirelesswired gsm alarm system LCD display door sensor home security alarm systems Wired Siren Kit SIM SMS Alarm ( 50.00 $)
Lumiere Blue Crystal and Brass Cufflinks ( 110.00 $)
Camouflage Cargo Pants Men Army Green Loose Tactical Sweatpant Man Pockets Cotton Trousers Male Fashion Men's Pant Plus Size 44 ( 57.88 $)
20FT 9 Cord Strand Nylon Paracord 550 Lb Parachute Cord Rope Cuerda Luminous Glow In The Dark Survival Kit Camping Equipment ( 3.15 $)
Bahamas blue perforated nubuck driver shoes wrubber sole ( 329.52 $) Moreschi
Ophir airbrush cosmetic makeup system kit 0.3mm air brush bag_op-mk002b ( 112.58 $)
Alice multicolor leather shoulder bag ( 802.42 $) Paula Cademartori
Grade 7a brazilian virgin hair malaysian curly hair,3pcslot human hair weave, aliexpress yvonne 7a unprocessed virgin hair ( 66.67 $)
Vernee Apollo Android 6.0 5.5 inch 4G Phablet Helio X25 2.5GHz Deca Core 4GB RAM 64GB ROM 21.0MP Rear Camera Fingerprint Scanner Hall Sensor$
JAKEMY JM-6111 69 in 1 Screwdriver Hardware Repair Open Tools Demolition Kit Electronic Devices Eyeglass ( 35.88 $)
Brazilian virgin hair straight 7a unprocessed virgin hair weft cheap brazilian hair 4bundles human hair extensions can be curled ( 42.00 $)
купить nike force duckboot
7a glueless full lace human hair wigs for black women loose curly wave lace front human hair wigs brazilian virgin hair lace wig ( 130.00 $)
Fashion ivory pearl dress shoes peep toe women rhinestone bridal shoes wedding high heel shoes party prom shoes 4 inches pumps ( 111.99 $)


89bb.jpg
Discounts! must have products

progect13.jpg
Products which fall under this return policy can be returned domestically, as long as they are unused and in the original packaging. No questions asked!
If a product that falls under this guarantee is found to be counterfeit, you will get a full refund (shipping costs included).

buy.png

READ MORE
H Women's Hollow Out Punch Messenger Bags Classic Famous Brand Designer Genuine Leather Handbags Female Casual Crossbody Bags ( 69.18 $)
Fashion grid design women skirt elastic faldas ladies midi skirt sexy girls mini pleated skirts saias korea clothes ( 26.59 $)
Chic print backless cut out one piece swimwear ( 14.11 $)
Rossen, Robert
Chic round neck color block cut out one-piece women's swimwear ( 11.57 $)
KUPI KOLYASKU.RU - the best Internet-shop of children's goods for newborns and preschoolers with delivery across Russia free delivery in Moscow
IQI I2 3G Smartwatch Phone-92.99 $
Brazilian virgin hair body wave cheap human hair 3 bundle deals black friday deals 7a unprocessed brizilian virgin hair body ( 52.35 $)
5 Piece / Set KANGKANG XKZ001 Wall / Glass Gravity Back Somersault Turning Spiderman Toy Fun Game ( $1.79 )
Free Gift Blackview A8 smartphone MTK6580 5.0 inch IPS HD Quad Core Android 5.1 Mobile Phone 1GB RAM 8GB ROM 8MP 3G cell phone ( 59.99 $)
5-50 Kg Expander Wrist Forearm Strength Training Adjustable Heavy Grips Hand Gripper Gym Fitness Training Portable Hand Grip ( 7.99 $)
SKONE Fashion Imported Movement Women Quartz Watch ( $9.60 )
SOCOOLE W08 Smartwatch Phone MTK2502 Waterproof Shockproof Dustproof IP68 Anti-lost Sedentary Reminder Music Playing Remote Capture 58.79$
shopping live телемагазин смотреть
владимир красный богатырь


42.jpg
Discounts! best of beauty

progect13.jpg
Products which fall under this return policy can be returned domestically, as long as they are unused and in the original packaging. No questions asked!
If a product that falls under this guarantee is found to be counterfeit, you will get a full refund (shipping costs included).

buy.png

READ MORE
Old Style - Car Cufflinks ( 59.50 $)
Quad4 band lcd smart touch keypad panel wireless pstn sms voice burglar gsm android ios app remote arm alarm security system ( 103.69 $)
Brazilian virgin hair with closure queen hair product brazilian hair weave bundles with closure brazilian body wave with closure ( 62.30 $)
Sin 2H Silver Tone Dial Womens Watch ( 188.00 $)
when mobile phones were
Cartoon Puppy Patrol Backpack Boys Girls School Bags Children Mochila Infantil Kindergarten Backpacks Kids Bag Patrulla Canina ( 22.29 $)
Fashion jewelry 8ct solitaire luxury 925 silver big white topaz simulated diamond wedding band crown ring gift size5-11 ( 139.90 $)
Full Lace Human Hair Wigs Front Lace Wigs Body Wave 250% Density Glueless Lace Front Human Hair Wigs For Black Women Wavy Wig ( 245.00 $)
ZnDiy - BRY Practical High Torque Gear Box Motor + 12V 500RPM / DC 6V 250RPM ( $6.62 )
Black Gloves ( 112.00 $)
Trendy weaving and gradient color design wallet for women ( 9.37 $)
line 6 mobile keys 49 отзывы
UMI Super 5.5 inch 2.5D Arc Screen Android 6.0 4G Phablet Helio P10 64bit Octa Core 2.0GHz 13.0MP Rear Camera 4GB RAM 32GB ROM Type-C Accelerometer Compass Fingerprint Scanner HiFi 216.39$
Konstanciya
ZEROTECH DOBBY Mini Selfie Quadcopter-349.89 $


72bb.jpg
Discounts! cool makeup products progect13.jpg Products which fall under this return policy can be returned domestically, as long as they are unused and in the original packaging. No questions asked! If a product that falls under this guarantee is found to be counterfeit, you will get a full refund (shipping costs included). buy.png READ MORE New electronic accessories travel bag nylon mens travel organizer for date line sd card usb cable digital device bag ( 12.16 $)Original SJCAM M20 2160P 16MP 166 Adjustable Degree WiFi Action Camera Sport DV 109.00$Peruvian virgin hair straight 4 bundles 7a peruvian straight virgin hair weave 100 human hair extensions ( 78.00 $)U shape electrical shiatsu back neck shoulder massager body infrared 3d kneading massager eu plug flat plug ( 43.80 $)ONAGO ONAGOfly 1 Plus Mini RC Quadcopter-339.12 $Small Cognac Leather Shoulder Bag ( 120.00 $)грм 405 евро 3lunar force duckbootThe loan online urgently to lend money to the card, making the clock - MigkreditNylon outdoor male female sport bag raveling bag waterproof hiking handbag fitness shoulder gym bag training yoga duffel bag ( 15.43 $)5 pieces lot women cotton brief underwear letter mid waist panties anti bacterial breathable ladies girl ( 10.46 $)Zenbefe linen small backpack unisex school bag for teenage school backpack for students backpacks rucksack bookbags travel bag ( 27.88 $)High grade jewelry display box 3 layers ring necklace jewelry carrying case crocodile print lady gift home storage supplies ( 25.29 $)Malaysian virgin hair weave body wave bundles 3 bundle deals unprocessed Malaysia mink hair wet and wavy human hair peerless ( 67.00 $)Filomena 104.jpg

#10 LarPhozyHah

LarPhozyHah

    Super Veterano

  • Usuários
  • 14515 posts
  • Sexo:Masculino
  • Localidade:San Miguel de Tucuman

Posted 02/11/2017, 13:53

Propecia Langzeitnebenwirkungen Ordering Cheap Prednisone Without X buy viagra online Levitra Tab 20mg
Propecia Mujeres Prescription Du Viagra How Much Is Cialis Without Insurance buy viagra Cialis No Prescription From Canada Ceftin
Acquisto Cialis Veloce Le Cialis En Tunisie Where Can I Purchase Prandin In Europe viagra online pharmacy Norvasc Cialis Avis Consommateur
Propecia Young Men Buy Robaxin Without Prescription cialis Priligy Combined With Cialis Viagraprofessionalwithoutaprescription
Medicamento Cialis Tadalafil Generic Priligy Buy can i buy levitra in mexico Levitra Annonce





Veja alguns posts relacionados com: php, login

0 user(s) are reading this topic

0 membro(s), 0 visitante(s) e 0 membros anônimo(s)

IPB Skin By Virteq